Fetch OI data for each candle/ tick

Is there a way to fetch the OI data for each candle, similar to the way we get volume in the response while calling get_intraday_data()?

Ideally, I would like to capture change in OI either for each candle or each tick(if within rate limit rules)

@Tradehull_Imran, would highly appreciate if you could respond :slight_smile:

Hi @cyberpunk_danny ,

You can use the Market Depth API to access real-time Open Interest (OI) data. - Market Quote - DhanHQ Ver 2.0 / API Document

Additionally, while making the API call for intraday data, ensure that the OI field is set to ‘true’ to receive the relevant information.

when i try to pass the OI field it gives an error “HistoricalData.intraday_minute_data() got an unexpected keyword argument ‘oi’”

@Tradehull_Imran

tsl = Tradehull(CLIENT_ID, ACCESS_TOKEN)

all_ltp_data = tsl.get_ltp_data(names = [ “ACC”, “CIPLA”])

acc_ltp = all_ltp_data[‘ACC’]

chart = tsl.get_historical_data(tradingsymbol = ‘NIFTY’, exchange = ‘INDEX’,timeframe=“DAY”)

print(chart)

error

Exception in Getting OHLC data as HistoricalData.historical_daily_data() got an unexpected keyword argument ‘oi’

update code base

@tanvez OPen Interest Data not retrieved using Talib indicator - #13 by Tradehull_Imran

chart = tsl.get_historical_data(tradingsymbol=‘ACC’,exchange=‘NSE’,timeframe=‘DAY’)

print(chart)
i am getting same error for equity also

@tanvez OI is available for FnO segment only.

Hi @tanvez ,

Make sure you are using latest versions, refer the below link on how to update to latest codebase -

If you are still facing issue, do run the below commands in cmd terminal and share screenshot-

where python
pip show dhanhq
pip show Dhan-Tradehull