# sundrop2002/marketflow architecture

> Architecture diagram of the GitHub repository sundrop2002/marketflow, 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/sundrop2002/marketflow
- Repository: https://github.com/sundrop2002/marketflow

## Overview

This small Python script fetches Binance candle data, displays it, and demonstrates saving and reloading the raw response as JSON. `main.py` orchestrates the workflow; the client owns the HTTP request, while the storage helper owns file I/O. The README is empty, so the map reflects only the shown source; the JSON file is a runtime artifact, not a repository file.

Main entry points: [`main.py`](https://github.com/sundrop2002/marketflow/blob/main/main.py) (Candle runner), [`ingestion/binance_client.py`](https://github.com/sundrop2002/marketflow/blob/main/ingestion/binance_client.py) (Binance client), [`ingestion/raw_storage.py`](https://github.com/sundrop2002/marketflow/blob/main/ingestion/raw_storage.py) (Raw storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Workflow"]
  node_main["Candle runner<br/>[main.py]"]
end

subgraph group_ingestion["Ingestion"]
  node_client["Binance client<br/>[binance_client.py]"]
end

subgraph group_persistence["Persistence"]
  node_storage["Raw storage<br/>[raw_storage.py]"]
  node_jsonfile[("Candles JSON")]
end

node_user(("User"))
node_binance["Binance API"]

node_user -->|"runs"| node_main
node_main -->|"requests candles"| node_client
node_client -->|"GET klines"| node_binance
node_binance -->|"returns candles"| node_client
node_main -->|"saves and reads"| node_storage
node_storage -->|"writes and reads"| node_jsonfile

click node_main "https://github.com/sundrop2002/marketflow/blob/main/main.py"
click node_client "https://github.com/sundrop2002/marketflow/blob/main/ingestion/binance_client.py"
click node_storage "https://github.com/sundrop2002/marketflow/blob/main/ingestion/raw_storage.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_main,node_user toneBlue
class node_client toneAmber
class node_storage,node_jsonfile,node_binance toneMint
```

## Components

### Workflow

- [Candle runner](https://github.com/sundrop2002/marketflow/blob/main/main.py): `main.py`

### Ingestion

- [Binance client](https://github.com/sundrop2002/marketflow/blob/main/ingestion/binance_client.py): `ingestion/binance_client.py`

### Persistence

- [Raw storage](https://github.com/sundrop2002/marketflow/blob/main/ingestion/raw_storage.py): `ingestion/raw_storage.py`
- **Candles JSON**

### Other components

- **User**
- **Binance API**

## Connections

- User → Candle runner: runs (evidence: `main.py`)
- Candle runner → Binance client: requests candles (evidence: `main.py`)
- Binance client → Binance API: GET klines (evidence: `ingestion/binance_client.py`)
- Binance API → Binance client: returns candles (evidence: `ingestion/binance_client.py`)
- Candle runner → Raw storage: saves and reads (evidence: `main.py`)
- Raw storage → Candles JSON: writes and reads (evidence: `ingestion/raw_storage.py`)
