New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@bshada/nseapi

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bshada/nseapi

An unofficial TypeScript API for NSE India (based on NseIndiaApiTs)

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

nseapi

TypeScript/JavaScript client for NSE India endpoints.

  • Fully typed API (see dist/index.d.ts after build)
  • Works in Node.js (ESM and CJS builds)
  • Handles NSE cookies automatically and persists them in the downloads folder

Node-only

This library targets Node.js environments only. It relies on Node core modules like fs, path, and zlib, and performs file I/O for cookie persistence and report downloads. It is not intended for use in browsers.

Installation

npm install @bshada/nseapi
# or
yarn add @bshada/nseapi
# or
pnpm add @bshada/nseapi

Import and Initialize

// ESM / TypeScript
import { NSE } from '@bshada/nseapi';

// Create an instance with a download/cache folder (used for cookies and downloaded reports)
const nse = new NSE('./downloads', { server: false, timeout: 15000 });
// CommonJS
const { NSE } = require('@bshada/nseapi');
const nse = new NSE('./downloads', { server: false, timeout: 15000 });

Notes:

  • server: true uses HTTP/2 via got, which can be better in some environments. server: false uses axios.
  • Cookies are stored under the provided folder as nse_cookies_http1.json or nse_cookies_http2.json.

Usage Examples

import { NSE } from '@bshada/nseapi';

const nse = new NSE('./downloads');

// Market status
const status = await nse.status();
console.log('Market state:', status);

// Fetch current IPOs
const currentIpo = await nse.listCurrentIPO();
console.log('Current IPOs:', currentIpo);

// IPO details (EQ or SME series)
const urbancoIpo = await nse.getIpoDetails({ symbol: 'URBANCO', series: 'EQ' });
console.log('URBANCO IPO details:', urbancoIpo);

// Equity quote
const quote = await nse.equityQuote('HDFCBANK');
console.log('HDFCBANK quote:', quote);

Quick Start

const status = await nse.status();
console.log('Market state:', status);

Scripts

  • npm run build — Build ESM to dist/ and CJS to dist-cjs/

API Reference

The full list of methods is available in the NSE class under src/nse/NSE.ts. A summary is below. See inline JSDoc and README.md in the original repo for detailed examples.

  • Market and Search: status(), lookup()
  • Daily Files: equityBhavcopy(), deliveryBhavcopy(), indicesBhavcopy(), fnoBhavcopy(), priceband_report(), pr_bhavcopy(), cm_mii_security_report()
  • Corporate: actions(), announcements(), boardMeetings(), annual_reports()
  • Quotes: equityMetaInfo(), quote(), equityQuote()
  • Listings/Indices: listEquityStocksByIndex(), listIndices(), listEtf(), listSme(), listSgb()
  • IPO: listCurrentIPO(), listUpcomingIPO(), listPastIPO(), getIpoDetails()
  • Circulars/Deals: circulars(), blockDeals()
  • F&O Utilities: fnoLots(), optionChain(), getFuturesExpiry(), compileOptionChain(), NSE.maxpain()
  • Historical: fetch_equity_historical_data(), fetch_historical_vix_data(), fetch_historical_fno_data(), fetch_historical_index_data()
  • Reference Data: fetch_fno_underlying(), fetch_index_names(), fetch_daily_reports_file_metadata()

Requirements

  • Node.js >= 18

License

MIT

Keywords

nse

FAQs

Package last updated on 15 Sep 2025

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