Mathieu2301 / TradingView-API

📈 Get real-time stocks from TradingView

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'M' for month or minute on timeframe?

brandonros opened this issue · comments

* | '1D' | '1W' | '1M' | 'D' | 'W' | 'M'} TimeFrame

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

const client = new TradingView.Client()
const chart = new client.Session.Chart()
chart.setMarket('CME_MINI_DL:ES1!', {
  timeframe: '60', // 60 seconds = 1 minute?
  range: 100
})
chart.onUpdate(() => {
  console.log(chart.periods)
})
 $ node tradingview.js | grep time
    time: 1655269200, # Wednesday, June 15, 2022 5:00:00 AM
    time: 1655265600, # Wednesday, June 15, 2022 4:00:00 AM
    time: 1655262000,
    time: 1655258400,
    time: 1655254800,
    time: 1655251200,
    time: 1655247600,
    time: 1655244000,

if I am requesting 1 minute timeframe, why are the results coming back 1 hour apart?

Ok, you need to pass 1 to timeframe to get 1 minute