Historical data not fetched

Jitu1990
Hello friends, I am trying to fetch historical data programatically and even with curl command but program is returning 0 data and curl command is failing with invalid token exception. I have subscribed for historical data and the token I am using is perfectly working for login and other requests. Can someone plz help me here. Thanks in advance.

Program:
void getKiteHistoricalData()
{
std::vector data =
Kite.getHistoricalData(kc::historicalDataParams().InstrumentToken(8963586).From("2023-05-28 9:30:00").To("2023-05-28 10:30:00").Interval("minute"));
for (const auto& i : data) {
std::cout << "datetime: " << i.datetime << " close: " << i.close << "\n";
};
}

//Here i dont get any exception but returned number of data is 0

Curl cmd:
curl "https://api.kite.trade/instruments/historical/8963586/minute?from=2023-05-29+09:15:00&to=2023-05-29+09:20:00"
-H "X-Kite-Version: 3" \
-H "Authorization: token *********mu:***************************bqaUoN"

//Here I get below error
{"status":"error","message":"Invalid `api_key` or `access_token`.","data":null,"error_type":"InputException"}-H: command not found
  • sujith
    You will have to re-login and create a new access token after subscribing for historical data API.
Sign In or Register to comment.