Error with get_quote

razcads
Hi
Not sure what I am doing wrong
My script is further below.
On execution kite.quote is giving me below error. However if I comment out kite.quote; the print kite.positions() goes through fine and lists all my positions. Earlier in the day though the same kite.quote gave me proper results. Is there some issue with "quote" api now?
Traceback (most recent call last):
File "openko_functions.py", line 28, in <module>
print kite.quote("NSE","RELIANCE")
File "C:\Program Files (x86)\Python27\lib\site-packages\kiteconnect\__init__.py", line 501, in quote
return self._get("market.quote", {"exchange": exchange, "tradingsymbol": tradingsymbol})
File "C:\Program Files (x86)\Python27\lib\site-packages\kiteconnect\__init__.py", line 577, in _get
return self._request(route, "GET", params)
File "C:\Program Files (x86)\Python27\lib\site-packages\kiteconnect\__init__.py", line 668, in _request
raise(exp(data["message"], code=r.status_code))
kiteconnect.exceptions.TokenException: Invalid token
-----

#!python
from kiteconnect import KiteConnect
import raz_tokens

# Initialise.
my_api_key = raz_tokens.api_key
my_access_token = raz_tokens.access_token

kite = KiteConnect(api_key = my_api_key, access_token = my_access_token)
kite.set_access_token(my_access_token)

rel_quote = kite.quote("NSE","RELIANCE")
print rel_quote
print kite.positions()
------




  • razcads
    Hi
    Do update if there is a problem with the quote api for python client. I read another discussion where get_quote was causing a problem since 26th Sep. Not sure if these two are related. Do update.
    Thanks
    Ravi
  • razcads
    Hi
    Can you update here? Is this still now resolved - quote api in python
  • sujith
    Hi @razcads,
    I think you need to create a new session when it happens.
    Quote and positions are from the source.
    Don't use PI or NEST for monitoring, use Kite for monitoring purpose. If you log out from any platform then also this can happen.
  • razcads
    Great find. Yes it works if I don't keep PI open for monitoring.
  • razcads
    you can close the ticket. Thanks!
This discussion has been closed.