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

getIndicator no longer works for Indicators with Id's starting with 'USER;' and only works for Indicators with Id's starting with 'PUB;' #249

Closed
TaylorArmstrong opened this issue Aug 7, 2024 · 4 comments · Fixed by #250
Assignees
Labels
bug Something isn't working

Comments

@TaylorArmstrong
Copy link

Describe the bug
A clear and concise description of what the bug is.
getIndicator fails with the following error thrown from misRequests.js line 257 : 'The user requesting information on the script is not allowed to do so'
getIndicator succeeds with ID starting with 'PUB;' , but not 'USER;'

To Reproduce
Code to reproduce the behavior.

    const client = new TradingView.Client({token: process.env.TRADINGVIEW_SESSION_ID, signature: process.env.TRADINGVIEW_SESSION_ID_SIGN});
    const chart = new client.Session.Chart();

    chart.setMarket(symbol, {
        timeframe: timeframe.toString(),
        type: 'HeikinAshi',
        to: _to,
        range: number_of_candles,
        session: 'extended'
    });
    
    TradingView.getIndicator(indicator).then(indic => {

        const study = new chart.Study(indic);

    })

Expected behavior
A clear and concise description of what you expected to happen.

08/05 - This same code was working and returning data for all indicators. Could this be an issue with the account or a permissions issue? Nothing has changed that we are aware of.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment:

  • OS: mac Sonoma 14.5
  • Node version: v20.15.0

Additional context
Add any other context about the problem here.

@TaylorArmstrong TaylorArmstrong added the bug Something isn't working label Aug 7, 2024
@ZhangJiankun-1997
Copy link

it lost cookies, pass it in src/miscRequest.js like this:

  const { data } = await axios.get(
    `https://pine-facade.tradingview.com/pine-facade/translate/${indicID}/${version}`,
-    { validateStatus },
+   { validateStatus,
+     headers: {
+         cookie: `sessionid=${session}${signature ? `;sessionid_sign=${signature};` : ''}`,
+      }
+   },
  );

@Mathieu2301 Mathieu2301 linked a pull request Aug 8, 2024 that will close this issue
@TaylorArmstrong
Copy link
Author

Thank you for the quick fix.

@aiyunstunna
Copy link

This bug is back. It was fixed as of yesterday and now the same issue occurs.

@aiyunstunna
Copy link

Nvm it only affects the Replay mode and I fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants