How kumar306/market-tick-aggregator works
Market Tick Aggregator is a real-time market-data platform. Exchange feeds enter through the adapter, pass through normalization into separate metrics and order-book processing, then flow to durable storage and a live dashboard. The graph preserves the README’s REST-history and WebSocket-live paths. Relationships are drawn from README statements and the shown entry points; unsampled service internals are represented by their listed runtime paths, without inferring calls between sibling helpers.
Main entry points: worker/worker.go Order-book workers · worker/worker.go Metric workers · main.go UI backend · page.tsx Next.js dashboard
Components 26
Feed ingestion
- Feed adapter
adapter/main.go - Raw Kafka topics
Stream processing
- Normalizer workers
normalizer/worker/worker.go - Normalized topics
- Depth resync
normalizer/resync/adapter_signal.go - Metric workers
aggregator/worker/worker.go - Metric registry
aggregator/internal/metric_registry.go - Metric flush scheduler
aggregator/flush/scheduler.go - Order-book workers
orderbook/worker/worker.go - Book dispatcher
orderbook/dispatcher/dispatcher.go - Book flush scheduler
orderbook/flush/scheduler.go - Redis state
orderbook/redis/redis.go
Persistence
- Aggregated topics
- Flushed-book topics
- Persistence consumer
persistence/kafka/consumer.go - Conversion and batching
persistence/pipeline/pipeline.go - Postgres
Dashboard serving
- UI backend
ui-backend/main.go - Historical REST API
ui-backend/controller/market_controller.go - Market repository
ui-backend/repository/market_repository.go - Live Kafka stream
ui-backend/stream/kafka_consumer.go - WebSocket fanout
ui-backend/stream/stream_manager.go - Next.js dashboard
ui/src/app/page.tsx
Shared runtime
- Ingest timestamp
shared/ingestts/ingestts.go
Other components
- Exchange feeds
- Dashboard user
Connections 28
- Exchange feeds → Feed adapter: send feeds
- Feed adapter → Raw Kafka topics: publish events
- Raw Kafka topics → Normalizer workers: consume events
- Normalizer workers → Normalized topics: publish schemas
- Normalized topics → Metric workers: consume ticks
- Normalized topics → Order-book workers: consume books
- Normalizer workers → Depth resync: request resync
- Metric workers → Metric registry: update metrics
- Metric workers → Metric flush scheduler: schedule windows
- Metric workers → Aggregated topics: publish aggregates
- Order-book workers → Book dispatcher: dispatch records
- Order-book workers → Book flush scheduler: schedule flushes
- Order-book workers → Redis state: use state
- Order-book workers → Flushed-book topics: publish snapshots
- Aggregated topics → Persistence consumer: consume ticks
- Flushed-book topics → Persistence consumer: consume books
- Persistence consumer → Conversion and batching: process records
- Conversion and batching → Postgres: batch writes
- Dashboard user → Next.js dashboard: inspect markets
- Next.js dashboard → UI backend: request history
- UI backend → Historical REST API: route REST
ui-backend/main.go - Historical REST API → Market repository: query history
ui-backend/controller/market_controller.go - Market repository → Postgres: read history
- Next.js dashboard → UI backend: open WebSocket
- UI backend → Live Kafka stream: start consumer
ui-backend/main.go - Live Kafka stream → Aggregated topics: read live updates
- Live Kafka stream → WebSocket fanout: broadcast updates
ui-backend/stream/stream_manager.go - WebSocket fanout → Next.js dashboard: fan out updates