Python code to read expiry details for Futures from NSE

# Get all get possible expiry date details for the given script
def get_expiry_from_future_list (symbol):

    # Base url page for the symbole with default expiry date
    Base_url = "https://www.nseindia.com/live_market/dynaContent/live_watch/fomwatchsymbol.jsp?key=" + symbol + "&Fut_Opt=Futures"

    # Load the page and sent to HTML parse
    page = requests.get(Base_url)
    soup = BeautifulSoup(page.content, 'html.parser')

    table_cls_2 = soup.find(id="tab26Content")
    req_row = table_cls_2.find_all('tr')


    expiry_list = []

    for row_number, tr_nos in enumerate(req_row):

        # This ensures that we use only the rows with values
        if row_number <= 0 or row_number == len(req_row):
            continue

        td_columns = tr_nos.find_all('td')
        expiry = BeautifulSoup(str(td_columns[2]), 'html.parser').get_text()
        expiry_list.append(expiry)

    return expiry_list

Jegathesan Durairaj, a mathematician by qualification, an Ex-software professional and now a full time Risk Defined Option Writer. With his Open Book Strategies, he is the most known identity in twitter as itjegan, with huge followers. He had won Zerodha 60 Day Challenge – 10 Times round-the-clock. He is one of the prime Option Writing Trainer and tutored close to 1000 members till now.

He is the Mastermind of CapitalZone РActive Option Trading where Traders can avail Trading Chart with customised indicators, FNO tools and Payoff analysis. His keynote is to provide whole FNO deets to be handy for Traders in a sole place.

Now he is taking more heed on hedging portfolio in Option Writing where we might subject to more market risk. He is streamlining his strategies often and improving perpetually. At this time unfolding ways to measure good-quality Trend Following System.

Conducting workshop in all Metro Cities (Delhi, Mumbai, Bangalore, Chennai and Coimbatore) often based on queries from Traders.

 

 

Leave comment

Your email address will not be published. Required fields are marked with *.