Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gateio futures #37

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading