From 01751e10a58538719428e573e81a9c2e5397345f Mon Sep 17 00:00:00 2001 From: Martin Kersner Date: Wed, 1 Jul 2026 12:37:43 +0900 Subject: [PATCH 1/5] Convert forex, naver, telegram to request_endpoint --- datamaxi/datamaxi/forex.py | 9 ++------- datamaxi/naver/__init__.py | 6 ++---- datamaxi/telegram/__init__.py | 36 +++++++++++++++++------------------ 3 files changed, 21 insertions(+), 30 deletions(-) diff --git a/datamaxi/datamaxi/forex.py b/datamaxi/datamaxi/forex.py index 1983804..e0165de 100644 --- a/datamaxi/datamaxi/forex.py +++ b/datamaxi/datamaxi/forex.py @@ -39,11 +39,7 @@ def __call__( """ check_required_parameter(symbol, "symbol") - params = { - "symbol": symbol, - } - - res = self.query("/api/v1/forex", params) + res = self.request_endpoint("forex", symbol=symbol) if pandas: return pd.DataFrame([res]) @@ -60,5 +56,4 @@ def symbols(self) -> List[str]: Returns: List of supported symbols """ - url_path = "/api/v1/forex/symbols" - return self.query(url_path) + return self.request_endpoint("forex_symbols") diff --git a/datamaxi/naver/__init__.py b/datamaxi/naver/__init__.py index 434075f..e4342c3 100644 --- a/datamaxi/naver/__init__.py +++ b/datamaxi/naver/__init__.py @@ -29,8 +29,7 @@ def symbols(self) -> List[str]: Returns: List of supported Naver trend token symbols """ - url_path = "/api/v1/naver-trend/symbols" - return self.query(url_path) + return self.request_endpoint("naver_trend_symbols") def trend(self, symbol: str, pandas: bool = True) -> Union[List, pd.DataFrame]: """Get Naver trend for given token symbol @@ -47,8 +46,7 @@ def trend(self, symbol: str, pandas: bool = True) -> Union[List, pd.DataFrame]: Naver trend data as list or pandas DataFrame """ check_required_parameter(symbol, "symbol") - params = {"symbol": symbol} - res = self.query("/api/v1/naver-trend", params) + res = self.request_endpoint("naver_trend", symbol=symbol) if pandas: return pd.DataFrame(res) return res diff --git a/datamaxi/telegram/__init__.py b/datamaxi/telegram/__init__.py index 03a075a..96977dc 100644 --- a/datamaxi/telegram/__init__.py +++ b/datamaxi/telegram/__init__.py @@ -50,15 +50,14 @@ def channels( if sort not in ["asc", "desc"]: raise ValueError("sort must be either asc or desc") - params = { - "page": page, - "limit": limit, - "category": category, - "key": key, - "sort": sort, - } - - res = self.query("/api/v1/telegram/channels", params) + res = self.request_endpoint( + "telegram_channels", + page=page, + limit=limit, + category=category, + key=key, + sort=sort, + ) if res["data"] is None: raise ValueError("no data found") @@ -107,16 +106,15 @@ def messages( if sort not in ["asc", "desc"]: raise ValueError("sort must be either asc or desc") - params = { - "channel": channel_name, - "page": page, - "limit": limit, - "key": key, - "sort": sort, - "category": category, - } - - res = self.query("/api/v1/telegram/messages", params) + res = self.request_endpoint( + "telegram_messages", + channel=channel_name, + page=page, + limit=limit, + key=key, + sort=sort, + category=category, + ) if res["data"] is None: raise ValueError("no data found") From f1b12c4cdbb08a805686aa39fbe7fdb3e3380a10 Mon Sep 17 00:00:00 2001 From: Martin Kersner Date: Wed, 1 Jul 2026 12:38:17 +0900 Subject: [PATCH 2/5] Convert cex_fee, cex_ticker, cex_wallet_status to request_endpoint --- datamaxi/datamaxi/cex_fee.py | 19 ++----------- datamaxi/datamaxi/cex_ticker.py | 38 ++++++++------------------ datamaxi/datamaxi/cex_wallet_status.py | 20 ++++---------- 3 files changed, 20 insertions(+), 57 deletions(-) diff --git a/datamaxi/datamaxi/cex_fee.py b/datamaxi/datamaxi/cex_fee.py index ebb4073..3c1f590 100644 --- a/datamaxi/datamaxi/cex_fee.py +++ b/datamaxi/datamaxi/cex_fee.py @@ -33,14 +33,7 @@ def __call__( Returns: Trading fee data """ - params = {} - if exchange: - params["exchange"] = exchange - if symbol: - params["symbol"] = symbol - - url_path = "/api/v1/cex/fees" - return self.query(url_path, params) + return self.request_endpoint("cex_fees", exchange=exchange, symbol=symbol) def exchanges(self) -> List[str]: """Fetch supported exchanges for fee data. @@ -52,8 +45,7 @@ def exchanges(self) -> List[str]: Returns: List of supported exchanges """ - url_path = "/api/v1/cex/fees/exchanges" - return self.query(url_path) + return self.request_endpoint("cex_fees_exchanges") def symbols(self, exchange: str) -> List[str]: """Fetch supported symbols for fee data. @@ -70,9 +62,4 @@ def symbols(self, exchange: str) -> List[str]: """ check_required_parameter(exchange, "exchange") - params = { - "exchange": exchange, - } - - url_path = "/api/v1/cex/fees/symbols" - return self.query(url_path, params) + return self.request_endpoint("cex_fees_symbols", exchange=exchange) diff --git a/datamaxi/datamaxi/cex_ticker.py b/datamaxi/datamaxi/cex_ticker.py index 16aa64c..ddcf658 100644 --- a/datamaxi/datamaxi/cex_ticker.py +++ b/datamaxi/datamaxi/cex_ticker.py @@ -55,19 +55,14 @@ def get( if market not in [SPOT, FUTURES]: raise ValueError("market must be either spot or futures") - params = { - "exchange": exchange, - "symbol": symbol, - "market": market, - } - - if currency is not None: - params["currency"] = currency - - if conversion_base is not None: - params["conversion_base"] = conversion_base - - res = self.query("/api/v1/ticker", params) + res = self.request_endpoint( + "ticker", + exchange=exchange, + symbol=symbol, + market=market, + currency=currency, + conversion_base=conversion_base, + ) if pandas: df = pd.DataFrame([res["data"]]) @@ -101,12 +96,7 @@ def exchanges( if market not in [SPOT, FUTURES]: raise ValueError("market must be either spot or futures") - params = { - "market": market, - } - - url_path = "/api/v1/ticker/exchanges" - return self.query(url_path, params) + return self.request_endpoint("ticker_exchanges", market=market) def symbols( self, @@ -136,10 +126,6 @@ def symbols( if market not in [SPOT, FUTURES]: raise ValueError("market must be either spot or futures") - params = { - "exchange": exchange, - "market": market, - } - - url_path = "/api/v1/ticker/symbols" - return self.query(url_path, params) + return self.request_endpoint( + "ticker_symbols", exchange=exchange, market=market + ) diff --git a/datamaxi/datamaxi/cex_wallet_status.py b/datamaxi/datamaxi/cex_wallet_status.py index 48a5498..bf74ffc 100644 --- a/datamaxi/datamaxi/cex_wallet_status.py +++ b/datamaxi/datamaxi/cex_wallet_status.py @@ -44,13 +44,9 @@ def __call__( ] ) - params = { - "exchange": exchange, - "asset": asset, - } - - url_path = "/api/v1/wallet-status" - res = self.query(url_path, params) + res = self.request_endpoint( + "wallet_status", exchange=exchange, asset=asset + ) if pandas: df = pd.DataFrame(res) df = df.set_index("network") @@ -68,8 +64,7 @@ def exchanges(self) -> List[str]: Returns: List of supported exchange """ - url_path = "/api/v1/wallet-status/exchanges" - return self.query(url_path) + return self.request_endpoint("wallet_status_exchanges") def assets(self, exchange: str) -> List[str]: """Fetch supported assets for wallet status data. @@ -86,9 +81,4 @@ def assets(self, exchange: str) -> List[str]: """ check_required_parameter(exchange, "exchange") - params = { - "exchange": exchange, - } - - url_path = "/api/v1/wallet-status/assets" - return self.query(url_path, params) + return self.request_endpoint("wallet_status_assets", exchange=exchange) From b81f5ac1c913398ed088d5d6eb1784c36de9635c Mon Sep 17 00:00:00 2001 From: Martin Kersner Date: Wed, 1 Jul 2026 12:38:58 +0900 Subject: [PATCH 3/5] Convert cex_announcement, liquidation, open_interest to request_endpoint --- datamaxi/datamaxi/cex_announcement.py | 19 +++++++-------- datamaxi/datamaxi/liquidation.py | 33 +++++++++++++------------ datamaxi/datamaxi/open_interest.py | 35 ++++++++++++++------------- 3 files changed, 44 insertions(+), 43 deletions(-) diff --git a/datamaxi/datamaxi/cex_announcement.py b/datamaxi/datamaxi/cex_announcement.py index 8d3a2af..2e996ff 100644 --- a/datamaxi/datamaxi/cex_announcement.py +++ b/datamaxi/datamaxi/cex_announcement.py @@ -50,16 +50,15 @@ def __call__( if sort not in [ASC, DESC]: raise ValueError("sort must be either asc or desc") - params = { - "page": page, - "limit": limit, - "sort": sort, - "key": key, - "exchange": exchange, - "category": category, - } - - res = self.query("/api/v1/cex/announcements", params) + res = self.request_endpoint( + "cex_announcements", + page=page, + limit=limit, + sort=sort, + key=key, + exchange=exchange, + category=category, + ) if res["data"] is None: raise ValueError("no data found") diff --git a/datamaxi/datamaxi/liquidation.py b/datamaxi/datamaxi/liquidation.py index f38d4a9..1a5b5a8 100644 --- a/datamaxi/datamaxi/liquidation.py +++ b/datamaxi/datamaxi/liquidation.py @@ -34,8 +34,9 @@ def __call__( """ if limit < 1: raise ValueError("limit must be greater than 0") - params = {"exchange": exchange, "symbol": symbol, "limit": limit} - return self.query("/api/v1/liquidation", params) + return self.request_endpoint( + "liquidation", exchange=exchange, symbol=symbol, limit=limit + ) def feed(self, limit: int = 100) -> Dict[str, Any]: """Firehose: most recent liquidation events across every symbol. @@ -47,7 +48,7 @@ def feed(self, limit: int = 100) -> Dict[str, Any]: """ if limit < 1: raise ValueError("limit must be greater than 0") - return self.query("/api/v1/liquidation/feed", {"limit": limit}) + return self.request_endpoint("liquidation_feed", limit=limit) def heatmap( self, @@ -64,8 +65,8 @@ def heatmap( """ if topN < 1 or topN > 30: raise ValueError("topN must be between 1 and 30") - return self.query( - "/api/v1/liquidation/heatmap", {"window": window, "top_n": topN} + return self.request_endpoint( + "liquidation_heatmap", window=window, top_n=topN ) def map( @@ -83,8 +84,9 @@ def map( exchange (str): Exchange (default ``binance``). quote (str): Quote asset (default ``USDT``). """ - params = {"base": base, "exchange": exchange, "quote": quote} - return self.query("/api/v1/liquidation/map", params) + return self.request_endpoint( + "liquidation_map", base=base, exchange=exchange, quote=quote + ) def symbol_history( self, @@ -106,12 +108,11 @@ def symbol_history( interval (str): Bucket interval (``5m``, ``15m``, or ``1h``). window (str): Lookback window (``24h``, ``72h``, or ``7d``). """ - params = { - "symbol": symbol, - "quote": quote, - "interval": interval, - "window": window, - } - if exchange is not None: - params["exchange"] = exchange - return self.query("/api/v1/liquidation/symbol-history", params) + return self.request_endpoint( + "liquidation_symbol_history", + symbol=symbol, + quote=quote, + exchange=exchange, + interval=interval, + window=window, + ) diff --git a/datamaxi/datamaxi/open_interest.py b/datamaxi/datamaxi/open_interest.py index 73e2a62..eac8d0d 100644 --- a/datamaxi/datamaxi/open_interest.py +++ b/datamaxi/datamaxi/open_interest.py @@ -23,8 +23,8 @@ def __call__(self, exchange: str, symbol: str) -> Dict[str, Any]: exchange (str): Exchange (e.g. ``binance``). symbol (str): Exchange-native API symbol (e.g. ``BTC-USDT``). """ - return self.query( - "/api/v1/open-interest", {"exchange": exchange, "symbol": symbol} + return self.request_endpoint( + "open_interest", exchange=exchange, symbol=symbol ) def list(self, exchange: Optional[str] = None) -> Dict[str, Any]: @@ -35,10 +35,7 @@ def list(self, exchange: Optional[str] = None) -> Dict[str, Any]: Args: exchange (str): Optional filter to one exchange. """ - params = {} - if exchange is not None: - params["exchange"] = exchange - return self.query("/api/v1/open-interest/list", params) + return self.request_endpoint("open_interest_list", exchange=exchange) def overview( self, @@ -65,10 +62,14 @@ def overview( raise ValueError("limit must be greater than 0") if sort not in ("asc", "desc"): raise ValueError("sort must be either asc or desc") - params = {"page": page, "limit": limit, "key": key, "sort": sort} - if query is not None: - params["query"] = query - return self.query("/api/v1/open-interest/overview", params) + return self.request_endpoint( + "open_interest_overview", + page=page, + limit=limit, + key=key, + sort=sort, + query=query, + ) def summary(self, topN: int = 10) -> Dict[str, Any]: """Top-line OI aggregates (total USD, top tokens, top exchanges). @@ -80,7 +81,7 @@ def summary(self, topN: int = 10) -> Dict[str, Any]: """ if topN < 1 or topN > 30: raise ValueError("topN must be between 1 and 30") - return self.query("/api/v1/open-interest/summary", {"top_n": topN}) + return self.request_endpoint("open_interest_summary", top_n=topN) def history_aggregated( self, @@ -105,9 +106,9 @@ def history_aggregated( ``from_`` is named with a trailing underscore because ``from`` is a Python keyword. The wire-level query param remains ``from``. """ - params: Dict[str, Any] = {"token_id": token_id, "interval": interval} - if from_ is not None: - params["from"] = from_ - if to is not None: - params["to"] = to - return self.query("/api/v1/open-interest/history-aggregated", params) + return self.request_endpoint( + "open_interest_history_aggregated", + token_id=token_id, + interval=interval, + **{"from": from_, "to": to}, + ) From 799c47968d2155a7ca717eba56bef0bbbf3ef211 Mon Sep 17 00:00:00 2001 From: Martin Kersner Date: Wed, 1 Jul 2026 12:39:47 +0900 Subject: [PATCH 4/5] Convert funding_rate, cex_symbol, premium partials to request_endpoint latest/cautions/delistings/volume/premium.__call__ left on hardcoded paths due to registry (openapi.yaml) gaps that would break pinned wire contracts. --- datamaxi/datamaxi/cex_symbol.py | 39 ++++++++++++++----------------- datamaxi/datamaxi/funding_rate.py | 27 +++++++++------------ datamaxi/datamaxi/premium.py | 3 +-- 3 files changed, 29 insertions(+), 40 deletions(-) diff --git a/datamaxi/datamaxi/cex_symbol.py b/datamaxi/datamaxi/cex_symbol.py index 80d7907..e3e5302 100644 --- a/datamaxi/datamaxi/cex_symbol.py +++ b/datamaxi/datamaxi/cex_symbol.py @@ -21,12 +21,9 @@ def metadata( `GET /api/v1/cex/symbol/metadata` """ - params: Dict[str, Any] = {} - if exchange is not None: - params["exchange"] = exchange - if base is not None: - params["base"] = base - return self.query("/api/v1/cex/symbol/metadata", params) + return self.request_endpoint( + "cex_symbol_metadata", exchange=exchange, base=base + ) def tags( self, exchange: Optional[str] = None, base: Optional[str] = None @@ -35,12 +32,9 @@ def tags( `GET /api/v1/cex/symbol/tags` """ - params: Dict[str, Any] = {} - if exchange is not None: - params["exchange"] = exchange - if base is not None: - params["base"] = base - return self.query("/api/v1/cex/symbol/tags", params) + return self.request_endpoint( + "cex_symbol_tags", exchange=exchange, base=base + ) def cautions( self, exchange: Optional[str] = None, base: Optional[str] = None @@ -85,10 +79,9 @@ def oi(self, base: str, exchange: Optional[str] = None) -> Dict[str, Any]: `GET /api/v1/cex/symbol/oi` """ - params: Dict[str, Any] = {"base": base} - if exchange is not None: - params["exchange"] = exchange - return self.query("/api/v1/cex/symbol/oi", params) + return self.request_endpoint( + "cex_symbol_oi", base=base, exchange=exchange + ) def oi_stats( self, @@ -107,10 +100,12 @@ def oi_stats( """ if currency not in ("USD", "KRW"): raise ValueError("currency must be either USD or KRW") - params: Dict[str, Any] = {"base": base, "currency": currency} - if exchange is not None: - params["exchange"] = exchange - return self.query("/api/v1/cex/symbol/oi-stats", params) + return self.request_endpoint( + "cex_symbol_oi_stats", + base=base, + exchange=exchange, + currency=currency, + ) def liquidation(self, base: str, window: str = "24h") -> Dict[str, Any]: """Per-exchange long / short liquidation aggregates over a window. @@ -121,6 +116,6 @@ def liquidation(self, base: str, window: str = "24h") -> Dict[str, Any]: base (str): Base asset (e.g. ``BTC``). window (str): Time window (``1h``, ``24h``, ``7d`` — server caps at 30d). """ - return self.query( - "/api/v1/cex/symbol/liquidation", {"base": base, "window": window} + return self.request_endpoint( + "cex_symbol_liquidation", base=base, window=window ) diff --git a/datamaxi/datamaxi/funding_rate.py b/datamaxi/datamaxi/funding_rate.py index 8ee0cde..f8e7d7a 100644 --- a/datamaxi/datamaxi/funding_rate.py +++ b/datamaxi/datamaxi/funding_rate.py @@ -70,17 +70,15 @@ def history( if sort not in [ASC, DESC]: raise ValueError("sort must be either asc or desc") - params = { - "exchange": exchange, - "symbol": symbol, - "page": page, - "limit": limit, - "from": fromDateTime, - "to": toDateTime, - "sort": sort, - } - - res = self.query("/api/v1/funding-rate/history", params) + res = self.request_endpoint( + "funding_rate_history", + exchange=exchange, + symbol=symbol, + page=page, + limit=limit, + sort=sort, + **{"from": fromDateTime, "to": toDateTime}, + ) if res["data"] is None or len(res["data"]) == 0: raise ValueError("no data found") @@ -159,8 +157,7 @@ def exchanges(self) -> List[str]: Returns: List of supported exchanges """ - url_path = "/api/v1/funding-rate/exchanges" - return self.query(url_path) + return self.request_endpoint("funding_rate_exchanges") def symbols(self, exchange: str) -> List[str]: """Fetch supported symbols for funding rate endpoints. @@ -176,6 +173,4 @@ def symbols(self, exchange: str) -> List[str]: List of supported symbols """ check_required_parameter(exchange, "exchange") - params = {"exchange": exchange} - url_path = "/api/v1/funding-rate/symbols" - return self.query(url_path, params) + return self.request_endpoint("funding_rate_symbols", exchange=exchange) diff --git a/datamaxi/datamaxi/premium.py b/datamaxi/datamaxi/premium.py index 7861788..dbaa561 100644 --- a/datamaxi/datamaxi/premium.py +++ b/datamaxi/datamaxi/premium.py @@ -380,5 +380,4 @@ def exchanges(self) -> List[str]: Returns: List of supported exchanges """ - url_path = "/api/v1/premium/exchanges" - return self.query(url_path) + return self.request_endpoint("premium_exchanges") From f8a9dcfbe3696bc1d2cfe25a9d4c7801f144f883 Mon Sep 17 00:00:00 2001 From: Martin Kersner Date: Wed, 1 Jul 2026 12:40:13 +0900 Subject: [PATCH 5/5] style: black formatting for converted modules --- datamaxi/datamaxi/cex_symbol.py | 12 +++--------- datamaxi/datamaxi/cex_ticker.py | 4 +--- datamaxi/datamaxi/cex_wallet_status.py | 4 +--- datamaxi/datamaxi/liquidation.py | 4 +--- datamaxi/datamaxi/open_interest.py | 4 +--- 5 files changed, 7 insertions(+), 21 deletions(-) diff --git a/datamaxi/datamaxi/cex_symbol.py b/datamaxi/datamaxi/cex_symbol.py index e3e5302..35c79dd 100644 --- a/datamaxi/datamaxi/cex_symbol.py +++ b/datamaxi/datamaxi/cex_symbol.py @@ -32,9 +32,7 @@ def tags( `GET /api/v1/cex/symbol/tags` """ - return self.request_endpoint( - "cex_symbol_tags", exchange=exchange, base=base - ) + return self.request_endpoint("cex_symbol_tags", exchange=exchange, base=base) def cautions( self, exchange: Optional[str] = None, base: Optional[str] = None @@ -79,9 +77,7 @@ def oi(self, base: str, exchange: Optional[str] = None) -> Dict[str, Any]: `GET /api/v1/cex/symbol/oi` """ - return self.request_endpoint( - "cex_symbol_oi", base=base, exchange=exchange - ) + return self.request_endpoint("cex_symbol_oi", base=base, exchange=exchange) def oi_stats( self, @@ -116,6 +112,4 @@ def liquidation(self, base: str, window: str = "24h") -> Dict[str, Any]: base (str): Base asset (e.g. ``BTC``). window (str): Time window (``1h``, ``24h``, ``7d`` — server caps at 30d). """ - return self.request_endpoint( - "cex_symbol_liquidation", base=base, window=window - ) + return self.request_endpoint("cex_symbol_liquidation", base=base, window=window) diff --git a/datamaxi/datamaxi/cex_ticker.py b/datamaxi/datamaxi/cex_ticker.py index ddcf658..f0fb22c 100644 --- a/datamaxi/datamaxi/cex_ticker.py +++ b/datamaxi/datamaxi/cex_ticker.py @@ -126,6 +126,4 @@ def symbols( if market not in [SPOT, FUTURES]: raise ValueError("market must be either spot or futures") - return self.request_endpoint( - "ticker_symbols", exchange=exchange, market=market - ) + return self.request_endpoint("ticker_symbols", exchange=exchange, market=market) diff --git a/datamaxi/datamaxi/cex_wallet_status.py b/datamaxi/datamaxi/cex_wallet_status.py index bf74ffc..b42786a 100644 --- a/datamaxi/datamaxi/cex_wallet_status.py +++ b/datamaxi/datamaxi/cex_wallet_status.py @@ -44,9 +44,7 @@ def __call__( ] ) - res = self.request_endpoint( - "wallet_status", exchange=exchange, asset=asset - ) + res = self.request_endpoint("wallet_status", exchange=exchange, asset=asset) if pandas: df = pd.DataFrame(res) df = df.set_index("network") diff --git a/datamaxi/datamaxi/liquidation.py b/datamaxi/datamaxi/liquidation.py index 1a5b5a8..ff4260c 100644 --- a/datamaxi/datamaxi/liquidation.py +++ b/datamaxi/datamaxi/liquidation.py @@ -65,9 +65,7 @@ def heatmap( """ if topN < 1 or topN > 30: raise ValueError("topN must be between 1 and 30") - return self.request_endpoint( - "liquidation_heatmap", window=window, top_n=topN - ) + return self.request_endpoint("liquidation_heatmap", window=window, top_n=topN) def map( self, diff --git a/datamaxi/datamaxi/open_interest.py b/datamaxi/datamaxi/open_interest.py index eac8d0d..eda2050 100644 --- a/datamaxi/datamaxi/open_interest.py +++ b/datamaxi/datamaxi/open_interest.py @@ -23,9 +23,7 @@ def __call__(self, exchange: str, symbol: str) -> Dict[str, Any]: exchange (str): Exchange (e.g. ``binance``). symbol (str): Exchange-native API symbol (e.g. ``BTC-USDT``). """ - return self.request_endpoint( - "open_interest", exchange=exchange, symbol=symbol - ) + return self.request_endpoint("open_interest", exchange=exchange, symbol=symbol) def list(self, exchange: Optional[str] = None) -> Dict[str, Any]: """List all (exchange, symbol) pairs currently reporting OI.