From f16b3be7f362ee5cd5136998625791122adaeb96 Mon Sep 17 00:00:00 2001 From: Martin Kou Date: Wed, 30 Mar 2022 17:58:13 -0700 Subject: [PATCH] Added order completion messages for CEX orders, when running amm_arb. --- hummingbot/connector/gateway_EVM_AMM.py | 3 --- hummingbot/strategy/amm_arb/amm_arb.py | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/hummingbot/connector/gateway_EVM_AMM.py b/hummingbot/connector/gateway_EVM_AMM.py index 4235926af1..a7619ca914 100644 --- a/hummingbot/connector/gateway_EVM_AMM.py +++ b/hummingbot/connector/gateway_EVM_AMM.py @@ -773,9 +773,6 @@ async def update_order_status(self, tracked_orders: List[GatewayInFlightOrder]): ) ) tracked_order.last_state = "FILLED" - self.logger().info(f"The {tracked_order.trade_type.name} order " - f"{tracked_order.client_order_id} has completed " - f"according to order status API.") event_tag: MarketEvent = ( MarketEvent.BuyOrderCompleted if tracked_order.trade_type is TradeType.BUY else MarketEvent.SellOrderCompleted diff --git a/hummingbot/strategy/amm_arb/amm_arb.py b/hummingbot/strategy/amm_arb/amm_arb.py index 66ab3f64f0..168ecc94b2 100644 --- a/hummingbot/strategy/amm_arb/amm_arb.py +++ b/hummingbot/strategy/amm_arb/amm_arb.py @@ -448,9 +448,31 @@ def set_order_completed(self, order_id: str): def did_complete_buy_order(self, order_completed_event: BuyOrderCompletedEvent): self.set_order_completed(order_id=order_completed_event.order_id) + market_info: MarketTradingPairTuple = self.order_tracker.get_market_pair_from_order_id( + order_completed_event.order_id + ) + log_msg: str = f"Buy order completed on {market_info.market.name}: {order_completed_event.order_id}." + if self.is_gateway_market(market_info): + log_msg += f" txHash: {order_completed_event.exchange_order_id}" + self.log_with_clock(logging.INFO, log_msg) + self.notify_hb_app_with_timestamp(f"Bought {order_completed_event.base_asset_amount:.8f} " + f"{order_completed_event.base_asset}-{order_completed_event.quote_asset} " + f"on {market_info.market.name}.") + def did_complete_sell_order(self, order_completed_event: SellOrderCompletedEvent): self.set_order_completed(order_id=order_completed_event.order_id) + market_info: MarketTradingPairTuple = self.order_tracker.get_market_pair_from_order_id( + order_completed_event.order_id + ) + log_msg: str = f"Sell order completed on {market_info.market.name}: {order_completed_event.order_id}." + if self.is_gateway_market(market_info): + log_msg += f" txHash: {order_completed_event.exchange_order_id}" + self.log_with_clock(logging.INFO, log_msg) + self.notify_hb_app_with_timestamp(f"Sold {order_completed_event.base_asset_amount:.8f} " + f"{order_completed_event.base_asset}-{order_completed_event.quote_asset} " + f"on {market_info.market.name}.") + def did_fail_order(self, order_failed_event: MarketOrderFailureEvent): self.set_order_completed(order_id=order_failed_event.order_id)