flowchart TD
A[On-chain Event Source] --> B[Ingestion Layer]
B --> C[Processing & Aggregation]
C --> D[Database]
D --> E[REST / WebSocket API]
- Ingestion: listens to smart contract events
- Processing: calculates volume, open interest, funding, PnL
- Storage: PostgreSQL schema with tables:
tradesfunding_ratesopen_interest
- API Layer: endpoints for metrics, history, real-time feed