How to get nse live data in java
What you will learn here about java
- How to get nse live data in java
Here will see how to get live nse data for nifty and bank nifty in java with springboot framework.
Please click on below link to download sample project
Sample project to get live NSE data (347 downloads)How to get nse live data in java
Please follow the following steps to know how to get nse live data for nifty and bank nifty using springboot framework of java.
1)First create a simple maven project
2)Please add feign and thymeleaf dependency in pom.xml which is shown below
3)Please create entity with respect of NSE response which is shown below
4)Below I have created sample html page which is shown below
5)Now create feign builder to call third party API which is shown below
6)Now create a controller to get live data and display in html page which is shown below
7)Now please run your springboot application
8)Once you run your application. Please visit following URL and you will see following kind of output on the browser
Commonly Ask Question
1)Why am I not getting live data even I used above sample project code?
Answer : The reason is very simple. you are not getting because you have to replace cookies in your code. Please follow the following steps to replace cookies in your code which is shown below.
- Please visit the link -> https://www.nseindia.com/option-chain
- Inspect page -> Right click and click on Inspect
- Click on Network (Step 3)
- Click on Option chain nifty (Step 4)
- Get nsit, nseappid and bmsv value from request headers (Step 5)
- Once you replace above headers please rerun the code again