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. Follows semantic versioning: the public surface will not change incompatibly without a major version bump.

Install

pip install options-analysis-suite

Quickstart

from oas import OASClient, SchwabCredentials, TastytradeCredentials, TradierCredentials

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

    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=...)
    )
    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 v2 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.1.1

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.1.1
File Size Uploaded
options_analysis_suite-1.1.1.tar.gz 110.0 kB Details

Built distribution (wheel)

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

Total release size: 149.1 kB

Release files / options_analysis_suite-1.1.1.tar.gz

Download URL options_analysis_suite-1.1.1.tar.gz
Size 110.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0119f5bd655428c5cf8a6f638231e3755b5511010314a70dc3847b3f089d8a62
BLAKE2b-256 checksum
How to use checksums
ed970fb9f7e633766e331468ccf376c2b6fe83f468c994133d0ed14866c6b9ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 7, 2026.

Transparency log

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

Download URL options_analysis_suite-1.1.1-py3-none-any.whl
Size 39.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a29b3554fd505bad676d712244a09c0845aad5d30178f25bd94ffd69e476389
BLAKE2b-256 checksum
How to use checksums
8b3bd9e297519c2c5c1d01a44731957778c8e059902549de6d4c600d53b174ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.1

2 release files

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