The problem
Anyone building on crypto market data has to integrate each exchange separately. Different protocols, different symbol formats, different rate limits, different failure modes — and the moment you add a decentralised exchange, none of the assumptions hold.
The usual answer is to write a pile of connectors, dump everything into a time-series database, and query that. It works, but it puts a database between you and data that is only interesting while it is fresh, and it turns a read into a network round trip plus a disk seek.
The brief was a single API — one symbol format, one response shape, one connection — fast enough that the only wait a consumer notices is their own network.
What we built
Finstrm answers every request from memory. There is no database or cache in the request path and no external service to call. Feeds land in per-exchange goroutines, fan into a worker pool sized to the machine, and update a store built for lock-free reads. A broker fans the same events out over WebSocket.
History is kept on disk, out of the way of requests. Once a minute a background writer saves recent trades and candles to a SQLite file that sits beside the binary, and on startup Finstrm loads that file back in. Candle history survives a restart, and live prices rebuild themselves from the feeds. Old rows are deleted on a schedule (trades after 24 hours, short candles after 30 days) so the file stops growing.
Decisions
No database in the request path
Market data is only valuable while it is current, and the working set fits comfortably in memory — under 512 MB for 500 symbols across three exchanges. Putting Postgres or a time-series store in front of reads would have cost a round trip on every request, so a read never touches a disk.
SQLite came later, for one job: keeping trade and candle history across restarts. It is compiled into the binary, written in the background and read once at startup. There is still no database server to run, no connection pool and no failover.
Go, and only Go
Thousands of concurrent inbound events across a dozen feeds is precisely what goroutines
and channels are for. The whole system builds with go build and no other toolchain —
which matters more than it sounds, because the thing that runs in production is one
static binary with no runtime to install.
One symbol format
Every exchange names pairs differently. Normalising to BASE/QUOTE at the connector
boundary means consumers write the integration once. Adding a fourth exchange is a
connector satisfying an interface — no changes anywhere else in the system.
Result
The original target was 1,000 requests a second. The slowest endpoint does 23,500.
Those figures measure the server. What a consumer feels is the server plus their network, so the live site times each visitor’s own round trip in their browser and shows it. In our own check a request took about 50 ms end to end, almost all of it network.
- Go 1.23
- WebSocket
- SQLite
- The Graph
- Docker
- Prometheus