qlib icon indicating copy to clipboard operation
qlib copied to clipboard

Update utils.py

Open Vanchrn opened this issue 2 years ago • 0 comments

Description

In /contrib/strategy/signal_strategy.py, it comments "get the number of trading step finished, trade_step can be [0, 1, 2, ..., trade_len - 1]" If set finished == self.trade_step >= self.trade_len it will raise IndexError: index X is out of bounds for axis 0 with size X. I think change self.trade_len = _end_index - _start_index + 1 to self.trade_len = _end_index - _start_index maybe better, but it may result in other errors.

Motivation and Context

How Has This Been Tested?

  • [x] Pass the test by running: pytest qlib/tests/test_all_pipeline.py under upper directory of qlib.
  • [ ] If you are adding a new feature, test on your own test scripts.

Screenshots of Test Results (if appropriate):

  1. Pipeline test:
  2. Your own tests:

Types of changes

  • [x] Fix bugs
  • [ ] Add new feature
  • [ ] Update documentation

Vanchrn avatar Feb 10 '23 05:02 Vanchrn