diff --git a/datamaxi/datamaxi/candle.py b/datamaxi/datamaxi/candle.py index 44b1d77..4ee1291 100644 --- a/datamaxi/datamaxi/candle.py +++ b/datamaxi/datamaxi/candle.py @@ -18,87 +18,6 @@ def __init__(self, api_key=None, **kwargs: Any): """ super().__init__(api_key, **kwargs) - def exchanges(self, market: str = "spot") -> List[str]: - """Fetch supported exchanges accepted by - [datamaxi.Candle.get](./#datamaxi.datamaxi.Candle.get) - API. - - `GET /v1/candle/exchanges` - - - - Args: - market (str): Market type (spot/futures) - - Returns: - List of supported exchanges - """ - check_required_parameter(market, "market") - - if market not in ["spot", "futures"]: - raise ValueError("market must be either spot or futures") - - params = {"market": market} - url_path = "/v1/candle/exchanges" - return self.query(url_path, params) - - def symbols(self, exchange: str, market: str = "spot") -> List[str]: - """Fetch supported symbols accepted by - [datamaxi.Candle.get](./#datamaxi.datamaxi.Candle.get) - API. - - `GET /v1/candle/symbols` - - - - Args: - exchange (str): Exchange name - market (str): Market type (spot/futures) - - Returns: - List of supported symbols - """ - check_required_parameters( - [ - [exchange, "exchange"], - [market, "market"], - ] - ) - - if market not in ["spot", "futures"]: - raise ValueError("market must be either spot or futures") - - params = {"exchange": exchange, "market": market} - url_path = "/v1/candle/symbols" - return self.query(url_path, params) - - def intervals(self, exchange: str, market: str = "spot") -> List[str]: - """Fetch supported intervals accepted by - [datamaxi.Candle.get](./#datamaxi.datamaxi.Candle.get) - API. - - `GET /v1/candle/intervals` - - - - Args: - exchange (str): Exchange name - market (str): Market type (spot/futures) - - Returns: - List of supported intervals - """ - check_required_parameters( - [ - [exchange, "exchange"], - [market, "market"], - ] - ) - - params = {"exchange": exchange, "market": market} - url_path = "/v1/candle/intervals" - return self.query(url_path, params) - def get( self, exchange: str, @@ -194,3 +113,84 @@ def next_request(): return df, next_request else: return res, next_request + + def exchanges(self, market: str = "spot") -> List[str]: + """Fetch supported exchanges accepted by + [datamaxi.Candle.get](./#datamaxi.datamaxi.Candle.get) + API. + + `GET /v1/candle/exchanges` + + + + Args: + market (str): Market type (spot/futures) + + Returns: + List of supported exchanges + """ + check_required_parameter(market, "market") + + if market not in ["spot", "futures"]: + raise ValueError("market must be either spot or futures") + + params = {"market": market} + url_path = "/v1/candle/exchanges" + return self.query(url_path, params) + + def symbols(self, exchange: str, market: str = "spot") -> List[str]: + """Fetch supported symbols accepted by + [datamaxi.Candle.get](./#datamaxi.datamaxi.Candle.get) + API. + + `GET /v1/candle/symbols` + + + + Args: + exchange (str): Exchange name + market (str): Market type (spot/futures) + + Returns: + List of supported symbols + """ + check_required_parameters( + [ + [exchange, "exchange"], + [market, "market"], + ] + ) + + if market not in ["spot", "futures"]: + raise ValueError("market must be either spot or futures") + + params = {"exchange": exchange, "market": market} + url_path = "/v1/candle/symbols" + return self.query(url_path, params) + + def intervals(self, exchange: str, market: str = "spot") -> List[str]: + """Fetch supported intervals accepted by + [datamaxi.Candle.get](./#datamaxi.datamaxi.Candle.get) + API. + + `GET /v1/candle/intervals` + + + + Args: + exchange (str): Exchange name + market (str): Market type (spot/futures) + + Returns: + List of supported intervals + """ + check_required_parameters( + [ + [exchange, "exchange"], + [market, "market"], + ] + ) + + params = {"exchange": exchange, "market": market} + url_path = "/v1/candle/intervals" + return self.query(url_path, params) diff --git a/datamaxi/datamaxi/funding_rate.py b/datamaxi/datamaxi/funding_rate.py index acfb17f..fe4d742 100644 --- a/datamaxi/datamaxi/funding_rate.py +++ b/datamaxi/datamaxi/funding_rate.py @@ -18,41 +18,6 @@ def __init__(self, api_key=None, **kwargs: Any): """ super().__init__(api_key, **kwargs) - def exchanges(self) -> List[str]: - """Fetch supported exchanges accepted by - [datamaxi.FundingRate.get](./#datamaxi.datamaxi.FundingRate.get) - API. - - `GET /v1/funding-rate/exchanges` - - - - Returns: - List of supported exchanges - """ - url_path = "/v1/funding-rate/exchanges" - return self.query(url_path) - - def symbols(self, exchange: str, market: str = "spot") -> List[str]: - """Fetch supported symbols accepted by - [datamaxi.FundingRate.get](./#datamaxi.datamaxi.FundingRate.get) - API. - - `GET /v1/funding-rate/symbols` - - - - Args: - exchange (str): Exchange name - - Returns: - List of supported symbols - """ - check_required_parameter(exchange, "exchange") - params = {"exchange": exchange} - url_path = "/v1/funding-rate/symbols" - return self.query(url_path, params) - def get( self, exchange: str, @@ -135,3 +100,38 @@ def next_request(): return df, next_request else: return res, next_request + + def exchanges(self) -> List[str]: + """Fetch supported exchanges accepted by + [datamaxi.FundingRate.get](./#datamaxi.datamaxi.FundingRate.get) + API. + + `GET /v1/funding-rate/exchanges` + + + + Returns: + List of supported exchanges + """ + url_path = "/v1/funding-rate/exchanges" + return self.query(url_path) + + def symbols(self, exchange: str, market: str = "spot") -> List[str]: + """Fetch supported symbols accepted by + [datamaxi.FundingRate.get](./#datamaxi.datamaxi.FundingRate.get) + API. + + `GET /v1/funding-rate/symbols` + + + + Args: + exchange (str): Exchange name + + Returns: + List of supported symbols + """ + check_required_parameter(exchange, "exchange") + params = {"exchange": exchange} + url_path = "/v1/funding-rate/symbols" + return self.query(url_path, params) diff --git a/mkdocs.yml b/mkdocs.yml index 7ed393d..9f1dd45 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -18,6 +18,7 @@ plugins: show_signature_annotations: true show_symbol_type_heading: true merge_init_into_class: true + members_order: source markdown_extensions: - toc: