Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 NEPSE API by Diwas Khatri - The Ultimate Unofficial Nepal Stock Exchange API

FastAPI Python PyPI MIT License

NEPSE API by Diwas Khatri is a comprehensive, high-performance, and unofficial API designed specifically for the Nepal Stock Exchange (NEPSE). Developed and maintained by Diwas Khatri, this API provides seamless access to real-time market data, historical records, and deep market insights for developers, traders, and financial analysts. Whether you're building a new application, conducting research, or simply tracking the Nepali stock market, this API offers robust and reliable data.


🔥 Key Features of NEPSE API by Diwas Khatri

  • Real-time Data: Get live stock prices, Last Traded Price (LTP), and current market status directly from NEPSE.
  • 📊 Full Market Coverage: Access Today's Price, various Indices, Sub-Indices, and detailed Floorsheet data.
  • 🏢 Company Insights: Retrieve complete lists of companies, securities, and in-depth market depth information.
  • 🔝 Performance Tracking: Identify Top Gainers, Losers, Turnover, Volume, and Transaction data with ease.
  • 🛠️ Developer First: Enjoy standardized JSON responses, interactive Swagger UI documentation, and straightforward integration into your projects.
  • 🛡️ Advanced Scraping: The API handles complex NEPSE authentication and WASM-based token parsing automatically, ensuring consistent data flow.
  • 🔄 Multiple Headers: Utilizes User-Agent rotation to prevent blocking and maintain uninterrupted access to NEPSE data.

🚀 Quick Start with NEPSE API by Diwas Khatri

1. Installation

Install api-nepse directly from PyPI:

pip install api-nepse

2. Run the API Server

After installation, you can run the API server using the api-nepse command:

api-nepse

The API will be live at http://localhost:8080.


💻 Code Examples

Python Example

import requests

# Get Today's Price using NEPSE API by Diwas Khatri
response = requests.get("http://localhost:8080/api/v1/market/today-price")
data = response.json()

if data["status"] == "success":
    for record in data["data"]:
        print(f"{record["symbol"]}: {record["lastTradedPrice"]}")

JavaScript (Fetch) Example

fetch("http://localhost:8080/api/v1/market/live")
  .then(response => response.json())
  .then(data => console.log(data.data))
  .catch(error => console.error("Error:", error));

🌐 How to Host Your NEPSE API by Diwas Khatri

1. Local Hosting

Simply run api-nepse on your local machine. Ensure port 8080 is open.

2. Cloud Hosting (Heroku / Render / Railway)

  1. Fork this repository.
  2. Connect your GitHub to the hosting platform.
  3. Set the start command to:
    uvicorn api_nepse.main:app --host 0.0.0.0 --port $PORT

3. Docker Hosting

Use the following Dockerfile:

FROM python:3.9
RUN pip install api-nepse
EXPOSE 8080
CMD ["api-nepse"]

📖 API Endpoints

👉 http://localhost:8080/docs

Category Endpoint Description
Market GET /api/v1/market/status Check if market is OPEN/CLOSED
Market GET /api/v1/market/today-price Full Today's Price sheet
Market GET /api/v1/market/live Real-time live stock prices
Indices GET /api/v1/indices All NEPSE Indices
Performers GET /api/v1/top/gainers Top 10 Gaining stocks
Advanced GET /api/v1/market/floorsheet Latest Floorsheet data

👨‍💻 Developed by Diwas Khatri (Balochleader)


📜 License

This project is licensed under the MIT License.

⚠️ Disclaimer

This is an unofficial API. Use for informational purposes only. Not affiliated with NEPSE. All data is provided as-is and should not be used for financial decisions. Always consult with a professional financial advisor.

About

NEPSE API by Diwas Khatri: Comprehensive Python API for real-time Nepal Stock Exchange (NEPSE) data. Developed by Diwas Khatri for market analysis, data retrieval, and application integration. Optimized for developers and researchers. Keywords: NEPSE API, Diwas Khatri, Nepal Stock Exchange, Python, Stock Market, Balochleader.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages