Option analytics in Python
Price options, calculate Greeks, solve implied volatility and identify market regimes with morphiq-sdk.
1. Get your API key
Create an account, verify your email, set up your plan and create an API key. Copy its secret when shown, then set it in the terminal where you will run Python:
export MORPHIQ_API_KEY="YOUR_API_KEY"Replace YOUR_API_KEY with the secret, not the public key ID. MorphIQ() reads this variable and uses https://api.morphiqlabs.com automatically. A newly created key can take a few minutes to become active. See key storage and rotation.
2. Install the SDK
Use Python 3.11 or newer. In Bash or Zsh:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install morphiq-sdkOn Windows, activate with .venv\Scripts\Activate.ps1 and set the key with $env:MORPHIQ_API_KEY="YOUR_API_KEY" in PowerShell. The core SDK needs no Yahoo, pandas or notebook dependencies.
3. Price an option
Save this as price_option.py. It prices a synthetic European call with spot and strike of 100, one year to expiry, 20% annual volatility, a 5% annual interest rate and no dividend yield.
from morphiq_sdk import MorphIQ, PriceRequest
request = PriceRequest(
exercise_style="european",
option_type="call",
spot=100.0,
strike=100.0,
time_to_expiry_years=1.0,
risk_free_rate=0.05,
dividend_yield=0.0,
volatility=0.20,
)
with MorphIQ() as client:
response = client.price(request)
print(response.model_dump_json(indent=2, exclude_unset=True))python price_option.pyThis sends one authenticated pricing request using your account’s allowance and prints the response. Example output from the SDK’s recorded synthetic fixture:
{
"result": {
"price": 10.450583572185538,
"exercise_style": "european",
"option_type": "call",
"pricing_model": "black_scholes_merton",
"model_version": "black_scholes_merton/1"
},
"metadata": {
"request_id": "fixture-european",
"api_version": "v1",
"engine_version": "0.39.1",
"engines": [
{
"name": "morphiq-risk",
"version": "0.39.1",
"revision": "b4c29d492ff96dddf9b25f745d2be4d253202164"
}
],
"units_charged": 1,
"compute_schedule_version": "2026-09-11"
}
}Read result.price for the value per share and metadata.request_id for support. Prices and strike share a currency; rates and volatility are decimals. Your live response supplies its own request and engine identities.
The open-mode fixture above has no commercial charge field. When reported, metadata.fcu_charged is the commercial CU charge; units_charged is a separate internal measure. A missing commercial charge is unreported, not zero.
Choose your next analysis
- Option pricing — Choose European or American exercise and a pricing model.
- Greeks — Calculate ten sensitivities with documented units and scaling.
- Implied volatility — Solve volatility from an observed option premium.
- Combined analytics — Get the supported combined analysis in one server request.
- Batch workflows — Process ordered contracts with per-item outcomes and exact reported CU totals.
- Market regimes — Analyze ordered prices and interpret availability, labels and scores.
Use the Python API reference for sync/async methods and typed requests, and the executable cookbook for complete scripts. Batches retain ordered successes and failures; optional concurrency is explicit.
Open an analysis workspace
With Docker running and MORPHIQ_API_KEY set in the same terminal, build the notebooks from the release checkout:
git clone --branch v0.1.0 https://github.com/MorphIQ-Labs/morphiq-sdk-python.git
cd morphiq-sdk-python
docker compose up --buildOpen the token-authenticated local URL printed by Jupyter. Start Here links to option pricing and regime analysis. Run all cells once to display the controls, then use the labeled action buttons to submit API requests.
Pricing includes exercise/model selectors, Yahoo underlying prices, Greeks and implied volatility. Regime analysis accepts a ticker and daily or intraday prices. Yahoo is an optional companion provider; you can supply your own data to the SDK.
Compose passes the API key into the container. Setup and control changes make no MorphIQ requests; action buttons show request counts. Notebook edits persist in a named volume. Stop with Ctrl-C and docker compose down. See notebook setup, networking and persistence.
Errors and compatibility
For 401, check the secret and key status. For 403, check the account and operation entitlement; for 402, check the account allowance. A 429 exposes retry guidance when supplied by the server. The SDK does not automatically retry requests: a timeout can occur after work is charged. See error handling and recovery.
This example is verified against SDK 0.1.0. The contract guide records the pinned API identity; compatibility policy describes the pre-1.0 version series. The API is in beta and its contract is still evolving. SDK package releases identify installable artifacts; they do not mark the API as stable.
Report client defects in the SDK issue tracker. For account, key or billing help, contact support@morphiqlabs.com with the request ID. Keep API keys and private inputs out of reports.