It looks like you're new here. If you want to get involved, click one of these buttons!
Node JS client
.Net API client
.Net / VBA / Excel (3rd party)
Algorithms and Strategies
Mobile and Desktop apps
Market data (WebSockets)
In this Discussion
Invalid Api Credentials
I have Kite Connect app and also subscribed for historical data to access this API. But still I am getting an error as " TokenException: Invalid API credentials". and also the following are shown as errors.
TokenException Traceback (most recent call last)
---> 94 start()
90 def start():
---> 91 records = get_historical_data()
21 # Gets historical data from Kite Connect
22 def get_historical_data():
---> 23 return kite.historical(instrument_token, from_date, to_date, interval)
~\Anaconda3\lib\site-packages\kiteconnect\__init__.py in historical(self, instrument_token, from_date, to_date, interval, continuous)
536 "to": to_date,
537 "interval": interval,
--> 538 "continuous": 1 if continuous else 0})
540 records = 
~\Anaconda3\lib\site-packages\kiteconnect\__init__.py in _get(self, route, params)
591 def _get(self, route, params=None):
592 """Alias for sending a GET request."""
--> 593 return self._request(route, "GET", params)
595 def _post(self, route, params=None):
~\Anaconda3\lib\site-packages\kiteconnect\__init__.py in _request(self, route, method, parameters)
683 elif exp:
--> 684 raise(exp(data["message"], code=r.status_code))
686 raise(ex.GeneralException(data["message"], code=r.status_code))
TokenException: Invalid API credentials
@invalid API credentials
Can anybody help me to solve the problem. I am using jupiter notebook and spyder to run this code. I have bought kiteconnect and historical api subscribed. But still I am getting this error.
Can you let us know more details?
When you logged into App? Are you using Pi or NEST for monitoring?
What about other API calls, is it working?
If you could let us know what you are doing after generating an access token, it would be helpful.
Thanks for your response.
I am surprised to know about pi and nest for monitoring. I am not aware of using pi or nest! I just tried backtesting in ipython notebook. Because, when I tried simple buy order it worked well. But streaming SMA is giving a problem as invalid API credentials.
I believe I am in the right direction to your question.
If not please correct me.
i guess the reason
asked about PI is because the Token is invalidated when you login to PI.
More information is needed here as to where are you storing you Token and how are you passing it to your code.
Without which its really difficult to tell what the issue may be.
Dear Prat and Sujit
Thanks to both of you for giving me the solution.
This discussion has been closed.