Skip to content

Commit

Permalink
feat: change order of functions and reflect in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkersner committed Jul 18, 2024
1 parent ee936b8 commit 60ec49b
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 116 deletions.
162 changes: 81 additions & 81 deletions datamaxi/datamaxi/candle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`
<https://docs.datamaxiplus.com/api/datasets/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`
<https://docs.datamaxiplus.com/api/datasets/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`
<https://docs.datamaxiplus.com/api/datasets/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,
Expand Down Expand Up @@ -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`
<https://docs.datamaxiplus.com/api/datasets/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`
<https://docs.datamaxiplus.com/api/datasets/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`
<https://docs.datamaxiplus.com/api/datasets/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)
70 changes: 35 additions & 35 deletions datamaxi/datamaxi/funding_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`
<https://docs.datamaxiplus.com/api/datasets/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`
<https://docs.datamaxiplus.com/api/datasets/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,
Expand Down Expand Up @@ -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`
<https://docs.datamaxiplus.com/api/datasets/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`
<https://docs.datamaxiplus.com/api/datasets/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)
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 60ec49b

Please sign in to comment.