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.
- ⚡ 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.
Install api-nepse directly from PyPI:
pip install api-nepseAfter installation, you can run the API server using the api-nepse command:
api-nepseThe API will be live at http://localhost:8080.
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"]}")fetch("http://localhost:8080/api/v1/market/live")
.then(response => response.json())
.then(data => console.log(data.data))
.catch(error => console.error("Error:", error));Simply run api-nepse on your local machine. Ensure port 8080 is open.
- Fork this repository.
- Connect your GitHub to the hosting platform.
- Set the start command to:
uvicorn api_nepse.main:app --host 0.0.0.0 --port $PORT
Use the following Dockerfile:
FROM python:3.9
RUN pip install api-nepse
EXPOSE 8080
CMD ["api-nepse"]| 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 |
- 📸 Instagram: @DiwasKhatri07
- 💻 GitHub: DiwasKhatri07
- 🐦 Twitter: @DiwasKhatri07
This project is licensed under the MIT License.
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.