# oolallal/profile-regime architecture

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

- Interactive diagram: https://gitdiagram.com/oolallal/profile-regime
- Repository: https://github.com/oolallal/profile-regime

## Overview

This repository is a Python research pipeline for Binance futures activity events and strategy evaluation. Its principal workflow downloads aggregate trades, converts them into bars and timeframe features, detects ATZ events, enriches events with forward-horizon features, and analyzes rules or simulated returns. The excerpts show the early orchestration and several downstream data readers; later workflow links are included only where the excerpts support them. The README is empty, so unsampled capabilities and connections are represented conservatively.

Main entry points: [`src/build_event_horizon_features.py`](https://github.com/oolallal/profile-regime/blob/main/src/build_event_horizon_features.py) (Horizon features), [`src/run.py`](https://github.com/oolallal/profile-regime/blob/main/src/run.py) (Pipeline runner), [`src/build_tf_features.py`](https://github.com/oolallal/profile-regime/blob/main/src/build_tf_features.py) (Timeframe features), [`src/evaluate_atz.py`](https://github.com/oolallal/profile-regime/blob/main/src/evaluate_atz.py) (ATZ evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Market data"]
  node_download["Daily download"]
  node_tradeparquet["Trade conversion"]
  node_bars["Minute bars<br/>[build_1m_bars.py]"]
  node_runner["Pipeline runner<br/>[run.py]"]
  node_bars_repair["Bar repair<br/>[fix_band.py]"]
end

subgraph group_features["Event features"]
  node_tf["Timeframe features"]
  node_events["ATZ detection"]
  node_horizon["Horizon features"]
end

subgraph group_evaluation["Event evaluation"]
  node_atz_eval["ATZ evaluation<br/>[evaluate_atz.py]"]
  node_comparison["Statistical comparison"]
  node_baseline_label["Baseline labeling"]
end

subgraph group_research["Strategy research"]
  node_rule_table["Rule table"]
  node_walkforward["Walk-forward analysis<br/>[wf_final.py]"]
  node_paper["Paper simulation<br/>[paper.py]"]
  node_simulation["Trade simulation<br/>[scratch.py]"]
end

node_user(("Researcher"))
node_binance(("Binance data"))

node_user -->|"runs pipeline"| node_runner
node_runner -->|"invokes download"| node_download
node_runner -->|"invokes conversion"| node_tradeparquet
node_runner -->|"invokes bar build"| node_bars
node_runner -->|"invokes features"| node_tf
node_download -->|"requests archives"| node_binance
node_tf -->|"reads bars"| node_bars
node_horizon -->|"reads features"| node_tf
node_horizon -->|"reads event files"| node_events
node_rule_table -->|"reads horizon data"| node_horizon
node_walkforward -->|"reads horizon data"| node_horizon
node_simulation -->|"reads parquet input"| node_horizon
node_paper -->|"reads parquet input"| node_horizon
node_atz_eval -->|"reads event data"| node_events
node_atz_eval -->|"reads features"| node_tf

click node_download "https://github.com/oolallal/profile-regime/blob/main/src/download_um_aggtrades_daily.py"
click node_tradeparquet "https://github.com/oolallal/profile-regime/blob/main/src/build_aggtrades_parquet.py"
click node_bars "https://github.com/oolallal/profile-regime/blob/main/src/build_1m_bars.py"
click node_tf "https://github.com/oolallal/profile-regime/blob/main/src/build_tf_features.py"
click node_events "https://github.com/oolallal/profile-regime/blob/main/src/build_atz_events.py"
click node_horizon "https://github.com/oolallal/profile-regime/blob/main/src/build_event_horizon_features.py"
click node_runner "https://github.com/oolallal/profile-regime/blob/main/src/run.py"
click node_atz_eval "https://github.com/oolallal/profile-regime/blob/main/src/evaluate_atz.py"
click node_comparison "https://github.com/oolallal/profile-regime/blob/main/src/analize_atz_eval.py"
click node_rule_table "https://github.com/oolallal/profile-regime/blob/main/src/build_rule_table.py"
click node_walkforward "https://github.com/oolallal/profile-regime/blob/main/src/wf_final.py"
click node_paper "https://github.com/oolallal/profile-regime/blob/main/src/paper.py"
click node_simulation "https://github.com/oolallal/profile-regime/blob/main/src/scratch.py"
click node_bars_repair "https://github.com/oolallal/profile-regime/blob/main/src/fix_band.py"
click node_baseline_label "https://github.com/oolallal/profile-regime/blob/main/src/heatmap_baseline_label.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_download,node_tradeparquet,node_bars,node_runner,node_bars_repair toneBlue
class node_tf,node_events,node_horizon toneAmber
class node_atz_eval,node_comparison,node_baseline_label toneMint
class node_rule_table,node_walkforward,node_paper,node_simulation toneRose
class node_user,node_binance toneIndigo
```

## Components

### Market data

- [Daily download](https://github.com/oolallal/profile-regime/blob/main/src/download_um_aggtrades_daily.py): `src/download_um_aggtrades_daily.py`
- [Trade conversion](https://github.com/oolallal/profile-regime/blob/main/src/build_aggtrades_parquet.py): `src/build_aggtrades_parquet.py`
- [Minute bars](https://github.com/oolallal/profile-regime/blob/main/src/build_1m_bars.py): `src/build_1m_bars.py`
- [Pipeline runner](https://github.com/oolallal/profile-regime/blob/main/src/run.py): `src/run.py`
- [Bar repair](https://github.com/oolallal/profile-regime/blob/main/src/fix_band.py): `src/fix_band.py`

### Event features

- [Timeframe features](https://github.com/oolallal/profile-regime/blob/main/src/build_tf_features.py): `src/build_tf_features.py`
- [ATZ detection](https://github.com/oolallal/profile-regime/blob/main/src/build_atz_events.py): `src/build_atz_events.py`
- [Horizon features](https://github.com/oolallal/profile-regime/blob/main/src/build_event_horizon_features.py): `src/build_event_horizon_features.py`

### Event evaluation

- [ATZ evaluation](https://github.com/oolallal/profile-regime/blob/main/src/evaluate_atz.py): `src/evaluate_atz.py`
- [Statistical comparison](https://github.com/oolallal/profile-regime/blob/main/src/analize_atz_eval.py): `src/analize_atz_eval.py`
- [Baseline labeling](https://github.com/oolallal/profile-regime/blob/main/src/heatmap_baseline_label.py): `src/heatmap_baseline_label.py`

### Strategy research

- [Rule table](https://github.com/oolallal/profile-regime/blob/main/src/build_rule_table.py): `src/build_rule_table.py`
- [Walk-forward analysis](https://github.com/oolallal/profile-regime/blob/main/src/wf_final.py): `src/wf_final.py`
- [Paper simulation](https://github.com/oolallal/profile-regime/blob/main/src/paper.py): `src/paper.py`
- [Trade simulation](https://github.com/oolallal/profile-regime/blob/main/src/scratch.py): `src/scratch.py`

### Other components

- **Researcher**
- **Binance data**

## Connections

- Researcher → Pipeline runner: runs pipeline (evidence: `src/run.py`)
- Pipeline runner → Daily download: invokes download (evidence: `src/run.py`)
- Pipeline runner → Trade conversion: invokes conversion (evidence: `src/run.py`)
- Pipeline runner → Minute bars: invokes bar build (evidence: `src/run.py`)
- Pipeline runner → Timeframe features: invokes features (evidence: `src/run.py`)
- Daily download → Binance data: requests archives (evidence: `src/download_um_aggtrades_daily.py`)
- Timeframe features → Minute bars: reads bars (evidence: `src/build_tf_features.py`)
- Horizon features → Timeframe features: reads features (evidence: `src/build_event_horizon_features.py`)
- Horizon features → ATZ detection: reads event files (evidence: `src/build_event_horizon_features.py`)
- Rule table → Horizon features: reads horizon data (evidence: `src/build_rule_table.py`)
- Walk-forward analysis → Horizon features: reads horizon data (evidence: `src/wf_final.py`)
- Trade simulation → Horizon features: reads parquet input (evidence: `src/scratch.py`)
- Paper simulation → Horizon features: reads parquet input (evidence: `src/paper.py`)
- ATZ evaluation → ATZ detection: reads event data (evidence: `src/evaluate_atz.py`)
- ATZ evaluation → Timeframe features: reads features (evidence: `src/evaluate_atz.py`)
