A deep dive into the five distinct data flows inside an Elixir-based autonomous trading system: inbound ticks, outbound orders, persistence, reconciliation, and portfolio aggregation. Each flow is framed around a core trust question — who is authoritative when data conflicts? Key design principles include: persist orders before submitting to the broker, reconcile against the broker every 30 seconds for positions and 5 minutes for orders, persist only what cannot be recomputed, offload heavy work to Oban, and never block position exits. The broker is always the source of truth; GenServer state is a cheap working copy; Postgres is the audit trail.
Table of contents
Five flows, five trust questionsInbound: is this candle complete?Outbound: did this order make it?Persistence: if we crash, what can we reconstruct?Reconciliation: is the broker still telling us the same thing?Aggregation: what's the total risk right now?The principles underneathWhat this post deliberately doesn't cover151 Impressions