tradingview/lightweight-charts

Alternative method to update charts that doesn't necessarily require establishing a websocket connection

Closed this issue · 1 comments

Is there an alternative method to update charts that doesn't necessarily require establishing a websocket connection? Currently, we have an existing trade event watcher that generates candle data for the candlesticks chart. The documentation recommends using websockets with subscribeBars and onRealtimeCallback, but implementing this would duplicate our existing logic unnecessarily.

We're specifically thinking:

  • Is there a programmatic way to update chart data without using websockets?
  • Can we add a new candle to the chart directly, bypassing the standard datafeed update mechanism?
  • Are there any methods to trigger a chart update using our existing trade event data without implementing the full websocket pattern?

Our goal is to efficiently integrate our current data stream with the TradingView charting library while avoiding redundant implementation. Would appreciate your insights on potential approaches.

Is this question specifically for Lightweight Charts or Charting Library?

If it is for Lightweight Charts then you can use the update method on the series to provide new bars of data. We have an example here: https://tradingview.github.io/lightweight-charts/tutorials/demos/realtime-updates

It is explained in our Getting Started page here: https://tradingview.github.io/lightweight-charts/docs#updating-the-data-in-a-series

If the question is for Charting Library then please ask the question on that repo instead.