# ghostfinancialllc/goldmicrostructure architecture

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

- Interactive diagram: https://gitdiagram.com/ghostfinancialllc/goldmicrostructure
- Repository: https://github.com/ghostfinancialllc/goldmicrostructure

## Overview

This repository is a quantitative research pipeline for testing tick-level order-flow signals on COMEX Gold futures, not a trading system. The principal workflow ingests Databento ticks, constructs footprint and range-bar features, loads and filters overnight data, tests signals, sweeps trade parameters, validates candidates, and reports findings. Later phases add regime, event-table, filter, machine-learning, multi-signal, and rule-based analyses. The graph reflects documented pipeline stages and source-index references; unsampled module internals are not assumed, and the README is the evidence for the documented ingestion and research workflow.

Main entry points: [`pipeline/run_pipeline.py`](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/run_pipeline.py) (Pipeline runner), [`pipeline/phase2_signals.py`](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase2_signals.py) (Bidirectional signals), [`pipeline/phase0_load.py`](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase0_load.py) (Overnight data load), [`pipeline/phase5_cuda.py`](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase5_cuda.py) (Exit parameter sweep)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Data and Features"]
  node_ingest["Tick ingestion"]
  node_footprint["Footprint signals<br/>[footprint_calc.py]"]
  node_load["Overnight data load<br/>[phase0_load.py]"]
end

subgraph group_research["Signal Research"]
  node_orchestrator["Pipeline runner<br/>[run_pipeline.py]"]
  node_census["Signal census<br/>[phase1_census.py]"]
  node_signals["Bidirectional signals<br/>[phase2_signals.py]"]
  node_spaghetti["Signal exploration"]
  node_combos["Signal combinations<br/>[phase4_combos.py]"]
  node_cuda["Exit parameter sweep<br/>[phase5_cuda.py]"]
  node_regimes["Regime analysis<br/>[phase5b_regimes.py]"]
  node_events["Master event table"]
  node_filters["Filter sweep"]
  node_ml["Conditional ML"]
  node_multi["Multi-signal analysis"]
  node_rules["Rule testing<br/>[phase12_rules.py]"]
end

subgraph group_validation["Validation and Analysis"]
  node_validation["Walk-forward validation<br/>[phase6_validate.py]"]
  node_report["Research reporting<br/>[phase7_report.py]"]
  node_deepdive["Session deep dive<br/>[deep_dive.py]"]
  node_targeted["Targeted CUDA sweep<br/>[targeted_sweep.py]"]
end

subgraph group_shared["Shared Runtime"]
  node_config["Research configuration<br/>[config.py]"]
  node_utils["Shared analysis utilities<br/>[utils.py]"]
end

node_databento(("Databento ticks"))

node_databento -->|"provides ticks"| node_ingest
node_ingest -->|"computes features"| node_footprint
node_ingest -->|"writes bar data"| node_load
node_orchestrator -->|"runs phase"| node_load
node_orchestrator -->|"runs phase"| node_census
node_orchestrator -->|"runs phase"| node_signals
node_orchestrator -->|"runs phase"| node_spaghetti
node_orchestrator -->|"runs phase"| node_combos
node_orchestrator -->|"runs phase"| node_cuda
node_orchestrator -->|"runs phase"| node_regimes
node_orchestrator -->|"runs phase"| node_validation
node_orchestrator -->|"runs phase"| node_report
node_orchestrator -->|"runs phase"| node_events
node_orchestrator -->|"runs phase"| node_filters
node_orchestrator -->|"runs phase"| node_ml
node_orchestrator -->|"runs phase"| node_multi
node_orchestrator -->|"runs phase"| node_rules
node_census -->|"uses loaded data"| node_load
node_signals -->|"uses loaded data"| node_load
node_spaghetti -->|"uses signal definitions"| node_signals
node_spaghetti -->|"uses loaded data"| node_load
node_combos -->|"uses signal definitions"| node_signals
node_cuda -->|"selects candidates"| node_signals
node_cuda -->|"uses tick data"| node_load
node_regimes -->|"uses signal definitions"| node_signals
node_validation -->|"validates configs"| node_cuda
node_events -->|"uses tick data"| node_load
node_filters -->|"uses event table"| node_events
node_filters -->|"uses signal definitions"| node_signals
node_ml -->|"uses event table"| node_events
node_ml -->|"evaluates candidates"| node_signals
node_multi -->|"uses ML results"| node_ml
node_multi -->|"uses event table"| node_events
node_rules -->|"uses signal definitions"| node_signals
node_deepdive -->|"loads research data"| node_load
node_deepdive -->|"uses signal definitions"| node_signals
node_targeted -->|"uses sweep kernel"| node_cuda
node_targeted -->|"uses signal definitions"| node_signals
node_load -->|"uses utilities"| node_utils
node_signals -->|"uses utilities"| node_utils
node_orchestrator -->|"reads settings"| node_config

