# nprawn/autoquant architecture

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

- Interactive diagram: https://gitdiagram.com/nprawn/autoquant
- Repository: https://github.com/nprawn/autoquant

## Overview

AutoQuant is a crypto strategy backtesting and paper-trading platform. Users author or AI-convert a strategy in the web app, submit it to the API, then inspect backtest or simulation performance. The documented backtest path records a job and outbox, queues work after commit, and exposes results separately; market ingestion supplies candle data. Other documented capabilities include authentication, contests, charts/realtime prices, and notifications. Edges rely on README statements and the shown source/index references; some subsystems are represented by their existing directories because their implementation was not sampled.

Main entry points: [`frontend/src`](https://github.com/nprawn/autoquant/tree/develop/frontend/src) (React app), [`backend/ingest/cmd/consumer/main.go`](https://github.com/nprawn/autoquant/blob/develop/backend/ingest/cmd/consumer/main.go) (Candle consumer), [`backend/api/src/main/java/com/ssafy/a107/auth/service/AuthCommandService.java`](https://github.com/nprawn/autoquant/blob/develop/backend/api/src/main/java/com/ssafy/a107/auth/service/AuthCommandService.java) (SSAFY auth), [`backend/api/src/main/java/com/ssafy/a107/strategy/controller/StrategyController.java`](https://github.com/nprawn/autoquant/blob/develop/backend/api/src/main/java/com/ssafy/a107/strategy/controller/StrategyController.java) (Strategy APIs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_frontend["React app"]
end

subgraph group_api["Platform API"]
  node_auth["SSAFY auth"]
  node_members["Member profiles<br/>[Member.java]"]
  node_strategy_api["Strategy APIs"]
  node_notifications["Notifications"]
end

subgraph group_strategy["Strategy and trading"]
  node_strategies["Strategy DSL<br/>[StrategyDsl.java]"]
  node_engine["Strategy engine"]
  node_backtest["Backtest API"]
  node_worker["Backtest worker"]
  node_simulation["Paper trading"]
  node_contest["Strategy contests"]
end

subgraph group_market["Market data"]
  node_assets["Asset catalog<br/>[Asset.java]"]
  node_candles["Candle services"]
  node_producer["Trade producer<br/>[main.go]"]
  node_consumer["Candle consumer<br/>[main.go]"]
  node_backfill["Candle backfill<br/>[main.go]"]
  node_realtime["Realtime prices"]
end

subgraph group_services["External services"]
  node_upbit["Upbit market"]
  node_kafka["Kafka stream"]
  node_postgres[("PostgreSQL")]
  node_redis[("Redis")]
  node_rabbit["RabbitMQ"]
  node_ai["AI strategy service<br/>[strategy.py]"]
end

node_user(("Investor"))

node_user -->|"uses"| node_frontend
node_frontend -->|"submits strategy"| node_strategy_api
node_strategy_api -.->|"manages DSL"| node_strategies
node_strategy_api -.->|"executes strategy"| node_engine
node_engine -->|"evaluates candles"| node_candles
node_frontend -->|"requests backtest"| node_backtest
node_backtest -->|"stores run and outbox"| node_postgres
node_backtest -->|"publishes job"| node_rabbit
node_rabbit -->|"delivers job"| node_worker
node_worker -->|"stores results"| node_postgres
node_frontend -->|"uses simulation"| node_simulation
node_simulation -->|"runs strategy"| node_engine
node_simulation -->|"reads candles"| node_candles
node_frontend -->|"requests conversion"| node_ai
node_ai -->|"returns DSL"| node_strategies
node_user -->|"authenticates"| node_auth
node_auth -->|"registers member"| node_members
node_auth -.->|"exchanges code"| node_upbit
node_upbit -->|"streams trades"| node_producer
node_producer -->|"publishes trades"| node_kafka
node_kafka -->|"delivers trades"| node_consumer
node_consumer -->|"writes candles"| node_postgres
node_consumer -->|"updates recent data"| node_redis
node_upbit -->|"provides history"| node_backfill
node_backfill -->|"writes candles"| node_postgres
node_backfill -->|"updates cache"| node_redis
node_candles -->|"reads coverage"| node_postgres
node_frontend -->|"views contests"| node_contest
node_frontend -->|"views live prices"| node_realtime
node_consumer -.->|"publishes updates"| node_realtime
node_frontend -.->|"views notifications"| node_notifications
node_assets -.->|"persists catalog"| node_postgres

click node_frontend "https://github.com/nprawn/autoquant/tree/develop/frontend/src"
click node_auth "https://github.com/nprawn/autoquant/blob/develop/backend/api/src/main/java/com/ssafy/a107/auth/service/AuthCommandService.java"
click node_members "https://github.com/nprawn/autoquant/blob/develop/backend/api/src/main/java/com/ssafy/a107/member/domain/Member.java"
click node_assets "https://github.com/nprawn/autoquant/blob/develop/backend/api/src/main/java/com/ssafy/a107/asset/domain/Asset.java"
click node_strategies "https://github.com/nprawn/autoquant/blob/develop/backend/api/src/main/java/com/ssafy/a107/strategy/domain/dsl/StrategyDsl.java"
click node_strategy_api "https://github.com/nprawn/autoquant/blob/develop/backend/api/src/main/java/com/ssafy/a107/strategy/controller/StrategyController.java"
click node_engine "https://github.com/nprawn/autoquant/blob/develop/backend/api/src/main/java/com/ssafy/a107/strategy/engine/StrategyExecutionPipeline.java"
click node_candles "https://github.com/nprawn/autoquant/tree/develop/backend/api/src/main/java/com/ssafy/a107/candle/service"
click node_producer "https://github.com/nprawn/autoquant/blob/develop/backend/ingest/cmd/producer/main.go"
click node_consumer "https://github.com/nprawn/autoquant/blob/develop/backend/ingest/cmd/consumer/main.go"
click node_backfill "https://github.com/nprawn/autoquant/blob/develop/backend/ingest/cmd/backfill/main.go"
click node_backtest "https://github.com/nprawn/autoquant/tree/develop/backend/api/src/main/java/com/ssafy/a107/trading/backtest/service"
click node_worker "https://github.com/nprawn/autoquant/tree/develop/backend/api/src/main/java/com/ssafy/a107/trading/backtest"
click node_simulation "https://github.com/nprawn/autoquant/blob/develop/backend/api/src/main/java/com/ssafy/a107/trading/simulation/service/SimulationCandleExecutionService.java"
click node_ai "https://github.com/nprawn/autoquant/blob/develop/ai/app/api/v1/strategy.py"
click node_contest "https://github.com/nprawn/autoquant/tree/develop/backend/api/src/main/java/com/ssafy/a107/contest"
click node_realtime "https://github.com/nprawn/autoquant/tree/develop/backend/api/src/main/java/com/ssafy/a107/realtime"
click node_notifications "https://github.com/nprawn/autoquant/tree/develop/backend/api/src/main/java/com/ssafy/a107/notification"

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_frontend toneBlue
class node_auth,node_members,node_strategy_api,node_notifications toneAmber
class node_strategies,node_engine,node_backtest,node_worker,node_simulation,node_contest toneMint
class node_assets,node_candles,node_producer,node_consumer,node_backfill,node_realtime toneRose
class node_upbit,node_kafka,node_postgres,node_redis,node_rabbit,node_ai,node_user toneIndigo
```

## Components

### Web client

- [React app](https://github.com/nprawn/autoquant/tree/develop/frontend/src): `frontend/src`

### Platform API

- [SSAFY auth](https://github.com/nprawn/autoquant/blob/develop/backend/api/src/main/java/com/ssafy/a107/auth/service/AuthCommandService.java): `backend/api/src/main/java/com/ssafy/a107/auth/service/AuthCommandService.java`
- [Member profiles](https://github.com/nprawn/autoquant/blob/develop/backend/api/src/main/java/com/ssafy/a107/member/domain/Member.java): `backend/api/src/main/java/com/ssafy/a107/member/domain/Member.java`
- [Strategy APIs](https://github.com/nprawn/autoquant/blob/develop/backend/api/src/main/java/com/ssafy/a107/strategy/controller/StrategyController.java): `backend/api/src/main/java/com/ssafy/a107/strategy/controller/StrategyController.java`
- [Notifications](https://github.com/nprawn/autoquant/tree/develop/backend/api/src/main/java/com/ssafy/a107/notification): `backend/api/src/main/java/com/ssafy/a107/notification`

### Strategy and trading

- [Strategy DSL](https://github.com/nprawn/autoquant/blob/develop/backend/api/src/main/java/com/ssafy/a107/strategy/domain/dsl/StrategyDsl.java): `backend/api/src/main/java/com/ssafy/a107/strategy/domain/dsl/StrategyDsl.java`
- [Strategy engine](https://github.com/nprawn/autoquant/blob/develop/backend/api/src/main/java/com/ssafy/a107/strategy/engine/StrategyExecutionPipeline.java): `backend/api/src/main/java/com/ssafy/a107/strategy/engine/StrategyExecutionPipeline.java`
- [Backtest API](https://github.com/nprawn/autoquant/tree/develop/backend/api/src/main/java/com/ssafy/a107/trading/backtest/service): `backend/api/src/main/java/com/ssafy/a107/trading/backtest/service`
- [Backtest worker](https://github.com/nprawn/autoquant/tree/develop/backend/api/src/main/java/com/ssafy/a107/trading/backtest): `backend/api/src/main/java/com/ssafy/a107/trading/backtest`
- [Paper trading](https://github.com/nprawn/autoquant/blob/develop/backend/api/src/main/java/com/ssafy/a107/trading/simulation/service/SimulationCandleExecutionService.java): `backend/api/src/main/java/com/ssafy/a107/trading/simulation/service/SimulationCandleExecutionService.java`
- [Strategy contests](https://github.com/nprawn/autoquant/tree/develop/backend/api/src/main/java/com/ssafy/a107/contest): `backend/api/src/main/java/com/ssafy/a107/contest`

### Market data

- [Asset catalog](https://github.com/nprawn/autoquant/blob/develop/backend/api/src/main/java/com/ssafy/a107/asset/domain/Asset.java): `backend/api/src/main/java/com/ssafy/a107/asset/domain/Asset.java`
- [Candle services](https://github.com/nprawn/autoquant/tree/develop/backend/api/src/main/java/com/ssafy/a107/candle/service): `backend/api/src/main/java/com/ssafy/a107/candle/service`
- [Trade producer](https://github.com/nprawn/autoquant/blob/develop/backend/ingest/cmd/producer/main.go): `backend/ingest/cmd/producer/main.go`
- [Candle consumer](https://github.com/nprawn/autoquant/blob/develop/backend/ingest/cmd/consumer/main.go): `backend/ingest/cmd/consumer/main.go`
- [Candle backfill](https://github.com/nprawn/autoquant/blob/develop/backend/ingest/cmd/backfill/main.go): `backend/ingest/cmd/backfill/main.go`
- [Realtime prices](https://github.com/nprawn/autoquant/tree/develop/backend/api/src/main/java/com/ssafy/a107/realtime): `backend/api/src/main/java/com/ssafy/a107/realtime`

### External services

- **Upbit market**
- **Kafka stream**
- **PostgreSQL**
- **Redis**
- **RabbitMQ**
- [AI strategy service](https://github.com/nprawn/autoquant/blob/develop/ai/app/api/v1/strategy.py): `ai/app/api/v1/strategy.py`

### Other components

- **Investor**

## Connections

- Investor → React app: uses
- React app → Strategy APIs: submits strategy
- Strategy APIs → Strategy DSL: manages DSL
- Strategy APIs → Strategy engine: executes strategy
- Strategy engine → Candle services: evaluates candles (evidence: `backend/api/src/main/java/com/ssafy/a107/strategy/engine/StrategyExecutionPipeline.java`)
- React app → Backtest API: requests backtest
- Backtest API → PostgreSQL: stores run and outbox
- Backtest API → RabbitMQ: publishes job
- RabbitMQ → Backtest worker: delivers job
- Backtest worker → PostgreSQL: stores results
- React app → Paper trading: uses simulation
- Paper trading → Strategy engine: runs strategy (evidence: `backend/api/src/main/java/com/ssafy/a107/trading/simulation/service/SimulationCandleExecutionService.java`)
- Paper trading → Candle services: reads candles (evidence: `backend/api/src/main/java/com/ssafy/a107/trading/simulation/service/SimulationCandleExecutionService.java`)
- React app → AI strategy service: requests conversion
- AI strategy service → Strategy DSL: returns DSL
- Investor → SSAFY auth: authenticates
- SSAFY auth → Member profiles: registers member (evidence: `backend/api/src/main/java/com/ssafy/a107/auth/service/AuthCommandService.java`)
- SSAFY auth → Upbit market: exchanges code
- Upbit market → Trade producer: streams trades
- Trade producer → Kafka stream: publishes trades
- Kafka stream → Candle consumer: delivers trades
- Candle consumer → PostgreSQL: writes candles
- Candle consumer → Redis: updates recent data
- Upbit market → Candle backfill: provides history
- Candle backfill → PostgreSQL: writes candles (evidence: `backend/ingest/cmd/backfill/main.go`)
- Candle backfill → Redis: updates cache (evidence: `backend/ingest/cmd/backfill/main.go`)
- Candle services → PostgreSQL: reads coverage (evidence: `backend/api/src/main/java/com/ssafy/a107/candle/service/CandleCoverageReadService.java`)
- React app → Strategy contests: views contests
- React app → Realtime prices: views live prices
- Candle consumer → Realtime prices: publishes updates
- React app → Notifications: views notifications
- Asset catalog → PostgreSQL: persists catalog
