Getting LTP through kite 3 API

nknaveen328
I am trying to get the LTP, Quote and ohlc but it just returns the argument i am passing. This is the format i am passing. Please point it out if i am doing anything wrong.

quote = kite.ltp('NSE:INFY') and how do i pass multiple instruments ?
  • nknaveen328
    nknaveen328 edited January 2018
    @sujith refering to the question. the api responds with just the argument passed. This is the response i get 'NSE:INFY'
  • sujith
    You need to pass instruments like this,
    instruments = ["NSE:INFY", "BSE:INFY"]
  • nknaveen328
    tried them but the response is same.
  • rakeshr
    Hi @nknaveen328
    Working fine at our end.Can you post your code?
  • nknaveen328
    @rakeshr here it is

    instruments = ["NSE:INFY", "BSE:INFY"]
    quote = kite.ltp(instruments)
    return quote

    and the response i get is BSE:INFYNSE:INFY
  • Vivek
    Vivek edited January 2018
    I just tried with same symbols and it works
    kite.ltp(["NSE:INFY", "BSE:INFY"])
    DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade
    DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "GET /quote/ltp?i=NSE%3AINFY&i=BSE%3AINFY HTTP/1.1" 200 149
    {
    "BSE:INFY": {
    "instrument_token": 128053508,
    "last_price": 1143.75
    },
    "NSE:INFY": {
    "instrument_token": 408065,
    "last_price": 1144
    }
    }
    Please make sure you are using the latest release

    pip install kiteconnect --upgrade --pre
  • nknaveen328
    using the latest version. Still the issue exists. No idea why it isn't working. But orders, holding and other functions are working fine
  • sujith
    @nknaveen328,
    You can enable debugging and check the final URL sent with header details.
  • Dileep
    @sujith Hi..
    I am trying to fetch bid prices for an instrument by the below python code.
    data=kite.quote.get("NFO:NMDC19JULFUT").depth.buy.get(4).getPrice();
    some where my syntax is wrong. Can you please let me know the correct syntax to fetch depth of the buy price?
  • Imran
    hii @Dileep
    this worked for me
    kite.quote("NFO:NMDC19JULFUT")['NFO:NMDC19JULFUT']['depth']['buy'][4]['price']
  • ZI4453
    print('last_quantity=',dict_digger.dig(apiq,'data',inst_a1,'last_quantity',fail=True))
    please try dict_digger, works charming....
  • arulchellappa
    ltp =(kite.ltp('NSE:'+str(stock))).get('NSE:'+str(stock),{}).get('last_price')
  • disakar
    how to get only last price from this function
  • rakeshr
    You can use this API to get only LTP quote.
  • HeroOrZeroTrader
    HeroOrZeroTrader edited January 4
    How can I get LTP for ['NSE:NIFTY BANK']? It is giving empty. But working for ['NSE:INFY'].
  • dwk91
    Hi , can we use LTP quotes without the historical API?
Sign In or Register to comment.