From 240fab3d256cb1c64086c130d2c2e6b04e0138cf Mon Sep 17 00:00:00 2001 From: Camilo1704 Date: Fri, 13 Mar 2020 11:52:17 -0300 Subject: [PATCH] sign added in current_cash calculation --- backtester/backtester.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/backtester/backtester.py b/backtester/backtester.py index 0dca6cf..7705bd0 100644 --- a/backtester/backtester.py +++ b/backtester/backtester.py @@ -202,10 +202,7 @@ class Backtest: options_value = self._get_current_option_quotes(options) self._sell_some_options(date, to_sell, options_value) - options_value = self._current_options_capital(options) - value = self._get_current_option_quotes(options) - # current cash due to options added _execute_option_entries or _options_to_sell def _sell_options(self, options, date): # This method essentially recycles most of the code in the filter_exits method in Strategy. # The whole thing needs a refactor. @@ -257,7 +254,7 @@ class Backtest: self._options_inventory.at[i, ('totals', 'qty')] += qty_to_sell sold -= (qty_to_sell * contract_per_row) - self.current_cash = to_sell - sold + self.current_cash += to_sell - sold def _current_stock_capital(self, stocks): """Return the current value of the stocks inventory.