Skip to main content

stockseyes

Official Stockseyes SDK for Python — real-time Indian stock market (NSE/BSE) quotes, instrument search, and market data, served through the Stockseyes APIs on RapidAPI.

Zero runtime dependencies. Uses only Python's built-in urllib. Ships with inline type annotations (PEP 561).

Install

pip install stockseyes

Requires Python ≥ 3.10.

Quickstart

from stockseyes import use_stockeyes, StockEyesConfig

client = use_stockeyes(StockEyesConfig(api_key="your-rapidapi-key"))

quote = client.quote("RELIANCE")
print(f"{quote.symbol}  ₹{quote.price}  ({quote.change_percent:.2f}%)")

Getting an API key

  1. Subscribe to the Stockseyes API on RapidAPI.
  2. Copy your X-RapidAPI-Key from the RapidAPI dashboard.
  3. Pass it to StockEyesConfig(api_key=...).

⚠️ Keep your key server-side

Your RapidAPI key is a secret. Never expose it in client-side or public code.

  • Do: use this SDK in a backend service / API route / script.
  • If you must call from the browser: put a proxy in front of RapidAPI and point the SDK at it with the base_url option.

API

use_stockeyes(config) → StockEyesClient

Config Type Default Description
api_key str — Required. Your RapidAPI key (x-rapidapi-key).
host str | None Stockseyes RapidAPI host Bare RapidAPI host (x-rapidapi-host).
base_url str | None https://<host>/v1 Override the request base URL (e.g. to point at your proxy).
timeout_s float 10.0 Per-request timeout in seconds.

client.quote(symbol, exchange="NSE") → Quote

q = client.quote("TCS", "NSE")
# Quote(symbol, name, price, change, change_percent, open, high, low,
#       volume, market_cap, timestamp, currency, exchange)

client.batch_quote(symbols, exchange="NSE") → dict

Fetches many quotes sequentially; per-symbol failures are returned, not raised.

batch = client.batch_quote(["RELIANCE", "TCS", "INFY"])
for symbol, data in batch.items():
    if isinstance(data, dict) and "error" in data:
        print(f"{symbol}: {data['error']}")
    else:
        print(f"{symbol}: ₹{data.price}")

client.search(term, options=None) → SearchResult

results = client.search("REL", SearchOptions(limit=10, offset=0))
for i in results.results:
    print(f"{i.symbol} — {i.name}")

Error handling

Every failed request raises a typed StockEyesError so you can react programmatically:

from stockseyes import use_stockeyes, StockEyesError, is_stockeyes_error

try:
    quote = client.quote("RELIANCE")
except StockEyesError as err:
    match err.code:
        case "rate_limit":  ...  # back off (HTTP 429)
        case "auth":        ...  # bad/expired key (401/403)
        case "not_found":   ...  # unknown symbol (404)
        case "timeout":     ...  # exceeded timeout_s
        case "network":     ...  # connection failed
        case _:             ...  # other HTTP error — see err.status

StockEyesError exposes code ('rate_limit' | 'auth' | 'not_found' | 'http' | 'network' | 'timeout') and status (HTTP status, or 0 for network/timeout).

Development

cd python
pip install -e ".[dev]"
pytest -v

License

MIT © Tushar Singhal

Metadata

Release files for stockseyes 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stockseyes 0.2.0
File Size Uploaded Provenance Actions
stockseyes-0.2.0.tar.gz 12.6 kB Without provenance Details for stockseyes-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stockseyes 0.2.0
File Interpreter ABI Platform Actions
stockseyes-0.2.0-py3-none-any.whl Python 3 none any Details for stockseyes-0.2.0-py3-none-any.whl

Total release size: 24.2 kB

Release files / stockseyes-0.2.0.tar.gz

Download URL stockseyes-0.2.0.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
20f7e411466da795b032b036c6928e797e9c56fdad118eab878c4b25aa5cc641
BLAKE2b-256 checksum
How to use checksums
1aa5c99c5938190bb61bb9079867de6846404b478ec644ad2abae7ebe7f83c71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / stockseyes-0.2.0-py3-none-any.whl

Download URL stockseyes-0.2.0-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cac393796838256db8f9781b7046d6a2c5cb8b19cd8ad946d1222c16ce9f0982
BLAKE2b-256 checksum
How to use checksums
ba5d3e240bdbdfe38f5e668e0d98b37009e1fccd2032ee69fe8b0a8056ab4320
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Security for stockseyes 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page