STOCKAP DEVELOPER GUIDES
Historical OHLCV API: building stock and crypto charts
By StockAP · Updated November 24, 2026
Use daily, weekly and monthly candles while handling missing sessions, volume units and historical coverage.
Historical candles summarize price activity over a period: open, high, low and close describe the price range, while volume describes activity in the source’s units. They are useful for charts, but the interval, session boundaries and source must be understood before comparing instruments.
Choose the market and interval explicitly
curl --fail-with-body "https://stockap.com/v1/candles?market=stock&symbol=AAPL&interval=1d" -H "Authorization: Bearer $STOCKAP_API_KEY" curl --fail-with-body "https://stockap.com/v1/candles?market=crypto&symbol=BTCUSDT&interval=1wk" -H "Authorization: Bearer $STOCKAP_API_KEY"
The authenticated historical endpoint accepts 1d, 1wk and 1mo. A chart interface may expose other views; do not assume those are supported parameters on this REST endpoint. Keep your API key server-side and use the account dashboard to check usage.
Validate coverage before drawing
Inspect returned dates, sort observations chronologically and check for duplicates. Coverage varies by instrument. A missing stock date may be a non-trading day, but it may also be a data gap; the absence of a row does not tell you which. Do not fill missing observations with zero. If your application requires a continuous trading calendar, validate that calendar separately before reporting completeness.
Preserve source and adjustment assumptions
StockAP’s public pilot pages use stored Yahoo history and may supplement missing dates with completed regular-session aggregates from the Binance stock collector. Existing Yahoo dates take precedence. The page labels the source, and provider volume is not independently verified. The crypto pilot pages describe Binance USDT pairs. These pilot descriptions are not a guarantee that every API instrument has the same source or depth.
Do not assume a series is split-adjusted or dividend-adjusted without confirming its source semantics. A return calculation across a corporate action can be misleading when prices and adjustment factors are inconsistent.
Use the correct volume comparison
Stock share volume and crypto base-asset volume have different units. A daily candle’s volume is also not necessarily a rolling 24-hour total. Comparing today’s partial session against a full historical day can create a misleading relative-volume signal. Preserve partial or finality information when present, and label uncertain coverage rather than presenting it as a completed session.
Separate history from the current quote
Load stored candles once for the requested range, cache them and fetch the latest quote separately. Do not overwrite a completed historical candle with an unrelated live observation. On request failure, retain the previous chart with its original dates and a visible refresh state. The historical API guide and the AAPL/BTC example pages provide starting points for testing both markets.