rqalpha学习-2

conf = default_config()
deep_update(user_config(), conf)
deep_update(project_config(), conf)
 
三种不同级别的配置,第一个是默认配置,第二个是用户级配置,第三个是工程级配置(这种方法看起来和php的配置逻辑相似)
 
第四个是命令行若存在config_path选项,则使用config_path提供的配置
 
get_trading_calendar, 搞清楚这儿怎样得到的交易日:通过读取文件:trading_dates.bcolz获取到:
通过:
self._dates = pd.Index(pd.Timestamp(str(d)) for d in bcolz.open(f, 'r')),
其中:f = 'C:\Users\lu/.rqalpha\bundle\trading_dates.bcolz'
获取到的数据是已经去除了周六和周日,国家公布的法定节假日的日期集合
取得的数据类似如下:
image
DividendStore:看起来是除权信息
 
InstrumentStore看起来是股票信息,形如:
image
 
 
通过:
user_strategy = Strategy(env.event_bus, scope, ucontext, should_run_init)
env.user_strategy = user_strategy
user_strategy.init()

将代码读入并运行

executor.py是一个执行器

executor.run():

这儿通过simulation_event_source.events():

 

在simulation_event_source.py中:

yield Event(EVENT.BEFORE_TRADING, calendar_dt=dt_before_trading, trading_dt=dt_before_trading)这儿连续几个yield需要深度理解,明显还没有理解好
原文地址:https://www.cnblogs.com/luhouxiang/p/11638391.html