stock-nse-india v1.1.7
National Stock Exchange - India (Unofficial)
This package will help us to get equity/index details and historical data from National Stock Exchange of India.
Please refer Documentation here.
See the Examples here
Installation
Install using 'npm'
npm i stock-nse-indiaInstall using 'yarn'
yarn add stock-nse-indiaUsage
import { NseIndia } from "stock-nse-india";
const nseIndia = new NseIndia()
// To get all symbols from NSE
nseIndia.getAllStockSymbols().then(symbols => {
console.log(symbols)
})
// To get equity details for specific symbol
nseIndia.getEquityDetails('IRCTC').then(details => {
console.log(details)
})
// To get equity historical data for specific symbol
const range = {
start: new Date("2010-01-01"),
end: new Date("2021-03-20")
}
nseIndia.getEquityHistoricalData(symbol, range).then(data => {
console.log(data)
})API Methods
Common Methods
getDataByEndpoint - Get data by NSE API endpoints. API Endpoints list
Equity Methods
Index Methods
Helper Methods
Run locally
Clone the repo locally using below command
git clone https://github.com/hi-imcodeman/stock-nse-india.gitGoto 'stock-nse-india' folder
cd stock-nse-indiaThen install packages using 'npm' or 'yarn'
npm installor
yarnStart the application using 'npm' or 'yarn'
npm startor
yarn startThen open the URL http://localhost:3000 in browser.
For API service documentation please hit http://localhoast:3000/api-docs
CLI
We can use this package in CLI.
Install for CLI
npm i -g stock-nse-indiaCLI Usage
To get CLI help
nseindia --helpTo get market status
nseindiaTo get the current equity details of the NSE symbol
nseindia equity IRCTCTo get the historical details of the NSE symbol
nseindia historical IRCTCTo get the details of the indices
nseindia indexTo get the details of the specific index
nseindia index "NIFTY AUTO"Docker
Build & Run in local
Build and run the docker instance in local machine.
docker build -t nseindia . && docker run --rm -d -p 3001:3001 nseindia:latestStart a instance
docker run --rm -d -p 3001:3001 imcodeman/nseindiaTest the instance
Open the browser and hit http://localhoast:3001
For API service documentation please hit http://localhoast:3001/api-docs
Docker Hub link
https://hub.docker.com/r/imcodeman/nseindia
Testing
Run the below command for testing and coverage.
yarn test