Not getting OI data in ticker

allang
Hi

I am using kite ticker(python). I am getting all the data except oi data. I have set the mode to full quote.
  • sujith
    Can you paste your code and response data here?
  • allang
    Here it is
    # Callback for tick reception.
    def on_ticks(ws, ticks):
    if len(ticks) > 0:
    insert_ticks.delay(ticks)
    # logging.info("Current mode: {}".format(ticks["mode"]))


    # Callback for successful connection.
    def on_connect(ws, response):
    logging.info("Successfully connected. Response: {}".format(response))
    ws.subscribe(tokens)
    ws.set_mode(ws.MODE_FULL, tokens)
    logging.info("Subscribe to tokens in Full mode: {}".format(tokens))


    # Callback when current connection is closed.
    def on_close(ws, code, reason):
    logging.info("Connection closed: {code} - {reason}".format(code=code, reason=reason))


    # Callback when connection closed with error.
    def on_error(ws, code, reason):
    logging.info("Connection error: {code} - {reason}".format(code=code, reason=reason))


    # Callback when reconnect is on progress
    def on_reconnect(ws, attempts_count):
    logging.info("Reconnecting: {}".format(attempts_count))


    # Callback when all reconnect failed (exhausted max retries)
    def on_noreconnect(ws):
    logging.info("Reconnect failed.")


    # Assign the callbacks.
    kws.on_ticks = on_ticks
    kws.on_close = on_close
    kws.on_error = on_error
    kws.on_connect = on_connect
    kws.on_reconnect = on_reconnect
    kws.on_noreconnect = on_noreconnect

    # Infinite loop on the main thread. Nothing after this will run.
    # You have to use the pre-defined callbacks to manage subscriptions.
    kws.connect(threaded=True)

    # Block main thread
    logging.info("This is main thread. Will change webosocket mode every 5 seconds.")

    while True:
    time.sleep(5)
  • allang
    Response:
    ([{'tradable': True, 'mode': 'full', 'instrument_token': 7455745, 'last_price': 44.75, 'last_quantity': 444, 'average_price': 46.59, 'volume': 16372314, 'buy_quantity': 1038200, 'sell_quantity': 1551455, 'ohlc': {...}, 'change': -2.717391304347826, 'last_trade_time': datetime.datetime(2019, 6, 19, 11, 33, 43), 'oi': 0, 'oi_day_high': 0, 'oi_day_low': 0, 'timestamp': datetime.datetime(2019, 6, 19, 11, 33, 45), 'depth': {...}}, {'tradable': True, 'mode': 'full', 'instrument_token': 3906305, 'last_price': 4.0, 'last_quantity': 510, 'average_price': 4.2, 'volume': 48871073, 'buy_quantity': 3982127, 'sell_quantity': 8297692, 'ohlc': {...}, 'change': -12.087912087912086, 'last_trade_time': datetime.datetime(2019, 6, 19, 11, 33, 43), 'oi': 0, 'oi_day_high': 0, 'oi_day_low': 0, 'timestamp': datetime.datetime(2019, 6, 19, 11, 33, 45), 'depth': {...}}, {'tradable': True, 'mode': 'full', 'instrument_token': 2661633, 'last_price': 21.35, 'last_quantity': 1302, 'average_price': 23.08, 'volume': 66470978, 'buy_quantity': 2..., ...}],)
  • rakeshr
    @allang
    Open Interest is available only for F&O, but as per above response instrument_token(7455745,3906305,2661633) all are Nse EQ instruments.
  • sujith
    You can know more here.
Sign In or Register to comment.