Possible data missing for 26th June 2025 from NSE.csv?

Hi team,

In today’s NSE.csv I fail to locate options for 26th June 2025.
I see for the trading_symbol NIFTY 27000 PE 26 JUN 25, the expiry timestamp is 1750962599000
which converts into 25-07-2025, 25th of JULY !
I then checked what the timestamp would actually be for the 26th of June Thursday. It came out to be 1750895400000. This stamp does not exist in today’s NSE.csv

Please check and advise if we should rely on the expiry field

Hi @RISHIKUL_29593713
I can see the option contracts for the 26th June expiry in the NSE.csv file. However, there are no expiry timestamps available in the CSV. Could you please clarify where you are getting the expiry timestamp from

Please note that CSV files will soon be deprecated. We recommend using the JSON file instead. For more information, please refer to this link: Instruments | Upstox Developer API

Thanks!

Hi @Ketan_Gupta , sorry for the confusion. let me clarify the workflow i’ve written-

  1. I download the .json file from https://assets.upstox.com/market-quote/instruments/exchange/NSE.json.gz. This gives me NSE.json
  2. I then load this NSE.json into a dataframe and then spit it back out as a NSE.csv. This is not the .csv which might have existed with upstox but instead a transposition of the .json to .csv

so now we have this cleared, step3 is
3. The NSE.json has a field called expiry, sample here-

{“weekly”:true,“segment”:“NSE_FO”,“name”:“NIFTY”,“exchange”:“NSE”,“expiry”:1750357799000,“instrument_type”:“CE”,“asset_symbol”:“NIFTY”,“underlying_symbol”:“NIFTY”,“instrument_key”:“NSE_FO|50917”,“lot_size”:75,“freeze_quantity”:1800.0,“exchange_token”:“50917”,“minimum_lot”:75,“asset_key”:“NSE_INDEX|Nifty 50”,“underlying_key”:“NSE_INDEX|Nifty 50”,“tick_size”:5.0,“asset_type”:“INDEX”,“underlying_type”:“INDEX”,“trading_symbol”:“NIFTY 23550 CE 19 JUN 25”,“strike_price”:23550.0,“qty_multiplier”:1.0},

  1. next step is to then sort on expiry. Here i expected to find 1750895400000 which would effectively convert into 26th June which does not exist.

What going on is that the instrument is there for the 26th June but its mapped against the expiry of 1750962599000, this number converts into 25th July

Please clarify for me if I’m accessing the correct link for the .json file ?
I can find the expiry field in the .json, can you confirm the same as well ?
Can you then check for mapping of expiry time to the instrument ?

here is the same instrument as you were considering from the .json file

{“weekly”:false,“segment”:“NSE_FO”,“name”:“NIFTY”,“exchange”:“NSE”,“expiry”:1750962599000,“instrument_type”:“PE”,“asset_symbol”:“NIFTY”,“underlying_symbol”:“NIFTY”,“instrument_key”:“NSE_FO|50970”,“lot_size”:75,“freeze_quantity”:1800.0,“exchange_token”:“50970”,“minimum_lot”:75,“asset_key”:“NSE_INDEX|Nifty 50”,“underlying_key”:“NSE_INDEX|Nifty 50”,“tick_size”:5.0,“asset_type”:“INDEX”,“underlying_type”:“INDEX”,“trading_symbol”:“NIFTY 27000 PE 26 JUN 25”,“strike_price”:27000.0,“qty_multiplier”:1.0}

Hi Team, @Ketan ,
Today again, the NSE.json has no reference of the 26th July expiry under the ‘Expiry’ header.
Am I missing something here ?
Should I completely avoid using the ‘Expiry’ header ? Please advise

In example you have given

    {
        "weekly": false,
        "segment": "NSE_FO",
        "name": "NIFTY",
        "exchange": "NSE",
        "expiry": 1750962599000,
        "instrument_type": "PE",
        "asset_symbol": "NIFTY",
        "underlying_symbol": "NIFTY",
        "instrument_key": "NSE_FO|50970",
        "lot_size": 75,
        "freeze_quantity": 1800.0,
        "exchange_token": "50970",
        "minimum_lot": 75,
        "asset_key": "NSE_INDEX|Nifty 50",
        "underlying_key": "NSE_INDEX|Nifty 50",
        "tick_size": 5.0,
        "asset_type": "INDEX",
        "underlying_type": "INDEX",
        "trading_symbol": "NIFTY 27000 PE 26 JUN 25",
        "strike_price": 27000.0,
        "qty_multiplier": 1.0
    }

the expiry is 1750962599000 which refers to Thursday, 26 June 2025 23:59:59 GMT+05:30, you can use https://www.epochconverter.com/ website to get time from epoch.

I did not get this, how is 1750962599000 mapped to 25th July, from where are you getting this mapping??

1 Like

@Ketan , I found the problem and it is something very trivial, its TIMEZONE !
I did not account for Koltaka timezone
I was converting epoch directly into human readable timestamp with -
df[‘expiry_date’] = pd.to_datetime(df[‘expiry’], unit=‘ms’).dt.strftime(‘%d-%m-%Y’), which defaults to UTC±0

Quite silly of me, I did not in match it against the timezone
I ended up adjusting for timezone with -
datetime.fromtimestamp(epoch_ms / 1000, tz=pytz.utc).astimezone(pytz.timezone(“Asia/Kolkata”))

And it worked !

Thanks for getting me out of this pickle

2 Likes