Mathieu2301 / TradingView-API

📈 Get real-time stocks from TradingView

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support replay for subdaily candles

BigFav opened this issue · comments

Describe the bug
When I try to run replay mode with any timeframe below a day, it fetches the 1st values and it gives an error.

In the ReplayMode example is looks like this:

----- Testing ReplayMode: -----
Next -> 1660420800 0
Chart error: Critical error: no_point_or_series {"command":"step","args":{"length":1}}
Chart error: Series error: Upstream error, errmsg: session <session id here> was not created in time
Upstream error, errmsg: session <session id here> was not created in time undefined

In my code it looks like this:

Market "Bitcoin / Euro" loaded !
Period {"time":1660420800,"open":23802.58,"close":23848.48,"max":23942.41,"min":23728.89,"volume":117.75}
EMA_50 plots {"$time":1660420800,"EMA":23261.19299390461,"Smoothing_Line":23211.664818650996}
EMA_200 plots {"$time":1660420800,"EMA":22510.359431069326,"Smoothing_Line":22483.28651113566}
Chart error: Critical error: no_point_or_series {"command":"step","args":{"length":1}}
...

To Reproduce
This can be seen using the ReplayMode example with the below config:

const config = {
  symbol: 'BINANCE:BTCEUR',
  timeframe: '240',
  startFrom: Math.round(Date.now() / 1000) - 86400 * 1, // One day before now
}

Expected behavior
Print the relevant historical candles.

Environment:

  • OS: Windows 10 using Ubuntu 18.04
  • Node version: v16.15.1

Additional context
Using a day works fine, even for 30+ candles.

Ah it just hit me that this may be due to limitations around the Trading View product. Is there an easy way to insert my account credentials?

Apologies for the confusion. Feel free to resolve this.