%LTP change for NSE option chain

Hi Imran,

I want to build trading symbol from the strike price obtained from options data. Do we have any function for this? This way i can pass the trading symbol to the get_long_term_historical_data function.

hi @vedvishwa

Since in option chain we get the strike only, we need to construct trading_symbol manually.

Where getting underlying, strike, and right as easy tasks.

expiry we can give manually

underlying = 'NIFTY'   
expiry     = '12 MAY' # expiry we can give manually
strike     = "24300"   # this we get from option chain
right      = "CALL"

trading_symbol = f"{underlying} {expiry} {strike} {right}"

now we have got our trading_symbol, we can pass this to get_long_term_historical_data

@vedvishwa
Also there is a second method to get %ltp change

we can call quote data.. it contains, ltp and previous close values.. and then calculate pct change
see solution

symbol_name    = 'NIFTY 12 MAY 24400 CALL'
quote_data     = tsl.get_quote_data(names=[symbol_name])[symbol_name]
previous_close = quote_data['ohlc']['close']
ltp            = quote_data['last_price']
ltp_pct_change = ((ltp-previous_close)/previous_close)*100

and the same info matched with dhan charts as well