Options pricing and volatility analysis from the terminal.
Define a position as a TOML file, then plot its payoff at expiration or sweep any Black-Scholes input against any output — all rendered as ASCII charts, no notebook or GUI required.
pip install -e .A position is a title plus one or more contracts:
title = "Long Straddle"
[[contracts]]
type = "Call"
position = "BUY"
price = 5
expiration = "2023-01-01"
strike = 40
[[contracts]]
type = "Put"
position = "BUY"
price = 5
expiration = "2023-01-01"
strike = 40type is Call or Put; position is BUY or SELL. Ten common structures ship in
strategies/ — long and short calls, puts, straddles, strangles, and butterflies.
Plot the payoff diagram at expiration:
options parity-graph strategies/long_straddle.toml --underlying-max 100Sweep one Black-Scholes input against one output across the whole position:
options info-graph strategies/long_call.toml -x volatility -y contract_priceBoth axes accept any of:
- Inputs:
underlying_price,expiration,volatility,interest - Outputs:
contract_price,delta,gamma,theta,vega,rho
So -x underlying_price -y delta traces the delta curve of the combined position;
-x volatility -y contract_price traces its vega exposure.
options/pricing.py is a from-scratch Black-Scholes implementation — prices and the
full first- and second-order Greeks for both calls and puts, using only the standard
library. options/portfolio.py aggregates across every contract in a position, so the
curves reflect the whole structure rather than a single leg.
See LICENSE.