# tlsehd195/new- architecture

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

- Interactive diagram: https://gitdiagram.com/tlsehd195/new-
- Repository: https://github.com/tlsehd195/new-

## Overview

This is an autonomous investment research, validation, learning, and trading system, with fail-closed safety principles and no guarantee of returns. The principal workflow is to acquire point-in-time market data, evaluate strategies through backtesting, make portfolio decisions under risk controls, execute through paper or live broker paths, record outcomes, and use those records for learning and candidate evolution. The graph also preserves documented research, monitoring, counterfactual analysis, and AI capabilities. Several implementation links are based on README documentation because those source files were not sampled; unsampled internals are not treated as inspected.

Main entry points: [`src/backtest/engine.py`](https://github.com/tlsehd195/new-/blob/main/src/backtest/engine.py) (Backtest Engine), [`src/decision/agent.py`](https://github.com/tlsehd195/new-/blob/main/src/decision/agent.py) (Decision Agent), [`src/orchestration/paper_runner.py`](https://github.com/tlsehd195/new-/blob/main/src/orchestration/paper_runner.py) (Trading Orchestration), [`src/trade_journal/repository.py`](https://github.com/tlsehd195/new-/blob/main/src/trade_journal/repository.py) (Trade Journal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Market Data"]
  node_providers["Data Providers"]
  node_ingestion["Data Ingestion<br/>[provider.py]"]
  node_datarepo["Point-in-Time Data<br/>[repository.py]"]
end

subgraph group_research["Research &amp; Validation"]
  node_backtest["Backtest Engine<br/>[engine.py]"]
  node_portfolio["Portfolio Accounting<br/>[portfolio.py]"]
  node_strategy["Strategies &amp; Research"]
  node_regime["Market Regime<br/>[detector.py]"]
end

subgraph group_trading["Decisions &amp; Trading"]
  node_prediction["Prediction<br/>[predictor.py]"]
  node_decision["Decision Agent<br/>[agent.py]"]
  node_risk["Portfolio Risk<br/>[engine.py]"]
  node_orchestration["Trading Orchestration<br/>[paper_runner.py]"]
  node_broker["Broker Adapters<br/>[pipeline.py]"]
  node_journal["Trade Journal<br/>[repository.py]"]
end

subgraph group_learning["Learning &amp; Evolution"]
  node_learning["Learning Pipeline<br/>[pipeline.py]"]
  node_evolution["Model Evolution<br/>[pipeline.py]"]
  node_counterfactual["Counterfactual Analysis<br/>[pipeline.py]"]
end

subgraph group_platform["Shared Services"]
  node_store[("Persistent Store<br/>[engine.py]")]
  node_monitoring["Monitoring &amp; Alerts<br/>[pipeline.py]"]
  node_ai["AI Gateway<br/>[gateway.py]"]
end

node_user(("Researcher / Operator"))

node_user -->|"imports data"| node_ingestion
node_providers -.->|"provides data"| node_ingestion
node_ingestion -.->|"records data"| node_datarepo
node_datarepo -->|"serves point-in-time data"| node_backtest
node_backtest -->|"updates accounting"| node_portfolio
node_strategy -->|"supplies strategy"| node_backtest
node_user -->|"evaluates strategies"| node_backtest
node_regime -->|"informs decisions"| node_decision
node_prediction -->|"informs decisions"| node_decision
node_decision -->|"assesses exposure"| node_risk
node_risk -->|"gates trading"| node_orchestration
node_orchestration -->|"submits orders"| node_broker
node_broker -->|"records trading"| node_journal
node_backtest -->|"records outcomes"| node_journal
node_journal -->|"supplies experience"| node_learning
node_learning -->|"trains candidates"| node_evolution
node_learning -.->|"persists results"| node_store
node_evolution -.->|"approved deployment"| node_orchestration
node_journal -->|"analyzes outcomes"| node_counterfactual
node_orchestration -.->|"provides observations"| node_monitoring
node_monitoring -.->|"raises alerts"| node_user
node_decision -.->|"optional AI requests"| node_ai
node_datarepo -.->|"persists market data"| node_store

click node_providers "https://github.com/tlsehd195/new-/tree/main/src/data_infra/providers"
click node_ingestion "https://github.com/tlsehd195/new-/blob/main/src/data_infra/provider.py"
click node_datarepo "https://github.com/tlsehd195/new-/blob/main/src/data_infra/repository.py"
click node_store "https://github.com/tlsehd195/new-/blob/main/src/storage/engine.py"
click node_backtest "https://github.com/tlsehd195/new-/blob/main/src/backtest/engine.py"
click node_portfolio "https://github.com/tlsehd195/new-/blob/main/src/backtest/portfolio.py"
click node_strategy "https://github.com/tlsehd195/new-/tree/main/src/strategy_research"
click node_regime "https://github.com/tlsehd195/new-/blob/main/src/regime/detector.py"
click node_prediction "https://github.com/tlsehd195/new-/blob/main/src/predict/predictor.py"
click node_decision "https://github.com/tlsehd195/new-/blob/main/src/decision/agent.py"
click node_risk "https://github.com/tlsehd195/new-/blob/main/src/risk/engine.py"
click node_orchestration "https://github.com/tlsehd195/new-/blob/main/src/orchestration/paper_runner.py"
click node_broker "https://github.com/tlsehd195/new-/blob/main/src/broker/pipeline.py"
click node_journal "https://github.com/tlsehd195/new-/blob/main/src/trade_journal/repository.py"
click node_learning "https://github.com/tlsehd195/new-/blob/main/src/learning/pipeline.py"
click node_evolution "https://github.com/tlsehd195/new-/blob/main/src/evolution/pipeline.py"
click node_counterfactual "https://github.com/tlsehd195/new-/blob/main/src/counterfactual/pipeline.py"
click node_monitoring "https://github.com/tlsehd195/new-/blob/main/src/monitoring/pipeline.py"
click node_ai "https://github.com/tlsehd195/new-/blob/main/src/ai_gateway/gateway.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_providers,node_ingestion,node_datarepo toneBlue
class node_backtest,node_portfolio,node_strategy,node_regime toneAmber
class node_prediction,node_decision,node_risk,node_orchestration,node_broker,node_journal toneMint
class node_learning,node_evolution,node_counterfactual toneRose
class node_store,node_monitoring,node_ai,node_user toneIndigo
```

## Components

### Market Data

- [Data Providers](https://github.com/tlsehd195/new-/tree/main/src/data_infra/providers): `src/data_infra/providers`
- [Data Ingestion](https://github.com/tlsehd195/new-/blob/main/src/data_infra/provider.py): `src/data_infra/provider.py`
- [Point-in-Time Data](https://github.com/tlsehd195/new-/blob/main/src/data_infra/repository.py): `src/data_infra/repository.py`

### Research & Validation

- [Backtest Engine](https://github.com/tlsehd195/new-/blob/main/src/backtest/engine.py): `src/backtest/engine.py`
- [Portfolio Accounting](https://github.com/tlsehd195/new-/blob/main/src/backtest/portfolio.py): `src/backtest/portfolio.py`
- [Strategies & Research](https://github.com/tlsehd195/new-/tree/main/src/strategy_research): `src/strategy_research`
- [Market Regime](https://github.com/tlsehd195/new-/blob/main/src/regime/detector.py): `src/regime/detector.py`

### Decisions & Trading

- [Prediction](https://github.com/tlsehd195/new-/blob/main/src/predict/predictor.py): `src/predict/predictor.py`
- [Decision Agent](https://github.com/tlsehd195/new-/blob/main/src/decision/agent.py): `src/decision/agent.py`
- [Portfolio Risk](https://github.com/tlsehd195/new-/blob/main/src/risk/engine.py): `src/risk/engine.py`
- [Trading Orchestration](https://github.com/tlsehd195/new-/blob/main/src/orchestration/paper_runner.py): `src/orchestration/paper_runner.py`
- [Broker Adapters](https://github.com/tlsehd195/new-/blob/main/src/broker/pipeline.py): `src/broker/pipeline.py`
- [Trade Journal](https://github.com/tlsehd195/new-/blob/main/src/trade_journal/repository.py): `src/trade_journal/repository.py`

### Learning & Evolution

- [Learning Pipeline](https://github.com/tlsehd195/new-/blob/main/src/learning/pipeline.py): `src/learning/pipeline.py`
- [Model Evolution](https://github.com/tlsehd195/new-/blob/main/src/evolution/pipeline.py): `src/evolution/pipeline.py`
- [Counterfactual Analysis](https://github.com/tlsehd195/new-/blob/main/src/counterfactual/pipeline.py): `src/counterfactual/pipeline.py`

### Shared Services

- [Persistent Store](https://github.com/tlsehd195/new-/blob/main/src/storage/engine.py): `src/storage/engine.py`
- [Monitoring & Alerts](https://github.com/tlsehd195/new-/blob/main/src/monitoring/pipeline.py): `src/monitoring/pipeline.py`
- [AI Gateway](https://github.com/tlsehd195/new-/blob/main/src/ai_gateway/gateway.py): `src/ai_gateway/gateway.py`

### Other components

- **Researcher / Operator**

## Connections

- Researcher / Operator → Data Ingestion: imports data
- Data Providers → Data Ingestion: provides data
- Data Ingestion → Point-in-Time Data: records data
- Point-in-Time Data → Backtest Engine: serves point-in-time data (evidence: `src/backtest/engine.py`)
- Backtest Engine → Portfolio Accounting: updates accounting (evidence: `src/backtest/engine.py`)
- Strategies & Research → Backtest Engine: supplies strategy
- Researcher / Operator → Backtest Engine: evaluates strategies
- Market Regime → Decision Agent: informs decisions
- Prediction → Decision Agent: informs decisions
- Decision Agent → Portfolio Risk: assesses exposure
- Portfolio Risk → Trading Orchestration: gates trading
- Trading Orchestration → Broker Adapters: submits orders
- Broker Adapters → Trade Journal: records trading
- Backtest Engine → Trade Journal: records outcomes
- Trade Journal → Learning Pipeline: supplies experience (evidence: `src/learning/pipeline.py`)
- Learning Pipeline → Model Evolution: trains candidates (evidence: `src/evolution/pipeline.py`)
- Learning Pipeline → Persistent Store: persists results
- Model Evolution → Trading Orchestration: approved deployment
- Trade Journal → Counterfactual Analysis: analyzes outcomes (evidence: `src/counterfactual/pipeline.py`)
- Trading Orchestration → Monitoring & Alerts: provides observations
- Monitoring & Alerts → Researcher / Operator: raises alerts
- Decision Agent → AI Gateway: optional AI requests
- Point-in-Time Data → Persistent Store: persists market data
