Trade carries the option greeks delta, gamma, theta and vega, refreshed every pulse from the
datafeed. They come in two scales: per-unit and per-contract.
Per-unit vs per-contract
delta, gamma, theta, vega are the per-unit greeks straight from the instrument’s market
data. delta_contract, gamma_contract, theta_contract, vega_contract scale each by the trade’s
unit count (the position’s signed size in underlying units):
units is quantity directly when the trade was sized in units, or quantity * contract_size when
it was sized in lots (is_lots=True). So a per-unit delta of 0.5 on a 10-contract position with a
contract size of 100 gives a delta_contract of 0.5 * 10 * 100 = 500 - the position’s actual
directional exposure in underlying units.
Each has a matching per-pulse history aligned to the trade’s
datetimes: delta_history /
delta_contract_history, and likewise for gamma, theta and vega.
Beside them, underlying_price_history records the raw price the greeks were taken against (the
option’s underlying, or a future’s or spot’s own price) and iv_history the option’s implied vol
(None for a future or spot).
Futures greeks
Only options carry real greeks. For any non-option instrument - a future - the greeks are fixed values: delta1.0, gamma 0.0, theta 0.0, vega 0.0 per unit. A long future therefore
contributes a delta_contract equal to its unit count and contributes nothing to gamma, theta or
vega, which is what you want when using futures to delta-hedge an option book.
Per-unit greeks on a future are constants, not market dataA future’s delta is
1.0 by construction, not read from a model. Its delta_contract still scales
with units, so a hedge of N units of the future offsets N units of option delta.Aggregation
The portfolio keeps no greek aggregate; net book exposure is the sum of per-contract greeks over open trades,sum(t.delta_contract for t in self.open_trades), computed where you need it.
get_trades_summary_by_tags(...) returns a
TradesSummary with aggregated greeks for a tagged group of trades (delta, delta_contract,
gamma, gamma_contract, theta, vega). See the API reference for the exact aggregation fields.
Related: Orders, trades and the broker ·
Portfolio, equity and PnL · Metrics and Stats ·
Architecture and the pulse loop
