# narodomy/time-series-generative-ai-for-asset-investment architecture

> Architecture diagram of the GitHub repository narodomy/time-series-generative-ai-for-asset-investment, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/narodomy/time-series-generative-ai-for-asset-investment
- Repository: https://github.com/narodomy/time-series-generative-ai-for-asset-investment

## Overview

This thesis codebase generates conditional asset-return paths and uses them to construct and backtest portfolios. The documented workflow runs from market-data engineering and window preparation, through DDPM-Transformer or Flow Matching training, to DDIM sampling, portfolio optimization, and distributional checks. The README documents these stage relationships; sampled source confirms selected implementation details, but the notebooks that orchestrate the end-to-end workflow are not in the supplied tree, so internal call links are limited.

Main entry points: [`src/engine/trainer.py`](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/engine/trainer.py) (Training engine), [`src/utils/features.py`](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/features.py) (Feature engineering), [`src/datasets/dataset.py`](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/datasets/dataset.py) (Window datasets), [`src/models/ddpm_transformer.py`](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/models/ddpm_transformer.py) (Diffusion Transformer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_data_config["Data configuration"]
  node_engineering_config["Feature configuration"]
  node_feature_engineering["Feature engineering<br/>[features.py]"]
  node_dataset["Window datasets<br/>[dataset.py]"]
  node_scaling["Scaling<br/>[scaler.py]"]
  node_io["Data I/O<br/>[io.py]"]
  node_paths["Path configuration<br/>[paths.py]"]
end

subgraph group_generation["Path generation"]
  node_model_config["Model configuration<br/>[modeling_config.py]"]
  node_ddpm_transformer["Diffusion Transformer"]
  node_ddpm["DDPM<br/>[ddpm.py]"]
  node_ddim["DDIM sampler<br/>[ddim.py]"]
  node_flow_matching["Flow Matching<br/>[flow_matching.py]"]
  node_trainer["Training engine<br/>[trainer.py]"]
  node_experiment["Experiment manager<br/>[experiment.py]"]
  node_inference_config["Inference configuration"]
  node_decode["Inverse transforms<br/>[features.py]"]
end

subgraph group_portfolio["Portfolio decisions"]
  node_portfolio["MPT portfolio<br/>[portfolio.py]"]
end

subgraph group_evaluation["Evaluation tools"]
  node_statistics["Distribution statistics<br/>[statistics.py]"]
  node_analysis["Distribution analysis<br/>[analysis.py]"]
  node_visualization["Visualization<br/>[visualization.py]"]
end

node_analyst(("Researcher"))

node_analyst -->|"sets universe"| node_data_config
node_data_config -.->|"configures features"| node_feature_engineering
node_engineering_config -.->|"configures features"| node_feature_engineering
node_feature_engineering -->|"prepares windows"| node_dataset
node_dataset -.->|"transforms windows"| node_scaling
node_analyst -->|"selects model"| node_model_config
node_dataset -->|"supplies training data"| node_trainer
node_model_config -.->|"configures training"| node_trainer
node_trainer -->|"trains"| node_ddpm_transformer
node_trainer -->|"trains ablation"| node_flow_matching
node_ddpm_transformer -.->|"uses diffusion"| node_ddpm
node_analyst -->|"configures inference"| node_inference_config
node_ddpm_transformer -->|"samples paths"| node_ddim
node_inference_config -.->|"configures sampling"| node_ddim
node_ddim -->|"decodes paths"| node_decode
node_decode -->|"provides generated returns"| node_portfolio
node_portfolio -.->|"provides backtest results"| node_statistics
node_statistics -->|"summarizes fidelity"| node_analysis
node_portfolio -.->|"visualizes results"| node_visualization
node_io -.->|"loads and saves data"| node_feature_engineering
node_paths -->|"provides data paths"| node_data_config
node_paths -->|"provides data paths"| node_engineering_config
node_experiment -.->|"tracks training"| node_trainer

click node_data_config "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/config/data_engineering.py"
click node_engineering_config "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/config/engineering_config.py"
click node_feature_engineering "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/features.py"
click node_dataset "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/datasets/dataset.py"
click node_scaling "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/scaler.py"
click node_model_config "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/config/modeling_config.py"
click node_ddpm_transformer "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/models/ddpm_transformer.py"
click node_ddpm "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/models/ddpm.py"
click node_ddim "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/models/ddim.py"
click node_flow_matching "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/models/flow_matching.py"
click node_trainer "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/engine/trainer.py"
click node_experiment "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/experiment.py"
click node_inference_config "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/config/inferencing_config.py"
click node_decode "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/features.py"
click node_portfolio "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/entities/portfolio.py"
click node_io "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/io.py"
click node_statistics "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/statistics.py"
click node_analysis "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/analysis.py"
click node_visualization "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/visualization.py"
click node_paths "https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/paths.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_data_config,node_engineering_config,node_feature_engineering,node_dataset,node_scaling,node_io,node_paths toneBlue
class node_model_config,node_ddpm_transformer,node_ddpm,node_ddim,node_flow_matching,node_trainer,node_experiment,node_inference_config,node_decode toneAmber
class node_portfolio toneMint
class node_statistics,node_analysis,node_visualization toneRose
class node_analyst toneIndigo
```

## Components

### Data preparation

- [Data configuration](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/config/data_engineering.py): `src/config/data_engineering.py`
- [Feature configuration](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/config/engineering_config.py): `src/config/engineering_config.py`
- [Feature engineering](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/features.py): `src/utils/features.py`
- [Window datasets](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/datasets/dataset.py): `src/datasets/dataset.py`
- [Scaling](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/scaler.py): `src/utils/scaler.py`
- [Data I/O](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/io.py): `src/utils/io.py`
- [Path configuration](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/paths.py): `src/utils/paths.py`

### Path generation

- [Model configuration](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/config/modeling_config.py): `src/config/modeling_config.py`
- [Diffusion Transformer](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/models/ddpm_transformer.py): `src/models/ddpm_transformer.py`
- [DDPM](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/models/ddpm.py): `src/models/ddpm.py`
- [DDIM sampler](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/models/ddim.py): `src/models/ddim.py`
- [Flow Matching](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/models/flow_matching.py): `src/models/flow_matching.py`
- [Training engine](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/engine/trainer.py): `src/engine/trainer.py`
- [Experiment manager](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/experiment.py): `src/utils/experiment.py`
- [Inference configuration](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/config/inferencing_config.py): `src/config/inferencing_config.py`
- [Inverse transforms](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/features.py): `src/utils/features.py`

### Portfolio decisions

- [MPT portfolio](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/entities/portfolio.py): `src/entities/portfolio.py`

### Evaluation tools

- [Distribution statistics](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/statistics.py): `src/utils/statistics.py`
- [Distribution analysis](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/analysis.py): `src/utils/analysis.py`
- [Visualization](https://github.com/narodomy/time-series-generative-ai-for-asset-investment/blob/main/src/utils/visualization.py): `src/utils/visualization.py`

### Other components

- **Researcher**

## Connections

- Researcher → Data configuration: sets universe (evidence: `README.md`)
- Data configuration → Feature engineering: configures features
- Feature configuration → Feature engineering: configures features
- Feature engineering → Window datasets: prepares windows (evidence: `README.md`)
- Window datasets → Scaling: transforms windows
- Researcher → Model configuration: selects model (evidence: `README.md`)
- Window datasets → Training engine: supplies training data (evidence: `README.md`)
- Model configuration → Training engine: configures training
- Training engine → Diffusion Transformer: trains (evidence: `README.md`)
- Training engine → Flow Matching: trains ablation (evidence: `README.md`)
- Diffusion Transformer → DDPM: uses diffusion
- Researcher → Inference configuration: configures inference (evidence: `README.md`)
- Diffusion Transformer → DDIM sampler: samples paths (evidence: `README.md`)
- Inference configuration → DDIM sampler: configures sampling
- DDIM sampler → Inverse transforms: decodes paths (evidence: `README.md`)
- Inverse transforms → MPT portfolio: provides generated returns (evidence: `README.md`)
- MPT portfolio → Distribution statistics: provides backtest results
- Distribution statistics → Distribution analysis: summarizes fidelity (evidence: `README.md`)
- MPT portfolio → Visualization: visualizes results
- Data I/O → Feature engineering: loads and saves data
- Path configuration → Data configuration: provides data paths (evidence: `src/config/data_engineering.py`)
- Path configuration → Feature configuration: provides data paths (evidence: `src/config/engineering_config.py`)
- Experiment manager → Training engine: tracks training
