Skip to content

Commit

Permalink
feat: gateio futures
Browse files Browse the repository at this point in the history
  • Loading branch information
hayotbisonai committed Jul 8, 2024
1 parent cb26182 commit 61f03d2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion datamaxi/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.8.0"
__version__ = "0.9.0"
19 changes: 15 additions & 4 deletions datamaxi/gateio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ def intervals(self) -> List[str]:

@postprocess()
def candle(
self, symbol: str, interval: str = "1d", pandas: bool = True
self,
symbol: str,
interval: str = "1d",
market: str = "spot",
pandas: bool = True,
) -> Union[List, pd.DataFrame]:
"""Get Gateio candle data
Expand All @@ -60,11 +64,18 @@ def candle(
Args:
symbol (str): Gateio symbol
interval (str): Candle interval
market (str): Market type (spot/futures)
pandas (bool): Return data as pandas DataFrame
Returns:
Gateio candle data for a given symbol and interval in pandas DataFrame
Gateio candle data for a given symbol, interval and market in pandas DataFrame
"""
check_required_parameters([[symbol, "symbol"], [interval, "interval"]])
params = {"symbol": symbol, "interval": interval}
check_required_parameters(
[[symbol, "symbol"], [interval, "interval"], [market, "market"]]
)

if market not in ["spot", "futures"]:
raise ValueError("market must be either spot or futures")

params = {"symbol": symbol, "interval": interval, "market": market}
return self.query("/v1/raw/gateio/candle", params)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "datamaxi"
version = "0.8.0"
version = "0.9.0"
authors = [
{ name="Bisonai", email="[email protected]" },
]
Expand Down
4 changes: 2 additions & 2 deletions tests/gateio/test_gateio_candle.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
key = random_str()
client = Client(key)

req_params = {"symbol": "BTC-USDT", "interval": "1d"}
params = {"symbol": "BTC-USDT", "interval": "1d", "pandas": False}
req_params = {"symbol": "BTC-USDT", "interval": "1d", "market": "spot"}
params = {"symbol": "BTC-USDT", "interval": "1d", "market": "spot", "pandas": False}


@mock_http_response(
Expand Down

0 comments on commit 61f03d2

Please sign in to comment.