# skmbatha/forex-math architecture

> Architecture diagram of the GitHub repository skmbatha/forex-math, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/skmbatha/forex-math
- Repository: https://github.com/skmbatha/forex-math

## Overview

ForexMath is a small wxWidgets desktop calculator for forex trade risk and margin. The user enters price, lot size, digit count, leverage, and leaves a target value blank; Calculate validates inputs, derives the missing take-profit/stop-loss or lot/profit-loss value, and can compute margin. A toggle converts displayed profit/loss and margin between price-relative and absolute amounts. The sampled sources show the GUI and calculation flow; no persistence or external services are evident.

Main entry points: [`ForexMathMain.cpp`](https://github.com/skmbatha/forex-math/blob/main/ForexMathMain.cpp) (Calculator Window), [`GUIFrame.cpp`](https://github.com/skmbatha/forex-math/blob/main/GUIFrame.cpp) (Calculator Form), [`ForexMathApp.cpp`](https://github.com/skmbatha/forex-math/blob/main/ForexMathApp.cpp) (App Startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop Application"]
  node_app_init["App Startup<br/>[ForexMathApp.cpp]"]
  node_window["Calculator Window<br/>[ForexMathMain.cpp]"]
  node_form["Calculator Form<br/>[GUIFrame.cpp]"]
end

subgraph group_calc["Forex Calculations"]
  node_input_check["Input Validation<br/>[ForexMathMain.cpp]"]
  node_trade_math["Trade Risk Math<br/>[ForexMathMain.cpp]"]
  node_margin_math["Margin Math<br/>[ForexMathMain.cpp]"]
  node_currency_toggle["Currency Toggle<br/>[ForexMathMain.cpp]"]
  node_field_helpers["Field Helpers<br/>[ForexMathMain.cpp]"]
end

node_user(("User"))

node_app_init -->|"creates"| node_window
node_window -->|"inherits"| node_form
node_user -->|"enters values"| node_form
node_form -->|"dispatches actions"| node_window
node_window -->|"validates inputs"| node_input_check
node_window -->|"calculates missing value"| node_trade_math
node_window -->|"calculates margin"| node_margin_math
node_window -->|"handles toggle"| node_currency_toggle
node_input_check -->|"highlights fields"| node_field_helpers
node_trade_math -->|"shows answer"| node_field_helpers
node_margin_math -->|"shows answer"| node_field_helpers
node_currency_toggle -->|"reads field values"| node_field_helpers

click node_app_init "https://github.com/skmbatha/forex-math/blob/main/ForexMathApp.cpp"
click node_window "https://github.com/skmbatha/forex-math/blob/main/ForexMathMain.cpp"
click node_form "https://github.com/skmbatha/forex-math/blob/main/GUIFrame.cpp"
click node_input_check "https://github.com/skmbatha/forex-math/blob/main/ForexMathMain.cpp"
click node_trade_math "https://github.com/skmbatha/forex-math/blob/main/ForexMathMain.cpp"
click node_margin_math "https://github.com/skmbatha/forex-math/blob/main/ForexMathMain.cpp"
click node_currency_toggle "https://github.com/skmbatha/forex-math/blob/main/ForexMathMain.cpp"
click node_field_helpers "https://github.com/skmbatha/forex-math/blob/main/ForexMathMain.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_app_init,node_window,node_form,node_user toneBlue
class node_input_check,node_trade_math,node_margin_math,node_currency_toggle,node_field_helpers toneAmber
```

## Components

### Desktop Application

- [App Startup](https://github.com/skmbatha/forex-math/blob/main/ForexMathApp.cpp): `ForexMathApp.cpp`
- [Calculator Window](https://github.com/skmbatha/forex-math/blob/main/ForexMathMain.cpp): `ForexMathMain.cpp`
- [Calculator Form](https://github.com/skmbatha/forex-math/blob/main/GUIFrame.cpp): `GUIFrame.cpp`

### Forex Calculations

- [Input Validation](https://github.com/skmbatha/forex-math/blob/main/ForexMathMain.cpp): `ForexMathMain.cpp`
- [Trade Risk Math](https://github.com/skmbatha/forex-math/blob/main/ForexMathMain.cpp): `ForexMathMain.cpp`
- [Margin Math](https://github.com/skmbatha/forex-math/blob/main/ForexMathMain.cpp): `ForexMathMain.cpp`
- [Currency Toggle](https://github.com/skmbatha/forex-math/blob/main/ForexMathMain.cpp): `ForexMathMain.cpp`
- [Field Helpers](https://github.com/skmbatha/forex-math/blob/main/ForexMathMain.cpp): `ForexMathMain.cpp`

### Other components

- **User**

## Connections

- App Startup → Calculator Window: creates (evidence: `ForexMathApp.cpp`)
- Calculator Window → Calculator Form: inherits
- User → Calculator Form: enters values (evidence: `GUIFrame.cpp`)
- Calculator Form → Calculator Window: dispatches actions (evidence: `ForexMathMain.cpp`)
- Calculator Window → Input Validation: validates inputs (evidence: `ForexMathMain.cpp`)
- Calculator Window → Trade Risk Math: calculates missing value (evidence: `ForexMathMain.cpp`)
- Calculator Window → Margin Math: calculates margin (evidence: `ForexMathMain.cpp`)
- Calculator Window → Currency Toggle: handles toggle (evidence: `ForexMathMain.cpp`)
- Input Validation → Field Helpers: highlights fields (evidence: `ForexMathMain.cpp`)
- Trade Risk Math → Field Helpers: shows answer (evidence: `ForexMathMain.cpp`)
- Margin Math → Field Helpers: shows answer (evidence: `ForexMathMain.cpp`)
- Currency Toggle → Field Helpers: reads field values (evidence: `ForexMathMain.cpp`)
