Nifty exchange timestamp


I am using node.js client library and normally for every other symbol I am getting "timestamp" data properly but for NIFTY (Instrument = 256265), It gives me 1970 date.

{ tradable: false,
mode: 'full',
instrument_token: 256265,
last_price: 12099.3,
ohlc: { high: 12132.45, low: 12063, open: 12110.2, close: 12073.75 },
change: 0.21161610932808178,
timestamp: 1970-01-19T05:25:52.669Z }

Can you please advise how Can I get actual exchange tick time?
  • wtdmarketing
    Can anyone from Zerodha answer my query here?
  • rakeshr
    Can you let us know, which API call you are making?Are youmaking OHLC API call?
  • wtdmarketing
    Here is my code, I am using Node.js client library.

    function Setup_Ticker()
    ticker = new KiteTicker({
    "api_key": api_key,
    "access_token": access_token

    ticker.autoReconnect(true, 20, 5);
    ticker.on("ticks", onTicks);
    ticker.on("connect", subscribe);
    ticker.on("noreconnect", noReconnect);

    function subscribe()
    ticker.setMode(ticker.modeFull, [256265]);

    function onTicks(ticks)
    And this gives me output as stated in post #1 here. I am not getting exchange timestamp for the tick.
  • wtdmarketing

    I found the issue, It's in the Ticker library (node.js version).

    Line #545
    if (timestamp) tick.timestamp = new Date(timestamp);
    Javascript Date object requires milliseconds as input, so it should be:
    if (timestamp) tick.timestamp = new Date(timestamp * 1000);
    Hope this helps. Looking forward for updated library.
  • sujith
    I think you are using kite3 branch. You need to use the master branch or refer to the release page.
  • wtdmarketing
    Not sure which brach it uses but I installed it using
    npm install kiteconnect

    The github link I posted above, I got from your documentation page:
  • rakeshr
    We just installed fresh kiteconnect node.js client using npm install kiteconnect and tested your above code, timestamp returned to us is current_timestamp.Check below response:
    [ { tradable: false,
    mode: 'full',
    instrument_token: 256265,
    last_price: 12033.5,
    ohlc: { high: 12081.2, low: 11998.75, open: 12071.25, close: 12043.2 },
    change: -0.08054337717550757,
    timestamp: 2019-12-05T09:45:07.000Z } ]
    You might be using older version of client.Can you do npm show kiteconnect version and let us know the version, you are using?
Sign In or Register to comment.