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

getBars method is not getting called. #394

Open
sumanth1462 opened this issue Sep 4, 2024 · 11 comments
Open

getBars method is not getting called. #394

sumanth1462 opened this issue Sep 4, 2024 · 11 comments

Comments

@sumanth1462
Copy link

I am trying to integrate tradingview into flutter app. I am using in app webview of flutter and javacript handlers for communication.

{"name":"PNB","full_name":"PNB EQ","ticker":"5676","description":"","daily_multipliers":["1"],"delay":0,"type":"common_stock","session":"0915-1530","exchange":"NSECM","listed_exchange":"NSECM","timezone":"Asia/Kolkata","format":"price","pricescale":100,"minmov":1,"fractional":true,"minmove2":0,"has_intraday":true,"supported_resolutions":["1","5","30","60","1D","1W","1M"],"intraday_multipliers":["1","5","30","60"],"has_seconds":false,"has_ticks":true,"has_daily":true,"has_weekly_and_monthly":true,"weekly_multipliers":["1"],"monthly_multipliers":["1"],"has_empty_bars":false,"visible_plots_set":"ohlcv","volume_precision":0,"data_status":"streaming","expired":false,"expiration_date":0,"currency_code":"INR","original_currency_code":"INR"} - this is the data that is passed to resolveSymbol . After this step, there are no errors visible and also getBars is not being called.

@romfrancois
Copy link
Contributor

You would need to provide the version of the library you are currently on along with full logs attached as a text file by enabling then in Widget Constructor (debug: true).

@sumanth1462
Copy link
Author

version is v28.0.0
tradingviewlogs.txt

@sumanth1462
Copy link
Author

I'm facing an issue where the getBars callback is not being triggered after the resolveSymbol function completes successfully in my TradingView integration. The logs confirm that the symbol is resolved ("Symbol resolved"), but no subsequent logs indicate that getBars is called. Instead, I see a log stating, "Processing pending subscribers, count=2," suggesting that there are pending subscribers but no data is fetched. Structure of resolveSymbol is available in above message and logs attached.

I'd appreciate any insights on why getBars isn't being triggered or if there are specific steps I should follow to ensure it executes properly. Thank you!

@romfrancois
Copy link
Contributor

Would you be able to record a video of what's happening?

Looking at the logs it seems that the library is not requesting any data.

Ideally you should see something similar to

Leftmost subscriber requires 329 bars prior 2024-09-05T09:44:28.744Z
Requesting data: [2024-06-26T13:03:51.820Z ... 2024-09-05T09:44:28.744Z, 329 bars]

@sumanth1462
Copy link
Author

Recording.2024-09-05.152859.mp4

In video, we can see the logs and also the loading of chart.

@sumanth1462
Copy link
Author

sumanth1462 commented Sep 16, 2024

@romfrancois, any update on the query raised ?

@GeorgiiMatveev-tv
Copy link

@sumanth1462 could you please share your getBars implementation?

@ashlin-utrade
Copy link

Hi @GeorgiiMatveev-tv ,

Thanks for reaching out! Here's a quick clarification regarding the getBars implementation:

I've attached some snippets from our code that show how we're connecting TradingView from Flutter using an in-app WebView. The snippets follow the execution order:

chart_initiate: We load the TradingView HTML within our WebView. Once it loads, Flutter triggers the start handler, where we create the options widget. As you can see, we pass the path, datafeed, and container id here.

datafeed_obj: This snippet shows the structure of our datafeed object. I’ve included the implementations of resolveSymbol and getBars.

flutter_controller: This controller handles the data request made by the datafeed object. When the datafeed requests it, the controller fetches the necessary data and sends it back.

Up until the resolveSymbol part, everything works as expected. However, getBars is supposed to request the range and interval of the needed data, but that step is not happening as intended. @sumanth1462 has included the necessary logs throughout the connection and request process in the previous messages.

Let me know if you need more details.
1_chart_initiate
2_datafeed_obj
3_flutter_controller

@GeorgiiMatveev-tv
Copy link

The logs that you've shared above show that the library received the Symbol Info from resolveSymbol. So it should call getBars next unless something in the LibrarySymbolInfo is invalid.

Suggestions:
The type is 'common_stock' but that is not a possible option: https://www.tradingview.com/charting-library-docs/latest/api/modules/Charting_Library#symboltype, could you please adjust and check if it changes anything?

Also you could test against our demo datafeed to make sure that the issue is not with the flutter layer: https://github.com/tradingview/yahoo_datafeed

@ashlin-utrade
Copy link

@GeorgiiMatveev-tv

Even after hardcoding the type as "stock," the getBars function is still not being triggered. Additionally, we're unable to generate API keys for the demo datafeed, as the website mentioned seems to be down. Could you please advise on any alternative methods to proceed, or if there might be any additional steps we should take to resolve this issue?

Screenshot 2024-10-11 at 4 48 14 PM

@GeorgiiMatveev-tv
Copy link

Hello @ashlin-utrade
generate API keys for the demo datafeed, as the website mentioned seems to be down.

Apologies for the late reply, please try using the demo datafeed from here, might be an easier path.:
https://www.tradingview.com/charting-library-docs/latest/saving_loading/save-load-rest-api/#storage-example

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

4 participants