# 26pb27-final-year-project/t1-fx-risk architecture

> Architecture diagram of the GitHub repository 26pb27-final-year-project/t1-fx-risk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/26pb27-final-year-project/t1-fx-risk
- Repository: https://github.com/26pb27-final-year-project/t1-fx-risk

## Overview

T+1 is a local research simulator for settlement-failure and FX-funding risk. Its central workflow is to configure or select a dataset, generate synthetic trade scenarios, train risk and timing models, compare funding budgets and policies through replay, then inspect and export results in the dashboard. The graph preserves the major documented inspection views and supporting calendar/FX capabilities. Some UI-to-API wiring and unsampled subsystems are documented but not visible in excerpts, so those relationships are omitted or marked unverified.

Main entry points: [`src/t1fx/workflow.py`](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/workflow.py) (Experiment workflow), [`src/t1fx/pipeline.py`](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/pipeline.py) (Policy replay pipeline), [`src/t1fx/api.py`](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/api.py) (Local API), [`src/t1fx/storage.py`](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/storage.py) (Artifact stores)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Research dashboard"]
  node_dashboard["Dashboard shell<br/>[main.tsx]"]
  node_experiment_ui["Experiment controls<br/>[Experiments.tsx]"]
  node_evaluation_ui["Evaluation calendar<br/>[Evaluation.tsx]"]
end

subgraph group_orchestration["Experiment orchestration"]
  node_api["Local API<br/>[api.py]"]
  node_workflow["Experiment workflow<br/>[workflow.py]"]
  node_jobs[("Durable jobs<br/>[jobs.py]")]
end

subgraph group_data["Scenario data"]
  node_generator["Scenario generation<br/>[generation.py]"]
  node_datasets["Dataset validation<br/>[datasets.py]"]
  node_domain["Domain contracts<br/>[domain.py]"]
  node_calendars["Settlement calendars<br/>[calendars.py]"]
  node_market["Market references<br/>[market_data.py]"]
  node_fx_rates["FX rate provider<br/>[fx_rates.py]"]
end

subgraph group_analysis["Risk and funding analysis"]
  node_training["Risk training<br/>[training.py]"]
  node_features["Risk features<br/>[features.py]"]
  node_models["Model artifacts<br/>[models.py]"]
  node_timing["Receipt timing models<br/>[timing.py]"]
  node_funding["Funding optimizer<br/>[funding.py]"]
  node_pipeline["Policy replay pipeline<br/>[pipeline.py]"]
  node_snapshots["Decision snapshots<br/>[snapshots.py]"]
end

subgraph group_runtime["Simulation and persistence"]
  node_simulator["Settlement simulator<br/>[simulator.py]"]
  node_storage[("Artifact stores<br/>[storage.py]")]
  node_online_clock["Online clock<br/>[online_clock.py]"]
end

node_researcher(("Researcher"))
node_frankfurter(("Frankfurter rates"))

node_researcher -->|"uses"| node_dashboard
node_dashboard -->|"shows"| node_experiment_ui
node_dashboard -->|"shows"| node_evaluation_ui
node_experiment_ui -.->|"submits work"| node_api
node_evaluation_ui -.->|"requests evaluation time"| node_api
node_api -->|"uses"| node_workflow
node_api -->|"uses"| node_jobs
node_api -->|"reads artifacts"| node_storage
node_workflow -->|"generates scenarios"| node_generator
node_workflow -->|"validates datasets"| node_datasets
node_workflow -->|"trains models"| node_training
node_workflow -->|"prepares timing"| node_timing
node_workflow -->|"compares policies"| node_pipeline
node_workflow -->|"persists artifacts"| node_storage
node_generator -->|"uses calendars"| node_calendars
node_generator -->|"uses market data"| node_market
node_generator -->|"gets rates"| node_fx_rates
node_fx_rates -->|"fetches references"| node_frankfurter
node_datasets -->|"publishes data"| node_storage
node_training -->|"builds features"| node_features
node_training -->|"loads tables"| node_datasets
node_training -->|"publishes models"| node_models
node_pipeline -->|"replays scenario"| node_simulator
node_pipeline -->|"builds snapshots"| node_snapshots
node_pipeline -->|"optimizes funding"| node_funding
node_pipeline -->|"values currencies"| node_fx_rates
node_pipeline -->|"publishes runs"| node_storage
node_simulator -->|"uses contracts"| node_domain
node_timing -->|"stores timing model"| node_storage
node_api -->|"uses clock"| node_online_clock
node_workflow -->|"checks dates"| node_calendars

