Live crypto candles
StockChartREST candle history plus WebSocket candle updates. The example defaults to BNBUSDT, 1s interval and light chart theme.
Code layersHTML / TS / SCSS
<chart
[type]="'StockChart'"
[options]="binanceOptions"
(create)="onBinanceChartCreate($event)"
></chart>
binanceSymbol = 'BNBUSDT';
binanceInterval = '1s';
binanceTheme = 'light';
binanceOptions: any = this.createBinanceOptions();
onBinanceChartCreate(chart: any) {
this.binanceChart = chart;
}
private applyLiveCandle(candle: any) {
var ohlc = this.binanceChart.series[0];
var volume = this.binanceChart.series[1];
ohlc.addPoint([candle.time, candle.open, candle.high, candle.low, candle.close], false, true);
volume.addPoint([candle.time, candle.volume], true, true);
}
.chart-frame {
width: 100%;
min-height: 420px;
border: 1px solid #d9e5ee;
border-radius: 8px;
background: #fff;
}