click node_ingest "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/databento_ingest.py"
click node_footprint "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/footprint_calc.py"
click node_load "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase0_load.py"
click node_orchestrator "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/run_pipeline.py"
click node_census "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase1_census.py"
click node_signals "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase2_signals.py"
click node_spaghetti "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase3_spaghetti.py"
click node_combos "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase4_combos.py"
click node_cuda "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase5_cuda.py"
click node_regimes "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase5b_regimes.py"
click node_validation "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase6_validate.py"
click node_report "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase7_report.py"
click node_events "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase8_event_table.py"
click node_filters "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase9_filter_sweep.py"
click node_ml "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase10_ml_conditional.py"
click node_multi "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase11_multi_signal.py"
click node_rules "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase12_rules.py"
click node_deepdive "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/analysis/deep_dive.py"
click node_targeted "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/analysis/targeted_sweep.py"
click node_config "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/config.py"
click node_utils "https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/utils.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_ingest,node_footprint,node_load toneBlue
class node_orchestrator,node_census,node_signals,node_spaghetti,node_combos,node_cuda,node_regimes,node_events,node_filters,node_ml,node_multi,node_rules toneAmber
class node_validation,node_report,node_deepdive,node_targeted toneMint
class node_config,node_utils toneRose
class node_databento toneIndigo
```

## Components

### Data and Features

- [Tick ingestion](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/databento_ingest.py): `pipeline/databento_ingest.py`
- [Footprint signals](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/footprint_calc.py): `pipeline/footprint_calc.py`
- [Overnight data load](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase0_load.py): `pipeline/phase0_load.py`

### Signal Research

- [Pipeline runner](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/run_pipeline.py): `pipeline/run_pipeline.py`
- [Signal census](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase1_census.py): `pipeline/phase1_census.py`
- [Bidirectional signals](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase2_signals.py): `pipeline/phase2_signals.py`
- [Signal exploration](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase3_spaghetti.py): `pipeline/phase3_spaghetti.py`
- [Signal combinations](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase4_combos.py): `pipeline/phase4_combos.py`
- [Exit parameter sweep](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase5_cuda.py): `pipeline/phase5_cuda.py`
- [Regime analysis](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase5b_regimes.py): `pipeline/phase5b_regimes.py`
- [Master event table](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase8_event_table.py): `pipeline/phase8_event_table.py`
- [Filter sweep](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase9_filter_sweep.py): `pipeline/phase9_filter_sweep.py`
- [Conditional ML](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase10_ml_conditional.py): `pipeline/phase10_ml_conditional.py`
- [Multi-signal analysis](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase11_multi_signal.py): `pipeline/phase11_multi_signal.py`
- [Rule testing](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase12_rules.py): `pipeline/phase12_rules.py`

### Validation and Analysis

- [Walk-forward validation](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase6_validate.py): `pipeline/phase6_validate.py`
- [Research reporting](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/phase7_report.py): `pipeline/phase7_report.py`
- [Session deep dive](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/analysis/deep_dive.py): `analysis/deep_dive.py`
- [Targeted CUDA sweep](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/analysis/targeted_sweep.py): `analysis/targeted_sweep.py`

### Shared Runtime

- [Research configuration](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/config.py): `pipeline/config.py`
- [Shared analysis utilities](https://github.com/ghostfinancialllc/goldmicrostructure/blob/main/pipeline/utils.py): `pipeline/utils.py`

### Other components

- **Databento ticks**

## Connections

- Databento ticks → Tick ingestion: provides ticks (evidence: `README.md`)
- Tick ingestion → Footprint signals: computes features (evidence: `pipeline/databento_ingest.py`)
- Tick ingestion → Overnight data load: writes bar data (evidence: `README.md`)
- Pipeline runner → Overnight data load: runs phase (evidence: `pipeline/run_pipeline.py`)
- Pipeline runner → Signal census: runs phase (evidence: `pipeline/run_pipeline.py`)
- Pipeline runner → Bidirectional signals: runs phase (evidence: `pipeline/run_pipeline.py`)
- Pipeline runner → Signal exploration: runs phase (evidence: `pipeline/run_pipeline.py`)
- Pipeline runner → Signal combinations: runs phase (evidence: `pipeline/run_pipeline.py`)
- Pipeline runner → Exit parameter sweep: runs phase (evidence: `pipeline/run_pipeline.py`)
- Pipeline runner → Regime analysis: runs phase (evidence: `pipeline/run_pipeline.py`)
- Pipeline runner → Walk-forward validation: runs phase (evidence: `pipeline/run_pipeline.py`)
- Pipeline runner → Research reporting: runs phase (evidence: `pipeline/run_pipeline.py`)
- Pipeline runner → Master event table: runs phase (evidence: `pipeline/run_pipeline.py`)
- Pipeline runner → Filter sweep: runs phase (evidence: `pipeline/run_pipeline.py`)
- Pipeline runner → Conditional ML: runs phase (evidence: `pipeline/run_pipeline.py`)
- Pipeline runner → Multi-signal analysis: runs phase (evidence: `pipeline/run_pipeline.py`)
- Pipeline runner → Rule testing: runs phase (evidence: `pipeline/run_pipeline.py`)
- Signal census → Overnight data load: uses loaded data (evidence: `pipeline/phase1_census.py`)
- Bidirectional signals → Overnight data load: uses loaded data (evidence: `pipeline/phase2_signals.py`)
- Signal exploration → Bidirectional signals: uses signal definitions (evidence: `pipeline/phase3_spaghetti.py`)
- Signal exploration → Overnight data load: uses loaded data (evidence: `pipeline/phase3_spaghetti.py`)
- Signal combinations → Bidirectional signals: uses signal definitions (evidence: `pipeline/phase4_combos.py`)
- Exit parameter sweep → Bidirectional signals: selects candidates (evidence: `pipeline/phase5_cuda.py`)
- Exit parameter sweep → Overnight data load: uses tick data (evidence: `pipeline/phase5_cuda.py`)
- Regime analysis → Bidirectional signals: uses signal definitions (evidence: `pipeline/phase5b_regimes.py`)
- Walk-forward validation → Exit parameter sweep: validates configs (evidence: `pipeline/phase6_validate.py`)
- Master event table → Overnight data load: uses tick data (evidence: `pipeline/phase8_event_table.py`)
- Filter sweep → Master event table: uses event table (evidence: `pipeline/phase9_filter_sweep.py`)
- Filter sweep → Bidirectional signals: uses signal definitions (evidence: `pipeline/phase9_filter_sweep.py`)
- Conditional ML → Master event table: uses event table (evidence: `pipeline/phase10_ml_conditional.py`)
- Conditional ML → Bidirectional signals: evaluates candidates (evidence: `pipeline/phase10_ml_conditional.py`)
- Multi-signal analysis → Conditional ML: uses ML results (evidence: `pipeline/phase11_multi_signal.py`)
- Multi-signal analysis → Master event table: uses event table (evidence: `pipeline/phase11_multi_signal.py`)
- Rule testing → Bidirectional signals: uses signal definitions (evidence: `pipeline/phase12_rules.py`)
- Session deep dive → Overnight data load: loads research data (evidence: `analysis/deep_dive.py`)
- Session deep dive → Bidirectional signals: uses signal definitions (evidence: `analysis/deep_dive.py`)
- Targeted CUDA sweep → Exit parameter sweep: uses sweep kernel (evidence: `analysis/targeted_sweep.py`)
- Targeted CUDA sweep → Bidirectional signals: uses signal definitions (evidence: `analysis/targeted_sweep.py`)
- Overnight data load → Shared analysis utilities: uses utilities (evidence: `pipeline/phase0_load.py`)
- Bidirectional signals → Shared analysis utilities: uses utilities (evidence: `pipeline/phase2_signals.py`)
- Pipeline runner → Research configuration: reads settings (evidence: `pipeline/run_pipeline.py`)
