Skip to main content

A powerful, stealthy unofficial NSE India API wrapper.

Project description

PNSEA - Python NSE API

Overview

PNSEA is a Python library for fetching data from the National Stock Exchange of India (NSE). It provides easy access to stock market data, options chains, insider trading reports, mutual fund data, and more.

Features

  • Fetch real-time equity data (CMP, historical data, market status, etc.).
  • Get insider trading reports, pledged data, and SAST data.
  • Retrieve option chain data for stocks and indices.
  • Fetch mutual fund insider data.
  • Autocomplete search queries for NSE symbols.
  • Endpoint tester for API debugging.

Installation

pip install pnsea

Usage

Initialize the NSE Instance

from pnsea import NSE

nse = NSE()

Fetch Equity Data

# Get current market price of SBIN
print(nse.equity.info("SBIN")['priceInfo']['lastPrice'])

# Fetch historical data
print(nse.equity.history("ESCORTS", "01-02-2025", "14-02-2025"))

# Get market status
print(nse.equity.market_status())

Fetch Insider Trading Data

# Get general insider trading data
print(nse.insider.insider_data())

# Get insider trading data with date range
print(nse.insider.insider_data(from_date="11-12-2023", to_date="14-02-2025"))

# Get insider trading data for a specific company
print(nse.insider.insider_data("SBIN"))

# Get insider trading data for a specific company with date range
print(nse.insider.insider_data("INFY", from_date="11-12-2023", to_date="14-02-2025"))

# Get pledged data for a single company
print(nse.insider.getPledgedData("ESCORTS"))

# Get SAST data for a single company
print(nse.insider.getSastData("ESCORTS"))

# Get SAST data for a single company with date range
print(nse.insider.getSastData("INFY", from_date="01-01-2024", to_date="01-02-2025"))

Options Expiry Dates

# All expiries from symbol
print(nse.options.expiry_dates("NIFTY"))

Fetch Option Chain Data

# Get option chain for NIFTY - all data
print(nse.options.option_chain("NIFTY")[0])

# Get option chain for NIFTY - by expiry date
print(nse.options.option_chain("NIFTY", expiry_date="06-Mar-2025")[0])

# Get option chain for NIFTY - by strike price
print(nse.options.option_chain("NIFTY", strike_price=22000)[0])

# Get option chain for NIFTY - by expiry date & strike price
print(nse.options.option_chain("NIFTY", expiry_date="06-Mar-2025", strike_price=22000)[0])

# Get option chain for NIFTY - All Expiries
print(nse.options.option_chain("NIFTY")[1])

# Get option chain for NIFTY - Underlying Value
print(nse.options.option_chain("NIFTY")[2])

Fetch Mutual Fund Data

#Get mutual fund insider data with date range
print(nse.mf.mf_insider_data(from_date="01-02-2025", to_date="02-02-2025"))

#Get mutual fund insider data by ISIN
print(nse.mf.mf_insider_data(isin="INF879O01027"))

#Get mutual fund insider data by symbol
print(nse.mf.mf_insider_data(symbol="PPFAS Mutual Fund"))

Autocomplete Search

# Search for NSE symbols
print(nse.autocomplete("Info"))

Author

Written by Anil Sardiwal

License

MIT License

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

pnsea-1.0.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

pnsea-1.0.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file pnsea-1.0.0.tar.gz.

File metadata

  • Download URL: pnsea-1.0.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for pnsea-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6327cd7156f25be995a10cb8322c845cc85c9cdddaabedf281bf4bb8c7efbd5b
MD5 72dac90665532045409b8a4c142c24da
BLAKE2b-256 7d5c06834f7ff97b6a723be3d7591c58aad3e4aab448b5a95adc61a811e8f1b3

See more details on using hashes here.

File details

Details for the file pnsea-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pnsea-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for pnsea-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d4153dc7ab540b5147bd7ed05d8328846c85a5d96cd1833cee2221fcbfe134c4
MD5 64e61837e1e7312a8dd8c32f81892e46
BLAKE2b-256 e5b9f724c694cddcc44876a8203d4d429ddb46955b9dc1286cb109183265d81a

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