Skip to content

Commit a3602b8

Browse files
authored
Merge pull request hummingbot#7588 from hummingbot/revert-7586-feat/mexc-assessment-zone
Revert "(feat) support for MEXC Assessment Zone"
2 parents 5c50e05 + 9d032ec commit a3602b8

File tree

8 files changed

+17
-41
lines changed

8 files changed

+17
-41
lines changed

hummingbot/connector/exchange/mexc/mexc_api_order_book_data_source.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ async def _request_order_book_snapshot(self, trading_pair: str) -> Dict[str, Any
5959
params=params,
6060
method=RESTMethod.GET,
6161
throttler_limit_id=CONSTANTS.SNAPSHOT_PATH_URL,
62-
headers={"Content-Type": "application/json"},
63-
sign_if_possible=True
62+
headers={"Content-Type": "application/json"}
6463
)
6564

6665
return data

hummingbot/connector/exchange/mexc/mexc_exchange.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,7 @@ def supported_order_types(self):
113113
return [OrderType.LIMIT, OrderType.LIMIT_MAKER, OrderType.MARKET]
114114

115115
async def get_all_pairs_prices(self) -> List[Dict[str, str]]:
116-
pairs_prices = await self._api_get(
117-
path_url=CONSTANTS.TICKER_BOOK_PATH_URL,
118-
headers={"Content-Type": "application/json"},
119-
sign_if_possible=True)
116+
pairs_prices = await self._api_get(path_url=CONSTANTS.TICKER_BOOK_PATH_URL, headers={"Content-Type": "application/json"})
120117
return pairs_prices
121118

122119
def _is_request_exception_related_to_time_synchronizer(self, request_exception: Exception):
@@ -548,24 +545,18 @@ async def _get_last_traded_price(self, trading_pair: str) -> float:
548545
method=RESTMethod.GET,
549546
path_url=CONSTANTS.TICKER_PRICE_CHANGE_PATH_URL,
550547
params=params,
551-
headers={"Content-Type": "application/json"},
552-
sign_if_possible=True)
548+
headers={"Content-Type": "application/json"}
549+
)
553550

554551
return float(resp_json["lastPrice"])
555552

556553
async def _make_network_check_request(self):
557554
await self._api_get(path_url=self.check_network_request_path, headers={"Content-Type": "application/json"})
558555

559556
async def _make_trading_rules_request(self) -> Any:
560-
exchange_info = await self._api_get(
561-
path_url=self.trading_rules_request_path,
562-
headers={"Content-Type": "application/json"},
563-
sign_if_possible=True)
557+
exchange_info = await self._api_get(path_url=self.trading_rules_request_path, headers={"Content-Type": "application/json"})
564558
return exchange_info
565559

566560
async def _make_trading_pairs_request(self) -> Any:
567-
exchange_info = await self._api_get(
568-
path_url=self.trading_pairs_request_path,
569-
headers={"Content-Type": "application/json"},
570-
sign_if_possible=True)
561+
exchange_info = await self._api_get(path_url=self.trading_pairs_request_path, headers={"Content-Type": "application/json"})
571562
return exchange_info

