{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    " %cd \"E:\\Project\\backtrader_strategy\"\n",
    "\n",
    "import sys\n",
    "import utils\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "import talib\n",
    "import plotly\n",
    "import plotly.offline\n",
    "from plotly.offline import iplot\n",
    "import cufflinks as cf\n",
    "plotly.offline.init_notebook_mode(connected=True)\n",
    "cf.set_config_file(theme=None, sharing='private', offline=True)\n",
    "import plotly.plotly as py\n",
    "import plotly.tools as tls\n",
    "import plotly.graph_objs as go\n",
    "import backtrader as bt\n",
    "import talib\n",
    "import math\n",
    "import qrisk\n",
    "\n",
    "from IPython.display import display, clear_output\n",
    "\n",
    "\n",
    "\n",
    "# 中证50、中证500，趋势相反时同时开仓，其中一边止损时同时止损\n",
    "# 一手中证500对两手上证50\n",
    "\n",
    "# def get_ts_trade_detail_df(stock_id, begin_date_str, end_date_str, cycle='10分钟线'):\n",
    "#     begin_date = utils.str_to_ts_date(begin_date_str)\n",
    "#     end_date = utils.str_to_ts_date(end_date_str)\n",
    "#     trade_detail_list = utils.ts_remote_call_func('TradeDetails',\n",
    "#                                                   [begin_date, end_date, cycle.decode('utf8').encode('gbk')], {\n",
    "#                                                       'StockID': stock_id,\n",
    "#                                                       'bRate': 2,  # 前复权\n",
    "#                                                       'RateDay': end_date\n",
    "#                                                   })\n",
    "#     row_size = len(trade_detail_list)\n",
    "#     if row_size == 0:\n",
    "#         return None\n",
    "#     return utils.ts_list_to_dataframe(\n",
    "#         ts_list=trade_detail_list,\n",
    "#         columns=[('datetime', '时间'), ('open', '开盘价'), ('close', '收盘价'), ('high', '最高价'), ('low', '最低价')],\n",
    "#         index_type=pd.DatetimeIndex\n",
    "#     )\n",
    "\n",
    "\n",
    "    \n",
    "\n",
    "\n"
   ]
  }
 ],
 "metadata": {
  "hide_input": false,
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
