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
| Parameter | Type | Description |
|---|---|---|
symbol | str | Trading pair (e.g., "WETH-USDC"). |
pool | str | Pool address (more efficient than symbol). |
interval | str | Time interval (e.g., "1m", "15m", "1h", "1d"). |
limit | int | Number of candles to return (1-100). |
from_time | datetime | Start time (optional). |
to_time | datetime | End time (optional). |