Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nse-js

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nse-js

An unofficial Node.js API for NSE India stock exchange

  • 0.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

nse-js

nse-js is a Node.js library for fetching data from the National Stock Exchange (NSE) of India. It provides various methods to retrieve market data, circulars, option chains, corporate actions, and more.

[!IMPORTANT] This module is not yet ready for production use as it's not tested on production environment.

Installation

npm install nse-js

API limits

All requests through NSE are rate limited or throttled to 3 requests per second. This allows making large number of requests without overloading the server or getting blocked.

  • If downloading a large number of reports from NSE, please do so after-market hours (Preferably late evening).
  • Add an extra 0.5 - 1 sec sleep between requests. The extra run time likely wont make a difference to your script.
  • Save the file and reuse them instead of re-downloading.

Usage

const { NSE, Extras } = require('nse-js');
const nse = new NSE();
const ex = new Extras("./");

Methods

status()

Get market status.

nse.status().then(data => console.log(data));

circulars(deptCode, fromDate, toDate)

Get NSE circulars.

  • deptCode (optional): Department code.
  • fromDate (optional): Start date.
  • toDate (optional): End date.
nse.circulars().then(data => console.log(data));

blockDeals()

Get block deals.

nse.blockDeals().then(data => console.log(data));

fnoLots()

Get the lot size of FnO stocks.

nse.fnoLots().then(data => console.log(data));

optionChain(symbol)

Get the option chain for a symbol.

  • symbol: Symbol code.
nse.optionChain('nifty').then(data => console.log(data));

maxpain(optionChain, expiryDate)

Get the max pain strike price.

  • optionChain: Option chain data.
  • expiryDate: Expiry date.
nse.maxpain(optionChain, new Date()).then(data => console.log(data));

compileOptionChain(symbol, expiryDate)

Compile the option chain for a symbol.

  • symbol: Symbol code.
  • expiryDate: Expiry date.
nse.compileOptionChain('nifty', new Date()).then(data => console.log(data));

advanceDecline()

Get advance decline data.

nse.advanceDecline().then(data => console.log(data));

holidays(type)

Get NSE holidays.

  • type: Type of holiday (trading or clearing).
nse.holidays('trading').then(data => console.log(data));

equityMetaInfo(symbol)

Get equity meta info.

  • symbol: Symbol code.
nse.equityMetaInfo('RELIANCE').then(data => console.log(data));

quote(symbol, type, section)

Get quote data.

  • symbol: Symbol code.
  • type: Type of quote (equity or fno).
  • section: Section of quote (trade_info).
nse.quote('RELIANCE').then(data => console.log(data));

equityQuote(symbol)

Get equity quote data.

  • symbol: Symbol code.
nse.equityQuote('RELIANCE').then(data => console.log(data));

gainers(data, count)

Get gainers data.

  • data: Data object.
  • count: Number of gainers to return.
nse.gainers(data).then(data => console.log(data));

losers(data, count)

Get losers data.

  • data: Data object.
  • count: Number of losers to return.
nse.losers(data).then(data => console.log(data));

listFnoStocks()

Get list of FNO stocks.

nse.listFnoStocks().then(data => console.log(data));

listIndices()

Get list of indices.

nse.listIndices().then(data => console.log(data));

listIndexStocks(index)

Get list of index stocks.

  • index: Index name.
nse.listIndexStocks('NIFTY 50').then(data => console.log(data));

listEtf()

Get list of ETFs.

nse.listEtf().then(data => console.log(data));

listSme()

Get list of SMEs.

nse.listSme().then(data => console.log(data));

listSgb()

Get list of SGBs.

nse.listSgb().then(data => console.log(data));

listCurrentIPO()

Get list of current IPOs.

nse.listCurrentIPO().then(data => console.log(data));

listUpcomingIPO()

Get list of upcoming IPOs.

nse.listUpcomingIPO().then(data => console.log(data));

listPastIPO(fromDate, toDate)

Get list of past IPOs.

  • fromDate: Start date.
  • toDate: End date.
nse.listPastIPO(new Date('2023-01-01'), new Date('2023-12-31')).then(data => console.log(data));

actions(segment, symbol, fromDate, toDate)

Get corporate actions.

  • segment: Segment name.
  • symbol: Symbol code.
  • fromDate: Start date.
  • toDate: End date.
nse.actions('equities', 'RELIANCE', new Date('2023-01-01'), new Date('2023-12-31')).then(data => console.log(data));

announcements(index, symbol, fno, fromDate, toDate)

Get corporate announcements.

  • index: Index name.
  • symbol: Symbol code.
  • fno: FNO flag.
  • fromDate: Start date.
  • toDate: End date.
nse.announcements('equities', 'RELIANCE', false, new Date('2023-01-01'), new Date('2023-12-31')).then(data => console.log(data));

boardMeetings(index, symbol, fno, fromDate, toDate)

Get board meetings.

  • index: Index name.
  • symbol: Symbol code.
  • fno: FNO flag.
  • fromDate: Start date.
  • toDate: End date.
nse.boardMeetings('equities', 'RELIANCE', false, new Date('2023-01-01'), new Date('2023-12-31')).then(data => console.log(data));

equityBhavcopy(date, folder)

Get equity bhavcopy.

  • date: Date.
  • folder: Folder path.
ex.equityBhavcopy(new Date(), './downloads').then(data => console.log(data));

deliveryBhavcopy(date, folder)

Get delivery bhavcopy.

  • date: Date.
  • folder: Folder path.
ex.deliveryBhavcopy(new Date(), './downloads').then(data => console.log(data));

fnoBhavcopy(date, folder)

Get FNO bhavcopy.

  • date: Date.
  • folder: Folder path.
ex.fnoBhavcopy(new Date(), './downloads').then(data => console.log(data));

prBhavcopy(date, folder)

Get PR bhavcopy.

  • date: Date.
  • folder: Folder path.
ex.prBhavcopy(new Date(), './downloads').then(data => console.log(data));

License

This project is licensed under the GPL v3 License.

Credits

This project is inspired by BennyThadikaran's python version of NSE API.

Keywords

FAQs

Package last updated on 26 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc