Historical Data: Getting TokenException: Invalid API credentials

sauravkedia
Hi,

I am trying to fetch historical data using following commands:

kite2 = KiteConnect(api_key = api_key)
kite2.set_access_token('XXXXXXX')
kite2.orders()
kite2.historical(1348, "2017-03-01", "2017-03-15", "day")

The first API call to fetch orders is successful, But the second API calls fails with

TokenException: Invalid API credentials

Can you tell me how to fetch this data.


Full error message is:
----------------------
kite2.historical(1348, "2017-03-01", "2017-03-15", "day")
Traceback (most recent call last):

File "", line 1, in
kite2.historical(1348, "2017-03-01", "2017-03-15", "day")

File "D:\Filehistory Backup D\WinPython-64bit-3.5.2.2\python-3.5.2.amd64\lib\site-packages\kiteconnect\__init__.py", line 423, in historical
"interval": interval})

File "D:\Filehistory Backup D\WinPython-64bit-3.5.2.2\python-3.5.2.amd64\lib\site-packages\kiteconnect\__init__.py", line 463, in _get
return self._request(route, "GET", params)

File "D:\Filehistory Backup D\WinPython-64bit-3.5.2.2\python-3.5.2.amd64\lib\site-packages\kiteconnect\__init__.py", line 554, in _request
raise(exp(data["message"], code=r.status_code))

TokenException: Invalid API credentials
  • sujith
    Hi @skk,
    Historical data API is an add-on subscription with Kite Connect, it is not included in the base subscription. It looks like you don't have historical data subscription.
Sign In or Register to comment.