hummingbot/connector/exchange_py_base.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,6 @@ async def _api_request(
890890
params: Optional[Dict[str, Any]] = None,
891891
data: Optional[Dict[str, Any]] = None,
892892
is_auth_required: bool = False,
893-
sign_if_possible: bool = False,
894893
return_err: bool = False,
895894
limit_id: Optional[str] = None,
896895
headers: Optional[Dict[str, Any]] = None,
@@ -910,7 +909,6 @@ async def _api_request(
910909
data=data,
911910
method=method,
912911
is_auth_required=is_auth_required,
913-
sign_if_possible=sign_if_possible,
914912
return_err=return_err,
915913
throttler_limit_id=limit_id if limit_id else path_url,
916914
headers=headers,

hummingbot/core/rate_oracle/sources/mexc_rate_source.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async def get_prices(self, quote_token: Optional[str] = None) -> Dict[str, Decim
4040

4141
def _ensure_exchanges(self):
4242
if self._mexc_exchange is None:
43-
self._mexc_exchange = self._build_mexc_connector()
43+
self._mexc_exchange = self._build_mexc_connector_without_private_keys()
4444

4545
@staticmethod
4646
async def _get_mexc_prices(exchange: 'MexcExchange', quote_token: str = None) -> Dict[str, Decimal]:
@@ -70,22 +70,17 @@ async def _get_mexc_prices(exchange: 'MexcExchange', quote_token: str = None) ->
7070
return results
7171

7272
@staticmethod
73-
def _build_mexc_connector() -> 'MexcExchange':
74-
from hummingbot.client.config.security import Security
73+
def _build_mexc_connector_without_private_keys() -> 'MexcExchange':
7574
from hummingbot.client.hummingbot_application import HummingbotApplication
7675
from hummingbot.connector.exchange.mexc.mexc_exchange import MexcExchange
7776

7877
app = HummingbotApplication.main_application()
7978
client_config_map = app.client_config_map
8079

81-
config_exists = Security.connector_config_file_exists("mexc")
82-
83-
api_keys = Security.api_keys("mexc") if config_exists else {}
84-
8580
return MexcExchange(
8681
client_config_map=client_config_map,
87-
mexc_api_key=api_keys.get("mexc_api_key", ""),
88-
mexc_api_secret=api_keys.get("mexc_api_secret", ""),
82+
mexc_api_key="",
83+
mexc_api_secret="",
8984
trading_pairs=[],
9085
trading_required=False,
9186
)

hummingbot/core/web_assistant/connections/data_types.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class RESTRequest:
3434
data: Any = None
3535
headers: Optional[Mapping[str, str]] = None
3636
is_auth_required: bool = False
37-
sign_if_possible: bool = False
3837
throttler_limit_id: Optional[str] = None
3938

4039

hummingbot/core/web_assistant/rest_assistant.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ async def execute_request(
4040
data: Optional[Dict[str, Any]] = None,
4141
method: RESTMethod = RESTMethod.GET,
4242
is_auth_required: bool = False,
43-
sign_if_possible: bool = False,
4443
return_err: bool = False,
4544
timeout: Optional[float] = None,
4645
headers: Optional[Dict[str, Any]] = None,
@@ -52,7 +51,6 @@ async def execute_request(
5251
data=data,
5352
method=method,
5453
is_auth_required=is_auth_required,
55-
sign_if_possible=sign_if_possible,
5654
return_err=return_err,
5755
timeout=timeout,
5856
headers=headers,
@@ -68,7 +66,6 @@ async def execute_request_and_get_response(
6866
data: Optional[Dict[str, Any]] = None,
6967
method: RESTMethod = RESTMethod.GET,
7068
is_auth_required: bool = False,
71-
sign_if_possible: bool = False,
7269
return_err: bool = False,
7370
timeout: Optional[float] = None,
7471
headers: Optional[Dict[str, Any]] = None,
@@ -90,7 +87,6 @@ async def execute_request_and_get_response(
9087
data=data,
9188
headers=local_headers,
9289
is_auth_required=is_auth_required,
93-
sign_if_possible=sign_if_possible,
9490
throttler_limit_id=throttler_limit_id
9591
)
9692

@@ -119,7 +115,7 @@ async def _pre_process_request(self, request: RESTRequest) -> RESTRequest:
119115
return request
120116

121117
async def _authenticate(self, request: RESTRequest):
122-
if self._auth is not None and (request.is_auth_required or request.sign_if_possible):
118+
if self._auth is not None and request.is_auth_required:
123119
request = await self._auth.rest_authenticate(request)
124120
return request
125121

test/hummingbot/connector/exchange/mexc/test_mexc_exchange.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,13 @@ class MexcExchangeTests(AbstractExchangeConnectorTests.ExchangeConnectorTests):
2727

2828
@property
2929
def all_symbols_url(self):
30-
url = web_utils.public_rest_url(path_url=CONSTANTS.EXCHANGE_INFO_PATH_URL, domain=self.exchange._domain)
31-
return re.compile(f"^{url}.*")
30+
return web_utils.public_rest_url(path_url=CONSTANTS.EXCHANGE_INFO_PATH_URL, domain=self.exchange._domain)
3231

3332
@property
3433
def latest_prices_url(self):
3534
url = web_utils.public_rest_url(path_url=CONSTANTS.TICKER_PRICE_CHANGE_PATH_URL, domain=self.exchange._domain)
36-
symbol = self.exchange_symbol_for_tokens(self.base_asset, self.quote_asset)
37-
return re.compile(rf"^{url}\?signature=.*&symbol={symbol}&timestamp=.*")
35+
url = f"{url}?symbol={self.exchange_symbol_for_tokens(self.base_asset, self.quote_asset)}"
36+
return url
3837

3938
@property
4039
def network_status_url(self):
@@ -44,7 +43,7 @@ def network_status_url(self):
4443
@property
4544
def trading_rules_url(self):
4645
url = web_utils.private_rest_url(CONSTANTS.EXCHANGE_INFO_PATH_URL, domain=self.exchange._domain)
47-
return re.compile(f"^{url}.*")
46+
return url
4847

4948
@property
5049
def order_creation_url(self):

test/hummingbot/core/rate_oracle/sources/test_mexc_rate_source.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import json
2-
import re
32
from decimal import Decimal
43
from test.isolated_asyncio_wrapper_test_case import IsolatedAsyncioWrapperTestCase
54

@@ -22,7 +21,7 @@ def setUpClass(cls):
2221
cls.ignored_trading_pair = combine_to_hb_trading_pair(base="SOME", quote="PAIR")
2322

2423
def setup_mexc_responses(self, mock_api, expected_rate: Decimal):
25-
pairs_url = re.compile(f"^{web_utils.public_rest_url(path_url=CONSTANTS.EXCHANGE_INFO_PATH_URL)}.*")
24+
pairs_url = web_utils.public_rest_url(path_url=CONSTANTS.EXCHANGE_INFO_PATH_URL)
2625
symbols_response = {
2726
"symbols": [
2827
{
@@ -44,7 +43,7 @@ def setup_mexc_responses(self, mock_api, expected_rate: Decimal):
4443
]
4544
}
4645

47-
mexc_prices_url = re.compile(f"^{web_utils.public_rest_url(path_url=CONSTANTS.TICKER_BOOK_PATH_URL)}.*")
46+
mexc_prices_url = web_utils.public_rest_url(path_url=CONSTANTS.TICKER_BOOK_PATH_URL)
4847
mexc_prices_response = [
4948
{
5049
"symbol": self.mexc_pair,

0 commit comments

Comments
 (0)