npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

stock-nse-india

v1.2.0

Published

This package will help us to get equity/index details and historical data from National Stock Exchange of India.

Downloads

1,438

Readme

NPM

National Stock Exchange - India (Unofficial)

npm NPM GitHub Release Date - Published_At GitHub top language

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-india

Install using 'yarn'

yarn add stock-nse-india

Usage

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

getAllStockSymbols

getData

getDataByEndpoint - Get data by NSE API endpoints. API Endpoints list

Equity Methods

getEquityCorporateInfo

getEquityDetails

getEquityHistoricalData

getEquityIntradayData

getEquityOptionChain

getEquitySeries

getEquityTradeInfo

Index Methods

getEquityStockIndices

getIndexIntradayData

getIndexHistoricalData

getIndexOptionChain

Commodity Methods

getCommodityOptionChain

Helper Methods

getGainersAndLosersByIndex

getMostActiveEquities

Run locally

Clone the repo locally using below command

git clone https://github.com/hi-imcodeman/stock-nse-india.git

Goto 'stock-nse-india' folder

cd stock-nse-india

Then install packages using 'npm' or 'yarn'

npm install

or

yarn

Start the application using 'npm' or 'yarn'

npm start

or

yarn start

Then 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-india

CLI Usage

To get CLI help

nseindia --help

To get market status

nseindia

To get the current equity details of the NSE symbol

nseindia equity IRCTC

To get the historical details of the NSE symbol

nseindia historical IRCTC

To get the details of the indices

nseindia index

To 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:latest

Start a instance

docker run --rm -d -p 3001:3001 imcodeman/nseindia

Test 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

Contributors