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 (1277 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
maven thymeleaf dependency

3)Please create entity with respect of NSE response which is shown below
how to get live nse data in java

4)Below I have created sample html page which is shown below
how to get nifty live in java

5)Now create feign builder to call third party API which is shown below
get live nse data in java

6)Now create a controller to get live data and display in html page which is shown below
how to get nse live data in java

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
spring boot get live nse data

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.

  1. Please visit the link -> https://www.nseindia.com/option-chain
  2. Inspect page -> Right click and click on Inspect
  3. Click on Network (Step 3)
  4. Click on Option chain nifty (Step 4)
  5. Get nsit, nseappid and bmsv value from request headers (Step 5)
  6. Once you replace above headers please rerun the code again

how to get live nse data in spring boot

You may also like...