BLD: for issue #144, skipped cash verification when there are open orders.

This commit is contained in:
Frederic Fortier
2018-01-07 02:32:12 -05:00
parent 30448a65c5
commit 33f94b3ef9
2 changed files with 11 additions and 3 deletions
+9 -1
View File
@@ -582,10 +582,18 @@ 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]
orders += asset_orders
required_cash = self.portfolio.cash if not orders else None
cash, positions_value = exchange.sync_positions(
positions=exchange_positions,
check_balances=check_balances,
cash=self.portfolio.cash,
cash=required_cash,
)
total_cash += cash
total_positions_value += positions_value