Live stock prices with OHLCV data (updated during market hours)
Every 30 min (Sun-Fri, market hours)
~140KB
/data/market_status.json
GET
Market open/closed status with last check timestamp
Every 30 min (Sun-Fri, market hours)
<1KB
/data/indices.json
GET
Major NEPSE indices (NEPSE, Sensitive, Float)
Every 30 min (Sun-Fri, market hours)
~2KB
/data/sector_indices.json
GET
Sector-wise index performance and metadata
Every 30 min (Sun-Fri, market hours)
~5KB
/data/top_stocks.json
GET
Top gainers, losers, turnover, and volume leaders
Every 30 min (Sun-Fri, market hours)
~3KB
/data/market_summary.json
GET
Key market metrics (turnover, trades, scrips)
Every 30 min (Sun-Fri, market hours)
~1KB
/data/market_summary_history.json
GET
Historical daily market summary data
Every 30 min (Sun-Fri, market hours)
~100KB
/data/notices.json
GET
General, company, and exchange notices
Every 30 min (Sun-Fri, market hours)
~20KB
/data/disclosures.json
GET
Company disclosures and announcements
Every 30 min (Sun-Fri, market hours)
~15KB
/data/exchange_messages.json
GET
Exchange announcements and circulars
Every 30 min (Sun-Fri, market hours)
~8KB
/data/brokers.json
GET
Complete broker directory with contact info
Conditional (about every 60 days)
~25KB
/data/all_securities.json
GET
Master list of all securities with metadata
Conditional (about every 60 days)
~30KB
/data/supply_demand.json
GET
Supply and demand book for all securities
Every 30 min (Sun-Fri, market hours)
~10KB
/data/upcoming_ipo.json
GET
Current and upcoming IPO announcements
Daily
~3KB
/data/oldipo.json
GET
Historical IPO archive
Daily
~5KB
/data/proposed_dividend/latest_1y.json
GET
Latest proposed dividend records (rolling 1-year snapshot)
Daily
~105KB
/data/proposed_dividend/history_all_years.json
GET
Append-only proposed dividend history across all fiscal years
Daily
~1.3MB
/data/proposed_dividend/meta.json
GET
Run metadata: mode, counts, and smoke-check status
Daily
<1KB
/data/nepse_sector_wise_codes.json
GET
Sector to security symbol mapping
Weekly
~8KB
Expected Formats
Formats below are based on current repository outputs and may include additional fields over time.
GET/data/nepse_data.jsonarray<stock>
Live market data with OHLCV, turnover, and real-time pricing. Updated every 30 minutes during market hours (11AM-3PM NST, Sun-Thu). Contains all active securities with current trading information.
Map of sector name to securities list. Useful for filtering and grouping.
shape
{
"Commercial Banks": [
{ "symbol": "ADBL", "name": "Agriculture Development Bank Limited" }
],
"Hydro Power": [
{ "symbol": "AHPC", "name": "Arun Valley Hydropower Development Co. Ltd." }
]
}
API Testing & Playground
Test endpoints directly from your browser with these interactive tools.
GETTest Market DataInteractive
Click to test the main market data endpoint and see live results.
Live Response
GETTest Market StatusQuick Check
Check if the market is currently open and get the last update time.
Live Response
Note: These tests make live API calls to your GitHub Pages deployment
CORS: All endpoints support cross-origin requests
Data Schema & Field Reference
Detailed field descriptions and data types for all endpoints.
nepse_data.json Schema
{
"symbol": "string", // Stock symbol (e.g., "NABIL")
"name": "string", // Full company name
"ltp": "number", // Last traded price
"previous_close": "number", // Previous closing price
"change": "number", // Absolute price change
"percent_change": "number", // Percentage change
"high": "number", // Day's highest price
"low": "number", // Day's lowest price
"volume": "integer", // Number of shares traded
"turnover": "number", // Total turnover in NPR
"trades": "integer", // Number of transactions
"last_updated": "datetime", // ISO timestamp of last update
"market_cap": "number" // Market capitalization in crores
}
Key Insights
ltp: The most recent traded price during market hours
turnover: Total value of all trades (volume × average price)
market_cap: In crores of NPR (1 crore = 10 million)
last_updated: Shows when data was last scraped
market_summary.json Schema
[
{
"detail": "string", // Description of the metric
"value": "number" // Metric value
}
]
Common Metrics
"Total Turnover Rs:" - Daily market turnover in NPR
"Total Traded Shares:" - Number of shares traded
"Total Transactions:" - Number of trades executed
"Traded Scrips:" - Number of securities with trades
indices.json Schema
{
"index": "string", // Index name (e.g., "NEPSE")
"generatedTime": "datetime", // When data was generated
"close": "number", // Current index value
"high": "number", // Day's highest value
"low": "number", // Day's lowest value
"previousClose": "number", // Previous closing value
"change": "number", // Absolute change
"perChange": "number", // Percentage change
"currentValue": "number" // Current market value
}
Available Indices
NEPSE - Main market index
Sensitive Index - Large-cap focused index
Float Index - Based on publicly traded shares
Sensitive Float Index - Combined sensitive & float
Understand HTTP response codes and implement proper error handling in your applications.
HTTP Status Codes
// 200 OK - Request successful
// 404 Not Found - Endpoint doesn't exist or file missing
// 500 Server Error - Temporary server issues
// Example error handling in JavaScript
async function fetchMarketData() {
try {
const response = await fetch('https://shubhamnpk.github.io/nepse-scaper/data/nepse_data.json');
if (!response.ok) {
if (response.status === 404) {
console.error('Data not available - market may be closed');
return [];
}
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Failed to fetch market data:', error);
return null;
}
}
Rate LimitingBest Practices
Implement responsible data fetching to ensure fair usage and reliability.
Rate Limiting Example
// Recommended: Cache data and refresh periodically
class MarketDataCache {
constructor() {
this.cache = new Map();
this.cacheTimeout = 5 * 60 * 1000; // 5 minutes
}
async getData(endpoint) {
const cached = this.cache.get(endpoint);
const now = Date.now();
if (cached && (now - cached.timestamp) < this.cacheTimeout) {
return cached.data;
}
try {
const response = await fetch(endpoint);
const data = await response.json();
this.cache.set(endpoint, {
data,
timestamp: now
});
return data;
} catch (error) {
// Return cached data if available on error
return cached ? cached.data : null;
}
}
}
Tip: Cache responses for 5 minutes to reduce server load
Warning: Always handle 404s for market-hours-only endpoints
Timing: Market hours: 11:00 AM - 3:00 PM NST (Sun-Thu)
Performance & Caching Strategies
Optimize your applications with these performance recommendations and caching patterns.
CachingPerformance
Implement smart caching to reduce API calls and improve response times.
Advanced Caching Strategy
class NEPSECacheManager {
constructor() {
this.cache = new Map();
this.cacheTimes = new Map();
this.marketHoursCache = 5 * 60 * 1000; // 5 minutes during market hours
this.offMarketCache = 30 * 60 * 1000; // 30 minutes off market hours
}
async getData(endpoint, forceRefresh = false) {
const cacheKey = endpoint;
const now = Date.now();
const cached = this.cache.get(cacheKey);
const cacheTime = this.cacheTimes.get(cacheKey);
// Check if cache is valid
if (!forceRefresh && cached && cacheTime) {
const age = now - cacheTime;
const maxAge = await this.getCacheDuration();
if (age < maxAge) {
console.log(`Cache hit for ${endpoint} (${Math.round(age/1000)}s old)`);
return cached;
}
}
// Fetch fresh data
try {
const response = await fetch(`https://shubhamnpk.github.io/nepse-scaper/data/${endpoint}`);
const data = await response.json();
// Update cache
this.cache.set(cacheKey, data);
this.cacheTimes.set(cacheKey, now);
console.log(`Fresh data fetched for ${endpoint}`);
return data;
} catch (error) {
console.error(`Error fetching ${endpoint}:`, error);
// Return cached data if available on error
return cached || null;
}
}
async getCacheDuration() {
try {
const status = await this.getData('market_status.json');
return status.is_open ? this.marketHoursCache : this.offMarketCache;
} catch {
return this.offMarketCache; // Default to longer cache
}
}
// Preload common endpoints
async preloadData() {
const endpoints = ['nepse_data.json', 'indices.json', 'market_summary.json'];
await Promise.all(endpoints.map(endpoint => this.getData(endpoint)));
}
// Clear cache manually
clearCache(endpoint = null) {
if (endpoint) {
this.cache.delete(endpoint);
this.cacheTimes.delete(endpoint);
} else {
this.cache.clear();
this.cacheTimes.clear();
}
}
}
Rate LimitingBest Practices
Implement rate limiting and request batching to be a good API citizen.
Rate Limiting Implementation
class NEPSERateLimiter {
constructor(maxRequests = 10, windowMs = 60000) { // 10 requests per minute
this.maxRequests = maxRequests;
this.windowMs = windowMs;
this.requests = [];
}
async waitForSlot() {
const now = Date.now();
// Clean old requests
this.requests = this.requests.filter(time => now - time < this.windowMs);
// Check if we can make a request
if (this.requests.length < this.maxRequests) {
this.requests.push(now);
return;
}
// Calculate wait time
const oldestRequest = Math.min(...this.requests);
const waitTime = this.windowMs - (now - oldestRequest);
if (waitTime > 0) {
console.log(`Rate limit reached, waiting ${Math.round(waitTime/1000)}s`);
await new Promise(resolve => setTimeout(resolve, waitTime));
return this.waitForSlot(); // Retry
}
}
}
// Usage with queue for multiple requests
class NEPSEQueue {
constructor() {
this.rateLimiter = new NEPSERateLimiter();
this.queue = [];
this.processing = false;
}
async add(endpoint, priority = 0) {
return new Promise((resolve, reject) => {
this.queue.push({ endpoint, priority, resolve, reject });
this.queue.sort((a, b) => b.priority - a.priority);
this.processQueue();
});
}
async processQueue() {
if (this.processing || this.queue.length === 0) return;
this.processing = true;
while (this.queue.length > 0) {
const item = this.queue.shift();
try {
await this.rateLimiter.waitForSlot();
const response = await fetch(`https://shubhamnpk.github.io/nepse-scaper/data/${item.endpoint}`);
const data = await response.json();
item.resolve(data);
} catch (error) {
item.reject(error);
}
}
this.processing = false;
}
}
Performance Tip: Cache for 5 minutes during market hours, 30 minutes after hours
Memory: Consider memory usage when caching large datasets
Timing: Schedule updates just after market opens for freshest data
Integration Examples
Complete examples for common integration scenarios.