Cox-Ross-Rubinstein (CRR) binomial option pricing model in Google Sheets using JavaScript
π» In this video, we explore how to implement the Cox-Ross-Rubinstein (CRR) binomial option pricing model directly in Google Sheets using JavaScript. This function calculates the price of both American and European call or put options. We'll walk you through each key component of the code, breaking down the parameters and explaining the underlying mathematical concepts. *Health Warning* javascript is not really recommended for large scale computations. Recommended to not exceed 1,000 steps in tree. π§ Key Highlights: 1. π Binomial Tree Construction: We break down the logic behind constructing a binomial tree for option valuation, using dynamic memory allocation for efficient calculations, inspired by Espen Haug's dynamic memory architecture from his VBA artefacts used in Excel. 2. π Backward Induction & Early Exercise: Learn how we use backward recursion to determine option values, with special consideration for American options, which may be exercised early. 3. π Parameter Explanation: - `AmeEurFlag`: Specifies whether the option is American ('a') or European ('e'). - `CallPutFlag`: Indicates whether it's a call ('c') or put ('p') option. - Additional parameters like stock price (`S`), strike price (`X`), time to maturity (`T`), and volatility (`v`) are thoroughly explained. 4. π Comparison Against Broadie & Detemple (1996): We'll test the CRR model's output against established benchmarks from Broadie and Detemple's work, specifically Table 2 on page 1224. This provides a solid stress test for the model. 5. π Manual Calculations in Google Sheets: We walk you through manually estimating option prices using a four-step binomial tree in Google Sheets and comparing the results with the JavaScript implementation. 6.β‘ Code Optimization Techniques: Learn about our use of precomputed powers of up (`u`) and down (`d`) factors and how we reduce memory usage through in-place updates of the option values array. This video serves as both a practical guide for implementing the CRR model and explores the theory behind option pricing, backed by hands-on comparisons with authoritative benchmarks. Perfect for finance enthusiasts, developers, and anyone interested in computational finance! π Resources: https://www.youtube.com/embed/videoseries?list=PLtlRowSvuTZTe2kCo68VXL1VIVoVOn1bx https://www.youtube.com/embed/videoseries?list=PLtlRowSvuTZR4ESJDmYf5oh2yUybjdUU0 - Code Snippet Used in the Video and Google Colab link: https://colab.research.google.com/drive/12uHJ487GWJjFmVBZqRP1Wy5EyUcMJSwz#scrollTo=nRgBmOQqGZRb - [π Broadie and Detemple (1996) Reference] https://colab.research.google.com/drive/12uHJ487GWJjFmVBZqRP1Wy5EyUcMJSwz#scrollTo=XAzWKbqAs_ZG&line=8&uniqifier=1 - [π Google Sheets Manual Calculation Template]https://docs.google.com/spreadsheets/d/1D8FXAIr2j4I5qQ4DGnOA9LxmBN8gVpktPye3udbMPn8/edit?usp=sharing π₯ Don't forget to like, subscribe, and hit the bell icon for more finance modeling tutorials and walkthroughs!
Download
1 formatsVideo Formats
Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.