# johnathanmartin1/call_put_options_montecarlo_pricer architecture

> Architecture diagram of the GitHub repository johnathanmartin1/call_put_options_montecarlo_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/johnathanmartin1/call_put_options_montecarlo_pricer
- Repository: https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer

## Overview

This is a C++ command-line Monte Carlo option-pricing program. Its demonstrated workflow creates Asian and European contracts, configures and reports their parameters, runs automatic-precision random-walk simulation, then reports simulated prices and contract-specific values. The source excerpts establish the entry-point calls and payoff calculations; MonteCarlo.cpp and Factories.h are present in the tree but unsampled, so their internal dispatch details are not expanded.

Main entry points: [`put_call_values_monte_carlo_model.cpp`](https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/put_call_values_monte_carlo_model.cpp) (Pricing workflow), [`Contract.cpp`](https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/Contract.cpp) (Contract parameters), [`Asian.cpp`](https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/Asian.cpp) (Asian option), [`MonteCarlo.cpp`](https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/MonteCarlo.cpp) (Random walk simulation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Program entry"]
  node_main["Pricing workflow"]
  node_factory["Contract factory<br/>[Factories.h]"]
end

subgraph group_contracts["Option contracts"]
  node_contract["Contract parameters<br/>[Contract.cpp]"]
  node_european["European option<br/>[European.cpp]"]
  node_asian["Asian option<br/>[Asian.cpp]"]
end

subgraph group_simulation["Monte Carlo"]
  node_auto["Auto-precision run<br/>[MonteCarlo.cpp]"]
  node_randomwalk["Random walk simulation<br/>[MonteCarlo.cpp]"]
  node_pricepaths["Simulated prices<br/>[Contract.cpp]"]
  node_averagepaths["Per-simulation averages<br/>[Contract.cpp]"]
end

subgraph group_analysis["Pricing analysis"]
  node_eupayoff["Call and put valuation<br/>[European.cpp]"]
  node_asianpayoff["Asian payoff<br/>[Asian.cpp]"]
  node_statistics["Summary statistics<br/>[statistics.cpp]"]
  node_results["Printed valuations"]
end

node_user(("CLI user"))

node_user -->|"runs program"| node_main
node_main -->|"creates contracts"| node_factory
node_main -->|"sets parameters"| node_contract
node_main -->|"starts simulation"| node_auto
node_main -->|"prints parameters"| node_contract
node_auto -->|"runs simulation"| node_randomwalk
node_randomwalk -->|"updates prices"| node_pricepaths
node_randomwalk -->|"updates averages"| node_averagepaths
node_main -->|"reports average"| node_contract
node_contract -->|"summarizes prices"| node_statistics
node_main -->|"requests call and put"| node_european
node_european -->|"calculates values"| node_eupayoff
node_eupayoff -->|"reads prices"| node_pricepaths
node_eupayoff -->|"calculates errors"| node_statistics
node_main -->|"requests Asian value"| node_asian
node_asian -->|"reads averages"| node_averagepaths
node_asian -->|"calculates payoff"| node_asianpayoff
node_asianpayoff -->|"computes mean"| node_statistics
node_main -->|"prints results"| node_results

click node_main "https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/put_call_values_monte_carlo_model.cpp"
click node_factory "https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/Factories.h"
click node_contract "https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/Contract.cpp"
click node_european "https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/European.cpp"
click node_asian "https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/Asian.cpp"
click node_auto "https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/MonteCarlo.cpp"
click node_randomwalk "https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/MonteCarlo.cpp"
click node_pricepaths "https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/Contract.cpp"
click node_averagepaths "https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/Contract.cpp"
click node_eupayoff "https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/European.cpp"
click node_asianpayoff "https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/Asian.cpp"
click node_statistics "https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/statistics.cpp"
click node_results "https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/put_call_values_monte_carlo_model.cpp"

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_main,node_factory,node_user toneBlue
class node_contract,node_european,node_asian toneAmber
class node_auto,node_randomwalk,node_pricepaths,node_averagepaths toneMint
class node_eupayoff,node_asianpayoff,node_statistics,node_results toneRose
```

## Components

### Program entry

- [Pricing workflow](https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/put_call_values_monte_carlo_model.cpp): `put_call_values_monte_carlo_model.cpp`
- [Contract factory](https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/Factories.h): `Factories.h`

### Option contracts

- [Contract parameters](https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/Contract.cpp): `Contract.cpp`
- [European option](https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/European.cpp): `European.cpp`
- [Asian option](https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/Asian.cpp): `Asian.cpp`

### Monte Carlo

- [Auto-precision run](https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/MonteCarlo.cpp): `MonteCarlo.cpp`
- [Random walk simulation](https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/MonteCarlo.cpp): `MonteCarlo.cpp`
- [Simulated prices](https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/Contract.cpp): `Contract.cpp`
- [Per-simulation averages](https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/Contract.cpp): `Contract.cpp`

### Pricing analysis

- [Call and put valuation](https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/European.cpp): `European.cpp`
- [Asian payoff](https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/Asian.cpp): `Asian.cpp`
- [Summary statistics](https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/statistics.cpp): `statistics.cpp`
- [Printed valuations](https://github.com/johnathanmartin1/call_put_options_montecarlo_pricer/blob/master/put_call_values_monte_carlo_model.cpp): `put_call_values_monte_carlo_model.cpp`

### Other components

- **CLI user**

## Connections

- CLI user → Pricing workflow: runs program
- Pricing workflow → Contract factory: creates contracts
- Pricing workflow → Contract parameters: sets parameters
- Pricing workflow → Auto-precision run: starts simulation
- Pricing workflow → Contract parameters: prints parameters
- Auto-precision run → Random walk simulation: runs simulation
- Random walk simulation → Simulated prices: updates prices
- Random walk simulation → Per-simulation averages: updates averages
- Pricing workflow → Contract parameters: reports average
- Contract parameters → Summary statistics: summarizes prices
- Pricing workflow → European option: requests call and put
- European option → Call and put valuation: calculates values
- Call and put valuation → Simulated prices: reads prices
- Call and put valuation → Summary statistics: calculates errors
- Pricing workflow → Asian option: requests Asian value
- Asian option → Per-simulation averages: reads averages
- Asian option → Asian payoff: calculates payoff
- Asian payoff → Summary statistics: computes mean
- Pricing workflow → Printed valuations: prints results
