- First we access the https://www.nseindia.com/ using headers.
- Then we extract cookies from the nse website.
- Using those cookies we create a session.
- Then access the api of nse website. Sample api link for SBIN is https://www.nseindia.com/api/quote-equity?symbol=SBIN
- Then we take the required data i.e open , close etc.
- To get last Thursday for a given month and year we get the number of days in that month in the respective year.
- Then looping from backwards of day i.e., in april we loop from 30 we check which day is it if we get Thursday then we return that date.
- To check whether the given date is last Thursday we convert the given date which is string to date format.
- Then we call get last Thursday of that month and check both if both are equal then return true else false.