click node_dashboard "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/frontend/src/main.tsx"
click node_experiment_ui "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/frontend/src/Experiments.tsx"
click node_evaluation_ui "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/frontend/src/Evaluation.tsx"
click node_api "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/api.py"
click node_workflow "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/workflow.py"
click node_jobs "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/jobs.py"
click node_generator "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/generation.py"
click node_datasets "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/datasets.py"
click node_domain "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/domain.py"
click node_calendars "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/calendars.py"
click node_market "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/market_data.py"
click node_fx_rates "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/fx_rates.py"
click node_training "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/training.py"
click node_features "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/features.py"
click node_models "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/models.py"
click node_timing "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/timing.py"
click node_funding "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/funding.py"
click node_pipeline "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/pipeline.py"
click node_snapshots "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/snapshots.py"
click node_simulator "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/simulator.py"
click node_storage "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/storage.py"
click node_online_clock "https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/online_clock.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_dashboard,node_experiment_ui,node_evaluation_ui toneBlue
class node_api,node_workflow,node_jobs toneAmber
class node_generator,node_datasets,node_domain,node_calendars,node_market,node_fx_rates toneMint
class node_training,node_features,node_models,node_timing,node_funding,node_pipeline,node_snapshots toneRose
class node_simulator,node_storage,node_online_clock,node_researcher,node_frankfurter toneIndigo
```

## Components

### Research dashboard

- [Dashboard shell](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/frontend/src/main.tsx): `frontend/src/main.tsx`
- [Experiment controls](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/frontend/src/Experiments.tsx): `frontend/src/Experiments.tsx`
- [Evaluation calendar](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/frontend/src/Evaluation.tsx): `frontend/src/Evaluation.tsx`

### Experiment orchestration

- [Local API](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/api.py): `src/t1fx/api.py`
- [Experiment workflow](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/workflow.py): `src/t1fx/workflow.py`
- [Durable jobs](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/jobs.py): `src/t1fx/jobs.py`

### Scenario data

- [Scenario generation](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/generation.py): `src/t1fx/generation.py`
- [Dataset validation](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/datasets.py): `src/t1fx/datasets.py`
- [Domain contracts](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/domain.py): `src/t1fx/domain.py`
- [Settlement calendars](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/calendars.py): `src/t1fx/calendars.py`
- [Market references](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/market_data.py): `src/t1fx/market_data.py`
- [FX rate provider](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/fx_rates.py): `src/t1fx/fx_rates.py`

### Risk and funding analysis

- [Risk training](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/training.py): `src/t1fx/training.py`
- [Risk features](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/features.py): `src/t1fx/features.py`
- [Model artifacts](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/models.py): `src/t1fx/models.py`
- [Receipt timing models](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/timing.py): `src/t1fx/timing.py`
- [Funding optimizer](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/funding.py): `src/t1fx/funding.py`
- [Policy replay pipeline](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/pipeline.py): `src/t1fx/pipeline.py`
- [Decision snapshots](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/snapshots.py): `src/t1fx/snapshots.py`

### Simulation and persistence

- [Settlement simulator](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/simulator.py): `src/t1fx/simulator.py`
- [Artifact stores](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/storage.py): `src/t1fx/storage.py`
- [Online clock](https://github.com/26pb27-final-year-project/t1-fx-risk/blob/main/src/t1fx/online_clock.py): `src/t1fx/online_clock.py`

### Other components

- **Researcher**
- **Frankfurter rates**

## Connections

- Researcher → Dashboard shell: uses (evidence: `README.md`)
- Dashboard shell → Experiment controls: shows (evidence: `frontend/src/main.tsx`)
- Dashboard shell → Evaluation calendar: shows (evidence: `frontend/src/main.tsx`)
- Experiment controls → Local API: submits work
- Evaluation calendar → Local API: requests evaluation time
- Local API → Experiment workflow: uses (evidence: `src/t1fx/api.py`)
- Local API → Durable jobs: uses (evidence: `src/t1fx/api.py`)
- Local API → Artifact stores: reads artifacts (evidence: `src/t1fx/api.py`)
- Experiment workflow → Scenario generation: generates scenarios (evidence: `src/t1fx/workflow.py`)
- Experiment workflow → Dataset validation: validates datasets (evidence: `src/t1fx/workflow.py`)
- Experiment workflow → Risk training: trains models (evidence: `src/t1fx/workflow.py`)
- Experiment workflow → Receipt timing models: prepares timing (evidence: `src/t1fx/workflow.py`)
- Experiment workflow → Policy replay pipeline: compares policies (evidence: `src/t1fx/workflow.py`)
- Experiment workflow → Artifact stores: persists artifacts (evidence: `src/t1fx/workflow.py`)
- Scenario generation → Settlement calendars: uses calendars (evidence: `src/t1fx/generation.py`)
- Scenario generation → Market references: uses market data (evidence: `src/t1fx/generation.py`)
- Scenario generation → FX rate provider: gets rates (evidence: `src/t1fx/generation.py`)
- FX rate provider → Frankfurter rates: fetches references (evidence: `README.md`)
- Dataset validation → Artifact stores: publishes data (evidence: `src/t1fx/datasets.py`)
- Risk training → Risk features: builds features (evidence: `src/t1fx/training.py`)
- Risk training → Dataset validation: loads tables (evidence: `src/t1fx/training.py`)
- Risk training → Model artifacts: publishes models (evidence: `src/t1fx/training.py`)
- Policy replay pipeline → Settlement simulator: replays scenario (evidence: `src/t1fx/pipeline.py`)
- Policy replay pipeline → Decision snapshots: builds snapshots (evidence: `src/t1fx/pipeline.py`)
- Policy replay pipeline → Funding optimizer: optimizes funding (evidence: `src/t1fx/pipeline.py`)
- Policy replay pipeline → FX rate provider: values currencies (evidence: `src/t1fx/pipeline.py`)
- Policy replay pipeline → Artifact stores: publishes runs (evidence: `src/t1fx/pipeline.py`)
- Settlement simulator → Domain contracts: uses contracts (evidence: `src/t1fx/simulator.py`)
- Receipt timing models → Artifact stores: stores timing model (evidence: `src/t1fx/timing.py`)
- Local API → Online clock: uses clock (evidence: `src/t1fx/api.py`)
- Experiment workflow → Settlement calendars: checks dates (evidence: `src/t1fx/workflow.py`)
