qlib
qlib copied to clipboard
Update utils.py
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.pyunder upper directory ofqlib. - [ ] If you are adding a new feature, test on your own test scripts.
Screenshots of Test Results (if appropriate):
- Pipeline test:
- Your own tests:
Types of changes
- [x] Fix bugs
- [ ] Add new feature
- [ ] Update documentation