# mcdallas/wallstreet architecture

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

- Interactive diagram: https://gitdiagram.com/mcdallas/wallstreet
- Repository: https://github.com/mcdallas/wallstreet

## Overview

##### Main components
- Wallstreet Library Core:
- The main package “wallstreet” holds the primary modules:
▪ wallstreet.py – likely the core API interface that instantiates Stock, Call, and Put objects.
▪ blackandscholes.py – module dedicated to computing option pricing using the Black-Scholes model.
▪ constants.py – contains constant values (perhaps including configuration like API URLs or financial constants).
- External Data Sources:
- Google Finance API: The primary source for stock and option quotes.
- Yahoo Finance (optional): Used when specified by the user.
- US Treasury Website: Provides risk-free rate details.
- Testing Infrastructure:
- The “tests” folder includes a “mockrequests” module used for simulating HTTP requests and responses for testing purposes.

##### Relationships and interactions
- The client’s code (as shown in the README usage examples) imports the Wallstreet API and instantiates Stock, Call, or Put objects.
- These objects internally use modules such as:
▪ data fetchers that query external APIs (Google/Yahoo Finance) and scrape the Treasury website.
▪ computational modules (like blackandscholes) for calculating option pricing and Greeks.
▪ constants to maintain configuration/settings.
- The testing modules (especially the mockrequests in tests) intercept or simulate external data calls to ensure the library’s reliability in various scenarios.

##### Architectural patterns and design principles
- Separation of concerns: Distinct modules for data fetching, computation (e.g., Black-Scholes), and configuration ensure maintainability.
- Modular design: Clearly separated packages (core functionality vs. testing) improve extensibility and readability.
- Dependency abstraction: Use of mocks in the tests indicates an emphasis on isolating external dependencies during testing.

##### Relevant technologies and libraries
- Python 3 is the target environment.
- Utilization of the Google Finance API, Yahoo Finance, and likely standard libraries for web scraping.
- Pandas support for downloading and representing historical data in DataFrame format.

##### Detailed explanation for the principal software engineer
- Sketch a central block labeled “Wallstreet Library” subdivided into:
▪ API Layer (wallstreet.py)
▪ Computation Layer (blackandscholes.py)
▪ Configuration Layer (constants.py)
- Off to one side, include a block for “External Data Sources” that includes nodes for “Google Finance API”, “Yahoo Finance (optional)”, and “US Treasury Website”.
- Modularity and the minimal user input design: the user makes a call to get a stock or option object and the internal components automatically perform the necessary calculations and data pulling.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Client["Client Code"]:::core

    subgraph "Wallstreet Library"
        API["API Interface: Stock/Option Classes"]:::core
        Calc["Calculation Engine: Black-Scholes Module"]:::core
        Const["Configuration: Constants"]:::core
    end

    subgraph "External Data Sources"
        GF["Google Finance API"]:::external
        YF["Yahoo Finance (Optional)"]:::external
        TR["US Treasury Website"]:::external
    end

    Test["Testing Suite: Mock Requests"]:::testing

    Client -->|"invokes"| API
    API -->|"fetches"| GF
    API -->|"fetches"| YF
    API -->|"fetches"| TR
    API -->|"processes"| Calc

    GF -->|"returnsData"| API
    YF -->|"returnsData"| API
    TR -->|"returnsData"| API

    Test ---|"simulate"| GF
    Test ---|"simulate"| YF
    Test ---|"simulate"| TR

    click API "https://github.com/mcdallas/wallstreet/blob/master/wallstreet/wallstreet.py"
    click Calc "https://github.com/mcdallas/wallstreet/blob/master/wallstreet/blackandscholes.py"
    click Const "https://github.com/mcdallas/wallstreet/blob/master/wallstreet/constants.py"
    click Test "https://github.com/mcdallas/wallstreet/tree/master/tests/mockrequests"

    classDef core fill:#A9D0F5,stroke:#1C1C1C,stroke-width:2px;
    classDef external fill:#B4F5B4,stroke:#1C1C1C,stroke-width:2px;
    classDef testing fill:#F7C6A3,stroke:#1C1C1C,stroke-dasharray: 5,5;
    class Client,API,Calc,Const core;
    class GF,YF,TR external;
    class Test testing;
```
