Websocket subscription changed to quote from full

prateek3211
Hi team,

I am using websocket to get real time data for multiple symbols. the subscription is full mode.
After sometime the mode is changed to quote on its own even thought I have made no change in subscription mode type.

2019-12-23T07:22:48.818727000Z INFO:root:{'tradable': True, 'mode': 'quote', 'instrument_token': 9174786, 'last_price': 1.9, 'last_quantity': 20, 'average_price': 2.18, 'volume': 6880, 'buy_quantity': 15640, 'sell_quantity': 13500, 'ohlc': {'open': 3.25, 'high': 3.25, 'low': 1.75, 'close': 2.4}, 'change': -20.833333333333336}

2019-12-23T06:25:52.742911000Z INFO:root:{'tradable': True, 'mode': 'full', 'instrument_token': 9174786, 'last_price': 2.1, 'last_quantity': 40, 'average_price': 2.25, 'volume': 5360, 'buy_quantity': 16180, 'sell_quantity': 12940, 'ohlc': {'open': 3.25, 'high': 3.25, 'low': 1.85, 'close': 2.4}, 'change': -12.499999999999993, 'last_trade_time': datetime.datetime(2019, 12, 23, 6, 17, 59), 'oi': 14460, 'oi_day_high': 14540, 'oi_day_low': 10600, 'timestamp': datetime.datetime(2019, 12, 23, 6, 18), 'depth': {'buy': [{'quantity': 380, 'price': 1.95, 'orders': 3}, {'quantity': 1020, 'price': 1.9, 'orders': 2}, {'quantity': 440, 'price': 1.75, 'orders': 2}, {'quantity': 520, 'price': 1.7, 'orders': 1}, {'quantity': 600, 'price': 1.65, 'orders': 1}], 'sell': [{'quantity': 60, 'price': 2.1, 'orders': 1}, {'quantity': 1180, 'price': 2.15, 'orders': 2}, {'quantity': 2000, 'price': 2.2, 'orders': 1}, {'quantity': 2000, 'price': 2.3, 'orders': 1}, {'quantity': 980, 'price': 2.5, 'orders': 1}]}}
  • prateek3211
    PFB the exact token for which failure is present.
    After some exception as logged below the subscription changed to quote from full mode.



    2019-12-23T11:01:30.610237000Z INFO:root:{'tradable': True, 'mode': 'full', 'instrument_token': 10224898, 'last_price': 610.35, 'last_quantity': 20, 'average_price': 607.64, 'volume': 3380, 'buy_quantity': 4640, 'sell_quantity': 3280, 'ohlc': {'open': 678.95, 'high': 679.0, 'low': 563.2, 'close': 600.25}, 'change': 1.6826322365681003, 'last_trade_time': datetime.datetime(2019, 12, 23, 9, 52, 17), 'oi': 1200, 'oi_day_high': 2140, 'oi_day_low': 1160, 'timestamp': datetime.datetime(2019, 12, 23, 10, 49, 41), 'depth': {'buy': [{'quantity': 40, 'price': 600.5, 'orders': 1}, {'quantity': 80, 'price': 600.0, 'orders': 1}, {'quantity': 20, 'price': 572.2, 'orders': 1}, {'quantity': 200, 'price': 556.85, 'orders': 1}, {'quantity': 200, 'price': 555.85, 'orders': 1}], 'sell': [{'quantity': 20, 'price': 613.5, 'orders': 1}, {'quantity': 20, 'price': 622.0, 'orders': 1}, {'quantity': 20, 'price': 630.05, 'orders': 1}, {'quantity': 200, 'price': 638.1, 'orders': 1}, {'quantity': 200, 'price': 639.1, 'orders': 1}]}}
    2019-12-23T11:01:54.220896000Z ERROR:kiteconnect.ticker:Connection error: 0 - Message too big. Connection will be closed.
    2019-12-23T11:01:54.221120000Z ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
    2019-12-23T11:01:54.221315000Z ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
    2019-12-23T11:01:54.700691000Z INFO:root:instrument tokens populated for NIFTY with size 384
    2019-12-23T11:01:54.700914000Z ERROR:kiteconnect.ticker:Connection error: 0 - Message too big. Connection will be closed.
    2019-12-23T11:01:54.701115000Z ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
    2019-12-23T11:01:54.701309000Z ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)



    2019-12-23T11:01:56.020208000Z ERROR:kiteconnect.ticker:Connection error: 0 - Message too big. Connection will be closed.
    2019-12-23T11:01:56.020445000Z ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
    2019-12-23T11:01:56.020627000Z ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)



    2019-12-23T11:01:56.434035000Z ERROR:kiteconnect.ticker:Connection error: 0 - Message too big. Connection will be closed.
    2019-12-23T11:01:56.444185000Z ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
    2019-12-23T11:01:56.444400000Z ERROR:kiteconnect.ticker:Connection closed: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)



    2019-12-23T11:01:56.848323000Z INFO:root:{'tradable': True, 'mode': 'quote', 'instrument_token': 10224898, 'last_price': 610.35, 'last_quantity': 20, 'average_price': 607.64, 'volume': 3380, 'buy_quantity': 4640, 'sell_quantity': 3280, 'ohlc': {'open': 678.95, 'high': 679.0, 'low': 563.2, 'close': 600.25}, 'change': 1.6826322365681003}


    2019-12-23T11:01:57.712710000Z INFO:root:{'tradable': True, 'mode': 'quote', 'instrument_token': 10224898, 'last_price': 610.35, 'last_quantity': 20, 'average_price': 607.64, 'volume': 3380, 'buy_quantity': 4640, 'sell_quantity': 3280, 'ohlc': {'open': 678.95, 'high': 679.0, 'low': 563.2, 'close': 600.25}, 'change': 1.6826322365681003}

  • prateek3211
    @sujith can u pls help here.
    Facing this issue today as well.
    Why is the subscription mode downgraded.

    I have even added code as below to update it on every tick:

    ws.set_mode(ws.MODE_FULL, OptionsWebsocketHandler.subscription_list)
  • rakeshr
    @prateek3211
    After sometime the mode is changed to quote on its own even thought I have made no change in subscription mode type.
    We checked at our end for same instrument(10224898).Full subscription mode remains through-out.
    2019-12-23T11:01:54.220896000Z ERROR:kiteconnect.ticker:Connection error: 0 - Message too big. Connection will be closed.
    For above error, are you inserting any logging statment inside on_connect or on_tick method?
  • prateek3211
    prateek3211 edited January 2020
    Hi @rakeshr / @sujith

    logs are added to check the size of tick & it worked fine.


    Today I have removed the logs but what I am still seeing only quote data.
    NIFTY - 20JAN30 - 12200PE

    "12200": {
    "tradable": true,
    "mode": "quote",
    "instrument_token": 12396802,
    "last_price": 125.95,
    "last_quantity": 150,
    "average_price": 123.72,
    "volume": 548100,
    "buy_quantity": 95100,
    "sell_quantity": 80475,
    "ohlc": {
    "open": 124.95,
    "high": 131.85,
    "low": 116.75,
    "close": 130.25
    },
    "change": -3.3013435700575795
    }

  • prateek3211
    prateek3211 edited January 2020
    @rakeshr
    As in the response u can see the mode is quote, whereas I have only subscribed to full mode
  • prateek3211
    getting below errors today.
    this is coming from zerodha package 'kiteconnect.ticker'

    Inside the method 'def on_ticks(ws, tick)' I have currently added nothing & left it blank as I was getting these error very frequently.

    Below are 2 types of error, can u suggest what needs to be done as these error logs are flooding the logs and meaningful logs are getting lost


    2020-01-01T05:41:58.924725000Z ERROR:kiteconnect.ticker:Connection error: 0 - Message too big. Connection will be closed.
    2020-01-01T05:41:58.947352000Z ERROR:kiteconnect.ticker:Connection error: 0 - Message too big. Connection will be closed.
    2020-01-01T05:41:58.947571000Z ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (WebSocket opening handshake timeout (peer did not finish the opening handshake in time))



    2020-01-01T05:50:00.018213000Z ERROR:kiteconnect.ticker:Connection error: 0 - Message too big. Connection will be closed.
    2020-01-01T05:50:00.018403000Z ERROR:kiteconnect.ticker:Connection error: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
  • rakeshr
    @prateek3211
    Please paste complete WebSocket code, so that we can reproduce the same at our end.
  • sagaranilganu
    @prateek3211
    I am developing code in python and need help!!!
    1] By what method you are checking the size of "ticks" received on websockets ? (Especially imp when you have more than 1 full mode subscriptions & response tick is received only when there is any change in script LTP)
    2] Has this "auto abrupt mode change" problem resolved? If so how?
    3] Also if heart beats (of 1 byte fixed length) are received, is it having any fixed value???
  • pkv1010
    Can anyone post a full beginner code to stream any scrip
Sign In or Register to comment.