# giacomo-grassi/exotic-options-pricer architecture

> Architecture diagram of the GitHub repository giacomo-grassi/exotic-options-pricer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/giacomo-grassi/exotic-options-pricer
- Repository: https://github.com/giacomo-grassi/exotic-options-pricer

## Overview

exotic-options-pricer is a Python Monte Carlo library for pricing path-dependent equity options. The principal workflow configures market and simulation parameters, selects a Black–Scholes or Heston model and a payoff, then uses the engine to generate paths, discount payoff samples, and return a price with sampling error. Separate capabilities include finite-difference Greeks and closed-form benchmark formulas. The README documents all five payoff families; some payoff implementations and the CLI are not sampled, so their internal wiring is not inferred.

Main entry points: [`src/exotic_pricer/engine/mc.py`](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/engine/mc.py) (Monte Carlo), [`src/exotic_pricer/analytics/greeks.py`](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/analytics/greeks.py) (Finite-difference Greeks), [`src/exotic_pricer/config.py`](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/config.py) (Market settings), [`src/exotic_pricer/payoffs/vanilla.py`](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/payoffs/vanilla.py) (Vanilla payoff)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_engine["Pricing engine"]
  node_api["Public API<br/>[__init__.py]"]
  node_config["Market settings<br/>[config.py]"]
  node_mc["Monte Carlo<br/>[mc.py]"]
  node_rng["Normal generator<br/>[rng.py]"]
  node_result["Price result<br/>[mc.py]"]
end

subgraph group_models["Market models"]
  node_bs["Black–Scholes<br/>[black_scholes.py]"]
  node_heston["Heston<br/>[heston.py]"]
end

subgraph group_payoffs["Payoff contracts"]
  node_vanilla["Vanilla payoff<br/>[vanilla.py]"]
  node_asian["Asian payoff<br/>[asian.py]"]
  node_barrier["Barrier payoff<br/>[barrier.py]"]
  node_lookback["Lookback payoff<br/>[lookback.py]"]
  node_cliquet["Cliquet payoff<br/>[cliquet.py]"]
end

subgraph group_analytics["Analytics"]
  node_greeks["Finite-difference Greeks<br/>[greeks.py]"]
  node_closed["Closed-form benchmarks<br/>[analytic.py]"]
end

node_user(("Pricing caller"))

node_user -->|"imports API"| node_api
node_user -->|"sets parameters"| node_config
node_user -->|"prices contract"| node_mc
node_user -->|"selects payoff"| node_vanilla
node_user -->|"selects payoff"| node_asian
node_user -->|"selects payoff"| node_barrier
node_user -->|"selects payoff"| node_lookback
node_user -->|"selects payoff"| node_cliquet
node_mc -->|"uses settings"| node_config
node_mc -->|"draws normals"| node_rng
node_mc -->|"simulates paths"| node_bs
node_mc -->|"simulates paths"| node_heston
node_mc -->|"invokes payoff"| node_vanilla
node_mc -->|"invokes payoff"| node_asian
node_mc -->|"invokes payoff"| node_barrier
node_mc -->|"invokes payoff"| node_lookback
node_mc -->|"invokes payoff"| node_cliquet
node_mc -->|"returns estimate"| node_result
node_greeks -->|"reprices"| node_mc
node_user -->|"requests sensitivities"| node_greeks
node_user -->|"requests benchmark"| node_closed

click node_api "https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/__init__.py"
click node_config "https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/config.py"
click node_mc "https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/engine/mc.py"
click node_rng "https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/engine/rng.py"
click node_result "https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/engine/mc.py"
click node_bs "https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/models/black_scholes.py"
click node_heston "https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/models/heston.py"
click node_vanilla "https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/payoffs/vanilla.py"
click node_asian "https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/payoffs/asian.py"
click node_barrier "https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/payoffs/barrier.py"
click node_lookback "https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/payoffs/lookback.py"
click node_cliquet "https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/payoffs/cliquet.py"
click node_greeks "https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/analytics/greeks.py"
click node_closed "https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/analytics/analytic.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_config,node_mc,node_rng,node_result toneBlue
class node_bs,node_heston toneAmber
class node_vanilla,node_asian,node_barrier,node_lookback,node_cliquet toneMint
class node_greeks,node_closed toneRose
class node_user toneIndigo
```

## Components

### Pricing engine

- [Public API](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/__init__.py): `src/exotic_pricer/__init__.py`
- [Market settings](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/config.py): `src/exotic_pricer/config.py`
- [Monte Carlo](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/engine/mc.py): `src/exotic_pricer/engine/mc.py`
- [Normal generator](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/engine/rng.py): `src/exotic_pricer/engine/rng.py`
- [Price result](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/engine/mc.py): `src/exotic_pricer/engine/mc.py`

### Market models

- [Black–Scholes](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/models/black_scholes.py): `src/exotic_pricer/models/black_scholes.py`
- [Heston](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/models/heston.py): `src/exotic_pricer/models/heston.py`

### Payoff contracts

- [Vanilla payoff](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/payoffs/vanilla.py): `src/exotic_pricer/payoffs/vanilla.py`
- [Asian payoff](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/payoffs/asian.py): `src/exotic_pricer/payoffs/asian.py`
- [Barrier payoff](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/payoffs/barrier.py): `src/exotic_pricer/payoffs/barrier.py`
- [Lookback payoff](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/payoffs/lookback.py): `src/exotic_pricer/payoffs/lookback.py`
- [Cliquet payoff](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/payoffs/cliquet.py): `src/exotic_pricer/payoffs/cliquet.py`

### Analytics

- [Finite-difference Greeks](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/analytics/greeks.py): `src/exotic_pricer/analytics/greeks.py`
- [Closed-form benchmarks](https://github.com/giacomo-grassi/exotic-options-pricer/blob/main/src/exotic_pricer/analytics/analytic.py): `src/exotic_pricer/analytics/analytic.py`

### Other components

- **Pricing caller**

## Connections

- Pricing caller → Public API: imports API
- Pricing caller → Market settings: sets parameters
- Pricing caller → Monte Carlo: prices contract
- Pricing caller → Vanilla payoff: selects payoff
- Pricing caller → Asian payoff: selects payoff
- Pricing caller → Barrier payoff: selects payoff
- Pricing caller → Lookback payoff: selects payoff
- Pricing caller → Cliquet payoff: selects payoff
- Monte Carlo → Market settings: uses settings
- Monte Carlo → Normal generator: draws normals
- Monte Carlo → Black–Scholes: simulates paths
- Monte Carlo → Heston: simulates paths
- Monte Carlo → Vanilla payoff: invokes payoff
- Monte Carlo → Asian payoff: invokes payoff
- Monte Carlo → Barrier payoff: invokes payoff
- Monte Carlo → Lookback payoff: invokes payoff
- Monte Carlo → Cliquet payoff: invokes payoff
- Monte Carlo → Price result: returns estimate
- Finite-difference Greeks → Monte Carlo: reprices
- Pricing caller → Finite-difference Greeks: requests sensitivities
- Pricing caller → Closed-form benchmarks: requests benchmark
