I am trying to get open interest data from tick in websocket client for NIFTY option (Example : NIFTY21N1818100CE). I am getting zero when I use tick.getOi(). It is tried when market is open. Is there any API which gives total number of OIs in CALL/PUT side.
There is no such api as tick.getOI(). To get oi,either use quote api and extract oi from it. Or,you can use websocket, subscribe to your desired instrument(s) and extract oi from the incoming ticks. Example:-
def on_ticks(ws.ticks):
for tick in ticks:
print(tick['oi'])
def on_ticks(ws.ticks):
for tick in ticks:
print(tick['oi'])