NEPSE Client Documentation
Welcome to NEPSE Client’s documentation! This is a comprehensive, production-ready unofficial Python client library for interacting with the Nepal Stock Exchange (NEPSE) API.
Warning
DISCLAIMER: This is an UNOFFICIAL library and is NOT affiliated with, endorsed by, or officially connected to Nepal Stock Exchange Limited (NEPSE) or any of its subsidiaries.
This library is provided for educational and informational purposes only. Always verify critical data with official NEPSE sources at https://www.nepalstock.com.np
Use at your own risk. See License for full disclaimers.
Overview
NEPSE Client provides both synchronous and asynchronous interfaces to access market data, company information, trading details, and more from the Nepal Stock Exchange.
Key Features
✨ Dual API Support - Both synchronous and asynchronous clients
🔒 Smart Token Management - Automatic authentication with token refresh
📊 Complete API Coverage - Access all NEPSE endpoints
🛡️ Robust Error Handling - Comprehensive exception hierarchy
📝 Full Type Hints - Complete type annotations for IDE support
🔄 Automatic Retry Logic - Built-in exponential backoff
📈 Progress Tracking - Optional progress bars
🧪 Well Tested - Comprehensive test suite with >80% coverage
🚀 Production Ready - Battle-tested and optimized
Quick Example
Synchronous usage:
from nepse_client import NepseClient
# Initialize client
client = NepseClient()
# Get market status
status = client.getMarketStatus()
print(f"Market is: {status['isOpen']}")
# Get company details
nabil = client.getCompanyDetails('NABIL')
print(f"NABIL LTP: {nabil['lastTradedPrice']}")
Asynchronous usage:
import asyncio
from nepse_client import AsyncNepseClient
async def main():
async with AsyncNepseClient() as client:
# Concurrent requests
status, summary = await asyncio.gather(
client.getMarketStatus(),
client.getSummary()
)
print(f"Market: {status['isOpen']}")
print(f"Turnover: {summary['totalTurnover']}")
asyncio.run(main())
Installation
Install from PyPI:
pip install nepse-client
Or install from source:
git clone https://github.com/4mritgiri/NepseClient.git
cd nepse-client
pip install -e .
Documentation Contents
Getting Started
Usage Examples
API Reference
- API Reference
- nepse_client Package
NepseClientAsyncNepseClientNepseErrorNepseClientErrorNepseServerErrorNepseAuthenticationErrorNepseNetworkErrorNepseValidationErrorNepseBadGatewayErrorNepseRateLimitErrorNepseDataNotFoundErrorNepseTimeoutErrorNepseConnectionErrorNepseConfigurationError- Main Classes
- Package Metadata
- Submodules
- Client Classes
- Exception Handling
NepseErrorNepseClientErrorNepseAuthenticationErrorNepseBadGatewayErrorNepseServerErrorNepseNetworkErrorNepseValidationErrorNepseRateLimitErrorNepseDataNotFoundErrorNepseTimeoutErrorNepseConnectionErrorNepseConfigurationErrorget_exception_for_status()- Exception Hierarchy
- Base Exception
- Client Errors
- Authentication Errors
- Server Errors
- Network Errors
- Rate Limiting
- Data Errors
- Configuration Errors
- Error Handling Best Practices
Additional Information
Project Links
GitHub Repository: https://github.com/4mritgiri/NepseClient
PyPI Package: https://pypi.org/project/nepse-client/
Issue Tracker: https://github.com/4mritgiri/NepseClient/issues
Discussions: https://github.com/4mritgiri/NepseClient/discussions
Support
If you find this library helpful:
⭐ Star the repository on GitHub
🐛 Report bugs and issues
💡 Suggest new features
🤝 Contribute code improvements
📢 Share with others
Indices and Tables
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Nepal Stock Exchange for providing the API
All contributors who have helped improve this library
The Python community for excellent tools and libraries