
Security News
Critical Security Vulnerability in React Server Components
React disclosed a CVSS 10.0 RCE in React Server Components and is advising users to upgrade affected packages and frameworks to patched versions now.
stock-nse-india
Advanced tools
This package will help us to get equity/index details and historical data from National Stock Exchange of India.
A comprehensive package and API server for accessing equity/index details and historical data from the National Stock Exchange of India. This project provides both an NPM package for direct integration and a full-featured GraphQL/REST API server.
๐ Documentation | ๐ Examples
โ ๏ธ Prerequisites: Node.js 18+ required
npm install stock-nse-india
import { NseIndia } from "stock-nse-india";
const nseIndia = new NseIndia();
// Get all stock symbols
const symbols = await nseIndia.getAllStockSymbols();
console.log(symbols);
// Get equity details
const details = await nseIndia.getEquityDetails('IRCTC');
console.log(details);
// Get historical data
const range = {
start: new Date("2020-01-01"),
end: new Date("2023-12-31")
};
const historicalData = await nseIndia.getEquityHistoricalData('IRCTC', range);
console.log(historicalData);
# Clone and setup
git clone https://github.com/hi-imcodeman/stock-nse-india.git
cd stock-nse-india
npm install
# Start the server
npm start
๐ Server URLs:
npm install stock-nse-india
# or
yarn add stock-nse-india
npm install -g stock-nse-india
git clone https://github.com/hi-imcodeman/stock-nse-india.git
cd stock-nse-india
npm install
npm start
The project now includes a powerful GraphQL API for flexible data querying:
# Get equity information
query GetEquity {
equities(symbolFilter: { symbols: ["IRCTC", "RELIANCE"] }) {
symbol
details {
info {
companyName
industry
isFNOSec
}
metadata {
listingDate
status
}
}
}
}
# Get indices data
query GetIndices {
indices(filter: { filterBy: "NIFTY" }) {
key
index
last
variation
percentChange
}
}
The API includes schemas for:
Comprehensive REST endpoints with automatic Swagger documentation:
GET / - Market statusGET /api/marketStatus - Market status informationGET /api/glossary - NSE glossaryGET /api/equity/:symbol - Equity detailsGET /api/equity/:symbol/historical - Historical dataGET /api/indices - Market indicesGET /api-docs - Interactive API documentationVisit http://localhost:3000/api-docs for complete interactive API documentation powered by Swagger UI.
# Get help
nseindia --help
# Get market status
nseindia
# Get equity details
nseindia equity IRCTC
# Get historical data
nseindia historical IRCTC
# Get indices information
nseindia index
# Get specific index details
nseindia index "NIFTY AUTO"
# Pull and run from Docker Hub
docker run --rm -d -p 3001:3001 imcodeman/nseindia
# Or build locally
docker build -t nseindia . && docker run --rm -d -p 3001:3001 nseindia:latest
Image: imcodeman/nseindia
Registry: Docker Hub
# Server Configuration
PORT=3000
HOST_URL=http://localhost:3000
NODE_ENV=development
# CORS Configuration
CORS_ORIGINS=https://myapp.com,https://admin.myapp.com
CORS_METHODS=GET,POST,OPTIONS
CORS_HEADERS=Content-Type,Authorization,X-Requested-With
CORS_CREDENTIALS=true
getAllStockSymbols() - Get all NSE stock symbolsgetData() - Generic data retrievalgetDataByEndpoint() - Get data by specific NSE API endpointsgetEquityDetails(symbol) - Get equity informationgetEquityHistoricalData(symbol, range) - Historical price datagetEquityIntradayData(symbol) - Intraday trading datagetEquityOptionChain(symbol) - Options chain datagetEquityCorporateInfo(symbol) - Corporate informationgetEquityTradeInfo(symbol) - Trading statisticsgetEquityStockIndices() - Get all market indicesgetIndexHistoricalData(index, range) - Index historical datagetIndexIntradayData(index) - Index intraday datagetIndexOptionChain(index) - Index options datagetCommodityOptionChain(symbol) - Commodity options datagetGainersAndLosersByIndex(index) - Top gainers and losersgetMostActiveEquities() - Most actively traded stocksโ ๏ธ Prerequisites: Node.js 18+ required
# Clone repository
git clone https://github.com/hi-imcodeman/stock-nse-india.git
cd stock-nse-india
# Install dependencies
npm install
# Development mode with auto-reload
npm run start:dev
# Build project
npm run build
# Run tests
npm test
# Generate documentation
npm run docs
npm start - Start production servernpm run start:dev - Development mode with auto-reloadnpm run build - Build TypeScript to JavaScriptnpm test - Run test suite with coveragenpm run docs - Generate TypeDoc documentationnpm run lint - Run ESLint# Run all tests
npm test
# Run tests with coverage
npm test -- --coverage
# Run specific test file
npm test -- utils.spec.ts
We welcome contributions! Please see our contributing guidelines and feel free to submit issues and pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
โญ Star this repository if you find it helpful!
FAQs
This package will help us to get equity/index details and historical data from National Stock Exchange of India.
We found that stock-nse-india demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.ย It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
React disclosed a CVSS 10.0 RCE in React Server Components and is advising users to upgrade affected packages and frameworks to patched versions now.

Research
/Security News
We spotted a wave of auto-generated โelf-*โ npm packages published every two minutes from new accounts, with simple malware variants and early takedowns underway.

Security News
TypeScript 6.0 will be the last JavaScript-based major release, as the project shifts to the TypeScript 7 native toolchain with major build speedups.