新建的线性策略运行报错
由bqxmd4pv创建,最终由small_q 被浏览 33 用户
修改了时间而已
日志 47 条 ▼
-
[2023-12-03 22:27:47.334253] INFO: moduleinvoker:3474968296.py:94:<module> input_features_dai.v6 开始运行..
-
[2023-12-03 22:27:47.477453] INFO: moduleinvoker:3474968296.py:94:<module> 命中缓存
-
[2023-12-03 22:27:47.481692] INFO: moduleinvoker:3474968296.py:94:<module> input_features_dai.v6 运行完成[0.147509s].
-
[2023-12-03 22:27:47.537090] INFO: moduleinvoker:3474968296.py:140:<module> extract_data_dai.v7 开始运行..
-
[2023-12-03 22:27:47.555685] INFO: moduleinvoker:3474968296.py:140:<module> 命中缓存
-
[2023-12-03 22:27:47.560204] INFO: moduleinvoker:3474968296.py:140:<module> extract_data_dai.v7 运行完成[0.02312s].
-
[2023-12-03 22:27:47.606477] INFO: moduleinvoker:3474968296.py:151:<module> bigtrader.v7 开始运行..
-
2023-12-03 22:27:47 [info ] got metadata extra from input datasource
-
2023-12-03 22:27:47 [info ] read data ..
-
2023-12-03 22:27:48 [info ] start_date='2022-10-01', end_date='2023-12-31', instruments=4246
-
2023-12-03 22:27:48 [info ] bigtrader module V2.0.1
-
2023-12-03 22:27:48 [info ] bigtrader engine v1.10.6 2023-11-28
-
2023-12-03 22:27:59.583599 strategy strategy exception:Traceback (most recent call last):
-
File "bigtrader/strategy/engine.py", line 608, in bigtrader2.bigtrader.strategy.engine.StrategyEngine._call_strategy_func
-
File "bigtrader/strategy/strategy_base.py", line 2181, in bigtrader2.bigtrader.strategy.strategy_base.StrategyBase.call_handle_continous_trading
-
File "bigtrader/finance/account_engine.py", line 1827, in bigtrader2.bigtrader.finance.account_engine.AccountEngine.send_order
-
File "bigtrader/finance/account_engine.py", line 1726, in bigtrader2.bigtrader.finance.account_engine.AccountEngine.do_send_order
-
File "/var/app/enabled/bigtrader2/bigtrader/gateway/backtest/backtest_gateway.py", line 240, in send_order
-
self._match_order(order, self.bardatas, self.bardatas.trading_day_dt)
-
File "/var/app/enabled/bigtrader2/bigtrader/gateway/backtest/backtest_gateway.py", line 554, in _match_order
-
trade_price_volumes = self.the_slippage.process_order(data, order)
-
File "/var/app/enabled/bigtrader2/bigtrader/finance/slippage.py", line 480, in process_order
-
trade_price, trade_volume = self.gen_trade_info(order, price, volume)
-
File "/var/app/enabled/bigtrader2/bigtrader/finance/slippage.py", line 484, in gen_trade_info
-
trade_volume = min(order.order_qty - order.filled_qty, int(bar_volume * self.volume_limit))
-
ValueError: cannot convert float NaN to integer
-
\
-
event engine process events exception err=cannot convert float NaN to integer
-
Traceback (most recent call last):
-
File "bigtrader/event/event_engine.py", line 83, in bigtrader2.bigtrader.event.event_engine.EventEngine.process_events
-
File "bigtrader/event/event_engine.py", line 131, in bigtrader2.bigtrader.event.event_engine.EventEngine._process_without_lock
-
File "bigtrader/strategy/engine.py", line 308, in bigtrader2.bigtrader.strategy.engine.StrategyEngine.process_continous_trading_event
-
File "bigtrader/strategy/engine.py", line 617, in bigtrader2.bigtrader.strategy.engine.StrategyEngine._call_strategy_func
-
File "bigtrader/strategy/engine.py", line 608, in bigtrader2.bigtrader.strategy.engine.StrategyEngine._call_strategy_func
-
File "bigtrader/strategy/strategy_base.py", line 2181, in bigtrader2.bigtrader.strategy.strategy_base.StrategyBase.call_handle_continous_trading
-
File "bigtrader/finance/account_engine.py", line 1827, in bigtrader2.bigtrader.finance.account_engine.AccountEngine.send_order
-
File "bigtrader/finance/account_engine.py", line 1726, in bigtrader2.bigtrader.finance.account_engine.AccountEngine.do_send_order
-
File "/var/app/enabled/bigtrader2/bigtrader/gateway/backtest/backtest_gateway.py", line 240, in send_order
-
self._match_order(order, self.bardatas, self.bardatas.trading_day_dt)
-
File "/var/app/enabled/bigtrader2/bigtrader/gateway/backtest/backtest_gateway.py", line 554, in _match_order
-
trade_price_volumes = self.the_slippage.process_order(data, order)
-
File "/var/app/enabled/bigtrader2/bigtrader/finance/slippage.py", line 480, in process_order
-
trade_price, trade_volume = self.gen_trade_info(order, price, volume)
-
File "/var/app/enabled/bigtrader2/bigtrader/finance/slippage.py", line 484, in gen_trade_info
-
trade_volume = min(order.order_qty - order.filled_qty, int(bar_volume * self.volume_limit))
-
ValueError: cannot convert float NaN to integer
-
Output exceeds the size limit. Open the full output data in a text editor
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) Cell In[1], line 151 140 m2 = M.extract_data_dai.v7( 141 sql=m1.data, 142 start_date='2022-10-01', (...) 147 debug=False 148 ) 150 # @module(position="169.92164611816406,380.49072265625", comment='交易,日线,设置初始化函数和K线处理函数,以及初始资金、基准等', comment_collapsed=False) --> 151 m3 = M.bigtrader.v7( 152 data=m2.data, 153 start_date='', 154 end_date='', 155 initialize=m3_initialize_bigquant_run, 156 before_trading_start=m3_before_trading_start_bigquant_run, 157 handle_tick=m3_handle_tick_bigquant_run, 158 handle_data=m3_handle_data_bigquant_run, 159 handle_trade=m3_handle_trade_bigquant_run, 160 handle_order=m3_handle_order_bigquant_run, 161 after_trading=m3_after_trading_bigquant_run, 162 capital_base=100000, 163 frequency='daily', 164 product_type='股票', 165 before_start_days=0, 166 volume_limit=1, 167 order_price_field_buy='open', 168 order_price_field_sell='open', 169 benchmark='000300.SH', 170 plot_charts=True, 171 disable_cache=True, 172 debug=False, 173 backtest_only=False 174 ) 175 # </aistudiograph> File module2/common/modulemanagerv2.py:88, in biglearning.module2.common.modulemanagerv2.BigQuantModuleVersion.call() File module2/common/moduleinvoker.py:370, in biglearning.module2.common.moduleinvoker.module_invoke() File module2/common/moduleinvoker.py:292, in biglearning.module2.common.moduleinvoker._invoke_with_cache() File module2/common/moduleinvoker.py:253, in biglearning.module2.common.moduleinvoker._invoke_with_cache() File module2/common/moduleinvoker.py:210, in biglearning.module2.common.moduleinvoker._module_run() File /var/app/data/custom_module/publicmodules/bigtrader/v7/init.py:301, in run(start_date, end_date, data, initialize, before_trading_start, handle_tick, handle_data, handle_trade, handle_order, after_trading, options_data, history_ds, benchmark_ds, capital_base, frequency, product_type, before_start_days, volume_limit, order_price_field_buy, order_price_field_sell, benchmark, plot_charts, disable_cache, debug, backtest_only, m_meta_kwargs) 297 else: 298 # use cppbacktest 299 from .core.cppbacktest import BigQuantModule --> 301 outputs = BigQuantModule( 302 start_date=start_date, 303 end_date=end_date, 304 **trading_params, 305 plot_charts=plot_charts, 306 disable_cache=disable_cache, 307 **m_meta_kwargs, 308 ).run() 309 elif backtest_only: 310 run_mode = None File /var/app/data/custom_module/publicmodules/bigtrader/v7/core/pybacktest/init.py:477, in BigQuantModule.run(self) 476 def run(self): --> 477 run_algo_result = self.run_algo() 478 if run_algo_result is None: 479 print("!!WARNING: hfbacketstv1回测结果返回为空") File /var/app/data/custom_module/publicmodules/bigtrader/v7/core/pybacktest/init.py:429, in BigQuantModule.run_algo(self) 425 self._trading_calendar = g_trading_calendar 427 self.create_history_data() --> 429 algo = run_backtest( 430 self._start_date, 431 self._end_date, 432 strategy=self._strategy, 433 instruments=self._instruments, 434 positions=self._positions, 435 capital_base=self._capital_base, 436 product_type=self._product_type, 437 adjust_type=self._adjust_type, 438 frequency=self._frequency, 439 volume_limit=self._volume_limit, 440 order_price_field_buy=self._order_price_field_buy, 441 order_price_field_sell=self._order_price_field_sell, 442 daily_df=self._daily_data, 443 minute_df=self._minute_data, 444 tick_df=self._tick_data, 445 each_data_df=self._each_data, 446 dominant_df=self._dominant_data, 447 benchmark_df=self._benchmark_data, 448 dividend_df=self._dividend_data, 449 basic_info_df=self._basic_info_data, 450 trading_calendar=self._trading_calendar, 451 options_data=self._options_data, 452 strategy_setting=self._strategy_setting, 453 show_debug_info=self._debug, 454 dbpath=None, 455 slippage_name="DailyBarsSlippage", 456 before_start_days=self._before_start_days,
...
477 return DEFAULT_TRADED_NONE 479 # Theory trade info --> 480 trade_price, trade_volume = self.gen_trade_info(order, price, volume) 481 return trade_price, trade_volume File /var/app/enabled/bigtrader2/bigtrader/finance/slippage.py:484, in DailyBarsSlippage.gen_trade_info(self, order, trade_price, bar_volume) 483 def gen_trade_info(self, order: OrderData, trade_price: float, bar_volume: int): --> 484 trade_volume = min(order.order_qty - order.filled_qty, int(bar_volume * self.volume_limit)) 485 if order.order_type == OrderType.MARKET and self.slippage_type != SlippageType.NONE: 486 if order.direction == Direction.LONG: ValueError: cannot convert float NaN to integer
\