From ab24db781f929e94a9296de8c4df33cf414eec8f Mon Sep 17 00:00:00 2001 From: drupman Date: Wed, 20 Sep 2023 20:54:10 -0300 Subject: [PATCH 1/3] (fix) replace deprecated endpoint and remove max_order_size --- hummingbot/connector/exchange/bitmart/bitmart_constants.py | 2 +- hummingbot/connector/exchange/bitmart/bitmart_exchange.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hummingbot/connector/exchange/bitmart/bitmart_constants.py b/hummingbot/connector/exchange/bitmart/bitmart_constants.py index 5df3f5930d..476bada752 100644 --- a/hummingbot/connector/exchange/bitmart/bitmart_constants.py +++ b/hummingbot/connector/exchange/bitmart/bitmart_constants.py @@ -26,7 +26,7 @@ CREATE_ORDER_PATH_URL = "spot/v1/submit_order" CANCEL_ORDER_PATH_URL = "spot/v2/cancel_order" GET_ACCOUNT_SUMMARY_PATH_URL = "spot/v1/wallet" -GET_ORDER_DETAIL_PATH_URL = "spot/v1/order_detail" +GET_ORDER_DETAIL_PATH_URL = "spot/v2/order_detail" GET_TRADE_DETAIL_PATH_URL = "spot/v1/trades" SERVER_TIME_PATH = "system/time" diff --git a/hummingbot/connector/exchange/bitmart/bitmart_exchange.py b/hummingbot/connector/exchange/bitmart/bitmart_exchange.py index acf7301f45..243385aaf0 100644 --- a/hummingbot/connector/exchange/bitmart/bitmart_exchange.py +++ b/hummingbot/connector/exchange/bitmart/bitmart_exchange.py @@ -232,7 +232,6 @@ async def _format_trading_rules(self, symbols_details: Dict[str, Any]) -> List[T "quote_currency":"BTC", "quote_increment":"1.00000000", "base_min_size":"1.00000000", - "base_max_size":"10000000.00000000", "price_min_precision":6, "price_max_precision":8, "expiration":"NA", @@ -254,7 +253,6 @@ async def _format_trading_rules(self, symbols_details: Dict[str, Any]) -> List[T price_step = Decimal("1") / Decimal(str(math.pow(10, price_decimals))) result.append(TradingRule(trading_pair=trading_pair, min_order_size=Decimal(str(rule["base_min_size"])), - max_order_size=Decimal(str(rule["base_max_size"])), min_order_value=Decimal(str(rule["min_buy_amount"])), min_base_amount_increment=Decimal(str(rule["base_min_size"])), min_price_increment=price_step)) @@ -291,7 +289,7 @@ async def _update_balances(self): async def _request_order_update(self, order: InFlightOrder) -> Dict[str, Any]: return await self._api_get( path_url=CONSTANTS.GET_ORDER_DETAIL_PATH_URL, - params={"clientOrderId": order.client_order_id}, + params={"order_id": order.exchange_order_id}, is_auth_required=True) async def _request_order_fills(self, order: InFlightOrder) -> Dict[str, Any]: From 25351d9cd1ec187284635a91a9693d57f56ca213 Mon Sep 17 00:00:00 2001 From: drupman Date: Wed, 20 Sep 2023 21:43:51 -0300 Subject: [PATCH 2/3] (fix) remove base_max_size from tests --- .../connector/exchange/bitmart/test_bitmart_exchange.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/test/hummingbot/connector/exchange/bitmart/test_bitmart_exchange.py b/test/hummingbot/connector/exchange/bitmart/test_bitmart_exchange.py index bde60b0bb0..d9f4becb44 100644 --- a/test/hummingbot/connector/exchange/bitmart/test_bitmart_exchange.py +++ b/test/hummingbot/connector/exchange/bitmart/test_bitmart_exchange.py @@ -65,7 +65,6 @@ def all_symbols_request_mock_response(self): "quote_currency": self.quote_asset, "quote_increment": "1.00000000", "base_min_size": "1.00000000", - "base_max_size": "10000000.00000000", "price_min_precision": 6, "price_max_precision": 8, "expiration": "NA", @@ -120,7 +119,6 @@ def all_symbols_including_invalid_pair_mock_response(self) -> Tuple[str, Any]: "quote_currency": self.quote_asset, "quote_increment": "1.00000000", "base_min_size": "1.00000000", - "base_max_size": "10000000.00000000", "price_min_precision": 6, "price_max_precision": 8, "expiration": "NA", @@ -135,7 +133,6 @@ def all_symbols_including_invalid_pair_mock_response(self) -> Tuple[str, Any]: "quote_currency": "PAIR", "quote_increment": "1.00000000", "base_min_size": "1.00000000", - "base_max_size": "10000000.00000000", "price_min_precision": 6, "price_max_precision": 8, "expiration": "NA", @@ -190,7 +187,6 @@ def trading_rules_request_mock_response(self): "quote_currency": self.quote_asset, "quote_increment": "1.00000000", "base_min_size": "5.00000000", - "base_max_size": "10000000.00000000", "price_min_precision": 6, "price_max_precision": 8, "expiration": "NA", @@ -296,7 +292,6 @@ def expected_trading_rule(self): return TradingRule( trading_pair=self.trading_pair, min_order_size=Decimal(self.trading_rules_request_mock_response["data"]["symbols"][0]["base_min_size"]), - max_order_size=Decimal(self.trading_rules_request_mock_response["data"]["symbols"][0]["base_max_size"]), min_order_value=Decimal(self.trading_rules_request_mock_response["data"]["symbols"][0]["min_buy_amount"]), min_base_amount_increment=Decimal(str( self.trading_rules_request_mock_response["data"]["symbols"][0]["base_min_size"])), From 8a47fc42bb1accd08ac0e5125622618e06865431 Mon Sep 17 00:00:00 2001 From: drupman Date: Wed, 20 Sep 2023 22:08:08 -0300 Subject: [PATCH 3/3] (fix) adapt tests --- .../connector/exchange/bitmart/test_bitmart_exchange.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/hummingbot/connector/exchange/bitmart/test_bitmart_exchange.py b/test/hummingbot/connector/exchange/bitmart/test_bitmart_exchange.py index d9f4becb44..0c251a68f7 100644 --- a/test/hummingbot/connector/exchange/bitmart/test_bitmart_exchange.py +++ b/test/hummingbot/connector/exchange/bitmart/test_bitmart_exchange.py @@ -370,7 +370,7 @@ def validate_order_cancelation_request(self, order: InFlightOrder, request_call: def validate_order_status_request(self, order: InFlightOrder, request_call: RequestCall): request_params = request_call.kwargs["params"] - self.assertEqual(order.client_order_id, request_params["clientOrderId"]) + self.assertEqual(order.exchange_order_id, request_params["order_id"]) def validate_trades_request(self, order: InFlightOrder, request_call: RequestCall): request_params = request_call.kwargs["params"]