Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) correct logic that updates available balance #1883

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion hummingbot/market/radar_relay/radar_relay_market.pyx
Expand Up @@ -290,7 +290,19 @@ cdef class RadarRelayMarket(MarketBase):
total_balances = self._account_balances

for order in self._in_flight_limit_orders.values():
locked_balances[order.trading_pair] = locked_balances.get(order.trading_pair, s_decimal_0) + order.amount
# Orders that are done, cancelled or expired don't deduct from the available balance
if (not order.is_cancelled and
not order.is_expired and
not order.is_failure and
not order.is_done):
pair_split = order.trading_pair.split("-")
if order.trade_type is TradeType.BUY:
currency = pair_split[1]
amount = Decimal(order.amount * order.price)
else:
currency = pair_split[0]
amount = Decimal(order.amount)
locked_balances[currency] = locked_balances.get(currency, s_decimal_0) + amount

for currency, balance in total_balances.items():
self._account_available_balances[currency] = \
Expand Down