问答交流

一个简单的策略,但在模拟交易里运行一直失败

由bqh3jpu8创建,最终由bqh3jpu8 被浏览 31 用户

https://bigquant.com/codeshare/a4eb0c11-16ca-4fe2-99f9-b9a86dc78ee8































2024-02-19 15:56:38 任务运行开始调度 state=trigger event= 0061f39d-6448-485e-a04b-79f2e7c3b9e4 .. 2024-02-19 15:56:39 任务运行状态更新 state=scheduled event=20240208 0061f39d-6448-485e-a04b-79f2e7c3b9e4 2024-02-19 15:56:46 任务运行状态更新 state=running event=20240208 0061f39d-6448-485e-a04b-79f2e7c3b9e4 2024-02-19 15:56:46 [info ] run task_id='0061f39d-6448-485e-a04b-79f2e7c3b9e4' .. 2024-02-19 15:56:46 [info ] fetch task 0061f39d-6448-485e-a04b-79f2e7c3b9e4 .. 2024-02-19 15:56:46 [info ] start 0061f39d-6448-485e-a04b-79f2e7c3b9e4.ipynb .. [IPKernelApp] WARNING | Unknown error in handling startup files: [2024-02-19 15:57:03.646807] INFO: moduleinvoker:3643601950.py:111:<module> input_features_dai.v6 开始运行.. [2024-02-19 15:57:03.812677] INFO: moduleinvoker:3643601950.py:111:<module> 命中缓存 [2024-02-19 15:57:03.817035] INFO: moduleinvoker:3643601950.py:111:<module> input_features_dai.v6 运行完成[0.170274s]. 2024-02-19 15:57:03 [warning ] cache disabled for paper/live trading for bound date [2024-02-19 15:57:03.888516] INFO: moduleinvoker:3643601950.py:138:<module> extract_data_dai.v7 开始运行.. 2024-02-19 15:57:03 [info ] start_date='2024-02-08', end_date='2024-02-08', query_start_date='2023-12-10' .. 2024-02-19 15:57:04 [info ] data extracted: (2030, 3) [2024-02-19 15:57:05.115600] INFO: moduleinvoker:3643601950.py:138:<module> extract_data_dai.v7 运行完成[1.227065s]. [2024-02-19 15:57:05.158018] INFO: moduleinvoker:3643601950.py:149:<module> bigtrader.v9 开始运行.. [2024-02-19 15:57:05.207491] INFO: hfpapertrading:init.py:88:init got metadata extra from input datasource [2024-02-19 15:57:05.211584] INFO: hfpapertrading:init.py:93:init read data dai.DataSource("_b8c3ff2d1ad04c02bde4863f5759565e") .. [2024-02-19 15:57:05.238513] INFO: hfpapertrading:init.py:123:init run try_run=True, run_date='2024-02-08', strategy_id=0061f39d-6448-485e-a04b-79f2e7c3b9e4, strategy_name=25日Aroon指标策略 [2024-02-19 15:57:05.255296] INFO: hfpapertrading:init.py:362:run bigtrader engine v1.10.7 2024-01-10 [2024-02-19 15:57:05.561058] INFO: hfpapertrading:init.py:366:run got 2492 trading_days [datetime.datetime(2024, 12, 25, 0, 0), datetime.datetime(2024, 12, 26, 0, 0), datetime.datetime(2024, 12, 27, 0, 0), datetime.datetime(2024, 12, 30, 0, 0), datetime.datetime(2024, 12, 31, 0, 0)] [2024-02-19 15:57:05.573372] INFO: hfpapertrading:init.py:370:run run_date=2024-02-08 is_trading_day=True, next_trading_day=2024-02-19 [2024-02-19 15:57:05.593162] INFO: hfpapertrading:init.py:386:run got strategy_info=None by '0061f39d-6448-485e-a04b-79f2e7c3b9e4' benchmark_data= date instrument name pre_close open high low 0 2024-02-07 000300.SH 沪深300指数 3311.69 3314.03 3343.63 3289.671 2024-02-08 000300.SH 沪深300指数 3343.63 3351.41 3367.21 3336.98close volume amount change change_ratio0 3343.63 216647900 2.979980e+11 31.94 0.00961 3364.93 189977599 2.702400e+11 21.30 0.0064[2024-02-19 15:57:05.749729] ERROR: hfpapertrading:init.py:652:run run hit Exception, e No daily data Traceback (most recent call last): File "/var/app/data/custom_module/publicmodules/bigtrader/v9/core/pypapertrading/init.py", line 476, in run raise Exception("No daily data") Exception: No daily data [2024-02-19 15:57:05.757816] ERROR: moduleinvoker:3643601950.py:149:<module> module name: bigtrader, module version: v9, trackeback: Exception: No daily data 2024-02-19 15:57:09 任务运行状态更新 state=failed event=20240208 0061f39d-6448-485e-a04b-79f2e7c3b9e4 Traceback (most recent call last): File "/var/app/enabled/aiflowtaskrun.py", line 150, in <module> run(run_id=sys.argv[1], task_id=sys.argv[2], event_name=sys.argv[3], dry_run=sys.argv[4]) File "/var/app/enabled/aiflowtaskrun.py", line 145, in run raise ex from ex File "/var/app/enabled/aiflowtaskrun.py", line 132, in run do_run(task_id, event_name) File "/var/app/enabled/aiflowtaskrun.py", line 109, in do_run pm.execute_notebook( File "/usr/local/python3/lib/python3.8/site-packages/papermill/execute.py", line 128, in execute_notebook raise_for_execution_errors(nb, output_path) File "/usr/local/python3/lib/python3.8/site-packages/papermill/execute.py", line 232, in raise_for_execution_errors raise error papermill.exceptions.PapermillExecutionError:

Exception encountered at "In [1]":

Exception Traceback (most recent call last) Cell In[1], line 149 138 m2 = M.extract_data_dai.v7( 139 sql=m1.data, 140 start_date='2023-01-01', (...) 145 debug=False 146 ) 148 # @module(position="283,294", comment='', comment_collapsed=True) --> 149 m4 = M.bigtrader.v9( 150 data=m2.data, 151 start_date='', 152 end_date='', 153 initialize=m4_initialize_bigquant_run, 154 before_trading_start=m4_before_trading_start_bigquant_run, 155 handle_tick=m4_handle_tick_bigquant_run, 156 handle_data=m4_handle_data_bigquant_run, 157 handle_trade=m4_handle_trade_bigquant_run, 158 handle_order=m4_handle_order_bigquant_run, 159 after_trading=m4_after_trading_bigquant_run, 160 capital_base=100000, 161 frequency='daily', 162 product_type='股票', 163 before_start_days=60, 164 volume_limit=1, 165 order_price_field_buy='open', 166 order_price_field_sell='open', 167 benchmark='000300.SH', 168 plot_charts=True, 169 disable_cache=True, 170 debug=False, 171 backtest_only=False 172 ) 173 # </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/v9/init.py:321, 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) 317 # result = do_live_run(env) 319 from .core.pypapertrading import BigQuantModule --> 321 outputs = BigQuantModule( 322 run_date=env.trading_date, 323 **trading_params, 324 # **m_meta_kwargs, 325 ).run() 326 else: 327 raise Exception("invalid trading mode") File /var/app/data/custom_module/publicmodules/bigtrader/v9/core/pypapertrading/init.py:653, in BigQuantModule.run(self) 651 except Exception as e: 652 log.exception("run hit Exception, e {}".format(e)) --> 653 raise e File /var/app/data/custom_module/publicmodules/bigtrader/v9/core/pypapertrading/init.py:476, in BigQuantModule.run(self) 474 # init equity names by 'instruments' after invoking prepare function 475 if self._daily_data is None or self._daily_data.empty: --> 476 raise Exception("No daily data") 478 if "name" in self._daily_data.columns: 479 today_daily_data = self._daily_data[self._daily_data.date == self._run_date] Exception: No daily data

标签

交易策略交易
评论
  • 今天再试试呢?能成功吗?
  • 不行,也是报错
  • 这到底怎么解决啊