A unified TypeScript API for both NSE (National Stock Exchange) and BSE (Bombay Stock Exchange) India. This package combines the functionality of both exchanges while keeping their APIs separate and isolated.
- π Real-time Stock Quotes - Get live stock prices and market data
- π Historical Data - Fetch historical stock prices and indices
- π Symbol Lookup - Search for stocks and securities
- π Option Chain Data - Complete options data with Greeks
- π’ Corporate Actions - Dividends, splits, bonuses, and more
- π° Corporate Announcements - Latest company announcements
- πΉ Market Status - Live market status and trading hours
- π Data Downloads - Bhavcopy and other reports
- π― IPO Information - Current, past, and upcoming IPOs
- π Stock Quotes - Real-time BSE stock prices
- π Historical Data - Historical price data and indices
- π Symbol Search - Find BSE listed companies
- π Gainers/Losers - Top performing stocks
- π Corporate Actions - Dividend, bonus, rights issues
- π° Announcements - Corporate announcements and news
- π Reports - Bhavcopy and delivery reports
- π― Result Calendar - Earnings announcement dates
npm install nse-bse-apiimport { NSE, BSE } from 'nse-bse-api';
// Initialize clients
const nse = new NSE();
const bse = new BSE();
// Get NSE quote
const nseQuote = await nse.equityQuote('RELIANCE');
console.log('NSE RELIANCE:', nseQuote);
// Get BSE quote
const bseQuote = await bse.quote('500325'); // RELIANCE BSE code
console.log('BSE RELIANCE:', bseQuote);
// Clean up
await nse.exit();
await bse.close();// Import only NSE
import { NSE } from 'nse-bse-api/nse';
const nse = new NSE();
const quote = await nse.equityQuote('TCS');
// Import only BSE
import { BSE } from 'nse-bse-api/bse';
const bse = new BSE();
const quote = await bse.quote('532540'); // TCS BSE codeimport { NSE } from 'nse-bse-api';
const nse = new NSE('./downloads');
// Get stock quote
const quote = await nse.equityQuote('RELIANCE');
// Get historical data
const historical = await nse.historical.fetchEquityHistoricalData({
symbol: 'RELIANCE',
from_date: new Date('2024-01-01'),
to_date: new Date('2024-01-31')
});
// Get option chain
const optionChain = await nse.options.getOptionChain('NIFTY');
// Search symbols
const results = await nse.market.lookup('reliance');equityQuote(symbol)- Get equity quotemarket.lookup(query)- Search symbolsmarket.getStatus()- Market statushistorical.fetchEquityHistoricalData(params)- Historical dataoptions.getOptionChain(symbol)- Option chaincorporate.getActions(params)- Corporate actionsipo.listCurrentIPO()- Current IPOs
import { BSE } from 'nse-bse-api';
const bse = new BSE();
// Get stock quote
const quote = await bse.quote('500325'); // RELIANCE
// Get gainers
const gainers = await bse.gainers();
// Get corporate actions
const actions = await bse.actions({
fromDate: new Date('2024-01-01'),
toDate: new Date('2024-01-31')
});
// Search symbol
const results = await bse.lookupSymbol('reliance');quote(scripcode)- Get stock quotegainers(options)- Top gainerslosers(options)- Top losersactions(options)- Corporate actionsannouncements(options)- Corporate announcementslookupSymbol(text)- Search symbols
const nse = new NSE('./downloads', {
server: false, // Use server mode
timeout: 10000 // Request timeout in ms
});const bse = new BSE({
downloadFolder: './downloads',
timeout: 10000
});import { NSE, BSE } from 'nse-bse-api';
try {
const nse = new NSE();
const quote = await nse.equityQuote('INVALID');
} catch (error) {
console.error('NSE Error:', error.message);
}
try {
const bse = new BSE();
const quote = await bse.quote('INVALID');
} catch (error) {
console.error('BSE Error:', error.message);
}Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.