We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用tdx数据bundle 回测示例的buy hold策略 买入 000001 起始日为2012-1-1
报如下错误
AttributeError: 'NoneType' object has no attribute 'index'
Debug跟了下,好像是1-16日的交易日历时间为 1-16 0.0 Nat NaT 这是数据导入出了问题,还是这个版本的交易日历有问题,还是那天停牌而系统处理失当,还是其他问题? buy1.zip 附件为完整代码
跟踪时 到 tradesimulation.py 这个文件时 查看 [dt for dt,action in self.clock] 的结果为 [Timestamp('2012-01-04 00:00:00+0000', tz='UTC'), Timestamp('2012-01-04 13:45:00+0000', tz='UTC'), Timestamp('2012-01-04 21:00:00+0000', tz='UTC'), Timestamp('2012-01-04 21:00:00+0000', tz='UTC'), Timestamp('2012-01-05 00:00:00+0000', tz='UTC')。。。Timestamp('2012-01-16 00:00:00+0000', tz='UTC'), NaT, Timestamp('2012-01-16 13:45:00+0000', tz='UTC'), NaT, Timestamp('2012-01-17 00:00:00+0000', tz='UTC'), Timestamp('2012-01-17 13:45:00+0000', tz='UTC'), Timestamp('2012-01-17 21:00:00+0000', tz='UTC'), Timestamp('2012-01-17 21:00:00+0000', tz='UTC'),
又跟踪了下 在 zipline/algorithm.py(531)_create_clock() 529 """ 530 trading_o_and_c = self.trading_calendar.schedule.ix[ 531 self.sim_params.sessions] --> 532 market_closes = trading_o_and_c['market_close']
这传出的close时间就已经有NAT值了,这个值是何用意? 2012-01-13 00:00:00+00:00 2012-01-13 21:00:00 2012-01-16 00:00:00+00:00 NaT 2012-01-17 00:00:00+00:00 2012-01-17 21:00:00
2012-02-17 00:00:00+00:00 2012-02-17 21:00:00 2012-02-20 00:00:00+00:00 NaT 2012-02-21 00:00:00+00:00 2012-02-21 21:00:00
The text was updated successfully, but these errors were encountered:
为啥 这个版本的 时间一天只排了三个 [dt for dt, action in self.clock] [Timestamp('2017-01-03 00:00:00+0000', tz='UTC'), Timestamp('2017-01-03 07:00:00+0000', tz='UTC'), Timestamp('2017-01-03 07:00:00+0000', tz='UTC'), 而kanghua309的版本 时间却排了四个 [dt for dt, action in self.clock] [Timestamp('2017-01-03 00:00:00+0000', tz='UTC'), Timestamp('2017-01-03 00:45:00+0000', tz='UTC'), Timestamp('2017-01-03 07:00:00+0000', tz='UTC'), Timestamp('2017-01-03 07:00:00+0000', tz='UTC'),
Sorry, something went wrong.
No branches or pull requests
使用tdx数据bundle
回测示例的buy hold策略
买入 000001
起始日为2012-1-1
报如下错误
AttributeError: 'NoneType' object has no attribute 'index'
Debug跟了下,好像是1-16日的交易日历时间为 1-16 0.0 Nat NaT
这是数据导入出了问题,还是这个版本的交易日历有问题,还是那天停牌而系统处理失当,还是其他问题?
buy1.zip
附件为完整代码
跟踪时 到 tradesimulation.py 这个文件时
查看 [dt for dt,action in self.clock] 的结果为
[Timestamp('2012-01-04 00:00:00+0000', tz='UTC'), Timestamp('2012-01-04 13:45:00+0000', tz='UTC'), Timestamp('2012-01-04 21:00:00+0000', tz='UTC'), Timestamp('2012-01-04 21:00:00+0000', tz='UTC'), Timestamp('2012-01-05 00:00:00+0000', tz='UTC')。。。Timestamp('2012-01-16 00:00:00+0000', tz='UTC'), NaT, Timestamp('2012-01-16 13:45:00+0000', tz='UTC'), NaT, Timestamp('2012-01-17 00:00:00+0000', tz='UTC'), Timestamp('2012-01-17 13:45:00+0000', tz='UTC'), Timestamp('2012-01-17 21:00:00+0000', tz='UTC'), Timestamp('2012-01-17 21:00:00+0000', tz='UTC'),
又跟踪了下
在 zipline/algorithm.py(531)_create_clock()
529 """
530 trading_o_and_c = self.trading_calendar.schedule.ix[
531 self.sim_params.sessions]
--> 532 market_closes = trading_o_and_c['market_close']
这传出的close时间就已经有NAT值了,这个值是何用意?
2012-01-13 00:00:00+00:00 2012-01-13 21:00:00
2012-01-16 00:00:00+00:00 NaT
2012-01-17 00:00:00+00:00 2012-01-17 21:00:00
2012-02-17 00:00:00+00:00 2012-02-17 21:00:00
2012-02-20 00:00:00+00:00 NaT
2012-02-21 00:00:00+00:00 2012-02-21 21:00:00
The text was updated successfully, but these errors were encountered: