nepsehub
v1.0.2
Published
TypeScript library and CLI for Nepal Stock Exchange (NEPSE) real-time and historical market data.
Maintainers
Readme
nepsehub
A TypeScript library and command-line tool (CLI) for accessing real-time and historical Nepal Stock Exchange (NEPSE) market data directly from official exchange endpoints.
Quick Start
Use with npx (No installation required)
# Get live quote for Nabil Bank
npx nepsehub stock NABIL
# View NEPSE market summary and indices
npx nepsehub market
# View top gainers of the session
npx nepsehub gainersInstall Globally as CLI
npm install -g nepsehubExecutable name nepsehub is now available globally:
nepsehub stock NABIL
nepsehub market
nepsehub gainers
nepsehub losers
nepsehub active
nepsehub history NABIL --limit 10
nepsehub search "Bank"Install as Library in your Project
npm install nepsehub
# or
pnpm add nepsehub
# or
yarn add nepsehubLibrary API Reference
1. getQuote(symbol: string)
Fetches the latest trading metrics for a given stock ticker symbol.
import { getQuote } from 'nepsehub';
async function main() {
const quote = await getQuote('NABIL');
console.log(quote);
}
main();Response (StockQuote):
{
"symbol": "NABIL",
"securityId": 131,
"companyName": "Nabil Bank Limited",
"sector": "Commercial Banks",
"lastTradedPrice": 545,
"closePrice": 545,
"openPrice": 550,
"highPrice": 552,
"lowPrice": 544.2,
"previousClose": 548.5,
"pointChange": -3.5,
"percentageChange": -0.64,
"totalTradedQuantity": 38251,
"totalTradedValue": 20904592.3,
"totalTrades": 416,
"fiftyTwoWeekHigh": 568,
"fiftyTwoWeekLow": 471,
"averageTradedPrice": 546.51,
"lastUpdatedTime": "2026-08-21 14:59:58.028540000",
"activeStatus": "A"
}2. getMarketSummary()
Fetches the overall NEPSE market turnover, volume, transactions, and major index values.
import { getMarketSummary } from 'nepsehub';
const summary = await getMarketSummary();
console.log(`NEPSE Index: ${summary.indices.nepse.currentValue} (${summary.indices.nepse.percentageChange}%)`);
console.log(`Total Turnover: Rs. ${summary.totalTurnoverRs.toLocaleString('en-IN')}`);3. getHistory(symbol: string, options?: HistoryOptions)
Retrieves historical OHLCV price records for a stock.
import { getHistory } from 'nepsehub';
// Get last 15 trading days
const history = await getHistory('NABIL', { limit: 15 });
history.forEach((h) => {
console.log(`${h.date} | Close: ${h.close} | Vol: ${h.volume}`);
});4. searchStocks(query: string)
Searches actively listed NEPSE companies by ticker symbol or full company name.
import { searchStocks } from 'nepsehub';
const banks = await searchStocks('Bank');
console.log(`Found ${banks.length} bank securities.`);5. Top Movers (getTopGainers, getTopLosers, getMostActive)
import { getTopGainers, getTopLosers, getMostActive } from 'nepsehub';
const [gainers, losers, active] = await Promise.all([
getTopGainers(),
getTopLosers(),
getMostActive(),
]);CLI Commands & Options
nepsehub -V, --version
Check the currently installed version of nepsehub.
nepsehub -Vnepsehub stock <symbol>
Get real-time quote for a stock.
nepsehub stock NABIL
nepsehub stock SHIVM --json
nepsehub stock NABIL --watch --interval 3000nepsehub market
Get market overview, indices, total turnover and status.
nepsehub market
nepsehub market --jsonnepsehub history <symbol>
Get historical OHLCV data with trend sparkline.
nepsehub history NABIL --limit 30
nepsehub history GBIME --jsonnepsehub search <query>
Search stocks by symbol or company name.
nepsehub search Microfinance
nepsehub search Hydronepsehub gainers & nepsehub losers
List top 10 price gainers / losers of the day.
nepsehub gainers
nepsehub losersnepsehub active
List top 10 most active stocks by trading turnover.
nepsehub activeTesting & Development
Run unit test suite with Vitest:
npm testBuild library and CLI distribution bundles:
npm run buildLicense
MIT License. Copyright (c) 2026.
