Skip to main content

NSDQ

  • Interacts with the NASDAQ API to retrieve asset-related data (quotes, historical data, option chains, etc.).

  • Retrieves real-time trade data and both raw and processed option chain data.

  • Calculates implied volatility and option Greeks using pricing models (e.g., Black-Scholes-Merton).

  • Provides dedicated functions to plot 2D & 3D representations of Greeks, option prices & implied volatilities over strike and time to expiry.

  • Guide is available here.

Requirements & Installation :

  • Requirements: requests, datetime, pandas, numpy, scipy, py_vollib_vectorized, matplotlib, re.
  • Install using: pip install NSDQ (https://pypi.org/project/NSDQ/)

Example:

import NSDQ

# Retrieve asset information (e.g., for AAPL)
Apple = NSDQ.Asset("AAPL", "stocks")
print(Apple.Informations())
# >>> {'Symbol': 'AAPL', 'Exchange': 'NASDAQ', 'Sector': 'Technology', ...}

# Get the asset's historical data as a DataFrame
historical_data = Apple.HistoricalData()
print(historical_data.head())

# Retrieve the most recent real-time trades (e.g., the last 5 trades)
RealtimeTrades = Apple.RealTime(NumberOfTrades=5)
print(RealtimeTrades)

# Retrieve the processed option chain data (for both calls and puts)
Options = Apple.Options(
    DataType="processed", 
    ExchangeCode="oprac", 
    Strategy="callput", 
    RiskFreeRate=0.04375,
)
print(OptionsChain.Data.head())
# Create and display 2D plots of Greeks vs Strike & Time to Expiry:
Options.Plot2D(Type='call')

# Create and display 3D plots of Greeks vs Strike & Time to Expiry:
Options.Plot3D(Type='call', ViewAngle=(15,45))

Note:

  • Implied Volatilities are calculated using the `py_vollib` library.
  • Outliers are identified using Median Absolute deviation (MAD).
  • An Implied Volatility Value is considered an outlier if:
  • \frac{X_i - \tilde{X}}{\mathrm{MAD}} > 3, \quad \text{where } \mathrm{MAD} = \mathrm{median}\left(|X_i - \tilde{X}|\right)
    
  • Greeks are then calculated for remaining options.

When plotting:

  • "Years Until Expiry" is converted into months and then rounded to the nearest multiple of 3.
  • "Contract Strike" is rounded down to the nearest multiple of 10.
  • The data is then grouped by these two new columns, and the mean of the specified column is computed for each group.
  • Important: This is a basic visualization; therefore, the results should be interpreted with caution.

Metadata

Release files for nasdaqFetcher 1.0.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 nasdaqFetcher 1.0.0
File Size Uploaded Provenance
nasdaqfetcher-1.0.0.tar.gz 14.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nasdaqFetcher 1.0.0
File Interpreter ABI Platform
nasdaqfetcher-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 29.4 kB

Release files / nasdaqfetcher-1.0.0.tar.gz

Download URL nasdaqfetcher-1.0.0.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
53c60b93d29476f7f857a55cca9a863aba1b44e31830bca2631a388cfdf87589
BLAKE2b-256 checksum
How to use checksums
2864a8163615f59c2dd94ff19edfda1e1e6c66c92bfe4667a1b66ca544e7afc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.2

Release files / nasdaqfetcher-1.0.0-py3-none-any.whl

Download URL nasdaqfetcher-1.0.0-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
467ec63b989146148c6235144229d3ed63ccb59e55136c4f617a11461ebfd839
BLAKE2b-256 checksum
How to use checksums
b061e7512f4a20e7e1816e8d1b16af96af4a1108cf6b85184a45ead967f36805
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.2

Security for nasdaqFetcher 1.0.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

1.0.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