backtesting.py
backtesting.py copied to clipboard
Fix read-only array error in FractionalBacktest indicator scaling
Fixes the CI failure in test_FractionalBacktest where indicator /= self._fractional_unit raises ValueError: output array is read-only on newer pandas.
The in-place division fails because the underlying numpy array from pandas is read-only (copy-on-write). Replaced with a non-mutating division that creates a new array and updates the list entry directly.
Ref: #1354
still relevant. pandas copy-on-write is the default in 2.x, so indicator /= self._fractional_unit blows up with ValueError: output array is read-only on any current install. fix is the 2-line non-mutating swap, no behavior change.