CEX Candle¶
Historical OHLCV candle data for centralized exchanges.
Usage¶
from datamaxi import Datamaxi
maxi = Datamaxi(api_key="YOUR_API_KEY")
exchanges = maxi.cex.candle.exchanges(market="spot")
symbols = maxi.cex.candle.symbols(exchange="binance", market="spot")
intervals = maxi.cex.candle.intervals()
df = maxi.cex.candle(
exchange="binance",
symbol="BTC-USDT",
interval="1d",
market="spot",
from_unix=1704067200,
to_unix=1706745600,
)
Notes¶
from_unixandto_unixuse Unix timestamps in seconds.- Set
pandas=Falseto return the raw dict response.
Bases: API
Client to fetch CEX candle data from DataMaxi+ API.
Parameters:
-
api_key(str, default:None) –The DataMaxi+ API key
-
**kwargs(Any, default:{}) –Keyword arguments used by
datamaxi.api.API.
__call__
¶
__call__(
exchange: str,
market: str,
symbol: str,
currency: str = USD,
interval: str = INTERVAL_1D,
from_unix: str = None,
to_unix: str = None,
pandas: bool = True,
) -> Union[Dict, pd.DataFrame]
Fetch candle data
GET /api/v1/cex/candle
https://docs.datamaxiplus.com/rest/cex/candle/data
Parameters:
-
exchange(str) –Exchange name
-
market(str) –Market type (spot/futures)
-
symbol(str) –Symbol name
-
currency(str, default:USD) –Currency
-
interval(str, default:INTERVAL_1D) –Candle interval
-
from_unix(str, default:None) –Start time in Unix timestamp
-
to_unix(str, default:None) –End time in Unix timestamp
-
pandas(bool, default:True) –Return data as pandas DataFrame
Returns:
-
Union[Dict, DataFrame]–Candle data in pandas DataFrame or dict response
exchanges
¶
exchanges(market: str) -> List[str]
Fetch supported exchanges for candle data.
GET /api/v1/cex/candle/exchanges
https://docs.datamaxiplus.com/rest/cex/candle/exchanges
Parameters:
-
market(str) –Market type (spot/futures)
Returns:
-
List[str]–List of supported exchanges
symbols
¶
symbols(
exchange: str = None, market: str = None
) -> List[Dict]
Fetch supported symbols for candle data.
GET /api/v1/cex/candle/symbols
https://docs.datamaxiplus.com/rest/cex/candle/symbols
Parameters:
-
exchange(str, default:None) –Exchange name
-
market(str, default:None) –Market type (spot/futures)
Returns:
-
List[Dict]–List of supported symbols
intervals
¶
intervals() -> List[str]
Fetch supported intervals for candle data.
GET /api/v1/cex/candle/intervals
https://docs.datamaxiplus.com/rest/cex/candle/intervals
Returns:
-
List[str]–List of supported intervals