From d8a8c6de88a5610bdb3d4ee4f65e22ebcdb3efb3 Mon Sep 17 00:00:00 2001 From: TheHolyRoger Date: Fri, 2 Apr 2021 19:55:32 +0100 Subject: [PATCH] CoinZoom: Change poll interval and balance update trigger --- hummingbot/connector/exchange/coinzoom/coinzoom_constants.py | 4 ++-- hummingbot/connector/exchange/coinzoom/coinzoom_exchange.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hummingbot/connector/exchange/coinzoom/coinzoom_constants.py b/hummingbot/connector/exchange/coinzoom/coinzoom_constants.py index a3af9fe30b..0cad1cb049 100644 --- a/hummingbot/connector/exchange/coinzoom/coinzoom_constants.py +++ b/hummingbot/connector/exchange/coinzoom/coinzoom_constants.py @@ -52,8 +52,8 @@ class Constants: # Intervals # Only used when nothing is received from WS SHORT_POLL_INTERVAL = 5.0 - # CoinZoom poll interval can't be too long since we don't get balances via websockets - LONG_POLL_INTERVAL = 8.0 + # One minute should be fine since we request balance updates on order updates + LONG_POLL_INTERVAL = 60.0 # One minute should be fine for order status since we get these via WS UPDATE_ORDER_STATUS_INTERVAL = 60.0 # 10 minute interval to update trading rules, these would likely never change whilst running. diff --git a/hummingbot/connector/exchange/coinzoom/coinzoom_exchange.py b/hummingbot/connector/exchange/coinzoom/coinzoom_exchange.py index a4d000accd..65108d7475 100644 --- a/hummingbot/connector/exchange/coinzoom/coinzoom_exchange.py +++ b/hummingbot/connector/exchange/coinzoom/coinzoom_exchange.py @@ -702,10 +702,11 @@ def _process_order_message(self, order_msg: Dict[str, Any]): # Estimate fee order_msg["trade_fee"] = self.estimate_fee_pct(tracked_order.order_type is OrderType.LIMIT_MAKER) updated = tracked_order.update_with_order_update(order_msg) + # Call Update balances on every message to catch order create, fill and cancel. + safe_ensure_future(self._update_balances()) if updated: safe_ensure_future(self._trigger_order_fill(tracked_order, order_msg)) - safe_ensure_future(self._update_balances()) elif tracked_order.is_cancelled: self.logger().info(f"Successfully cancelled order {tracked_order.client_order_id}.") self.stop_tracking_order(tracked_order.client_order_id)