Is depth updated as often as last_price in quote?

KesharDev
KesharDev edited June 2022 in General
I want to buy stocks during the first minute of market open. Prices change soo fast.

I want to know, if the last_price & market depth (bid-ask) are updated at the same exact time? (kite.quote(["NSE:RELIANCE"]))

Currently, I give the last_price to my algo as input. But I should be giving the first sell price (ask) in depth as input to my algo, if both are updated at same time and market depth is as reliable as last_price?
Tagged:
  • SRIJAN
    SRIJAN edited June 2022
    No, it's not necessary that last_price and market depth will update at same time.

    You need to know the concept of last_price and market depth to understand this.

    Last_price is the last traded price means this only changes when a trade takes place. Market depth is the current best bids/asks .

    For example:

    If traders see, that the counterparty is not willing to make a trade at their proposed price,they might modify their price. So,the market depth will change without a change in last_price.

    There are some other scenarios too, all of them can't be explained here.


    Although, for liquid instruments,like RELIANCE,fields like last_price and depth keep changing very frequently.

    Also,it looks like you are fetching quotes very frequently.
    It's not recommended,and you will miss the quote in realtime,as the quote APIs are near realtime.

    Websocket is recommended to stream realtime quotes.

    https://kite.trade/docs/connect/v3/websocket/
  • KesharDev
    KesharDev edited June 2022
    I don't understand why you are explaining the concept of last_price and depth to me. I understand them. At the exchange, last_price & market depth are updated thousands or millions of times every second, I think. I want to know, how often Kite updated them.

    Also, according to my tests, websocket is slower than kite quote in providing last_price. So I prefer kite quote. But I don't fetch quotes whole day. Just 10-20 calls a day. But when I fetch last_price, I need it to be as latest as possible.
  • SRIJAN
    SRIJAN edited June 2022
    I don't think you do, otherwise you wouldn't ask if ltp and depth update at same time.

    Anyways,
    Kite doesn't update anything in Websocket data. And the quote APIs use this websocket data.

    Websocket data comes from the exchange.
    Kite just relays whatever they get from the exchange without any modification.

    This data is basically a 1 second snapshot data.
    This is explained here:
    https://tradingqna.com/t/why-does-the-same-technical-charts-for-the-same-stock-from-nse-tame-google-finance-yahoo-finance-amibroker-not-match/1688/3

    Websocket is actually faster. All the quote calls are proxied to the websocket,as told above ,means they collect data from the websocket,then return that data . Plus,quote calls use HTTP ,whereas websocket uses Websocket Protocol,the latter is faster and even mentioned here:
    https://kite.trade/docs/connect/v3/websocket/#websocket-streaming
  • KesharDev
    KesharDev edited June 2022
    Last_price and market depth are probably updated thousands of time at the exchange. But Kite can't fetch all updates and send us. So it sends a tick every 0.5 second or so. So my question is, is the last_price and market depth updated at every tick kite sends us?

    For example: 20 level orderbook market depth is updated very slow. Is the case with 5 level orderbook market depth same?

    I will test the websocket and kite quote speed again. Thanks
  • SRIJAN
    SRIJAN edited June 2022
    You still don't get it.

    A tick is sent whenever there is a change in any of the fields in the mode subscribed by you. If none of the fields change ,you don't get any tick.

    So,even if just market depth changes but not the other fields,still a tick will be sent by the exchange to Kite ,and the same tick will be relayed to you by KiteConnect .

    So,NO, its not necessary that both last_price and market depth will be updated in the latest tick compared to the previous tick.
    It's even possible that none of them change.
  • KesharDev
    KesharDev edited June 2022
    Hmm thanks.

    Can someone from Kite team please tell me, so I can be sure @rakeshr sir. Thanks a lot.
Sign In or Register to comment.