kite.ltp returning null for banknifty options

SNRaj
SNRaj edited January 29 in Python client
Hi All,

I am encountering issue while getting last trade price using kite.ltp function for banknifty options. The function was working properly until last week. Please let me know if there is any change in the format or any mistake in my code.

Sample Code: kite.ltp(NFO:BANKNIFTY24JAN45900CE)
return ltp[NFO:BANKNIFTY24JAN45900CE]['last_price']

Error: KeyError: 'NFO:BANKNIFTY24JAN45900CE'
  • sujith
    Can you enable debug logs for pykiteconnect and share the complete stack trace? We want to see the request and response json.
  • SNRaj
    SNRaj edited January 29
    It just returns an empty response when i pass this command - kite.ltp(NFO:BANKNIFTY24JAN45900CE).

    DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
    DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /quote/ohlc?i=NSE%3ANIFTY+BANK HTTP/1.1" 200 None
    DEBUG:root:Getting last price for NFO:BANKNIFTY24JAN45900CE
    DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
    DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /quote/ltp?i=NFO%3ABANKNIFTY24JAN45900CE HTTP/1.1" 200 30
    {}
    WARNING:root:Instrument NFO:BANKNIFTY24JAN45900CE not found in ltp response.
  • SNRaj
    @sujith - Please let me know why empty response is received for my request? is there any issue in fetching banknifty instrument last trade price?
  • SNRaj
    Attaching screenshot for your reference. I am able to fetch LTP for stocks however i am unable to fetch for options
  • rakeshr
    NFO:BANKNIFTY24JAN45900CE
    This is an January NFO contract, and was expired on 2024-01-25. So, it's returning an empty slice. You can check the full instrument list for the current-day trading symbol.
Sign In or Register to comment.