Horizon Dashboard
Analytics2024

HORIZONDASHBOARD

PnL and Horizon Analysis at sub-100ms on multi-TB trading datasets.

<100ms
Continuous aggregate reads
3600s
Widest horizon window
6+
Rollup refresh policies
SCROLL
Client
Stealth Startup
Domain
Analytics / Trading
Platform
Web
Duration
2024
Core Stack
Python · Streamlit · TimescaleDB
The Brief

THE
PROBLEM

A stealth trading desk needed GMX perpetuals mark-out analysis: horizon curves from 1s to 3600s, trader leaderboards, and per-position lifecycles on data landing from a Substreams SQL sink into Timescale.

Timescale continuous aggregates and tuned chunk intervals feed Polars/asyncpg batch jobs; Streamlit with Plotly/Altair renders trader-facing views; Docker Compose wires Postgres, roles, and the app for reproducible analyst environments.

Core Engineering Challenge

Hypertables in the terabyte class — raw scans per chart click were unacceptable; compression policies and continuous aggregates had to precompute the heavy lifting while keeping refresh lag bounded.

100ms<
Latency
Horizons
Analytics
Extended stack
backend
Python
frontend
Streamlit
database
TimescaleDB
Trading Dashboard
Trading Dashboard
How we built it

THE ARCHITECTURE

01
Ingest validation

Reconcile Substreams SQL sink batches against chain head and Substreams cursors.

SubstreamsTimescaleDB
02
Hypertable design

Chunk intervals and partitioning keys tuned to query patterns (trader, market, time).

TimescaleDB
03
Continuous aggregates

Rollups for horizons, funding, and leaderboard metrics with refresh policies.

SQLAnalytics
04
Polars/asyncpg jobs

Offline recomputes and backfills without blocking Streamlit threads.

PythonPolars
05
Streamlit UX

Plotly/Altair charts with cached dataframes for snappy interactions.

StreamlitPlotly
System Data Flow
Ingestion
CrawlerContent Hash10K+ pages
Processing
ChunkerDeduplicatorEmbedding API
Storage
pgvectorPostgreSQLRedis Cache
Auth
Identity ProviderJWT BridgeSessions
Query
HNSW SearchRe-rankerLLM Stream
Delivery
Web AppMobile AppUsers
What we delivered

THE RESULTS

100ms<

Typical dashboard reads hit pre-aggregated continuous aggregate tables instead of scanning raw swap rows — the difference between an interactive desk review and a coffee-break query.

100ms<
Latency

Typical dashboard reads hit pre-aggregated continuous aggregate tables instead of scanning raw swap rows — the difference between an interactive desk review and a coffee-break query.

Horizons
Analytics

PnL windows from 1s through 3600s plus trader rankings aligned to the same Substreams-derived facts powering risk — so “who moved the book?” questions didn’t require a separate Jupyter notebook.

Engineering decisions

TECH
DEEP DIVE

CA
Continuous aggregates

Moved CPU from request time to refresh time — mandatory at TB scale.

Docker Compose gave analysts the same Postgres extensions locally as prod, reducing “works on my laptop” chart bugs.

PL
Polars for backfills

Vectorized transforms beat row-wise Python when recomputing horizon curves after code fixes.

Streamlit stayed thin — all heavy lifting in SQL or Polars kept the UI responsive.

Next Case Study
DevOps
KakarotGraphNode

zkEVM Deployment

AWSDockerGraph Node
Start a project

LET'S
BUILD
SOMETHING.

We take on a small number of projects at a time. If the problem is hard, we're interested.

Email
hello@techmusketeers.com
Response time
Within 24 hours
Availability
Open for new projects · 2025