protected subscribeDataSource = (
dataSource: DataSource,
): void => {
const minMove = getPricePrecisionStep();
this.lwcSeries.applyOptions({
priceFormat: {
type: 'custom',
minMove,
formatter: (price: number) =>
formatPrice(price) ?? String(price),
},
});
this.subscriptions.add(
this.mainSymbol$
.pipe(distinctUntilChanged())
.subscribe((symbol) => {
this.lwcSeries.applyOptions({
title: this.showSymbolLabel
? symbol
: '',
});
}),
);
this.subscriptions.add(
this.mainSymbolId$
.pipe(distinctUntilChanged())
.subscribe((symbolId) => {
this.dataSub?.unsubscribe();
this.realtimeSub?.unsubscribe();
this.dataSub = dataSource.subscribe(
symbolId,
(next) => {
this.dataSourceSubscription(next);
},
);
this.realtimeSub =
dataSource.subscribeRealtime(
symbolId,
(next: Candle) => {
this.dataSourceRealtimeSubscription(
next,
);
},
);
}),
);
};