Skip to content

Data feeds and BYOK

Connect a market data source to the chart and manage vendor keys in the host.

Each application owns a market data host. Register a MarketDataSource for your own HTTP feed or in-memory bars. The source supplies instruments and cursor-paginated history. Resolve instruments by their stable ID before mounting a chart.

import { createMarketDataHost, type MarketDataSource } from '@363045841yyt/klinechart'

export function connect(source: MarketDataSource) {
  const market = createMarketDataHost()
  const unregister = market.registerDataSource(source)
  return { market, unregister }
}

Provide market to provideBrowserAppRuntime in the parent of KlineWorkbench. Call unregister to remove the source and market.dispose() when the host unmounts.

A source can also provide a stream transport. The host manages connection lifetime and reconnects. The market data contract and V1.1 streaming reference describe the history cursor and stream frames.

Nebutra's BYOK data sources use authenticated same-origin proxies. The proxy encrypts keys on the server and verifies workspace ownership. The source-management slot lets the app expose connection controls.