Options and Futures
  • Home
  • Slides
  • Projects

Binomial Tree Option Pricing

Author

ChatGPT o1 and Zhiyu Fu

Published

February 16, 2025

Binomial Tree Option Pricing

The following cell is a calculator for the binomial tree option pricing, written by ChatGPT o1 in Python.

Option Pricing Calculator

Put your parameters below and the calculator will automatically calculate the option price and display the binomial tree.

Notice that if you want to manually specify the up and down factors, you can do so by setting the implied volatility to a negative number. Otherwise, the calculator will automatically overide the up and down factors from the implied volatility using the Cox-Ross-Rubinstein approach.

viewof u = Inputs.range([1, 2], {value: 1.2, step: 0.01, label: "Up factor (u)"})
viewof d = Inputs.range([0.5, 1], {value: 0.8, step: 0.01, label: "Down factor (d)"})
viewof r = Inputs.range([0, 20], {value: 4.22, step: 0.01, label: "Risk-free rate (r) %"})
viewof S0 = Inputs.range([0, 10000], {value: 6114.6, step: 0.01, label: "Initial stock price (S0)"})
viewof K = Inputs.range([0, 20000], {value: 7500, step: 0.01, label: "Strike price (K)"})
viewof T = Inputs.range([0, 30], {value: 1, step: 0.01, label: "Time to maturity (T) in years"})
viewof N = Inputs.range([1, 30], {value: 5, step: 1, label: "Number of steps (N)"})
viewof option_type = Inputs.select(["call", "put"], {value: "call", label: "Option type"})
viewof exercise_type = Inputs.select(["european", "american"], {value: "european", label: "Exercise type"})
viewof sigma = Inputs.range([-1, 100], {value: 11, step: 0.1, label: "Implied volatility (sigma) %"})