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.
npm install nse-js
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.
const { NSE, Extras } = require('nse-js');
const nse = new NSE();
const ex = new Extras("./");
Get market status.
nse.status().then(data => console.log(data));
Get NSE circulars.
-
deptCode
(optional): Department code. -
fromDate
(optional): Start date. -
toDate
(optional): End date.
nse.circulars().then(data => console.log(data));
Get block deals.
nse.blockDeals().then(data => console.log(data));
Get the lot size of FnO stocks.
nse.fnoLots().then(data => console.log(data));
Get the option chain for a symbol.
-
symbol
: Symbol code.
nse.optionChain('nifty').then(data => console.log(data));
Get the max pain strike price.
-
optionChain
: Option chain data. -
expiryDate
: Expiry date.
nse.maxpain(optionChain, new Date()).then(data => console.log(data));
Compile the option chain for a symbol.
-
symbol
: Symbol code. -
expiryDate
: Expiry date.
nse.compileOptionChain('nifty', new Date()).then(data => console.log(data));
Get advance decline data.
nse.advanceDecline().then(data => console.log(data));
Get NSE holidays.
-
type
: Type of holiday (trading or clearing).
nse.holidays('trading').then(data => console.log(data));
Get equity meta info.
-
symbol
: Symbol code.
nse.equityMetaInfo('RELIANCE').then(data => console.log(data));
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));
Get equity quote data.
-
symbol
: Symbol code.
nse.equityQuote('RELIANCE').then(data => console.log(data));
Get gainers data.
-
data
: Data object. -
count
: Number of gainers to return.
nse.gainers(data).then(data => console.log(data));
Get losers data.
-
data
: Data object. -
count
: Number of losers to return.
nse.losers(data).then(data => console.log(data));
Get list of FNO stocks.
nse.listFnoStocks().then(data => console.log(data));
Get list of indices.
nse.listIndices().then(data => console.log(data));
Get list of index stocks.
-
index
: Index name.
nse.listIndexStocks('NIFTY 50').then(data => console.log(data));
Get list of ETFs.
nse.listEtf().then(data => console.log(data));
Get list of SMEs.
nse.listSme().then(data => console.log(data));
Get list of SGBs.
nse.listSgb().then(data => console.log(data));
Get list of current IPOs.
nse.listCurrentIPO().then(data => console.log(data));
Get list of upcoming IPOs.
nse.listUpcomingIPO().then(data => console.log(data));
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));
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));
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));
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));
Get equity bhavcopy.
-
date
: Date. -
folder
: Folder path.
ex.equityBhavcopy(new Date(), './downloads').then(data => console.log(data));
Get delivery bhavcopy.
-
date
: Date. -
folder
: Folder path.
ex.deliveryBhavcopy(new Date(), './downloads').then(data => console.log(data));
Get FNO bhavcopy.
-
date
: Date. -
folder
: Folder path.
ex.fnoBhavcopy(new Date(), './downloads').then(data => console.log(data));
Get PR bhavcopy.
-
date
: Date. -
folder
: Folder path.
ex.prBhavcopy(new Date(), './downloads').then(data => console.log(data));
This project is licensed under the GPL v3 License.
This project is inspired by BennyThadikaran's python version of NSE API.