Skip to main content

A clean Python library for fetching Indian stock market data from NSE India

Project description

📈 Nifty Terminal

A comprehensive Python library for NSE India market data

Access Index, Equity, ETF, Commodity & Historical data from official NSE India APIs

PyPI Version Python Versions License


✨ Features

Category Features
🏛️ Market Market status, trading hours
📊 Indices List, quotes, historical OHLCV, PE/PB/DY ratios, constituents
📈 Equities Complete stock list, quotes, historical data
💰 ETFs All ETFs with smart asset categorization (Gold, Silver, Index, International)
🪙 Commodities Commodity list, spot prices, historical data
📉 VIX India VIX historical data

🚀 Quick Start

Installation

pip install niftyterminal

Basic Usage

from niftyterminal import get_market_status, get_index_historical_data

# Check if market is open
status = get_market_status()
print(f"Market is {status['marketStatus']}")

# Get NIFTY 50 historical data with PE/PB/DY
data = get_index_historical_data("NIFTY 50", "2025-01-01", "2025-12-31")
for row in data['indexData']:
    print(f"{row['date']}: Close={row['close']}, PE={row['PE']}")

📚 Table of Contents


📖 API Reference

get_market_status()

Get the current Capital Market status from NSE India.

from niftyterminal import get_market_status

status = get_market_status()
print(status)
📤 Output
{
  "marketStatus": "Close",
  "marketStatusMessage": "Market is Closed"
}
Field Description
marketStatus Current status: "Open", "Close", etc.
marketStatusMessage Detailed status message

Index Functions

get_index_list()

Get the master list of all indices with their category and derivatives eligibility.

from niftyterminal import get_index_list

data = get_index_list()
📤 Output
{
  "indexList": [
    {
      "indexName": "NIFTY 50",
      "subType": "Broad Market Indices",
      "derivativesEligiblity": true
    },
    {
      "indexName": "NIFTY BANK",
      "subType": "Broad Market Indices",
      "derivativesEligiblity": true
    }
  ]
}
Field Description
indexName Full name of the index
subType Category: Broad Market, Sectoral, Thematic, Strategy, Fixed Income
derivativesEligiblity true if eligible for F&O trading

get_all_index_quote()

Get comprehensive quote data for all indices including OHLC, valuation metrics (PE/PB/DY), and historical comparison data.

from niftyterminal import get_all_index_quote

data = get_all_index_quote()
📤 Output
{
  "timestamp": "02-Jan-2026 15:30",
  "indexQuote": [
    {
      "indexName": "NIFTY 50",
      "date": "2026-01-02",
      "open": 26155.1,
      "high": 26340,
      "low": 26118.4,
      "ltp": 26328.55,
      "prevClose": 26146.55,
      "change": 182,
      "percentChange": 0.7,
      "pe": "22.92",
      "pb": "3.58",
      "dy": "1.28",
      "oneWeekAgoPercentChange": 1.1,
      "30dAgoPercentChange": 1.14,
      "365dAgoPercentChange": 10.89
    }
  ]
}
Field Description
ltp Last traded price
percentChange Percentage change from previous close
pe / pb / dy PE ratio, PB ratio, Dividend Yield
oneWeekAgoPercentChange Percent change from 1 week ago
30dAgoPercentChange Percent change from 30 days ago
365dAgoPercentChange Percent change from 365 days ago

get_index_historical_data(index_symbol, start_date, end_date)

Get historical OHLC and valuation data (PE, PB, Dividend Yield) for any index.

Parameter Type Required Description
index_symbol str Index name (e.g., "NIFTY 50", "NIFTY BANK")
start_date str Start date in YYYY-MM-DD format
end_date str End date in YYYY-MM-DD format (defaults to today)
from niftyterminal import get_index_historical_data

# With date range
data = get_index_historical_data("NIFTY 50", "2025-01-01", "2026-01-03")

# Without end date (defaults to today)
data = get_index_historical_data("NIFTY BANK", "2024-01-01")
📤 Output
{
  "indexData": [
    {
      "indexName": "NIFTY 50",
      "date": "2025-01-10",
      "open": 23551.9,
      "high": 23596.6,
      "low": 23344.35,
      "close": 23431.5,
      "volume": 261022434,
      "PE": 21.59,
      "PB": 3.49,
      "divYield": 1.28
    }
  ]
}
Field Description
date Trading date in YYYY-MM-DD format
open / high / low / close OHLC prices
volume Total traded volume
PE / PB / divYield Valuation metrics

get_index_stocks(index_name)

Get the list of constituent stocks for an index.

Parameter Type Required Description
index_name str Index name (e.g., "NIFTY 50", "NIFTY BANK")
from niftyterminal import get_index_stocks

data = get_index_stocks("NIFTY 50")
📤 Output
{
  "indexName": "NIFTY 50",
  "date": "2026-01-02",
  "stockList": [
    {
      "symbol": "COALINDIA",
      "companyName": "Coal India Limited",
      "industry": "Coal",
      "listingDate": "2010-11-04",
      "isin": "INE522F01014",
      "isFNOSec": true,
      "isSLBSec": true
    }
  ]
}
Field Description
symbol Stock ticker symbol
companyName Full company name
industry Industry sector
isFNOSec Eligible for F&O trading

get_vix_historical_data(start_date, end_date)

