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

Premium account doesn't return 20000 bars for server='prodata' #223

Open
somethingbloodyfunky opened this issue Nov 25, 2023 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@somethingbloodyfunky
Copy link

const TradingView = require('@mathieuc/tradingview');

server = 'prodata';

var authToken;
var session;
var signature;
var sessionHash;
var privateChannel;

session: 'xxx';
signature: 'xxx';
sessionHash: 'xxx';
privateChannel: 'xxx';
authToken: 'xxx';

const client = new TradingView.Client({
    server: server,
    authToken: authToken,
    signature: signature,
    session: session,
    sessionHash: sessionHash,
    privateChannel: privateChannel
});

const chart = new client.Session.Chart();
const exchange = process.argv[2];
const symbol = process.argv[3];
const timeframe = process.argv[4];
const range = 100000;
const ticker = exchange + ':' + symbol;

chart.setTimezone('UTC');

chart.setMarket(ticker, {
    timeframe: timeframe,
    range: range
});

chart.onSymbolLoaded(() => {
    console.log(chart.infos.name, 'loaded !');
});

(async () => {
    chart.onUpdate(() => {
        console.log('OK', chart.periods);
        client.end();
    });
})();

e.g., node script.js BATS SPY 15

Despite the 'Premium' account of TradingView allowing for the download of 20000 historical bars, my login credentials (authToken, session, sessionHash etc) allow for only 10000 bars from the prodata server. I get 10000 bars even without logging-in so long as use the prodata server.

How can I get 20000 bars as I normally do if I manually export data from within the TradingView desktop app using my Premium account?

@somethingbloodyfunky somethingbloodyfunky added the bug Something isn't working label Nov 25, 2023
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

No branches or pull requests

2 participants