-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: include CEX-related classes under
cex
- Loading branch information
1 parent
de390af
commit 38f85b3
Showing
15 changed files
with
150 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
from typing import Any, List, Dict | ||
from datamaxi.api import API | ||
from datamaxi.lib.utils import check_required_parameter | ||
|
||
|
||
class CexTradingFees(API): | ||
"""Client to fetch CEX trading fee data from DataMaxi+ API.""" | ||
|
||
def __init__(self, api_key=None, **kwargs: Any): | ||
"""Initialize trading fee client. | ||
Args: | ||
api_key (str): The DataMaxi+ API key | ||
**kwargs: Keyword arguments used by `datamaxi.api.API`. | ||
""" | ||
super().__init__(api_key, **kwargs) | ||
|
||
def get( | ||
self, | ||
exchange: str = None, | ||
symbol: str = None, | ||
) -> List[Dict]: | ||
"""Fetch trading fee data | ||
`GET /api/v1/trading-fees` | ||
<https://docs.datamaxiplus.com/rest/cex/trading-fees/data> | ||
Args: | ||
exchange (str): Exchange name | ||
symbol (str): Symbol name | ||
Returns: | ||
Trading fee data | ||
""" | ||
params = {} | ||
if exchange: | ||
params["exchange"] = exchange | ||
if symbol: | ||
params["symbol"] = symbol | ||
|
||
url_path = "/api/v1/trading-fees" | ||
return self.query(url_path, params) | ||
|
||
def exchanges(self) -> List[str]: | ||
"""Fetch supported exchanges accepted by | ||
[datamaxi.CexTradingFees.get](./#datamaxi.datamaxi.CexTradingFees.get) | ||
API. | ||
`GET /api/v1/trading-fees/exchanges` | ||
<https://docs.datamaxiplus.com/rest/cex/trading-fees/exchanges> | ||
Returns: | ||
List of supported exchange | ||
""" | ||
url_path = "/api/v1/trading-fees/exchanges" | ||
return self.query(url_path) | ||
|
||
def symbols(self, exchange: str) -> List[str]: | ||
"""Fetch supported symbols accepted by | ||
[datamaxi.CexTradingFees.get](./#datamaxi.datamaxi.CexTradingFees.get) | ||
API. | ||
`GET /api/v1/trading-fees/symbols` | ||
<https://docs.datamaxiplus.com/rest/cex/trading-fees/symbols> | ||
Args: | ||
exchange (str): Exchange name | ||
Returns: | ||
List of supported assets | ||
""" | ||
check_required_parameter(exchange, "exchange") | ||
|
||
params = { | ||
"exchange": exchange, | ||
} | ||
|
||
url_path = "/api/v1/trading-fees/symbols" | ||
return self.query(url_path, params) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# CEX Announcement | ||
|
||
::: datamaxi.announcement | ||
::: datamaxi.datamaxi.CexAnnouncement | ||
options: | ||
show_submodules: true | ||
show_source: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# CEX Orderbook | ||
|
||
::: datamaxi.datamaxi.Orderbook | ||
::: datamaxi.datamaxi.CexOrderbook | ||
options: | ||
show_submodules: true | ||
show_source: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# CEX Ticker | ||
|
||
::: datamaxi.datamaxi.Ticker | ||
::: datamaxi.datamaxi.CexTicker | ||
options: | ||
show_submodules: true | ||
show_source: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# CEX Token Updates | ||
|
||
::: datamaxi.token | ||
::: datamaxi.datamaxi.CexTokenUpdates | ||
options: | ||
show_submodules: true | ||
show_source: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# CEX Trading Fees | ||
|
||
::: datamaxi.datamaxi.CexTradingFees | ||
options: | ||
show_submodules: true | ||
show_source: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# CEX Wallet Status | ||
|
||
::: datamaxi.datamaxi.WalletStatus | ||
::: datamaxi.datamaxi.CexWalletStatus | ||
options: | ||
show_submodules: true | ||
show_source: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters