Skip to main content

Python SDK Quickstart

For comprehensive documentation and usage details of the Python SDK, visit bisonai/datamaxi-python.

Requirements

info
  • Python 3.8 or onwards.
  • Access to PIP package manager
tip
  • If you are not sure of your Python version, you can check it with the command python --version.
  • Common Python IDE such as Jupyter Notebook, Visual Studio Code, PyCharm, or Google Colab will work.

Installation

pip3 install datamaxi

CEX Candle Data

The maxi.cex.candle() method requires a DataMaxi+ API key. To obtain an API key, refer to the How to get an API Key guide.

from datamaxi.datamaxi import Datamaxi

# Initialize the Datamaxi client with your API key
api_key = "YOUR_API_KEY"
maxi = Datamaxi(api_key=api_key)

# Retrieve a list of available CEX exchanges supported by the Datamaxi client
exchanges = maxi.cex.candle.exchanges()

# Retrieve a list of supported time intervals for CEX candle data
intervals = maxi.cex.candle.intervals()

# Retrieve a list of symbols available for CEX candle data on the Datamaxi client
symbols = maxi.cex.candle.symbols()

# Fetch recent CEX candle data for a specific trading pair from an exchange
# - exchange: Name of the exchange (e.g., "binance")
# - symbol: Trading pair symbol (e.g., "BTC-USDT")
# - interval: Time interval for each candle (e.g., "1m" for 1 minute)
candle, get_next = maxi.cex.candle(exchange="binance", symbol="BTC-USDT", interval="1m")

DEX Data

The maxi.dex.candle() and maxi.dex.trade() methods requires a DataMaxi+ API key. To obtain an API key, refer to the How to get an API Key guide.

from datamaxi.datamaxi import Datamaxi

# Initialize the Datamaxi client with your API key
api_key = "YOUR_API_KEY"
maxi = Datamaxi(api_key=api_key)

# Retrieve a list of available DEX exchanges supported by the Datamaxi client
exchanges = maxi.dex.exchanges()

# Retrieve a list of supported time intervals for DEX candle data
intervals = maxi.dex.intervals()

# Retrieve a list of pools available for DEX candle data on the Datamaxi client
symbols = maxi.dex.pools()

# Fetch recent DEX candle data for a specific pool from an exchange
# - chain: Name of the chain (e.g., "bsc_mainnet")
# - exchange: Name of the exchange (e.g., "pancakeswap")
# - pool: Trading pair symbol (e.g., "0xb24cd29e32FaCDDf9e73831d5cD1FFcd1e535423")
# - interval: Time interval for each candle (e.g., "1m" for 1 minute)
candle, get_next_candle = maxi.dex.candle(
chain="bsc_mainnet",
exchange="pancakeswap",
pool="0xb24cd29e32FaCDDf9e73831d5cD1FFcd1e535423",
interval="1m",
)

# Fetch recent DEX trade data for a specific pool from an exchange
# - chain: Name of the chain (e.g., "bsc_mainnet")
# - exchange: Name of the exchange (e.g., "pancakeswap")
# - pool: Trading pair symbol (e.g., "0xb24cd29e32FaCDDf9e73831d5cD1FFcd1e535423")
trade, get_next_trade = maxi.dex.trade(
chain="bsc_mainnet",
exchange="pancakeswap",
pool="0xb24cd29e32FaCDDf9e73831d5cD1FFcd1e535423",
)

The naver.trend() method requires a DataMaxi+ API key. To obtain an API key, refer to the How to get an API Key guide.

from datamaxi.naver import Naver

# Initialize the Naver client with an API key to access data
api_key = "YOUR_API_KEY"
naver = Naver(api_key=api_key)

# Retrieve and display available symbols for data retrieval
print(naver.symbols())

# Fetch and display trend data specifically for Bitcoin (BTC)
naver.trend("BTC")