NEWDirect chain access. 50% cheaper than competitors.

Candles

Fetch OHLCV market data

Fetch historical and real-time OHLCV (Open, High, Low, Close, Volume) data.

Method

client.candles.get(
    symbol: str = None,
    pool: str = None,
    interval: str = "15m",
    limit: int = 10,
    from_time: datetime = None,
    to_time: datetime = None
) -> Response

Example: Get DataFrame

The most common usage is fetching data directly into a Pandas DataFrame.

import qoery

client = qoery.Client()

# Get 15-minute candles for WETH-USDC
candles = client.candles.get(
    symbol="WETH-USDC",
    interval="15m",
    limit=100
)

# Convert to DataFrame
df = candles.df

print(df.head())

Output:

                       time      open      high       low     close      volume
0 2023-11-30 12:00:00+00:00   2050.50   2060.00   2045.20   2055.80  1500000.50
1 2023-11-30 12:15:00+00:00   2055.80   2065.20   2055.00   2062.10  1200000.00
...

Example: Iterate Objects

You can also iterate over the response objects directly if you don't need a DataFrame.

candles = client.candles.get(symbol="WETH-USDC", limit=5)

for candle in candles:
    print(f"Time: {candle.time}, Close: ${candle.close}")

Parameters

ParameterTypeDescription
symbolstrTrading pair (e.g., "WETH-USDC").
poolstrPool address (more efficient than symbol).
intervalstrTime interval (e.g., "1m", "15m", "1h", "1d").
limitintNumber of candles to return (1-100).
from_timedatetimeStart time (optional).
to_timedatetimeEnd time (optional).