cash calculations modified

This commit is contained in:
Camilo1704
2020-03-25 13:11:45 -03:00
parent d8899f4879
commit 53af4c0464
+2 -1
View File
@@ -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(