问答交流

求助:这个错误怎么回事?

由dreamquant创建,最终由small_q 被浏览 34 用户

2023-03-04 23:53:48.572177 strategy strategy exception:Traceback (most recent call last): File "bigtrader/strategy/engine.py", line 713, in bigtrader2.bigtrader.strategy.engine.StrategyEngine._call_strategy_func File "bigtrader/strategy/strategy_base.py", line 2281, in bigtrader2.bigtrader.strategy.strategy_base.StrategyBase.call_handle_data File "<ipython-input-25-53deef9cd102>", line 24, in m3_handle_data_bigquant_run rt=data.current(code, "close") File "/var/app/enabled/bigtrader2/bigtrader/protocol.py", line 285, in current return self.__data_engine.get_current_value(asset, curr_dt, fields) File "bigtrader/mdata/engine.py", line 702, in bigtrader2.bigtrader.mdata.engine.DataEngine._get_minute_value_from_df AttributeError: 'NoneType' object has no attribute 'get_value'


AttributeError Traceback (most recent call last) <ipython-input-25-53deef9cd102> in <module> 47 ) 48 ---> 49 m3 = M.hftrade.v2( 50 instruments=m1.data, 51 start_date='',

<ipython-input-25-53deef9cd102> in m3_handle_data_bigquant_run(context, data) 22 for code in context.instruments: 23 print(code) ---> 24 rt=data.current(code, "close") 25 r.append(rt) 26 print(r)

AttributeError: 'NoneType' object has no attribute 'get_value'

评论
  • 好的 我们排查下 ,若能分享策略或者部分策略 ,我们能复现就更好了
  • 是因为你订阅1分钟k线的时候,订阅 方法 写错了,应该这么 写: ``` context.subscribe_bar(context.instruments,'1m') ``` \
  • 参考这个链接:建议日志不要输出 太多,否则前端界面会卡死 [https://bigquant.com/experimentshare/0711774931e441a0a4511100176f4775](https://bigquant.com/experimentshare/0711774931e441a0a4511100176f4775) \
{link}