【代码报错】IndexError: index 8325 is out of bounds for axis 0 with size 8324
由bq0clqq6创建,最终由small_q 被浏览 10 用户
没明白咋回事儿啊 前几天还好的😂 以下是错误和策略
日志 13 条 ▼
[2024-10-26 20:01:30] INFO: input_features_dai.v30 开始运行 ..[2024-10-26 20:01:30] INFO: expr mode[2024-10-26 20:01:31] INFO: input_features_dai.v30 运行完成 [1.079s].[2024-10-26 20:01:31] INFO: extract_data_dai.v17 开始运行 ..[2024-10-26 20:01:33] INFO: data extracted: (0, 2)[2024-10-26 20:01:33] WARNING: data extracted: 0 rows[2024-10-26 20:01:33] INFO: extract_data_dai.v17 运行完成 [1.881s].[2024-10-26 20:01:33] INFO: bigtrader.v32 开始运行 ..[2024-10-26 20:01:33] INFO: got metadata extra from input datasource[2024-10-26 20:01:33] INFO: read input 'data' ..[2024-10-26 20:01:33] WARNING: [WARN] 'data' is empty df, donot run backtest!!![2024-10-26 20:01:33] INFO: , , , equity, instruments=0
您可以去社区论坛问答交流板块反馈咨询 去发帖>>
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[1], line 152
139 m2 = M.extract_data_dai.v17(
140 sql=m1.data,
141 start_date="""2021-08-23""",
(...)
148 m_name="""m2"""
149 )
151 # @module(position="-311,-201", comment="""""", comment_collapsed=True)
--> 152 m3 = M.bigtrader.v32(
153 data=m2.data,
154 start_date="""2024-10-01""",
155 end_date="""2024-10-25""",
156 initialize=m3_initialize_bigquant_run,
157 before_trading_start=m3_before_trading_start_bigquant_run,
158 handle_tick=m3_handle_tick_bigquant_run,
159 handle_data=m3_handle_data_bigquant_run,
160 handle_trade=m3_handle_trade_bigquant_run,
161 handle_order=m3_handle_order_bigquant_run,
162 after_trading=m3_after_trading_bigquant_run,
163 capital_base=100000,
164 frequency="""daily""",
165 product_type="""股票""",
166 rebalance_period_type="""交易日""",
167 rebalance_period_days="""1""",
168 rebalance_period_roll_forward=True,
169 backtest_engine_mode="""标准模式""",
170 before_start_days=0,
171 volume_limit=1,
172 order_price_field_buy="""open""",
173 order_price_field_sell="""close""",
174 benchmark="""000300.SH""",
175 plot_charts=True,
176 debug=False,
177 backtest_only=False,
178 m_cached=False,
179 m_name="""m3"""
180 )
181 # </aistudiograph>
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/bigmodule/modules.py:28, in __call__(self, **kwargs)
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/bigmodule/moduleinvoker.py:203, in module_invoke(name, version, kwargs)
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/bigmodule/moduleinvoker.py:169, in _module_invoke(name, version, kwargs)
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/bigmodule/moduleinvoker.py:41, in _module_run(module, kwargs)
File dist/build/bigtrader/v32/__init__.py:389, in v32.run()
File dist/build/bigtrader/v32/__init__.py:193, in v32._run()
File dist/build/bigtrader/v32/__init__.py:175, in v32._run_backtest()
File dist/build/bigtrader/v32/core/pybacktest/__init__.py:226, in v32.core.pybacktest.BigQuantModule.__init__()
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/vectortrader/rebalanceperiod.py:64, in build(self, start_date, end_date, extra_days)
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/pandas/core/indexes/base.py:5389, in Index.__getitem__(self, key)
5386 if is_integer(key) or is_float(key):
5387 # GH#44051 exclude bool, which would return a 2d ndarray
5388 key = com.cast_scalar_indexer(key)
-> 5389 return getitem(key)
5391 if isinstance(key, slice):
5392 # This case is separated from the conditional above to avoid
5393 # pessimization com.is_bool_indexer and ndim checks.
5394 return self._getitem_slice(key)
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/pandas/core/arrays/datetimelike.py:379, in DatetimeLikeArrayMixin.__getitem__(self, key)
372 """
373 This getitem defers to the underlying array, which by-definition can
374 only handle list-likes, slices, and integer scalars
375 """
376 # Use cast as we know we will get back a DatetimeLikeArray or DTScalar,
377 # but skip evaluating the Union at runtime for performance
378 # (see https://github.com/pandas-dev/pandas/pull/44624)
--> 379 result = cast("Union[Self, DTScalarOrNaT]", super().__getitem__(key))
380 if lib.is_scalar(result):
381 return result
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/pandas/core/arrays/_mixins.py:284, in NDArrayBackedExtensionArray.__getitem__(self, key)
278 def __getitem__(
279 self,
280 key: PositionalIndexer2D,
281 ) -> Self | Any:
282 if lib.is_integer(key):
283 # fast-path
--> 284 result = self._ndarray[key]
285 if self.ndim == 1:
286 return self._box_func(result)
IndexError: index 8325 is out of bounds for axis 0 with size 8324
https://bigquant.com/codesharev3/0ffe8aa8-da87-41c1-a3d7-c3ee40c0e117
\