# vihaan-narvekar/black-scholes-pricing architecture

> Architecture diagram of the GitHub repository vihaan-narvekar/black-scholes-pricing, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vihaan-narvekar/black-scholes-pricing
- Repository: https://github.com/vihaan-narvekar/black-scholes-pricing

## Overview

##### Main Components
- User Interface Layer: Represented by the interactive Streamlit components that let users input parameters (stock price, strike price, volatility, interest rate) and display results.
- Computation/Business Logic: Encapsulated in the BlackScholes.py file, which contains the functions or methods for calculating option prices, computing Greeks, and preparing data for visualization.
- Visualization Components: These are the parts to render charts like Greek plots and heatmaps based on the computed outputs from the Black-Scholes model.
- External Libraries & Dependencies: The requirements.txt indicates that external Python libraries (such as Streamlit, numpy, pandas, matplotlib, etc., if used) are part of the ecosystem.

##### Relationships and Interactions
- The User Interface collects parameters from the user via sidebar inputs.
- These parameters are passed to the computation component (BlackScholes.py), which calculates prices and Greeks.
- The results are then fed into the visualization components (plots and heatmaps) that are rendered on the Streamlit web page.
- The application also serves via a hosted URL (the Streamlit app link mentioned in the README), which indicates deployment on a cloud platform.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Even though the project is implemented as a single file, it conceptually separates input handling, business logic (Black-Scholes calculations), and output rendering.
- Interactive and Real-Time Feedback: Emphasizing the reactive nature of Streamlit, where user inputs immediately trigger recomputation and refresh of outputs.

##### Relevant Technologies/Frameworks
- Python is the primary language.
- Streamlit is used for rapid web interface design.
- Libraries for mathematical computations and visualizations (which should be listed in requirements.txt) play a vital role.

##### Detailed Steps
- A component for “Option Price Output” (showing Call and Put pricing analysis)
- A component for “Greeks Analysis” (displaying Delta, Gamma, Theta, Vega, Rho values)
- A component for “Heatmap Visualization” (depicting parameter sensitivities).
- A note or label that the system is deployed on a cloud platform (as referenced by the Streamlit app link).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Interface Layer"
        UI["Streamlit User Interface"]:::ui
    end

    subgraph "Computation/Business Logic"
        CALC["Black-Scholes Calculation Engine"]:::calc
    end

    subgraph "Visualization Components"
        OPT["Option Price Output"]:::viz
        GRE["Greeks Analysis"]:::viz
        HEAT["Heatmap Visualization"]:::viz
    end

    external["External Libraries & Dependencies"]:::ext
    deploy["Cloud Deployment (Streamlit App)"]:::deploy

    UI -->|"sends input"| CALC
    CALC -->|"calculates"| OPT
    CALC -->|"calculates"| GRE
    CALC -->|"calculates"| HEAT
    external -->|"dependencies"| CALC
    external -->|"dependencies"| HEAT
    UI -->|"accesses via"| deploy

    click UI "https://github.com/vihaan-narvekar/black-scholes-pricing/blob/main/BlackScholes.py"
    click CALC "https://github.com/vihaan-narvekar/black-scholes-pricing/blob/main/BlackScholes.py"
    click OPT "https://github.com/vihaan-narvekar/black-scholes-pricing/blob/main/BlackScholes.py"
    click GRE "https://github.com/vihaan-narvekar/black-scholes-pricing/blob/main/BlackScholes.py"
    click HEAT "https://github.com/vihaan-narvekar/black-scholes-pricing/blob/main/BlackScholes.py"
    click external "https://github.com/vihaan-narvekar/black-scholes-pricing/blob/main/requirements.txt"

    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef calc fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef viz fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef ext fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef deploy fill:#D3D3D3,stroke:#000,stroke-width:2px;
```
