Instruments json file expiry date

Hi , in instrument json file all the expiry date is wrong showing to me .

fileurl = ‘https://assets.upstox.com/market-quote/instruments/exchange/complete.json.gz
symboldf = pd.read_json(fileurl)
symboldf[‘expiry’] = pd.to_datetime(symboldf[‘expiry’])

using this code .

can any one guid me thatjson file is wrongly updated or I’m making any mistake.

sample output
|0|NSE_FO|NIFTY|NSE|01-01-1970|CE|NIFTY|NIFTY|NSE_FO|35346|25|1800|35346|25|5|INDEX|INDEX|NIFTY 30000 CE 30 DEC 27|30000|1||||NSE_INDEX|Nifty 50|NSE_INDEX|Nifty 50|||
|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|
|0|NSE_FO|NIFTY|NSE|01-01-1970|PE|NIFTY|NIFTY|NSE_FO|50970|25|1800|50970|25|5|INDEX|INDEX|NIFTY 27000 PE 26 JUN 25|27000|1||||NSE_INDEX|Nifty 50|NSE_INDEX|Nifty 50|||

Hi @Siltu_Ghosh

The expiries of instrument file are correct, please checkout the below code to get a list of all expires

import pandas as pd

# Load data
fileurl = 'https://assets.upstox.com/market-quote/instruments/exchange/complete.json.gz'
symboldf = pd.read_json(fileurl)

# Extract unique expiry dates
expiry_dates = symboldf['expiry'].unique()

# Convert from Unix timestamps to readable dates if needed
expiry_dates_readable = pd.to_datetime(expiry_dates, unit='ms')

expiry_dates_readable.tolist()

Hope this helps
Thank you.

1 Like