Producer (market-data-service):
- Backpressure: smart drop policy (heartbeats→quotes→trades preserved)
- Heartbeat monitor: synthetic HeartbeatEvent on provider silence
- Graceful shutdown: WS→bus→storage→DB engine cleanup sequence
- Bybit V5 public WS provider (backup for Binance, no API key needed)
- FailoverManager: health-based provider switching with recovery
- NATS output adapter: md.events.{type}.{symbol} for SenpAI
- /bus-stats endpoint for backpressure monitoring
- Dockerfile + docker-compose.node1.yml integration
- 36 tests (parsing + bus + failover), requirements.lock
Consumer (senpai-md-consumer):
- NATSConsumer: subscribe md.events.>, queue group senpai-md, backpressure
- State store: LatestState + RollingWindow (deque, 60s)
- Feature engine: 11 features (mid, spread, VWAP, return, vol, latency)
- Rule-based signals: long/short on return+volume+spread conditions
- Publisher: rate-limited features + signals + alerts to NATS
- HTTP API: /health, /metrics, /state/latest, /features/latest, /stats
- 10 Prometheus metrics
- Dockerfile + docker-compose.senpai.yml
- 41 tests (parsing + state + features + rate-limit), requirements.lock
CI: ruff + pytest + smoke import for both services
Tests: 77 total passed, lint clean
Co-authored-by: Cursor <cursoragent@cursor.com>
23 lines
238 B
Plaintext
23 lines
238 B
Plaintext
# SenpAI Market-Data Consumer
|
|
# Python 3.11+
|
|
|
|
# Core
|
|
pydantic>=2.5
|
|
pydantic-settings>=2.1
|
|
|
|
# NATS
|
|
nats-py>=2.7
|
|
|
|
# Logging
|
|
structlog>=24.1
|
|
|
|
# Metrics
|
|
prometheus_client>=0.20
|
|
|
|
# Testing
|
|
pytest>=8.0
|
|
pytest-asyncio>=0.23
|
|
|
|
# Linting
|
|
ruff>=0.3
|