回测类
构造函数
strategy (BaseStrategy): 自定义策略类
symbol (str): 股票代码
market (MARKET): 市场
start (str): 开始日期
end (str): 结束日期
funds (int, optional): 初始资金. Defaults to 100000.
base_symbol (BaseSymbol, optional): 基准指数. Defaults to BaseSymbol.HS300.
data (EventType, optional): _description_. 数据 to EventType.DAYLINE.
应用示例
from dsxquant.engins.engin import Engin
from dsxquant.backtest.back_test import BackTest
from dsxquant import StrategyEngin,EmulationEngin,DataFeed,EventType
from dsxquant.strategy.common.macross_strategy import MACrossStrategy
import dsxquant
# 先启动系统引擎
engin = Engin().start()
# 安装模块
engin.install(StrategyEngin,EmulationEngin,DataFeed)
# 调用回测,这个例子是日线回测
backtest = BackTest(MACrossStrategy,"sz000001",start="20200412",end="20230427",data=EventType.DAYLINE)
engin.install(backtest)
# 等待回测完成并显示回测结果
backtest.show()
engin.shutdown()