Kotak-Neo / kotak-neo-api

112 stars 103 forks source link

Expiry date in search_scrip / scrip_master not working properly - Probably Leap Year Issue #145

Open ronaldpaul opened 7 months ago

ronaldpaul commented 7 months ago

Try to pass 29FEB2024 (this month expity) and get the results. It returns empty data frame/result. It's either data issue or error in search_script.py in a way they are handling the expiry dates to get the instruments.

Example:

neo.search_scrip(exchange_segment = "nse_fo", symbol = "NIFTY", expiry = "29FEB2024", option_type = "CE", strike_price = "22200")

It was working fine till yesterday. Only for the month end expiry, it is throwing error.

crypt0inf0 commented 7 months ago
neo.search_scrip(exchange_segment = "nse_fo", symbol = "NIFTY", expiry = "01MAR2024", option_type = "CE", strike_price = "22200")

@Kotak-Neo the above script returns the FEB expiry & for the 07 MAR expiry I have to add expiry date + 1 to get the correct result like,

neo.search_scrip(exchange_segment = "nse_fo", symbol = "NIFTY", expiry = "08MAR2024", option_type = "CE", strike_price = "22200")
ronaldpaul commented 7 months ago
neo.search_scrip(exchange_segment = "nse_fo", symbol = "NIFTY", expiry = "01MAR2024", option_type = "CE", strike_price = "22200")

@Kotak-Neo the above script returns the FEB expiry & for the 07 MAR expiry I have to add expiry date + 1 to get the correct result like,

neo.search_scrip(exchange_segment = "nse_fo", symbol = "NIFTY", expiry = "08MAR2024", option_type = "CE", strike_price = "22200")

Yes. I suspect it is because of leap-year. For upcoming expiry dates, you have to minus one day. Otherwise, it won't work. I debugged and found that all upcoming expiry dates are showing Friday dates, not Thursday ones. So, I have reduced 1 day for upcoming days in this year. It's because they are doing addition of 10 years through offset. @Kotak-Neo , kindly fix this bug please. I have done workaround in my code for now.

arunjain9988 commented 7 months ago

@Kotak-Neo please take this seriously, your api returning wrong expiry dates for contracts. Why can't you provide a expiry date in DDMMYYYY format like (29022024) instead of epoch timestamp which has lots of confusion.

Prrix commented 6 months ago

the datetime in their database(scripmaster) has like a 10 year lapse with the global epoch time and so the issue when 10 years is added it doesnt account the current leap year

hivikash commented 6 months ago

Please resolve this issue on priority as it has been a long pending and very confusing to be useful.

vijaykz commented 5 months ago

@Kotak-Neo is not very serious! 😭

mavink commented 3 months ago

They should change it to df['pExpiryDate'] = df['pExpiryDate'] + pd.DateOffset(seconds=315513000) from df['pExpiryDate'] = df['pExpiryDate'] + pd.DateOffset(years=10)

As per their own postman spec https://documenter.getpostman.com/view/21534797/UzBnqmpD#1a2a5fad-4a0f-4ac9-86b5-96a3a3d6902a