Getting the nearest two strikes tradingsymbols

Benthomas
Hi,
Please help me to get the adjacent strikes trading symbols and price.

For example.

ATM call option is NIFTY21N1817900CE.

I want to get the ltp of NIFTY21N1818000CE and NIFTY21N1817800CE

Thanks








  • Imran
    hi @Benthomas
    use this code for it.
    # step_values reference : https://www1.nseindia.com/content/fo/sos_scheme.xls
    step_values = {'AARTIIND': 20, 'ACC': 20, 'ADANIENT': 20.....}


    def option_name_finder(ltp, multiplier, name, exipry, ce_pe):
    step_value = step_values[name]
    atm_strike = round(ltp/step_value)*step_value + multiplier*step_value
    option_name = name + exipry + str(atm_strike) + 'CE'
    return option_name

  • rakeshr
    Please help me to get the adjacent strikes trading symbols
    To form adjacent strikes trading symbol, you can fetch the current spot value using the LTP quote and then add strike Interval(i.e 50, 100, etc) to the strike price.
    and price.
    For the price, you will have to form the required symbol(as stated above) and request the same using the LTP quote.
  • Benthomas
    Thank you so much
  • Benthomas
    Hi,
    I just want to exit the losing straddle leg first, and the other leg after 10 seconds when a condition is met.
    Please give some logic.

    Is there any order precedence in executing CE and PE. I noticed (may be wrong), when closing all open positions through API, PE orders are executed first.

    Thanks







  • Imran
    import time

    find the loosing leg option name
    exit the loosing leg..
    time.sleep(10)
    exit the second leg..



Sign In or Register to comment.