Get Monthly expiry of OCT 24 for SENSEX

Abhishek_G
Instrument codes for Monthly expiry have different formats compared to Weekly.

Now, OCT has 2 remaining expiries for SENSEX. One on 25th Oct and the other on 31st Oct.
Usually, last expiry of the month is monthly expiry, so ideally 25th OCT should have instrument codes ending with "24O25"
and ones expiring on 31st Oct should end with "24OCT"

However, in the instrument file, instruments expiring on 25 Oct are ending with 25OCT and ones expiring on 31st OCT are ending with 24O31.

So, how can one correctly identify monthly expiry and weekly expiry here ?

PS: 31st OCT is thursday but has sensex expiry due to holiday on 1st Nov.
Tagged:
  • sujith
    Monthly expiry is on 25th October 2024 (SENSEX24OCT80200PE) and the weekly expiry is on 31st October 2024 (SENSEX24O3180200PE)
    You need to look at the tradingsymbol format and figure out which one is monthly and weekly expiry.
    You can know more about weekly symbols format here.
  • Abhishek_G
    Hi @sujith

    I looked at the file and that is how I realized 25th is monthly expiry (and this thread/question)
    Ideally last expiry of the month was monthly expiry.

    Programmatically, I can get all expiries of a particular instrument and then last one in that list can have code for monthly expiry and others for weekly.

    But in this case, 25th was monthly and not 31st. So, my question is how can one get which one is which via code ?
    usually instrument codes are generated dynamically in code using instrument name, strike, expiry code etc., so it is important to know which one is weekly/monthly expiry to appropriately generate expiry code.

    This is probably a very rare instance (or may be the first one) where last expiry of the month was not labeled as a monthly expiry.
  • sujith
    Yes, it is a rare scenario as mentioned by you. The logic of generating tradingsymbol at your end is flawed. You need to always fetch instruments master file for the day and use that as the source.
  • Abhishek_G
    Hi @sujith ,

    I agree to you in some parts.
    But picture this, on 20th Oct, if I have to trade in Sensex straddle of monthly expiry based on some strategy, now, I need to decide which is the monthly expiry (before fetching any instruments from instruments file).

    Now, programmatically, I will look into instruments file for all available expiries of Oct, and , since it's 20th Oct, so I will get 25th Oct and 31st Oct.

    To naked eye or manually, I can look at the instrument symbol of both expiries and say that 25th Oct looks like monthly, whereas 31st Oct looks like weekly.

    But how will any code or logic decide this, that's my question.

    If anyone wants to trade in monthly expiry on 1-3rd Oct, he will have 5 expiries, first 3 weekly, then 1 monthly and then 1 weekly at 31st. So, what logic can one use to identify monthly expiries ?

    Its either last expiry for the month, on in case of Nifty / BankNifty etc. where we have only monthly futures, the expriy date of futures can be considered as monthly.

    But since Sensex has weekly futures too, this wont work.

    So, now do you see the problem/issue here ?
  • themohammedfaisal
    themohammedfaisal edited November 6
    Hi @Abhishek_G ,

    Summarising first, which you already know-
    This goes back to the way exchanges introduce contracts for trading. For Sensex, monthly contracts have to the introduced on the last Friday of the month (which is 25th October). And for weekly contracts, it has to be on the Friday of the week, which in this case was a holiday, leading to an early expiry on 31st October.

    How do you identify a monthly vs a weekly programmatically? I have explained regex match approach here. You can implement something similar. If you just want to identify the last expiry of the month, you can do that with the expiry date itself.

    On our end, we received the instruments this way and process it in the same structure as we have multiple exchange files to rely on for various trading and backoffice processes and any restructuring would lead to confusion.

    Sorry, couldn't respond sooner.
  • Abhishek_G
    @themohammedfaisal Appreciate your response.
    What you have described is how to generate instrument code for instruments based on whether they are weekly or monthly. Thats the easy part to be honest.

    My query which i described in detail in last post, is specifically related to Oct month where SENSEX had expiries on 25Oct and 31st OCT and I wanted to know why 25th OCT is monthly and not 31st even though last expiry of the month is 31st, so monthly expiry should be 31st and not 25th?

    and if a similar case arises in future, how can I identify correctly which one is monthly.

    Once I know which one is monthly or weekly then your regex will come in play, and like i said, that's the simple part
Sign In or Register to comment.