Candlestick
Real-time OHLC (Open, High, Low, Close) data for market analysis
Real-Time OHLC Data
Access high-quality candlestick data for technical analysis and trading applications
Overview
Looking for OHLC data? You’re at the right place. The Candlestick API provides real-time access to Open, High, Low, and Close price data at various time intervals.
Currently, we only support OHLC data for onchain
data, but it will soon be available for offchain
data as well.
Connection
Open WebSocket Connection
Connect to our WebSocket endpoint on your preferred environment:
Subscribe to Asset Pair
Send a subscription message with your desired pair, network, interval, and number of candles.
Receive OHLC Updates
Once subscribed, you’ll receive candlestick data at your specified interval.
Subscription Management
Subscribing to a Pair
You can only subscribe to one pair at a time. Subscribing to a new pair will automatically replace your current subscription.
Available Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
pair | string | Yes | - | The trading pair you want to subscribe to (e.g., “BTC/USD”) |
network | string | Yes | - | The blockchain network to fetch data from (e.g., “mainnet”) |
interval | string | Yes | - | Time interval for each candle. Options include: “1min”, “5min”, “15min”, “30min”, “1hour”, “4hour”, “1day”, “1week” |
candles_to_get | string | No | ”10” | Number of historical candles to receive on initial subscription |
Unsubscribing
To stop receiving updates for your current subscription:
The server will unsubscribe you without sending any acknowledgment. Your connection will remain open but you’ll stop receiving updates.
Data Format
Candle Fields
Field | Type | Description |
---|---|---|
time | string | ISO 8601 timestamp marking the start of the candle period |
open | string | Opening price for the period (in raw price format) |
high | string | Highest price reached during the period (in raw price format) |
low | string | Lowest price reached during the period (in raw price format) |
close | string | Closing price for the period (in raw price format) |
Available Intervals
1min
One-minute candles
5min
Five-minute candles
15min
Fifteen-minute candles
30min
Thirty-minute candles
1hour
One-hour candles
4hour
Four-hour candles
1day
Daily candles
1week
Weekly candles
Best Practices
Start with Small Requests
Begin with smaller time intervals and fewer candles to ensure smooth performance
Handle Reconnections
Implement reconnection logic with subscription restoration when connections drop
Error Handling
Add robust error handling for network issues and malformed responses
Data Storage
Consider implementing local storage to cache historical candles when appropriate
Was this page helpful?