策略没问题,但是在画图的时候报错TypeError: '>=' not supported between instances of 'str' and 'int'
由bqjjtvys创建,最终由bqjjtvys 被浏览 3 用户
[2025-12-19 17:52:47] INFO: input_features_dai.v26 开始运行 ..[2025-12-19 17:52:47] INFO: input_features_dai.v26 命中缓存[2025-12-19 17:52:47] INFO: input_features_dai.v26 运行完成 [0.025s].[2025-12-19 17:52:47] INFO: extract_data_dai.v16 开始运行 ..[2025-12-19 17:52:47] WARNING: start_date='2025-01-01', end_date='2025-12-18', query_start_date='2024-10-03' (支持加速 升级资源) ..[2025-12-19 17:52:54] INFO: data extracted: (1268125, 33)[2025-12-19 17:52:56] INFO: extract_data_dai.v16 运行完成 [8.915s].[2025-12-19 17:52:56] INFO: bigtrader.v17 开始运行 ..[2025-12-19 17:52:56] INFO: got metadata extra from input datasource[2025-12-19 17:52:56] INFO: read input 'data' ..[2025-12-19 17:52:57] INFO: 2025-01-01, 2025-12-18, instruments=5488[2025-12-19 17:52:57] INFO: bigtrader module V2.0.3[2025-12-19 17:52:57] INFO: bigtrader engine v0.1.0.post21+gf44a778 2025-11-26[RISK_OFF][2025-01-02] bull_ratio=0.173 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-01-03] bull_ratio=0.110 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-01-06] bull_ratio=0.092 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-01-07] bull_ratio=0.113 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-01-08] bull_ratio=0.107 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-01-09] bull_ratio=0.097 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-01-10] bull_ratio=0.069 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-01-13] bull_ratio=0.077 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-01-14] bull_ratio=0.129 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-01-15] bull_ratio=0.165 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-01-16] bull_ratio=0.168 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-01-17] bull_ratio=0.168 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-01-20] bull_ratio=0.166 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-04-07] bull_ratio=0.097 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-04-08] bull_ratio=0.118 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-04-09] bull_ratio=0.139 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-04-10] bull_ratio=0.170 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-04-11] bull_ratio=0.180 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-04-14] bull_ratio=0.179 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-04-15] bull_ratio=0.162 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-04-16] bull_ratio=0.154 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-04-17] bull_ratio=0.174 min_bull_ratio=0.200 is_index_downtrend=False
[RISK_OFF][2025-04-18] bull_ratio=0.168 min_bull_ratio=0.200 is_index_downtrend=False
[2025-12-19 17:54:41] INFO: backtest done, raw_perf_ds:dai.DataSource("_24e9e1b7136b473286f702c54d9521b1")
您可以去社区论坛问答交流板块反馈咨询 去发帖>>
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[2], line 1069
1059 m1 = M.input_features_dai.v23(mode="SQL", sql=sql)
1061 m2 = M.extract_data_dai.v16(
1062 sql=m1.data,
1063 start_date=BT_START_DATE,
(...)
1066 end_date_bound_to_trading_date=True,
1067 )
-> 1069 m3 = M.bigtrader.v17(
1070 data=m2.data,
1071 start_date=BT_START_DATE,
1072 end_date=BT_END_DATE, # ✅ 对齐原策略(12-30)
1073 initialize=m_initialize,
1074 handle_data=m_handle_data,
1075 capital_base=100000,
1076 frequency="daily",
1077 product_type="stock",
1078 rebalance_period_type="交易日",
1079 rebalance_period_days=1,
1080 benchmark="000300.SH",
1081 plot_charts=True,
1082 backtest_engine_mode="标准模式",
1083 order_price_field_buy="open",
1084 order_price_field_sell="close",
1085 )
1088 print("=== DONE ===")
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:218, in module_invoke(name, version, kwargs)
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/bigmodule/moduleinvoker.py:190, in _module_invoke(name, version, kwargs)
File dist/build/bigtrader/v17/init.py:391, in v17.post_run()
File dist/build/bigtrader/v17/core/pybacktest/init.py:585, in v17.core.pybacktest.bigquant_postrun()
File dist/build/bigtrader/v17/core/pybacktest/postrun.py:31, in v17.core.pybacktest.postrun.render()
File dist/build/bigtrader/v17/core/pybacktest/perf_render.py:168, in v17.core.pybacktest.perf_render.render()
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/bigcharts/v3/charts.py:315, in render(self, minify, display)
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/bigcharts/v3/charts.py:779, in _render(self)
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/bigcharts/v3/charts.py:1022, in html_content(self)
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/bigcharts/v3/charts.py:779, in _render(self)
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/bigcharts/v3/charts.py:905, in html_content(self)
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/bigcharts/v3/charts.py:779, in _render(self)
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/bigcharts/v3/charts.py:809, in html_content(self)
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/jinja2/environment.py:1301, in Template.render(self, *args, **kwargs)
1299 return self.environment.concat(self.root_render_func(ctx)) # type: ignore
1300 except Exception:
-> 1301 self.environment.handle_exception()
File /opt/pyenv/versions/3.11.8/lib/python3.11/site-packages/jinja2/environment.py:936, in Environment.handle_exception(self, source)
931 """Exception handling helper. This is used internally to either raise
932 rewritten exceptions or return a rendered traceback for the template.
933 """
934 from .debug import rewrite_traceback_stack
--> 936 raise rewrite_traceback_stack(source=source)
File <template>:8, in top-level template code()
TypeError: '>=' not supported between instances of 'str' and 'int'