Retrieving Historical Candles from a Third-Party Data Source
Summary
This template describes retrieving historical candlestick data from an external market-data provider when an exchange integration does not supply the needed records. It maps a small set of supported exchange and currency combinations to provider symbols, requests candles at a chosen interval and size, and converts returned fields into time, open, high, low, close, and volume records. A parameter controls whether the latest, potentially incomplete candle is included; by default, the example excludes it.
The document says updates arrive every three seconds and advises against high-frequency use. It is intended for live trading, and the example demonstrates requesting both five-minute and four-hour candles. Errors in the response or JSON parsing return a null result, while unsupported exchanges fall back to the platform's standard candle retrieval, ignoring the requested interval and size. The provider's data accuracy and the template's correctness are not guaranteed, so users need to validate the returned series and handle missing or stale data before relying on it.
Key ideas
- A third-party provider can supply candle history when an exchange adapter lacks historical records.
- The template maps supported exchange and currency combinations to provider-specific market symbols.
- Callers can choose the candle interval, requested count, and whether to include the latest bar.
- The source updates every three seconds, so the method is unsuitable for high-frequency polling.
- Unsupported exchanges use the platform's default retrieval behavior, which ignores the requested interval and length.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.