Option price calculator
calculate_option_priceCompute an option's theoretical price and greeks (delta, gamma, vega, theta) for a given volatility and underlying price, using IBKR's pricing model. Ideal for scenario analysis.
Instructions
Compute an option's theoretical price and greeks at a given volatility, with IBKR's model.
`contract` must be one option (sec_type OPT or FOP with symbol, expiry, strike and
right, or its con_id; futures options also need their exchange, e.g. CME). Returns
`option_price` per share (multiply by the contract multiplier for the premium) and
the greeks (delta, gamma, vega, theta, dividend present value). Useful for
scenarios: vary volatility or underlying_price.
Errors: invalid_request when the contract is not an option, volatility looks like a
percent (above 10), or IBKR computed no price; not_found or ambiguous_contract when
the option cannot be resolved; request_timeout when IBKR does not answer within 4
seconds; ib_api_error if IBKR refuses (e.g. missing market data permissions).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contract | Yes | The instrument. A con_id alone is unambiguous; otherwise give symbol and sec_type, plus expiry, strike and right for options. | |
| volatility | Yes | Annualized volatility as a decimal: 0.25 means 25% (not 25). | |
| underlying_price | Yes | Underlying price to assume, e.g. the stock's current price. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| greeks | Yes | IBKR's full model output at that price: delta, gamma, vega, theta... | |
| contract | Yes | The option the calculation ran for. | |
| volatility | Yes | Volatility the price assumes, as a decimal. | |
| option_price | Yes | Theoretical option price, per share (unmultiplied). | |
| underlying_price | Yes | Underlying price the calculation assumed. |