# team-reboot-academy/quiet-water architecture

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

- Interactive diagram: https://gitdiagram.com/team-reboot-academy/quiet-water
- Repository: https://github.com/team-reboot-academy/quiet-water

## Overview

Quiet Water is a Kotlin strategy service for the Teacher Trading Platform: it consumes closed-candle events, builds per-instrument windows, evaluates a walk-forward RSI strategy, and publishes BUY/SELL/HOLD recommendations. A separate health path reports service and Kafka status over HTTP. The README documents the strategy stages and Kafka role; source excerpts show application wiring and candle-processing calls. Some adapter internals were not excerpted, so their connections are included only where the SOURCE INDEX or README supports them.

Main entry points: [`src/main/kotlin/ru/omsu/quietwater/application/candle/ProcessClosedCandle.kt`](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/application/candle/ProcessClosedCandle.kt) (Process closed candle), [`src/main/kotlin/ru/omsu/quietwater/adapter/config/EnvConfig.kt`](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/adapter/config/EnvConfig.kt) (Environment config), [`src/main/kotlin/ru/omsu/quietwater/adapter/kafka/inbound/KafkaCandleListener.kt`](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/adapter/kafka/inbound/KafkaCandleListener.kt) (Candle listener), [`src/main/kotlin/ru/omsu/quietwater/adapter/kafka/outbound/KafkaRecommendationPublisher.kt`](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/adapter/kafka/outbound/KafkaRecommendationPublisher.kt) (Recommendation publisher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Event adapters"]
  node_listener["Candle listener"]
  node_eventdto["Candle event DTO"]
  node_publisher["Recommendation publisher"]
  node_recommenddto["Recommendation DTO"]
end

subgraph group_workflow["Candle workflow"]
  node_process["Process closed candle"]
  node_port["Window store port"]
  node_store[("In-memory window")]
end

subgraph group_strategy["Strategy domain"]
  node_policy["Walk-forward policy"]
  node_setup["RSI reversal setup"]
  node_score["Success rate<br/>[SuccessRate.kt]"]
  node_recommendation["Recommendation model<br/>[Recommendation.kt]"]
end

subgraph group_health["Health endpoint"]
  node_healthroute["Health routes<br/>[HealthRoutes.kt]"]
  node_healthusecase["Get health status<br/>[GetHealthStatus.kt]"]
  node_healthprobe["Kafka health probe"]
  node_healthresponse["Health response<br/>[HealthResponse.kt]"]
end

subgraph group_config["Configuration"]
  node_config["Environment config<br/>[EnvConfig.kt]"]
end

node_platform(("Trading platform"))
node_broker{{"Kafka broker"}}
node_operator(("Health client"))

node_platform -.->|"sends candles"| node_broker
node_broker -.->|"delivers events"| node_listener
node_listener -.->|"decodes payload"| node_eventdto
node_listener -->|"forwards candle"| node_process
node_process -->|"uses store"| node_port
node_process -->|"appends and reads"| node_store
node_process -->|"evaluates window"| node_policy
node_policy -->|"detects setup"| node_setup
node_policy -->|"calculates rate"| node_score
node_process -->|"builds result"| node_recommendation
node_process -->|"publishes result"| node_publisher
node_publisher -.->|"encodes payload"| node_recommenddto
node_publisher -.->|"sends recommendation"| node_broker
node_operator -->|"requests status"| node_healthroute
node_healthroute -->|"executes query"| node_healthusecase
node_healthusecase -->|"checks component"| node_healthprobe
node_healthroute -->|"formats response"| node_healthresponse
node_healthprobe -->|"reads broker settings"| node_config
node_config -->|"configures consumer"| node_listener
node_config -->|"configures producer"| node_publisher
node_config -->|"sets strategy parameters"| node_process
node_config -->|"sets service identity"| node_healthusecase

click node_config "https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/adapter/config/EnvConfig.kt"
click node_listener "https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/adapter/kafka/inbound/KafkaCandleListener.kt"
click node_eventdto "https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/adapter/kafka/dto/CandlePayloadDto.kt"
click node_publisher "https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/adapter/kafka/outbound/KafkaRecommendationPublisher.kt"
click node_recommenddto "https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/adapter/kafka/dto/RecommendationPayloadDto.kt"
click node_process "https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/application/candle/ProcessClosedCandle.kt"
click node_port "https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/application/port/outbound/InstrumentWindowStore.kt"
click node_store "https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/adapter/persistence/InMemoryInstrumentWindowStore.kt"
click node_policy "https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/domain/walkforward/WalkForwardPolicy.kt"
click node_setup "https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/domain/setup/RsiReversalSetup.kt"
click node_score "https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/domain/score/SuccessRate.kt"
click node_recommendation "https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/domain/recommendation/Recommendation.kt"
click node_healthroute "https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/api/health/HealthRoutes.kt"
click node_healthusecase "https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/application/health/GetHealthStatus.kt"
click node_healthprobe "https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/adapter/health/KafkaHealthProbe.kt"
click node_healthresponse "https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/api/dto/HealthResponse.kt"

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_listener,node_eventdto,node_publisher,node_recommenddto,node_operator toneBlue
class node_process,node_port,node_store toneAmber
class node_policy,node_setup,node_score,node_recommendation toneMint
class node_healthroute,node_healthusecase,node_healthprobe,node_healthresponse toneRose
class node_config,node_platform,node_broker toneIndigo
```

## Components

### Event adapters

- [Candle listener](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/adapter/kafka/inbound/KafkaCandleListener.kt): `src/main/kotlin/ru/omsu/quietwater/adapter/kafka/inbound/KafkaCandleListener.kt`
- [Candle event DTO](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/adapter/kafka/dto/CandlePayloadDto.kt): `src/main/kotlin/ru/omsu/quietwater/adapter/kafka/dto/CandlePayloadDto.kt`
- [Recommendation publisher](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/adapter/kafka/outbound/KafkaRecommendationPublisher.kt): `src/main/kotlin/ru/omsu/quietwater/adapter/kafka/outbound/KafkaRecommendationPublisher.kt`
- [Recommendation DTO](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/adapter/kafka/dto/RecommendationPayloadDto.kt): `src/main/kotlin/ru/omsu/quietwater/adapter/kafka/dto/RecommendationPayloadDto.kt`

### Candle workflow

- [Process closed candle](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/application/candle/ProcessClosedCandle.kt): `src/main/kotlin/ru/omsu/quietwater/application/candle/ProcessClosedCandle.kt`
- [Window store port](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/application/port/outbound/InstrumentWindowStore.kt): `src/main/kotlin/ru/omsu/quietwater/application/port/outbound/InstrumentWindowStore.kt`
- [In-memory window](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/adapter/persistence/InMemoryInstrumentWindowStore.kt): `src/main/kotlin/ru/omsu/quietwater/adapter/persistence/InMemoryInstrumentWindowStore.kt`

### Strategy domain

- [Walk-forward policy](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/domain/walkforward/WalkForwardPolicy.kt): `src/main/kotlin/ru/omsu/quietwater/domain/walkforward/WalkForwardPolicy.kt`
- [RSI reversal setup](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/domain/setup/RsiReversalSetup.kt): `src/main/kotlin/ru/omsu/quietwater/domain/setup/RsiReversalSetup.kt`
- [Success rate](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/domain/score/SuccessRate.kt): `src/main/kotlin/ru/omsu/quietwater/domain/score/SuccessRate.kt`
- [Recommendation model](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/domain/recommendation/Recommendation.kt): `src/main/kotlin/ru/omsu/quietwater/domain/recommendation/Recommendation.kt`

### Health endpoint

- [Health routes](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/api/health/HealthRoutes.kt): `src/main/kotlin/ru/omsu/quietwater/api/health/HealthRoutes.kt`
- [Get health status](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/application/health/GetHealthStatus.kt): `src/main/kotlin/ru/omsu/quietwater/application/health/GetHealthStatus.kt`
- [Kafka health probe](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/adapter/health/KafkaHealthProbe.kt): `src/main/kotlin/ru/omsu/quietwater/adapter/health/KafkaHealthProbe.kt`
- [Health response](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/api/dto/HealthResponse.kt): `src/main/kotlin/ru/omsu/quietwater/api/dto/HealthResponse.kt`

### Configuration

- [Environment config](https://github.com/team-reboot-academy/quiet-water/blob/main/src/main/kotlin/ru/omsu/quietwater/adapter/config/EnvConfig.kt): `src/main/kotlin/ru/omsu/quietwater/adapter/config/EnvConfig.kt`

### Other components

- **Trading platform**
- **Kafka broker**
- **Health client**

## Connections

- Trading platform → Kafka broker: sends candles (evidence: `README.md`)
- Kafka broker → Candle listener: delivers events (evidence: `README.md`)
- Candle listener → Candle event DTO: decodes payload
- Candle listener → Process closed candle: forwards candle (evidence: `src/main/kotlin/ru/omsu/quietwater/adapter/kafka/inbound/KafkaCandleListener.kt`)
- Process closed candle → Window store port: uses store (evidence: `src/main/kotlin/ru/omsu/quietwater/application/candle/ProcessClosedCandle.kt`)
- Process closed candle → In-memory window: appends and reads (evidence: `src/main/kotlin/ru/omsu/quietwater/application/candle/ProcessClosedCandle.kt`)
- Process closed candle → Walk-forward policy: evaluates window (evidence: `src/main/kotlin/ru/omsu/quietwater/application/candle/ProcessClosedCandle.kt`)
- Walk-forward policy → RSI reversal setup: detects setup (evidence: `src/main/kotlin/ru/omsu/quietwater/domain/walkforward/WalkForwardPolicy.kt`)
- Walk-forward policy → Success rate: calculates rate (evidence: `src/main/kotlin/ru/omsu/quietwater/domain/walkforward/WalkForwardPolicy.kt`)
- Process closed candle → Recommendation model: builds result (evidence: `src/main/kotlin/ru/omsu/quietwater/application/candle/ProcessClosedCandle.kt`)
- Process closed candle → Recommendation publisher: publishes result (evidence: `src/main/kotlin/ru/omsu/quietwater/application/candle/ProcessClosedCandle.kt`)
- Recommendation publisher → Recommendation DTO: encodes payload
- Recommendation publisher → Kafka broker: sends recommendation (evidence: `README.md`)
- Health client → Health routes: requests status (evidence: `src/main/kotlin/ru/omsu/quietwater/api/health/HealthRoutes.kt`)
- Health routes → Get health status: executes query (evidence: `src/main/kotlin/ru/omsu/quietwater/api/health/HealthRoutes.kt`)
- Get health status → Kafka health probe: checks component (evidence: `src/main/kotlin/ru/omsu/quietwater/application/health/GetHealthStatus.kt`)
- Health routes → Health response: formats response (evidence: `src/main/kotlin/ru/omsu/quietwater/api/health/HealthRoutes.kt`)
- Kafka health probe → Environment config: reads broker settings (evidence: `src/main/kotlin/ru/omsu/quietwater/adapter/health/KafkaHealthProbe.kt`)
- Environment config → Candle listener: configures consumer (evidence: `src/main/kotlin/ru/omsu/quietwater/QuietWaterApplication.kt`)
- Environment config → Recommendation publisher: configures producer (evidence: `src/main/kotlin/ru/omsu/quietwater/QuietWaterApplication.kt`)
- Environment config → Process closed candle: sets strategy parameters (evidence: `src/main/kotlin/ru/omsu/quietwater/QuietWaterApplication.kt`)
- Environment config → Get health status: sets service identity (evidence: `src/main/kotlin/ru/omsu/quietwater/QuietWaterApplication.kt`)
