Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to update the last bar realtime in TradingView Charting Library in real-time when first loaded? #118

Open
vanhauhuynh17 opened this issue Jul 3, 2024 · 0 comments

Comments

@vanhauhuynh17
Copy link

0

/** * Charting Library calls this function when it wants to receive real-time updates for a symbol. * The Library assumes that you will call the callback provided by the onTick parameter every time you want to update the most recent bar or to add a new one. * * @param symbolInfo A SymbolInfo object * @param resolution Resolution of the symbol * @param onTick Callback function returning a Bar object * @param listenerGuid * @param onResetCacheNeededCallback Function to be executed when bar data has changed / subscribeBars(symbolInfo: LibrarySymbolInfo, resolution: ResolutionString, onTick: SubscribeBarsCallback, listenerGuid: string, onResetCacheNeededCallback: () => void): void; /*

I am implementing the realtime udpate bar part of tradingview's charting library. I have successfully implemented the realtime update and realized the key is that the subscribeBars function must run and save onSubscribeBarCallBack to update, the library will automatically call the subscribeBar function in datafeed api when the symbol changes. or resolution changes and will now save onSubscribeBarCallBack. This means that when entering the chart page, the library will not call the subscribeBar function, so the first time the chart is loaded, there will be no way to realtime update the last bar. I've searched and read the charting library's documentation over and over again but haven't found anything about this issue, i also try to call subscribeBars manually and not success . Can anyone help me, thank you very much.

Link document about charting librabry: (https://www.tradingview.com/charting-library-docs/latest/connecting_data/Datafeed-API/)

i want to subscribeBar is called and realtime update last bar in the first load in datafeed api

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant