Market Depth Data coming as {'buy': [], 'sell': []}

naz
naz edited April 2017 in Market data (WebSockets)
I am not receiving market depth data as on 2:58 pm today for many symbols. Is there a server side issue.
  • naz
    @sujith :
    Hi sujith,
    Any update on this as I could actually see market depth data on kite.zerodha.com but market depth coming on websocket was empty lists of 'buy' and 'sell'.
  • sujith
    @naz,
    It is working fine. Kite web uses same websockets API, So it is highly unlikely that this is happening.
  • naz
    @sujith

    below is the dump of tick data (i included the current timestamp in my program at my end). Can share multiple files like this where you can see depth data as empty lists of buy and sell (let me know if required).
    Also, if there are 0 buy/sell quantity, order, price then tick data normally shows 0 filled up in the value field of all key, value pair of python dictionary of depth (of price, quantity, order) and NOT an empty list []. So I would assume that it is a genuine issue.

    Please advise.

    timestamp average_price buy_quantity change depth instrument_token last_price last_quantity mode ohlc sell_quantity tradeable volume
    4/19/2017 14:52:03 80.93 12274 -0.796080833 {'buy': [], 'sell': []} 128061444 81 1000 quote {'open': 80.05, 'high': 82.0, 'low': 80.0, 'close': 81.65} 5532 TRUE 7540
    4/19/2017 14:52:03 311.71 1442 3.140495868 {'buy': [], 'sell': []} 137985540 312 75 quote {'open': 303.0, 'high': 312.0, 'low': 303.0, 'close': 302.5} 500 TRUE 80
    4/19/2017 14:52:03 133 6100 -2.21402214 {'buy': [], 'sell': []} 131448836 132.5 100 quote {'open': 139.0, 'high': 139.0, 'low': 132.5, 'close': 135.5} 2834 TRUE 29280
    4/19/2017 14:52:03 212.25 816 -1.286248831 {'buy': [], 'sell': []} 134043140 211.05 10 quote {'open': 215.0, 'high': 215.0, 'low': 211.05, 'close': 213.8} 404 TRUE 1570
    4/19/2017 14:52:03 113.61 2742 2.180685358 {'buy': [], 'sell': []} 134346244 114.8 150 quote {'open': 107.0, 'high': 114.8, 'low': 107.0, 'close': 112.35} 0 TRUE 2640
    4/19/2017 14:52:03 303.17 1765 -2.031930334 {'buy': [], 'sell': []} 134231556 303.75 70 quote {'open': 308.0, 'high': 308.0, 'low': 302.5, 'close': 310.05} 828 TRUE 1736
    4/19/2017 14:52:03 132.69 19922 1.908396947 {'buy': [], 'sell': []} 130174468 133.5 79 quote {'open': 131.8, 'high': 133.95, 'low': 131.0, 'close': 131.0} 3259 TRUE 658
    4/19/2017 14:52:03 525.92 1013 -0.980761977 {'buy': [], 'sell': []} 137342212 525 145 quote {'open': 525.0, 'high': 530.0, 'low': 525.0, 'close': 530.2} 1514 TRUE 417
    4/19/2017 14:52:03 153.08 1169 -1.481004507 {'buy': [], 'sell': []} 134051332 153 1 quote {'open': 152.25, 'high': 156.5, 'low': 152.25, 'close': 155.3} 2041 TRUE 1112
    4/19/2017 14:52:03 193.47 2413 1.854270044 {'buy': [], 'sell': []} 133400836 195 4 quote {'open': 191.0, 'high': 197.5, 'low': 188.0, 'close': 191.45} 6382 TRUE 4905
    4/19/2017 14:52:03 60.5 17958 -0.329218107 {'buy': [], 'sell': []} 134874372 60.55 500 quote {'open': 60.5, 'high': 61.25, 'low': 60.0, 'close': 60.75} 34599 TRUE 14993
    4/19/2017 14:52:03 14332.33 2 -1.979827653 {'buy': [], 'sell': []} 129957124 14281 3 quote {'open': 14855.0, 'high': 14855.0, 'low': 14278.1, 'close': 14569.45} 22 TRUE 95
    4/19/2017 14:52:03 28.37 7436 -0.856164384 {'buy': [], 'sell': []} 134257668 28.95 46 quote {'open': 29.0, 'high': 31.3, 'low': 28.0, 'close': 29.2} 14273 TRUE 20548
    4/19/2017 14:52:03 23.59 35544 -3.285420945 {'buy': [], 'sell': []} 134339588 23.55 100 quote {'open': 25.45, 'high': 25.45, 'low': 23.0, 'close': 24.35} 48227 TRUE 114837
    4/19/2017 14:52:03 43.06 45094 -1.506373117 {'buy': [], 'sell': []} 129371652 42.5 250 quote {'open': 43.4, 'high': 43.9, 'low': 42.5, 'close': 43.15} 32434 TRUE 24367
    4/19/2017 14:52:03 1307.44 67 -1.426415094 {'buy': [], 'sell': []} 130416132 1306.1 1 quote {'open': 1313.05, 'high': 1313.05, 'low': 1306.1, 'close': 1325.0} 227 TRUE 375
    4/19/2017 14:52:03 147.46 1650 1.235415237 {'buy': [], 'sell': []} 138034180 147.5 3 quote {'open': 149.0, 'high': 151.45, 'low': 144.0, 'close': 145.7} 7865 TRUE 11926
    4/19/2017 14:52:03 28.1 8256 -1.050788091 {'buy': [], 'sell': []} 128054020 28.25 6 quote {'open': 29.0, 'high': 29.0, 'low': 27.8, 'close': 28.55} 13598 TRUE 14628
    4/19/2017 14:52:03 59.94 902 2.564102564 {'buy': [], 'sell': []} 129903364 60 195 quote {'open': 59.85, 'high': 60.95, 'low': 59.5, 'close': 58.5} 1313 TRUE 935
    4/19/2017 14:52:03 139.37 1322 0.292718624 {'buy': [], 'sell': []} 132463876 137.05 50 quote {'open': 136.05, 'high': 142.9, 'low': 136.05, 'close': 136.65} 180 TRUE 861
    4/19/2017 14:52:03 10.14 34274 -1.941747573 {'buy': [], 'sell': []} 135758084 10.1 300 quote {'open': 10.08, 'high': 10.29, 'low': 10.08, 'close': 10.3} 41997 TRUE 4550
    4/19/2017 14:52:03 65.31 9482 0.934579439 {'buy': [], 'sell': []} 132919300 64.8 50 quote {'open': 70.0, 'high': 70.0, 'low': 64.0, 'close': 64.2} 18103 TRUE 12744
    4/19/2017 14:52:03 36.38 12785 -1.040118871 {'buy': [], 'sell': []} 130832900 33.3 11 quote {'open': 37.5, 'high': 37.5, 'low': 33.3, 'close': 33.65} 11540 TRUE 5355
    4/19/2017 14:52:04 22.2 11531 2.564102564 {'buy': [{'quantity': 600, 'price': 22.0, 'orders': 1}, {'quantity': 4, 'price': 21.8, 'orders': 2}, {'quantity': 1, 'price': 21.75, 'orders': 1}, {'quantity': 50, 'price': 21.7, 'orders': 1}, {'quantity': 1, 'price': 21.65, 'orders': 1}], 'sell': [{'quantity': 25, 'price': 22.15, 'orders': 1}, {'quantity': 451, 'price': 22.2, 'orders': 1}, {'quantity': 3650, 'price': 22.25, 'orders': 2}, {'quantity': 500, 'price': 22.45, 'orders': 1}, {'quantity': 525, 'price': 22.5, 'orders': 2}]} 131116804 22 400 quote {'open': 22.7, 'high': 22.7, 'low': 21.7, 'close': 21.45} 24290 TRUE 12299
    4/19/2017 14:52:04 26.63 49168 -0.374531835 {'buy': [{'quantity': 154, 'price': 26.6, 'orders': 1}, {'quantity': 650, 'price': 26.55, 'orders': 1}, {'quantity': 100, 'price': 26.4, 'orders': 1}, {'quantity': 200, 'price': 26.35, 'orders': 1}, {'quantity': 2000, 'price': 26.3, 'orders': 1}], 'sell': [{'quantity': 800, 'price': 26.65, 'orders': 2}, {'quantity': 317, 'price': 26.85, 'orders': 1}, {'quantity': 850, 'price': 26.95, 'orders': 2}, {'quantity': 11, 'price': 27.0, 'orders': 2}, {'quantity': 500, 'price': 27.05, 'orders': 1}]} 134313732 26.6 500 quote {'open': 26.5, 'high': 27.2, 'low': 26.25, 'close': 26.7} 81797 TRUE 32169
  • sujith
    @naz,
    Can you print mode also and paste log?
  • naz
    @sujith :
    1) as you can see in the above dump, it is showing mode as "quote" (in python client this is an error where "full" mode is also shown as "quote" mode in the received tick data). Please check below link where I reported it earlier:
    https://kite.trade/forum/discussion/1498/python-websoket-client-full-mode-working-but-showing-quote-value-for-mode-key-in-returned-dict#latest

    But in the dump above, you can see (towards the end), incoming tick data was giving correct and full market depth data so issue was probably not the quote or full mode.


    2) I logged the incoming data into a .csv file instead of a log file (portion of .csv file pasted above). Is there anything specific that you are looking for, I can try logging that into a log file today and see if I can reproduce the same error. Please let me know.


  • sujith
    @naz,
    Can you try this code.
  • sujith
    Is this issue intermittent?
  • naz
    @sujith :
    yes, this issue is intermittent and comes randomly in between for some of the stocks. And that's the reason I believe running the above code (for two stocks) might not reproduce the error. Will take a complete log and revert on this.
  • sujith
    @naz,
    All the above scrips seems to be BSE, are you subscribing only for BSE?
  • naz
    @sujith

    I am subscribing for some scrips of BSE on one socket and some scrips of NSE on another socket. But for BSE scrips also, most of the time market depth data comes correctly. It is only intermittently that I am facing this issue.
Sign In or Register to comment.