I have created a very simple custom script that should display the number of days to expiration as a column in the option chain. I use the GetDaysToExpiration() function. The platform shows that as of today (Dec 15th 2023), there are 280 days left to the expiration Sep 20th 2024). Therefore, I was expecting the script to display "280" for all the strikes within that expiration date.
THE PROBLEM IS... the function is displaying "282" for most strikes, and sometimes it displays other RANDOM numbers for different strikes within the SAME expiration date!!! It's like the function GetDaysToExpiration() itself was broken.
Please see the two screenshots attached.
Any idea how I can get the accurate number of days to expiration? Thanks!
THE PROBLEM IS... the function is displaying "282" for most strikes, and sometimes it displays other RANDOM numbers for different strikes within the SAME expiration date!!! It's like the function GetDaysToExpiration() itself was broken.
Please see the two screenshots attached.
Any idea how I can get the accurate number of days to expiration? Thanks!