Binomial option tree
Cox-Ross-Rubinstein binomial prices of European and American calls and puts with a dividend yield, with delta and gamma from the tree.
- Model id
derivatives.binomial_tree, version 1- Domain
- Derivatives
- Evidence
- standard
- Cost class
- light: A short numerical method; a hosted run may take up to 10 seconds.
Formula
Where
- The price ratio of a move up
up_factor - The price ratio of a move down
- The risk-neutral probability of a move up
up_probability - Volatility of the asset's return per year
volatility - The length of one step, in years: the time to expiry over the steps
- Risk-free rate per year, continuously compounded
risk_free_rate - Dividend yield per year, continuously compounded
dividend_yield - The option's value at step i after j moves up
- Price of the underlying asset now
spot - Delta: the change in price per unit of spot
delta - Gamma: the change in delta per unit of spot
gamma
Each symbol's field is named beside it; the inputs and outputs, with their units and bounds, are under Variables, and the citations give each formula's source.
Variables
Rates, returns and yields are decimals: 0.05 is five percent. Bounds in brackets include their end; in parentheses they exclude it.
Inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Option typeoption_typetext | text | A call (the right to buy) or a put (to sell) | |
Exerciseexercisetext | text | European (at expiry only) or American (at any step) exercise | |
Spotspotmoney · [0.01, 1e+07] | money | [0.01, 1e+07] | Price of the underlying asset now |
Strikestrikemoney · [0.01, 1e+07] | money | [0.01, 1e+07] | Strike price |
Yearsyearsyears · [0.001, 100] | years | [0.001, 100] | Time to expiry, in years |
Risk free raterisk_free_raterate · [-0.1, 1] | rate | [-0.1, 1] | Risk-free rate per year, continuously compounded |
Dividend yielddividend_yieldrate · [-0.1, 1] | rate | [-0.1, 1] | Dividend yield per year, continuously compounded |
Volatilityvolatilityvolatility · [0.01, 5] | volatility | [0.01, 5] | Volatility of the asset's return per year |
Stepsstepscount · [2, 5000] | count | [2, 5000] | Number of time steps in the tree |
Outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Pricepricemoney · [0, 1e+15] | money | [0, 1e+15] | Option price |
Deltadeltaratio · [-100000, 100000] | ratio | [-100000, 100000] | Change in price per unit of spot, across the first step |
Gammagammaratio · [-1e+12, 1e+12] | ratio | [-1e+12, 1e+12] | Change in delta per unit of spot, across the second step |
Up factorup_factorratio · (1, 1e+16] | ratio | (1, 1e+16] | Price ratio of a move up: e^(sigma sqrt(dt)) |
Up probabilityup_probabilityprobability · (0, 1) | probability | (0, 1) | Risk-neutral probability of a move up |
Calculator
Run the model on your own inputs, starting from its example. Rates are decimals: 0.05 is five percent. The run goes to the pyeconomics API on this site: your values travel only in the request, and nothing is stored.
Loading the calculator…
Worked example
Example five_step_american_put. Inputs:
{
"dividend_yield": 0,
"exercise": "american",
"option_type": "put",
"risk_free_rate": 0.1,
"spot": 50,
"steps": 5,
"strike": 50,
"volatility": 0.4,
"years": 0.4167
}Outputs:
{
"delta": -0.4145265585690454,
"gamma": 0.03414423922432854,
"price": 4.488599193823382,
"up_factor": 1.1224060865016658,
"up_probability": 0.5073195842891595
}Assumptions
- The asset's price moves up by u or down by d = 1/u each step; in the limit of many steps it follows geometric Brownian motion.
- The risk-free rate, dividend yield and volatility are constant; rates and the yield are continuously compounded.
- An American option may be exercised at any node, the first included.
Limitations
- Results are the tree's outputs for the inputs given, not a valuation of a traded contract or trading advice.
- The price converges to the continuous-time value as the steps grow, with an error that oscillates; it is not exact for any finite tree.
- A drift r - q that outruns the volatility over a step puts the up-probability outside (0, 1), and a top node above e^700 overflows; both raise DomainError.
- Discrete dividends and time-varying rates or volatility are out of scope.
Evidence
Status: standard. Textbook consensus, such as bond duration or the CAPM formula.
Every model declares one status: standard (textbook consensus), practitioner (a widely used convention), contested (under active debate), rejected (failed out of sample) or historical (a superseded methodology).
Syllabus
The 2027 CFA® Program's topic areas this model relates to, as factual tags. Each links to CFA Institute's page for its level; pyeconomics holds none of the curriculum's text.
Citations
- Cox, J. C., Ross, S. A. and Rubinstein, M. (1979). Option Pricing: A Simplified Approach. Journal of Financial Economics, 7(3), 229-263. doi:10.1016/0304-405X(79)90015-1 (The multiplicative binomial model, its risk-neutral probability and the limit u = e^(sigma sqrt(dt)))
- Hull, J. C. (2018). Options, Futures, and Other Derivatives, 10th ed. Pearson. https://openlibrary.org/isbn/9780134472089 (Chapters 13 and 21 (binomial trees; the five-step American put and its delta and gamma from the tree)). ISBN 9780134472089
Changelog
- Version 1: First version.
Use it elsewhere
- Documentation
- The model's reference page
- REST API
GET or POST /v1/models/derivatives.binomial_tree/run- MCP tool
derivatives_binomial_tree, orrun_modelwith the model's id; both give the same result. Connect an assistant- Command line
pyeconomics models run derivatives.binomial_tree --help
The worked example, from Python and from the command line:
import pyeconomics
inputs = {
"dividend_yield": 0,
"exercise": "american",
"option_type": "put",
"risk_free_rate": 0.1,
"spot": 50,
"steps": 5,
"strike": 50,
"volatility": 0.4,
"years": 0.4167,
}
result = pyeconomics.run("derivatives.binomial_tree", inputs)
print(result.to_json())
pyeconomics models run derivatives.binomial_tree --inputs - <<'JSON'
{
"dividend_yield": 0,
"exercise": "american",
"option_type": "put",
"risk_free_rate": 0.1,
"spot": 50,
"steps": 5,
"strike": 50,
"volatility": 0.4,
"years": 0.4167
}
JSON