microsoft / microsoft/qlib

examples\nested_decision_execution\workflow.py not work

Open
#1,623 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
48.7k
Forks
7.7k
PR merge metrics
No merged PRs in 30d

Description

🐛 Bug Description

To Reproduce

Steps to reproduce the behavior:

index 4943 is out of bounds for axis 0 with size 4943
  File "C:\Git\qlib\qlib\backtest\utils.py", line 131, in get_step_time
    return self._calendar[calendar_index], epsilon_change(self._calendar[calendar_index + 1])
  File "C:\Git\qlib\qlib\contrib\strategy\signal_strategy.py", line 141, in generate_trade_decision
    trade_start_time, trade_end_time = self.trade_calendar.get_step_time(trade_step)
  File "C:\Git\qlib\qlib\backtest\backtest.py", line 89, in collect_data_loop
    _trade_decision: BaseTradeDecision = trade_strategy.generate_trade_decision(_execute_result)
  File "C:\Git\qlib\qlib\backtest\backtest.py", line 44, in backtest_loop
    for _decision in collect_data_loop(start_time, end_time, trade_strategy, trade_executor, return_value):
  File "C:\Git\qlib\qlib\backtest\__init__.py", line 275, in backtest
    return backtest_loop(start_time, end_time, trade_strategy, trade_executor)
  File "C:\Git\qlib\qlib\workflow\record_temp.py", line 473, in _generate
    portfolio_metric_dict, indicator_dict = normal_backtest(
  File "C:\Git\qlib\qlib\workflow\record_temp.py", line 234, in generate
    return self._generate(*args, **kwargs)
  File "C:\Git\qlib\examples\nested_decision_execution\workflow.py", line 269, in backtest
    par.generate()
  File "C:\Develop\Python3.8\Lib\site-packages\fire-0.5.0-py3.8.egg\fire\core.py", line 691, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "C:\Develop\Python3.8\Lib\site-packages\fire-0.5.0-py3.8.egg\fire\core.py", line 475, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "C:\Develop\Python3.8\Lib\site-packages\fire-0.5.0-py3.8.egg\fire\core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "C:\Git\qlib\examples\nested_decision_execution\workflow.py", line 394, in <module>
    fire.Fire(NestedDecisionExecutionWorkflow)
  File "C:\Develop\Python3.8\Lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Develop\Python3.8\Lib\runpy.py", line 194, in _run_module_as_main (Current frame)
    return _run_code(code, main_globals, None,
IndexError: index 4943 is out of bounds for axis 0 with size 4943

Screenshot

Environment

Note: User could run cd scripts && python collect_info.py all under project directory to get system information
and paste them here directly.

  • Qlib version: lastest
  • Python version: 3.8.10
  • OS (Windows, Linux, MacOS): windows 11 22H2
  • Commit number (optional, please provide it if you are using the dev version):

Additional Notes

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running examples/nested_decision_execution/workflow.py in the reported Python 3.8.10 environment and reproduce the IndexError. Read qlib/backtest/utils.py around get_step_time, then trace its callers in qlib/contrib/strategy/signal_strategy.py and qlib/backtest/backtest.py. Done means the example completes without the out-of-bounds error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
fintech-quant
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.