getHistoricalData gets error "invalid from date"

sanjayssk
I tried many things including the following hard coded from and to parameters. But in all cases, I'm getting "invalid from date".

const NIFTY_TOKEN = 256265; // NIFTY index token
const INTERVAL = "minute"; // 1m interval
const TIMEZONE = "Asia/Kolkata";

(async () => {
const from = `2025-05-08 09:15:00`;
const to = `2025-05-08 15:30:00`;

try {
const candles = await kc.getHistoricalData(NIFTY_TOKEN, from, to, INTERVAL, false);
.....
catch (err) {
console.error("❌ Failed to fetch historical data:", err.message);
}

I'm using it today and specifying yesterday's date.
Other APIs that I tried are working fine. What is wrong in my usage?

Thanks
  • sanjayssk
    Oops. My bad. The sequence of parameters was coded wrong in a hurry. Fixed. Working.
This discussion has been closed.