Get historical India VIX data.

Parameter Type Required Description
start_date str Start date in YYYY-MM-DD format
end_date str End date in YYYY-MM-DD format (defaults to today)
from niftyterminal import get_vix_historical_data

data = get_vix_historical_data("2025-01-01", "2025-04-16")
📤 Output
{
  "vixData": [
    {
      "indexName": "INDIA VIX",
      "date": "2025-04-11",
      "open": 21.43,
      "high": 21.43,
      "low": 18.855,
      "close": 20.11
    }
  ]
}
Field Description
date Trading date in YYYY-MM-DD format
open / high / low / close VIX OHLC values

get_all_etfs()

Get list of all ETFs with smart asset categorization for easy filtering.

from niftyterminal import get_all_etfs

data = get_all_etfs()

# Filter by asset type
gold_etfs = [e for e in data['etfs'] if e['underlyingAsset'] == 'GOLD']
nifty_50_etfs = [e for e in data['etfs'] if e['underlyingAsset'] == 'NIFTY_50']
📤 Output
{
  "date": "2026-01-02",
  "etfs": [
    {
      "symbol": "NIFTYBEES",
      "companyName": "Nippon India ETF Nifty BeES",
      "assetType": "EquityIndex",
      "underlyingAsset": "NIFTY_50",
      "indexVariant": "TRI",
      "listingDate": "2002-01-08",
      "isFNOSec": true
    }
  ]
}
Field Values
assetType Commodity, EquityIndex, DebtIndex, Liquid, International
underlyingAsset GOLD, SILVER, NIFTY_50, SENSEX, NASDAQ_100, etc.
indexVariant TRI, EqualWeight, Momentum, Quality, Value, LowVol, Alpha

get_stocks_list()

Get the complete list of all listed stocks on NSE.

from niftyterminal import get_stocks_list

data = get_stocks_list()
print(f"Total stocks: {len(data['stockList'])}")
📤 Output
{
  "stockList": [
    {
      "symbol": "20MICRONS",
      "companyName": "20 Microns Limited",
      "series": "EQ",
      "listingDate": "2008-10-06",
      "isin": "INE144J01027",
      "faceValue": 5
    }
  ]
}
Field Description
symbol Stock ticker symbol
companyName Full company name
series Trading series: EQ, BE, BZ
listingDate Date of listing (YYYY-MM-DD)
faceValue Face value of share

Commodity Functions

get_commodity_list()

Get the list of all commodity symbols from NSE.

from niftyterminal import get_commodity_list

data = get_commodity_list()
print([c['symbol'] for c in data['commodityList']])
# Output: ['ALUMINI', 'GOLD', 'SILVER', 'CRUDEOIL', ...]

get_commodity_historical_data(symbol, start_date, end_date)

Get historical spot price data for a commodity.

Parameter Type Required Description
symbol str Commodity symbol (e.g., "GOLD1G", "SILVER")
start_date str Start date in YYYY-MM-DD format
end_date str End date (defaults to today)
from niftyterminal import get_commodity_historical_data

data = get_commodity_historical_data("GOLD1G", "2025-12-28", "2026-01-04")
📤 Output
{
  "commodityData": [
    {
      "symbol": "GOLD1G",
      "unit": "1 Grams",
      "spotPrice1": 13442,
      "spotPrice2": 13460,
      "date": "2026-01-02"
    }
  ]
}
Field Description
symbol Commodity symbol
unit Unit of measurement
spotPrice1 / spotPrice2 Spot prices
date Date (YYYY-MM-DD)

⚠️ Disclaimer

[!CAUTION]

  • This library is not affiliated with, endorsed by, or associated with the National Stock Exchange of India (NSE) or any other financial institution.
  • It does not provide financial, trading, or investment advice. Verify data independently before making financial decisions.
  • It only retrieves publicly available data without authentication or bypassing security measures.
  • Users are responsible for ensuring compliance with applicable laws and the data provider's terms of service.
  • Use at your own risk.

📄 License

MIT License © 2025


Made with ❤️ for the Indian trading 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

niftyterminal-0.1.0.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

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

niftyterminal-0.1.0-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file niftyterminal-0.1.0.tar.gz.

File metadata

  • Download URL: niftyterminal-0.1.0.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for niftyterminal-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1e3ce3bb22ec4d9e8ecc0f1ee92cba633132f1e8e91bd652198d6a9d7246e0fd
MD5 3032c97f0d57a57933dac88d8ae7e5c3
BLAKE2b-256 f73907e25ede4b4bdbe1da3e5be8e446fb2e124222f0e0d9735f3a15047183c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for niftyterminal-0.1.0.tar.gz:

Publisher: pypi-publish.yml on mwsurjith/niftyterminal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file niftyterminal-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: niftyterminal-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for niftyterminal-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b12de431faa80cb21b1e0e6efa799ec7da33be297d84baeff2b48a613f1b7a1
MD5 dae61ef225c8d76654649aa5a5ed1337
BLAKE2b-256 a3f85118a5b5c5c9b4bdc3075e4acad6023f5fc889300fed04a3eb425dc2a301

See more details on using hashes here.

Provenance

The following attestation bundles were made for niftyterminal-0.1.0-py3-none-any.whl:

Publisher: pypi-publish.yml on mwsurjith/niftyterminal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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