wrong historical data

aswin1231
aswin1231 edited March 21 in Node JS client
Hi,
I am getting contradicting historical data when i tried with day and minute intervals.
just checked with one anomaly.

Code:

const instrumentToken = "137059076"; // e.g., '256265' for NIFTY 50
const fromDate = "2022-08-06"; // Start date in YYYY-MM-DD format
const toDate = "2022-08-09"; // End date in YYYY-MM-DD format
const interval = "day"; // Could be "3minute", "5minute", "day" etc.

const result = await kc.getHistoricalData(instrumentToken, interval, fromDate, toDate, false, false)
console.log(result)

Response:

[
{
date: 2022-08-07T18:30:00.000Z,
open: 16.5,
high: 16.5,
low: 16.5,
close: 16.5,
volume: 575163
}
]

Code:

const instrumentToken = "137059076"; // e.g., '256265' for NIFTY 50
const fromDate = "2022-08-06"; // Start date in YYYY-MM-DD format
const toDate = "2022-08-09"; // End date in YYYY-MM-DD format
const interval = "minute"; // Could be "3minute", "5minute", "day" etc.

const result = await kc.getHistoricalData(instrumentToken, interval, fromDate, toDate, false, false)
console.log(result)

Response:
[
{
date: 2022-08-08T03:45:00.000Z,
open: 15.8,
high: 15.8,
low: 15.8,
close: 15.8,
volume: 0
},
{
date: 2022-08-08T04:07:00.000Z,
open: 15.8,
high: 15.8,
low: 15.8,
close: 15.8,
volume: 0
},
{
date: 2022-08-08T04:47:00.000Z,
open: 15.8,
high: 15.8,
low: 15.8,
close: 15.8,
volume: 0
},
{
date: 2022-08-08T04:52:00.000Z,
open: 15.8,
high: 15.8,
low: 15.8,
close: 15.8,
volume: 0
},
{
date: 2022-08-08T08:51:00.000Z,
open: 15.8,
high: 15.8,
low: 15.8,
close: 15.8,
volume: 0
},
{
date: 2022-08-08T09:25:00.000Z,
open: 15.8,
high: 15.8,
low: 15.8,
close: 15.8,
volume: 0
},
{
date: 2022-08-08T09:27:00.000Z,
open: 16.5,
high: 16.5,
low: 16.5,
close: 16.5,
volume: 0
},
{
date: 2022-08-08T09:32:00.000Z,
open: 16.5,
high: 16.5,
low: 16.5,
close: 16.5,
volume: 0
},
{
date: 2022-08-08T09:33:00.000Z,
open: 16.5,
high: 16.5,
low: 16.5,
close: 16.5,
volume: 300000
},
{
date: 2022-08-08T09:34:00.000Z,
open: 16.5,
high: 16.5,
low: 16.5,
close: 16.5,
volume: 201500
},
{
date: 2022-08-08T09:35:00.000Z,
open: 16.5,
high: 16.5,
low: 16.5,
close: 16.5,
volume: 0
},
{
date: 2022-08-08T09:37:00.000Z,
open: 16.5,
high: 16.5,
low: 16.5,
close: 16.5,
volume: 0
},
{
date: 2022-08-08T09:38:00.000Z,
open: 16.5,
high: 16.5,
low: 16.5,
close: 16.5,
volume: 0
},
{
date: 2022-08-08T09:41:00.000Z,
open: 16.5,
high: 16.5,
low: 16.5,
close: 16.5,
volume: 71000
},
{
date: 2022-08-08T09:42:00.000Z,
open: 16.5,
high: 16.5,
low: 16.5,
close: 16.5,
volume: 0
},
{
date: 2022-08-08T09:48:00.000Z,
open: 16.5,
high: 16.5,
low: 16.5,
close: 16.5,
volume: 1050
},
{
date: 2022-08-08T09:58:00.000Z,
open: 16.5,
high: 16.5,
low: 16.5,
close: 16.5,
volume: 613
}
]

1. The dates are wrong
2. the volume is also wrong when i sum all is coming to 574163 but not 575163

Please help.
  • rakeshr
    1. The dates are wrong
    It's not an issue. In node js, Date objects by default are always zero UTC offset. This thread explains the solution.
    the volume is also wrong when i sum all is coming to 574163 but not 575163
    It won't match because of post-market trade available in the bhavcopy, i.e day candle.
This discussion has been closed.