Skip to content

Derivatives

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

u=eσΔt,d=1/u,p=e(r−q)Δt−du−du = e^{\sigma\sqrt{\Delta t}}, \quad d = 1/u, \quad p = \frac{e^{(r - q)\Delta t} - d}{u - d}Vi,j=e−rΔt[pVi+1,j+1+(1−p)Vi+1,j]V_{i,j} = e^{-r\Delta t}\left[p V_{i+1,j+1} + (1 - p) V_{i+1,j}\right]Vi,jAmerican=max⁡(Vi,j,payoff(Su2j−i))V_{i,j}^{\mathrm{American}} = \max\left(V_{i,j}, \text{payoff}(S u^{2j - i})\right)Δ=V1,1−V1,0Su−Sd,Γ=Δ2,up−Δ2,down(Su2−Sd2)/2\Delta = \frac{V_{1,1} - V_{1,0}}{S u - S d}, \quad \Gamma = \frac{\Delta_{2,\mathrm{up}} - \Delta_{2,\mathrm{down}}}{(S u^2 - S d^2)/2}

Where

uu
The price ratio of a move up up_factor
dd
The price ratio of a move down
pp
The risk-neutral probability of a move up up_probability
σ\sigma
Volatility of the asset's return per year volatility
Δt\Delta t
The length of one step, in years: the time to expiry over the steps
rr
Risk-free rate per year, continuously compounded risk_free_rate
qq
Dividend yield per year, continuously compounded dividend_yield
Vi,jV_{i,j}
The option's value at step i after j moves up
SS
Price of the underlying asset now spot
Δ\Delta
Delta: the change in price per unit of spot delta
Γ\Gamma
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

Inputs
NameDescription
Option typeoption_typetextA call (the right to buy) or a put (to sell)
ExerciseexercisetextEuropean (at expiry only) or American (at any step) exercise
Spotspotmoney · [0.01, 1e+07]Price of the underlying asset now
Strikestrikemoney · [0.01, 1e+07]Strike price
Yearsyearsyears · [0.001, 100]Time to expiry, in years
Risk free raterisk_free_raterate · [-0.1, 1]Risk-free rate per year, continuously compounded
Dividend yielddividend_yieldrate · [-0.1, 1]Dividend yield per year, continuously compounded
Volatilityvolatilityvolatility · [0.01, 5]Volatility of the asset's return per year
Stepsstepscount · [2, 5000]Number of time steps in the tree

Outputs

Outputs
NameDescription
Pricepricemoney · [0, 1e+15]Option price
Deltadeltaratio · [-100000, 100000]Change in price per unit of spot, across the first step
Gammagammaratio · [-1e+12, 1e+12]Change in delta per unit of spot, across the second step
Up factorup_factorratio · (1, 1e+16]Price ratio of a move up: e^(sigma sqrt(dt))
Up probabilityup_probabilityprobability · (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

  1. 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)))
  2. 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, or run_model with 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:

Python
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())
Command line
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