Skip to main content

Options Analysis Suite: Python SDK

PyPI version Python versions License: MIT

Type-safe Python client for the Options Analysis Suite API.

Status: stable (1.0). Full coverage of every typed /v1/* operationId, plus a Calibration domain helper. Drift-checked against the deployed OpenAPI spec. The SDK follows the API, so a minor release can carry an incompatible change when the API makes one (1.6.0 and 1.7.0 did): the CHANGELOG marks each such change Breaking, so read those bullets before upgrading.

Install

pip install options-analysis-suite

Quickstart

from oas import MoomooCredentials, OASClient, SchwabCredentials, TastytradeCredentials, TradierCredentials

with OASClient(api_key="oas_live_...") as client:
    # Data: cached EOD analytics
    snap = client.snapshot("SPY")
    print(snap.atmIv, snap.maxPain, snap.exposure)

    if snap.maxPainCurve:
        for row in snap.maxPainCurve:
            print(row.strike, row.totalPain)

    # Compute: 17 pricing models, full Greeks, exposure, expected move...
    price = client.price(model="bs", is_call=True, S=650, K=650, r=0.05,
                         q=0.012, sigma=0.15, t=0.25)
    greeks = client.greeks(model="heston", is_call=True, S=650, K=650, r=0.05,
                           q=0.012, sigma=0.15, t=0.25)

    # Calibrate once, persist, reuse: never re-touches the calibrationId TTL.
    cal = client.calibrate(
        "SPY", model="heston",
        broker=TradierCredentials(token="..."),
        # Or TastytradeCredentials(refresh_token=..., client_secret=...)
        # or SchwabCredentials(refresh_token=..., client_id=..., client_secret=...)
        # or MoomooCredentials(sealed_token=...)  # the API token from the moomoo card
    )
    cal.save("spy_heston.json")

    # Evaluate the calibrated model anywhere across the chain.
    fair = cal.price(is_call=True, K=655, expiry="2026-06-19")

    # Stream batched metrics without manually paging.
    for m in client.iter_metrics(["SPY", "QQQ", "IWM", "DIA"], batch_size=50):
        print(m.symbol, m.ivRank)

Monte Carlo distributions

When model="mc", pass detail="distribution" to receive the full terminal-price distribution (percentiles + histogram) alongside the scalar price, or detail="full" to additionally receive the (subsampled) raw paths. detail="summary" is the default and matches the byte-identical shape any older caller already sees, plus an mcStats block (stdError + 95% CI + effective path count).

res = client.price(
    model="mc", detail="distribution",
    is_call=True, S=650, K=650, r=0.05, q=0.012, sigma=0.15, t=0.25,
)
print(res.price, res.mcStats.stdError)
print(res.distribution.percentiles.p50, res.distribution.percentiles.p95)

Sensitivity sweeps under Heston

client.sensitivity(...) returns the full 17-Greek set per point under Black-Scholes by default. Pass model="heston" together with the fitted Heston parameters (typically from a recent client.calibrate(...) call) to swap the per-point price to the Heston Fourier value and add a modelGreeks block with derivatives w.r.t. the five Heston parameters.

cal = client.calibrate("SPY", model="heston",
                       broker=TradierCredentials(token="..."))
sweep = client.sensitivity(
    is_call=True, S=650, K=650, r=0.05, sigma=0.15, t=0.25,
    axis="spot", model="heston", model_params=cal.params,
)
for row in sweep.data:
    print(row.x, row.delta, row.modelGreeks.dV0, row.modelGreeks.dRho)

Calibration round-trip

A Calibration is the durable wrapper around a /v1/compute/calibrate result. The fitted params dict survives a JSON round-trip; the 30-second-only calibrationId is intentionally not surfaced.

# Load a saved calibration in another process / hours later.
from oas import Calibration, OASClient

cal = Calibration.from_json("spy_heston.json")
with OASClient(api_key="oas_live_...") as client:
    cal.bind(client)  # attach so cal.price() / cal.greeks() can fire HTTP
    price = cal.price(is_call=True, K=650, S=650, r=0.05, q=0.012,
                      sigma=0.15, t=0.25)

Errors

Every error subclass carries the HTTP status, the server's structured code field (when present), and any extra fields the server returned.

from oas.errors import NotFoundError, RateLimitError, CalibrationQuotaError

try:
    snap = client.snapshot("UNKNOWN")
except NotFoundError as e:
    print(f"warehouse miss: {e}")
except RateLimitError as e:
    print(f"slow down, retry in {e.retry_after}s (bucket: {e.bucket})")
except CalibrationQuotaError as e:
    print(f"calibration quota exhausted; resets at {e.resets_at}")

The full hierarchy: OASError → AuthenticationError, ValidationError, PermissionDeniedError (with .required_scope), NotFoundError, RateLimitError (with .retry_after, .bucket), CalibrationQuotaError (with .resets_at), ConcurrencyLimitError (with .current, .max), ServerError.

Models

Response objects are typed Pydantic models. Import them from oas._generated.models for type hints. The classes use extra='ignore' so additive server fields (e.g., a new metric in MetricsResponse) don't break older SDK versions; older SDKs simply omit unknown fields.

License

MIT licensed.

Metadata

Release files for options-analysis-suite 1.7.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 options-analysis-suite 1.7.0
File Size Uploaded Provenance Actions
options_analysis_suite-1.7.0.tar.gz 170.7 kB With provenance Details for options_analysis_suite-1.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for options-analysis-suite 1.7.0
File Interpreter ABI Platform Actions
options_analysis_suite-1.7.0-py3-none-any.whl Python 3 none any Details for options_analysis_suite-1.7.0-py3-none-any.whl

Total release size: 218.1 kB

Release files / options_analysis_suite-1.7.0.tar.gz

Download URL options_analysis_suite-1.7.0.tar.gz
Size 170.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a300c55346d69d74bda0e755cbad037ca7ca9af7b197ac529fe55da14f613e76
BLAKE2b-256 checksum
How to use checksums
6791bd07bbdc0a17341b4c202f962d3a608ecb46801694fb589d01be85ad4d5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / options_analysis_suite-1.7.0-py3-none-any.whl

Download URL options_analysis_suite-1.7.0-py3-none-any.whl
Size 47.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a255c2e1a314f55e26ec33d3d776ac47fe9388a6d36d96152306eae112b9c22
BLAKE2b-256 checksum
How to use checksums
14a8b715ef418bf8f4e0babe596a6a7b5871ffdef8c296854929d708260dda9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Security for options-analysis-suite 1.7.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for options_analysis_suite-1.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

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.

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