mirror of
https://github.com/wassname/options_backtester.git
synced 2026-08-15 12:44:50 +08:00
cash calculations modified
This commit is contained in:
@@ -177,7 +177,7 @@ class Backtest:
|
||||
|
||||
# We simulate a sell of the stock positions and then a rebuy.
|
||||
# This would **not** work if we added transaction fees.
|
||||
self.current_cash += stock_capital
|
||||
self.current_cash = stocks_allocation + total_capital * self.allocation['cash']
|
||||
self._buy_stocks(stocks, stocks_allocation, sma_days)
|
||||
|
||||
# exit/enter contracts
|
||||
@@ -332,6 +332,7 @@ class Backtest:
|
||||
options (pd.DataFrame): Options data for the current time step.
|
||||
options_allocation (float): Capital amount allocated to options.
|
||||
"""
|
||||
self.current_cash += options_allocation
|
||||
|
||||
# Remove contracts already in inventory
|
||||
inventory_contracts = pd.concat(
|
||||
|
||||
Reference in New Issue
Block a user