optionda
Terminal options desk: manage small multi-account option books, freeze IV, and reprice on live underlying prints.
pip install optionda
# or from this repo:
pip install -e ./optionda
MODEL marks only — delayed/indicative data, not executable quotes.
Quick start (no API key)
Requires Python 3.11+.
py -3.11 -m venv .venv
source .venv/Scripts/activate
pip install -e .
# one-time (like conda init)
optionda init
eval "$(optionda shellenv)" # or open a new shell — default prompt: [optionda] (cyan)
optionda create demo
optionda activate demo # prompt → [demo]
optionda deactivate # prompt → [optionda]
optionda activate hedge # prompt → [hedge]
optionda add AAPL270115C00200000 --qty 2 --entry 5.20
# per-line qty + cost (semicolon batch):
optionda add "INTC 261016 140 C x10 @ 3.482; SKHY 261016 200 C x1 @ 9.5"
# easiest batch: bare add → paste lines → blank line to finish
optionda add
# INTC 261016 140 C x10 @ 3.482
# TSLA 261218 500 C x2 @ 5.75
# <empty line>
optionda export
optionda run
pip install cannot safely edit your shell config (unlike the Conda installer). Run optionda init once, then optionda activate <name> each session (like conda activate). Undo init with optionda init --reverse.
Without activate, export / run / add / delete cannot read or change any account book — only the session-active account is visible.
Cost is required on every add: use @ 5.20 on the line or --entry 5.20. Re-adding the same OCC+side merges qty and sets cost to the quantity-weighted average (q1·c1 + q2·c2) / (q1+q2).
add without --iv pulls IV from Alpaca (if key configured) or Yahoo. Use --iv only as fallback.
In the table, Model$ is the Black–Scholes theoretical premium (per share), Cost is your avg entry, and uPnL$ compares them. Not a live option bid/ask.
UI uses Rich (Panel, Rule, Table, Live spinner). No tqdm / popen required for the desk view.
Optional Alpaca key (15s refresh)
optionda key alpaca <KEY_ID> <SECRET> # verifies against Alpaca before saving
optionda key status # re-checks live credentials
optionda run # refresh every 15s
optionda key clear alpaca
key alpaca probes data.alpaca.markets (SPY latest trade). Invalid keys are not saved.
Credentials live in ~/.optionda/credentials.toml (mode 0600 when the OS allows). Override the data root with OPTIONDA_HOME.
Per-account tracking files (under the optionda data library, not your shell cwd):
Two separate write paths:
| Path | Role | Write mode |
|---|---|---|
~/.optionda/books/<account>.txt |
Current book only (human snapshot) | Overwrite on add/delete/refresh |
~/.optionda/logs/<account>.jsonl |
Full event stream for charts / history | Append only |
~/.optionda/surfaces/<underlying>.json |
Last valid Alpaca IV smile | Overwrite only on successful refresh-iv |
JSONL event types: add, merge, delete, refresh_iv, export, run.
refresh_iv records calibrated surface metadata. export/run rows include valuation_mode, surface_iv, and surface_as_of.
optionda add … # rewrite book + append add/merge event
optionda delete … # rewrite book + append delete event
optionda refresh-iv # calibrate Alpaca vendor-IV smiles while quotes are fresh
optionda export # print surface/frozen Model$ + append export mark
optionda run # each tick appends a run mark
Spot (24/5): Alpaca stock spots query overnight → boats → delayed_sip → iex and keep the newest trade/quote. Basic plans usually get overnight (≈Futu night session); boats needs a higher data tier.
Local overnight IV surface
Run optionda refresh-iv during the US option session, when Alpaca chain quotes are current. It collects valid Alpaca vendor-IV nodes, filters zero/wide/stale quotes, and saves a per-underlying expiry smile.
At night, run / export update the 24/5 stock Spot, use the saved expiry smile with sticky delta interpolation, and then reprice with Black–Scholes. The IVsrc column is surface when this succeeds and frozen when optionda falls back to the stored position IV. Surfaces older than 36 hours are not used.
This is a local, auditable model—not a copy of Futu's proprietary IV surface. Alpaca's free indicative chain is still the calibration input; OPRA improves the input only when the user has a subscription. optionda deliberately does not infer a new IV from frozen overnight option quotes.
# ~/.optionda/config.toml
alpaca_options_feed = "auto" # try opra, then indicative
For a paid match to exchange IV, subscribe to Alpaca OPRA.
Commands
| Command | Purpose |
|---|---|
optionda create <name> |
Create account |
optionda list |
List accounts (* = session-active) |
optionda book |
Show current positions (no fetch / no log write) |
optionda activate <name> |
Session-activate (prompt → cyan [name]) |
optionda deactivate |
Back to cyan [optionda] |
optionda init |
Persist hook in shell rc (like conda init) |
optionda add … |
Add with required cost; same OCC+side merges qty + avg cost |
optionda delete <id|OCC> |
Remove position |
optionda refresh-iv |
Calibrate local Alpaca IV smiles and refresh fallback IVs |
optionda run |
Live table until Ctrl+C |
optionda export |
One-shot snapshot |
optionda key … |
Configure Alpaca credentials |
Repository
Standalone project: github.com/ybenzou/optionda. Not part of the Next.js frontend app.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file optionda-0.1.0.tar.gz.
File metadata
- Download URL: optionda-0.1.0.tar.gz
- Upload date:
- Size: 52.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bda836ca4fb9f32245c5a5dd200edd48f122bd3be366f91f07e708fb7a97eeaf
|
|
| MD5 |
3c1c7572c1cb319146fd579f2180d285
|
|
| BLAKE2b-256 |
cc9b342c27428a4af12eb43ba00733abe26cd338ab1f673bcfb0f6fac115e11d
|
File details
Details for the file optionda-0.1.0-py3-none-any.whl.
File metadata
- Download URL: optionda-0.1.0-py3-none-any.whl
- Upload date:
- Size: 49.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e848f77764c2436117e7660f9f05b79c1bffdfffb3cf54ae0c43381f77f9e6bf
|
|
| MD5 |
070f07777af832e235b5939e8462d03d
|
|
| BLAKE2b-256 |
dd349271290c7a2d2796439e0ccdf75a4262b4f8216cf21f07b390abd11604c3
|