代码拉取完成,页面将自动刷新
from backtester.trade_back_tester import BackTester
from data.read_data import get_data_by_pickle, get_data_for_model
from data.time_data import TimeData
from strategy.greedy_strategy import GreedyStrategy
from strategy.gru_strategy import GRUStrategy
from strategy.concare_strategy import ConCareStrategy
from utils.date_util import diagnostics
import numpy as np
from view import Draw
if __name__ == '__main__':
back_tester = BackTester(start_date="2010-01-05", end_date="2010-02-06",
trade_strategy=GreedyStrategy(3, 2, 3, 1000))
# back_tester = BackTester(start_date="2010-01-30", end_date="2010-03-07",
# trade_strategy=GRUStrategy(3, 2, 3, 1000, './model/checkpoints/GRU/GRU_best_model.pt'))
# back_tester = BackTester(start_date="2010-01-30", end_date="2010-03-07",
# trade_strategy=ConCareStrategy(3, 2, 3, 1000, './model/checkpoints/ConCare/ConCare_best_model.pt'))
back_tester.execute_trade()
cash = back_tester.get_cash_array()
capital = back_tester.get_capital_array()
stock = back_tester.get_stock_array()
profits = back_tester.get_profit_array()
Draw().draw_plot(cash, 'cash')
Draw().draw_plot(capital, 'capital')
Draw().draw_plot(profits, 'profits')
print('-'*100)
print(stock)
print('-'*100)
print(back_tester.get_profit_array())
print('-'*100)
print(diagnostics(np.array(list(profits.values())))/1000)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。