Returns historical OHLCV (Open, High, Low, Close, Volume) candle data for technical analysis and charting. Use this to analyze price trends, build charts, and calculate indicators over time.
From spec: Get historic rates for a product. Rates are returned in an array of [time, low, high, open, close, volume] buckets.
Usage Tips
- Granularity options: 60, 300, 900, 3600, 21600, 86400 seconds
- Each candle: [timestamp, low, high, open, close, volume]
- Maximum 300 candles per request
- Timestamps are Unix epoch in seconds
Parameters (4)
end(string, query, optional)
End time in ISO 8601 format
granularity(integer, query, optional)
Time slice in seconds (60, 300, 900, 3600, 21600, 86400)
import zingu_apis
api = zingu_apis.api("coinbase-pro")
result = api.fetch("products/{product_id}/candles", granularity=3600)
for item in result:
print(item)
const resp = await fetch("https://api.exchange.coinbase.com/products/BTC-USD/candles?granularity=3600");
const data = await resp.json();