Skip to main content

Minimal, production-ready Python library for ingesting historical NSE India data - Indices, Equity, and Derivatives with yfinance-style API

Project description

nsefeed

nsefeed logo

Minimal, production-ready Python library for NSE India historical data

Python 3.9+ License

A reliable NSE India API wrapper focused on historical data, inspired by yfinance's intuitive API design.


✨ Features

  • yfinance-style Ticker API - Familiar, intuitive interface
  • Reliable CSV-based data - Historical data from NSE archives (95%+ uptime)
  • Clean modular structure - Following nselib's proven pattern
  • Comprehensive coverage - Indices, Equity, and Derivatives historical data
  • Production-ready - Caching, rate limiting, proper error handling
  • Type hints - Full IDE support with type annotations

📦 Installation

pip install nsefeed

🚀 Quick Start

Ticker API (yfinance-style)

import nsefeed as nf

# Fetch historical data for a stock
ticker = nf.Ticker("RELIANCE")
df = ticker.history(period="1M")
print(df.head())

# Download multiple tickers
data = nf.download(["RELIANCE", "TCS", "INFY"], period="1M")

Indices Module

import nsefeed as nf

# Get index constituent stocks (WORKING)
stocks = nf.indices.constituent_stock_list("BroadMarketIndices", "Nifty 50")

# Get list of all indices in a category (WORKING)
indices = nf.indices.index_list("SectoralIndices")

# Historical index OHLC data (UNDER DEVELOPMENT - see limitations below)
# df = nf.indices.index_data("NIFTY 50", period="1M")  # Currently unavailable
# vix = nf.indices.india_vix_data(period="1M")  # Currently unavailable

Equity Module

import nsefeed as nf

# Get price, volume, and deliverable position data
df = nf.equity.get_price_volume_and_deliverable_position_data(
    "RELIANCE", period="1M"
)

# Get bulk deals
bulk = nf.equity.get_bulk_deal_data(period="1D")

# Get block deals
block = nf.equity.get_block_deals_data(period="1D")

# Get short selling data
short = nf.equity.get_short_selling_data(period="1D")

Derivatives Module

import nsefeed as nf

# Get futures data
futures = nf.derivatives.get_future_price_volume_data(
    "NIFTY", "FUTIDX", period="1M"
)

# Get options data
options = nf.derivatives.get_option_price_volume_data(
    "NIFTY", "OPTIDX", "CE", period="1M"
)

# Get F&O bhav copy
bhav = nf.derivatives.get_fno_bhav_copy("01-12-2024")

📊 Module Structure

nsefeed/
├── indices/          # Index data (NIFTY, sectoral, thematic indices)
├── equity/           # Equity historical data, bulk/block deals
├── derivatives/      # F&O historical data, bhav copy
├── ticker.py         # yfinance-style Ticker class
├── cache.py          # SQLite caching
├── session.py        # NSE session management
└── utils.py          # Utility functions

🎯 Design Philosophy

nsefeed focuses on reliable historical data using CSV-based NSE endpoints:

  • Not a live market data library - We focus on historical data from NSE archives
  • CSV over JSON APIs - More reliable and less prone to breaking changes
  • Quality over quantity - Only functions that work reliably
  • Clean and minimal - Following nselib's proven modular structure
  • Familiar API - yfinance-style interface for ease of use

📝 Available Data

Indices

  • ✅ Index constituent lists
  • ✅ Sectoral, thematic, and strategy indices listing
  • ⚠️ Historical OHLCV for indices (under development - NSE API deprecated)
  • ⚠️ India VIX historical data (under development - NSE API deprecated)

Equity

  • Historical price, volume, and deliverable position data
  • Bulk deals and block deals
  • Short selling data

Derivatives

  • Futures price and volume data
  • Options price and volume data (CE/PE)
  • F&O bhav copy (end-of-day snapshots)

⚠️ Known Limitations

Historical Index Data (Under Development)

Functions affected:

  • nf.indices.index_data() - Returns NotImplementedError
  • nf.indices.india_vix_data() - Returns NotImplementedError

Reason: NSE India has deprecated their historical index data API endpoints. These functions are under development as we work on alternative data sources.

Workaround: Use constituent stocks to track index movement:

import nsefeed as nf

# Get NIFTY 50 constituent stocks
stocks = nf.indices.constituent_stock_list("BroadMarketIndices", "Nifty 50")

# Fetch data for individual stocks
for symbol in stocks['Symbol'][:10]:
    df = nf.Ticker(symbol).history(period="1M")
    print(f"{symbol}: {len(df)} days of data")

Working functions:

  • nf.Ticker().history() - Equity historical data (fully functional)
  • nf.equity.* - All equity functions (fully functional)
  • nf.derivatives.* - All derivatives functions (fully functional)
  • nf.indices.constituent_stock_list() - Index constituents (fully functional)
  • nf.indices.index_list() - List of indices (fully functional)

📖 Documentation

For detailed documentation, see:

🤝 Contributing

Contributions are welcome! This library is designed to be minimal and focused on reliable historical data from NSE.

📄 License

Apache License 2.0 - See LICENSE for details

🙏 Acknowledgments

⚠️ Disclaimer

This is an unofficial library. NSE India does not provide official APIs. This library uses publicly available data from NSE website and archives. Use at your own risk.


Made with ❤️ for the Indian financial data community

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

nsefeed-1.0.1.tar.gz (221.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nsefeed-1.0.1-py3-none-any.whl (59.2 kB view details)

Uploaded Python 3

File details

Details for the file nsefeed-1.0.1.tar.gz.

File metadata

  • Download URL: nsefeed-1.0.1.tar.gz
  • Upload date:
  • Size: 221.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for nsefeed-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c37d8a39246569793b7e8b4b24a960fdebf21950f3ef22cf5f14fe5f3512b26b
MD5 f187e05846e6ffb594b4c578f2061df5
BLAKE2b-256 2d8358988178669bac7fc346d99d5e0b4c901585baccad4097a92ec5f8cf76f3

See more details on using hashes here.

File details

Details for the file nsefeed-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: nsefeed-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 59.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for nsefeed-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ad6855c22e3d45dd6716b1ba12e4b06abef1a9b8bce58efea4d1d6962644b759
MD5 27b130a1c0822575e9637618fc130766
BLAKE2b-256 051adfded120c3cd4672ccfb07bdff602dac63584bdc70dedbc25de431edf395

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