Skip to content

theov07/Trinomial_Tree_Options_Pricer_Engine_CSharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trinomial Option Pricer in C#

Academic Project — M2 272 Quantitative Finance, Université Paris Dauphine-PSL
Théo Verdelhan & Arthur Le Net


Overview

This repository contains a high-performance trinomial tree pricer for European and American options, implemented in C# and supporting discrete dividends. The code is a faithful translation of a validated Python implementation, with a focus on numerical accuracy, extensibility, and computational efficiency.


Features

  • European & American option pricing (call/put)
  • Discrete dividend support (date & amount)
  • Fast convergence to Black-Scholes analytical price
  • Calculation of Greeks (Delta, Gamma, Theta, Vega, Rho)
  • Modular, object-oriented architecture
  • Extensive validation and test suite

Academic Context

This project was developed as part of the M2 272 Quantitative Finance course at Université Paris Dauphine-PSL. The assignment required:

  1. Faithful translation of a Python trinomial pricer to C#
  2. Numerical validation against Black-Scholes
  3. Implementation of dividend handling and Greeks
  4. Performance optimization and code structuring

Installation

Prerequisites

  • .NET 9.0 or higher

Quick Start

# Clone the repository
git clone https://github.com/theov07/Trinomial_Option_Pricer_CSharp.git
cd Trinomial_Option_Pricer_CSharp

# Build
dotnet build

# Run
dotnet run

Usage

All main parameters can be set in Tester/TesterPricer.cs (see the Main() method):

var market = new Market(s0: 100.0, rate: 0.05, sigma: 0.30, dividend: 3.0, 
                       exDivDate: DateTime.Parse("2026-04-21"));

To change the scenario, simply edit the values for:

  • s0: Initial underlying price
  • rate: Risk-free rate
  • sigma: Volatility
  • dividend: Dividend amount
  • exDivDate: Ex-dividend date

Running Specific Tests

# Convergence test
dotnet run | grep -A 10 "CONVERGENCE"

# Greeks test
dotnet run | grep -A 10 "GREEKS"

Project Structure

CSharp-Pricer-Verdelhan-LeNet/
├── Core/                    # Main pricer classes
│   ├── Market.cs           # Market parameters
│   ├── Option.cs           # Option definition
│   ├── Node.cs             # Tree node
│   ├── Tree.cs             # Trinomial tree logic
│   ├── BlackScholes.cs     # Analytical Black-Scholes model
│   └── Greeks.cs           # Sensitivities (Greeks)
├── Tester/                 # Test and demo scripts
│   └── TesterPricer.cs     # Main test runner
├── TrinomialPricer.csproj  # .NET project file
└── README.md               # Documentation

Validation & Performance

  • Convergence: Error < 1 cent vs Black-Scholes for 400 steps
  • Speed: < 2 seconds for 400 steps (~80,000 nodes)
  • Dividend Handling: Correct price adjustment for discrete dividends
  • Greeks: Delta, Gamma, Theta, Vega, Rho validated numerically

References

  • Black, F., & Scholes, M. (1973). The Pricing of Options and Corporate Liabilities. Journal of Political Economy, 81(3), 637-654.
  • Hull, J. C. (2018). Options, Futures, and Other Derivatives (10th Edition).
  • Cox, J. C., Ross, S. A., & Rubinstein, M. (1979). Option Pricing: A Simplified Approach. Journal of Financial Economics, 7(3), 229-263.

License

This project is for academic purposes. The code is provided as-is for educational use.


Contact

For questions or feedback:

Developed at Université Paris Dauphine-PSL

About

C# trinomial tree options pricer supporting European and American contracts, with lattice-based valuation and Greeks computation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages