Is there an api to remove all options connected to an asset / symbol ?

gautama
I would like to fetch a list of options connected to an asset e.g. RELIANCE .. how can I achieve it ?
  • gautama
    or do I have to use heuristics on the instruments list ?
  • gautama
    retrieve ^^^ NOT remove
  • MAG
    You will have to write your own code to parse the instrumentlist.
    The api is just that - basic building blocks. You need to write your own code to use these building blocks to achieve whatever end goal you have.

    In your case the symbolname for Reliance industries is RELIANCE
    instrument_token,exchange_token,tradingsymbol,name,last_price,expiry,strike,tick_size,lot_size,instrument_type,segment,exchange
    738561,2885,RELIANCE,"RELIANCE INDUSTRIES",0,,0,0.05,1,EQ,NSE,NSE


    So you would search for all symbols where name is "RELIANCE" and segment is "NFO-OPT".
    This will return a list of all options for Reliance Industries. Something that looks like
    39497986,154289,RELIANCE23NOV1840CE,"RELIANCE",0,2023-11-30,1840,0.05,250,CE,NFO-OPT,NFO
    39498242,154290,RELIANCE23NOV1840PE,"RELIANCE",0,2023-11-30,1840,0.05,250,PE,NFO-OPT,NFO
    39498498,154291,RELIANCE23NOV1860CE,"RELIANCE",0,2023-11-30,1860,0.05,250,CE,NFO-OPT,NFO
    39498754,154292,RELIANCE23NOV1860PE,"RELIANCE",0,2023-11-30,1860,0.05,250,PE,NFO-OPT,NFO
    39499010,154293,RELIANCE23NOV1880CE,"RELIANCE",0,2023-11-30,1880,0.05,250,CE,NFO-OPT,NFO
    39499266,154294,RELIANCE23NOV1880PE,"RELIANCE",0,2023-11-30,1880,0.05,250,PE,NFO-OPT,NFO
    39499522,154295,RELIANCE23NOV1900CE,"RELIANCE",0,2023-11-30,1900,0.05,250,CE,NFO-OPT,NFO
    39499778,154296,RELIANCE23NOV1900PE,"RELIANCE",0,2023-11-30,1900,0.05,250,PE,NFO-OPT,NFO
    39500034,154297,RELIANCE23NOV1920CE,"RELIANCE",0,2023-11-30,1920,0.05,250,CE,NFO-OPT,NFO
    39500290,154298,RELIANCE23NOV1920PE,"RELIANCE",0,2023-11-30,1920,0.05,250,PE,NFO-OPT,NFO
    39505666,154319,RELIANCE23NOV1940CE,"RELIANCE",0,2023-11-30,1940,0.05,250,CE,NFO-OPT,NFO
    39505922,154320,RELIANCE23NOV1940PE,"RELIANCE",0,2023-11-30,1940,0.05,250,PE,NFO-OPT,NFO
    39506178,154321,RELIANCE23NOV1960CE,"RELIANCE",0,2023-11-30,1960,0.05,250,CE,NFO-OPT,NFO
    39506434,154322,RELIANCE23NOV1960PE,"RELIANCE",0,2023-11-30,1960,0.05,250,PE,NFO-OPT,NFO
    39506690,154323,RELIANCE23NOV1980CE,"RELIANCE",0,2023-11-30,1980,0.05,250,CE,NFO-OPT,NFO
    39506946,154324,RELIANCE23NOV1980PE,"RELIANCE",0,2023-11-30,1980,0.05,250,PE,NFO-OPT,NFO
    39507202,154325,RELIANCE23NOV2000CE,"RELIANCE",0,2023-11-30,2000,0.05,250,CE,NFO-OPT,NFO
    39507458,154326,RELIANCE23NOV2000PE,"RELIANCE",0,2023-11-30,2000,0.05,250,PE,NFO-OPT,NFO
    39507714,154327,RELIANCE23NOV2020CE,"RELIANCE",0,2023-11-30,2020,0.05,250,CE,NFO-OPT,NFO
    39507970,154328,RELIANCE23NOV2020PE,"RELIANCE",0,2023-11-30,2020,0.05,250,PE,NFO-OPT,NFO
    39508226,154329,RELIANCE23NOV2040CE,"RELIANCE",0,2023-11-30,2040,0.05,250,CE,NFO-OPT,NFO
    39508482,154330,RELIANCE23NOV2040PE,"RELIANCE",0,2023-11-30,2040,0.05,250,PE,NFO-OPT,NFO
    39508738,154331,RELIANCE23NOV2060CE,"RELIANCE",0,2023-11-30,2060,0.05,250,CE,NFO-OPT,NFO
    39508994,154332,RELIANCE23NOV2060PE,"RELIANCE",0,2023-11-30,2060,0.05,250,PE,NFO-OPT,NFO
    39509250,154333,RELIANCE23NOV2080CE,"RELIANCE",0,2023-11-30,2080,0.05,250,CE,NFO-OPT,NFO
    ...
    ...
    ...
    42190594,164807,RELIANCE24JAN2580CE,"RELIANCE",0,2024-01-25,2580,0.05,250,CE,NFO-OPT,NFO
    42190850,164808,RELIANCE24JAN2580PE,"RELIANCE",0,2024-01-25,2580,0.05,250,PE,NFO-OPT,NFO
    42191106,164809,RELIANCE24JAN2600CE,"RELIANCE",0,2024-01-25,2600,0.05,250,CE,NFO-OPT,NFO
    42191362,164810,RELIANCE24JAN2600PE,"RELIANCE",0,2024-01-25,2600,0.05,250,PE,NFO-OPT,NFO
    42191618,164811,RELIANCE24JAN2620CE,"RELIANCE",0,2024-01-25,2620,0.05,250,CE,NFO-OPT,NFO
    42191874,164812,RELIANCE24JAN2620PE,"RELIANCE",0,2024-01-25,2620,0.05,250,PE,NFO-OPT,NFO
    42192130,164813,RELIANCE24JAN2640CE,"RELIANCE",0,2024-01-25,2640,0.05,250,CE,NFO-OPT,NFO
    42192386,164814,RELIANCE24JAN2640PE,"RELIANCE",0,2024-01-25,2640,0.05,250,PE,NFO-OPT,NFO
    42192642,164815,RELIANCE24JAN2660CE,"RELIANCE",0,2024-01-25,2660,0.05,250,CE,NFO-OPT,NFO
    42192898,164816,RELIANCE24JAN2660PE,"RELIANCE",0,2024-01-25,2660,0.05,250,PE,NFO-OPT,NFO
    42193154,164817,RELIANCE24JAN2680CE,"RELIANCE",0,2024-01-25,2680,0.05,250,CE,NFO-OPT,NFO
    42193410,164818,RELIANCE24JAN2680PE,"RELIANCE",0,2024-01-25,2680,0.05,250,PE,NFO-OPT,NFO
    42193666,164819,RELIANCE24JAN2700CE,"RELIANCE",0,2024-01-25,2700,0.05,250,CE,NFO-OPT,NFO
    42193922,164820,RELIANCE24JAN2700PE,"RELIANCE",0,2024-01-25,2700,0.05,250,PE,NFO-OPT,NFO
    42194178,164821,RELIANCE24JAN2720CE,"RELIANCE",0,2024-01-25,2720,0.05,250,CE,NFO-OPT,NFO
    42194434,164822,RELIANCE24JAN2720PE,"RELIANCE",0,2024-01-25,2720,0.05,250,PE,NFO-OPT,NFO


    If you want to further narrow down the list, by current/near/far options, your code will need to include the logic too.
  • gautama
    sure. thanks. that was surely understood. I was only being lazy :)
  • MAG
    Unfortunately, there is no such thing as something for nothing.
    If you want results, you need to put in the work. :smile:
  • gautama
    I needed to hear that o:) thanks B)
Sign In or Register to comment.