BUG: for issue #237, checking considering open orders when verifying the exchange balance for each positions

This commit is contained in:
Frederic Fortier
2018-02-27 00:18:43 -05:00
parent c65a976b81
commit 478579ed8c
2 changed files with 9 additions and 6 deletions
+1 -2
View File
@@ -631,8 +631,6 @@ class ExchangeTradingAlgorithmLive(ExchangeTradingAlgorithmBase):
if base_currency is None:
base_currency = exchange.base_currency
# Don't check the cash if there are open orders. This could
# results in false positives.
orders = []
for asset in self.blotter.open_orders:
asset_orders = self.blotter.open_orders[asset]
@@ -642,6 +640,7 @@ class ExchangeTradingAlgorithmLive(ExchangeTradingAlgorithmBase):
required_cash = self.portfolio.cash if not orders else None
cash, positions_value = exchange.sync_positions(
positions=exchange_positions,
open_orders=orders,
check_balances=check_balances,
cash=required_cash,
)