kernc / backtesting.py

:mag_right: :chart_with_upwards_trend: :snake: :moneybag: Backtest trading strategies in Python.
https://kernc.github.io/backtesting.py/
GNU Affero General Public License v3.0
5.39k stars 1.05k forks source link

Allow for cash to be deposited or withdrawn during a backtest #925

Open AdiSai opened 1 year ago

kernc commented 1 year ago

Sorry for the late turnaround. I'm not yet decided, but certainly not strongly opposed to this change. However, in the style of the rest of this library, I'd prefer Strategy.cash being a @property.

Implementing this would prevent people from accessing self._broker._cash as in https://github.com/kernc/backtesting.py/issues/493, https://github.com/kernc/backtesting.py/issues/340, https://github.com/kernc/backtesting.py/issues/124, ...