Skip to main content

An API for Nepali stock data from Sharsansar For NEPSE Stock

Project description

ShareSansar API 📈

Python Version License GitHub stars

An API for Nepali stock market data For NEPSE Market.

✨ Features

  • 🐍 Familiar API for Python developers
  • 📊 Historical data - Get stock data for any date range
  • 🔢 Multiple symbols - Download data for multiple stocks at once
  • 📅 Flexible date ranges - Support for various period formats
  • Easy to use - Simple, intuitive API design
  • 🇳🇵 Nepali stocks - Focused on Nepal Stock Exchange (NEPSE)

📦 Notes

  • More Section will be added soon in new updates

📦 Installation

pip install sharesansar-api

# Usage Guide

This file provides instructions and examples for using the `sharesansar-api` library.

---

## 1. Installation

First, install the package using pip:

```bash
pip install sharesansar-api

2. 🚀 Quick Start

Here are the most common commands to get you started immediately.

import sharesansar as ss

# Single stock (yfinance style)
nabil = ss.Ticker("NABIL")
info = nabil.info()
history = nabil.history(period="1w")

# Multiple stocks
data = ss.download(["NABIL", "SCB", "NICA"], period="1m")

# Market data for specific date
market_data = ss.get_market_data("2024-12-20")

3. 📚 Usage Examples

Detailed examples for specific use cases.

Get Stock Information

import sharesansar as ss

ticker = ss.Ticker("NABIL")
info = ticker.info()

print(f"LTP: {info['ltp']}")
print(f"Change: {info['change']} ({info['change_percent']}%)")

Historical Data

import sharesansar as ss

# Various period formats
data_1w = ss.Ticker("SCB").history(period="1w")
data_1m = ss.Ticker("NICA").history(period="1m")
data_custom = ss.Ticker("KBL").history(start="2024-01-01", end="2024-12-31")

Multiple Stocks

import sharesansar as ss

# Download multiple stocks
symbols = ["NABIL", "SCB", "NICA", "NMB", "KBL"]
data = ss.download(symbols, period="1w")

Market Overview

import sharesansar as ss

# Get all available symbols
symbols = ss.get_available_symbols()
print(f"Total stocks: {len(symbols)}")

# Get complete market data for the latest day
market_data = ss.get_market_data()

4. 🛠️ API Reference

A quick reference for available classes and functions.

Ticker Class

  • Ticker(symbol): Create a stock ticker object.
  • ticker.info(): Get current stock information.
  • ticker.history(period, start, end): Get historical data.

Module Functions

  • download(symbols, period): Download multiple stocks.
  • history(symbol, start, end): Get historical data for a single stock.
  • get_stock_info(symbol): Get detailed stock info.
  • get_market_data(date): Get market-wide data (latest if date is omitted).
  • get_available_symbols(): List all stock symbols.

Period Options

Valid strings for the period parameter:

  • "1d" - One day
  • "1w" - One week
  • "1m" - One month
  • "3m" - Three months
  • "6m" - Six months
  • "1y" - One year
  • "ytd" - Year to date

5. 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

6. 📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


7. 🙏 Acknowledgments

  • ShareSansar.com for providing the data.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sharesansar_api-0.2.0.tar.gz (11.2 kB view details)

Uploaded Source

File details

Details for the file sharesansar_api-0.2.0.tar.gz.

File metadata

  • Download URL: sharesansar_api-0.2.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for sharesansar_api-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3c42234a97c1774e43a69b17e503134b5cab41ecfe7f0772681f129f55ffcdec
MD5 60d92ade7e29366c8384f91bb6045825
BLAKE2b-256 031bc49e173392823bbc3ea76b58b1d2fa04f446c0f5263495defdb8dbad0489

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page