Implement a datafeed
Build a custom data source for the GoCharting chart in three steps: create the widget, serve history, then stream live updates.
Realtime is one of two paths (pick one — not both):
subscribeTicks— push trades; the SDK aggregates ticks into the active candle.subscribeBars— push complete OHLCV bars for the chart resolution; the SDK applies them directly (no tick aggregation).
If both are implemented, the SDK prefers ticks and ignores bars.
Tutorial path
| Step | Page | What you build |
|---|---|---|
| 1 | Widget setup | Container + createChart + stub datafeed |
| 2 | Datafeed implementation | resolveSymbol, getBars, optional searchSymbols / searchSymbolsPaginated |
| 3 | Streaming implementation | subscribeTicks / unsubscribeTicks or subscribeBars / unsubscribeBars |
Prerequisites
- GoCharting SDK installed (
@gocharting/chart-sdkor UMD) - A license key (use the demo key for local testing)
- A backend (or mock) that can return OHLCV history and, for live charts, trade ticks or bars
Related API
- Datafeed API — method contracts and payload shapes (
onReady, UDF adapter, bars/ticks) - Demo WebSocket — hosted demo stream for ticks and history
- Configuration — construct options (
symbol,interval,theme, …) - Labs:
phase6-subscribeBars-lab.html,phase6-searchSymbolsPaginated-lab.html,phase6-onReady-udf-lab.html
Last updated on