fix daily profit data and daily profit curve example
This commit is contained in:
@@ -215,13 +215,18 @@
|
||||
"stats = load_backtest_stats(backtest_dir)\n",
|
||||
"strategy_stats = stats['strategy'][strategy]\n",
|
||||
"\n",
|
||||
"dates = []\n",
|
||||
"profits = []\n",
|
||||
"for date_profit in strategy_stats['daily_profit']:\n",
|
||||
" dates.append(date_profit[0])\n",
|
||||
" profits.append(date_profit[1])\n",
|
||||
"\n",
|
||||
"equity = 0\n",
|
||||
"equity_daily = []\n",
|
||||
"for dp in strategy_stats['daily_profit']:\n",
|
||||
"for daily_profit in profits:\n",
|
||||
" equity_daily.append(equity)\n",
|
||||
" equity += float(dp)\n",
|
||||
" equity += float(daily_profit)\n",
|
||||
"\n",
|
||||
"dates = pd.date_range(strategy_stats['backtest_start'], strategy_stats['backtest_end'])\n",
|
||||
"\n",
|
||||
"df = pd.DataFrame({'dates': dates,'equity_daily': equity_daily})\n",
|
||||
"\n",
|
||||
|
Reference in New Issue
Block a user