Wiki Concepts
What Mirexa is
Mirexa is a storage engine for market candles and ticks — what it does, who it is for, what it deliberately is not, and how its parts fit together.
Mirexa is a storage engine for financial market data: candles (OHLCV bars) and ticks (individual trades). It takes data live as a feed produces it, makes it durable before acknowledging it, serves it back by stream and time range, pushes it to live subscribers, accepts corrections and history, keeps track of what is missing against each market's trading calendar, and can build longer bars from shorter ones by itself. It runs as one Go program on a single node, or as a cluster of them with replication and automatic failover.
It is written for the people who build trading and research systems on market data: developers writing feed handlers and backtesters, and quants who need the bars they read to be the bars that were written, with an honest account of the ones that are missing.
The model in one paragraph
Everything is organised by stream: one instrument, at one bar length, on one
exchange — binance:BTCUSDT:1m. A stream holds candles on a fixed time grid, and can
also hold raw trades beside them. A client writes batches to a stream and reads ranges
of it back; there is no query language and no table to declare. The first write to a
stream creates it. See Streams, symbols and timeframes and
Candles and ticks.
What it does
| Capability | What you get | Read more |
|---|---|---|
| Durable ingest | An acknowledged write is in the write-ahead log and the log is fsynced (by default), with one fsync shared by every batch waiting on it. An overloaded node sheds a batch before storing anything, so a retry can never duplicate it. | Durability and acknowledgements |
| Per-stream reads | Range queries over a stream, newest-first or oldest-first, paged, as rows or as columns; many streams in one round trip; longer bars computed at query time. Recent bars come from an in-memory columnar cache, older ones from compressed chunks on disk. | Reading data |
| Live subscriptions | Subscribe to a stream and receive its stored history, then every new bar as it is written, with the switch-over marked and dropped batches counted. | Subscribing to live data |
| Corrections and history | Re-sending a bar the stream already holds restates it, wherever it is stored; years of history can be loaded behind live data through a separate bulk route. | Corrections, restatements and history |
| Gap tracking with calendars | Each stream carries its trading hours and declared closures. A hole during trading hours is recorded as missing data you can repair; a weekend or holiday is recorded as a closure and can never be "filled". Changing the calendar re-files recorded gaps at once. | Gaps and trading calendars |
| Derived streams | Declare that a stream's candles are made from another stream's trades or shorter candles, and the node writes them as the source arrives, re-deriving when the source is corrected. | Derived streams and lineage |
| Clustering | Optional. Streams are split across nodes by partition; each partition has one primary and copies that pull from it; a dead primary is failed over to an in-sync copy automatically; partitions can be moved while serving; damaged chunks are found and repaired from a copy. | Cluster architecture |
| Authentication | Offline-signed Ed25519 tokens carrying a permission bitmap, verified against public keys in the node's configuration; TLS 1.3 on the data port. On by default: a single node with no keys configured generates its own issuer and admin token. | Authentication and tokens |
| Monitoring | Prometheus metrics, / and / on a separate port, per-stream data-health gauges measured in trading time, and a web dashboard. |
Monitoring and alerting |
Clients are a Go SDK (github.com/AmiraliOmidvar/mirexa/client), a Python SDK with
pandas and polars support, the mirexa-cli command-line client, and mirexa-cli load for
bulk files. All of them speak Mirexa's own binary protocol over TCP.
How the parts fit
flowchart LR
C[Clients: Go / Python SDK,<br/>mirexa-cli, mirexa-cli load] -- binary protocol, TCP :8080 --> N
subgraph N[mirexa-server node]
direction TB
W[Write path] --> WAL[(Write-ahead log)]
W --> HC[Hot cache<br/>in memory]
HC -- flush --> CH[(Compressed chunks<br/>+ stream and gap indexes)]
R[Read path] --> HC
R --> CH
S[Subscriptions] --> C2[subscribers]
D[Deriver] --> W
end
N -. metrics, health :9090 .-> P[Prometheus]
N -. control listener, gRPC .-> O[Operators:<br/>calendars, lineage, cluster]
A write is logged and fsynced, applied to the stream's in-memory hot cache, and acknowledged; a background flusher later compresses older bars into immutable chunks and records the gaps it finds. A read merges the cache and the chunks. In a cluster, a small Raft group holds only the cluster's metadata (which nodes exist, which node is primary of each partition); candle and tick data never pass through it. The write path and read path pages go further.
What Mirexa is not
Stating these plainly saves a reader from discovering them later:
- Not a general-purpose time-series database. There is no SQL or query language, no arbitrary series or tags, no joins and no server-side aggregation across streams. A read names a stream and a range. Query-time rollups exist, but only of one stream into longer bars.
- Not unbounded in precision. With the default codec, prices and volumes are stored to four decimal places; see Candles and ticks.
- Not synchronously replicated. In a cluster an acknowledgement is the primary's alone; a primary that crashes can lose writes it acknowledged during roughly its copies' last replication poll. A graceful move or shutdown loses none. See Durability.
- Not a market-calendar library. Each stream's hours and closures are entered by you; there is no built-in exchange holiday data.
- Not multi-tenant. A token carries a tenant id, but nothing reads it yet.
- Not a source of in-progress bars. Ingest and subscriptions carry closed candles only; asking a subscription for partial candles is refused.
- Not for pre-1970 data. A record stamped before the Unix epoch is refused.
The Known limitations page keeps the full list.
Where to go next
- New to Mirexa: the Quickstart starts a node and writes and reads bars in a few minutes.
- Writing a feed handler: Writing data, then Durability.
- Building a research pipeline: Reading data, Bulk loading files, and Gaps and trading calendars.
- Running it: Running a node.
References
Source
- /README.md — the project summary.
- /cmd/server/main.go — the node's startup sequence.
- /client/client.go — the public Go SDK surface.
- /internal/config/config.go —
Default(): ports, codec, defaults.
Tests
TestServer_AckedCandleIngestIsInWALBeforeAckin /tests/ack_durability_test.go — an acknowledgement follows the log fsync.TestCrash_KillDashNinein /tests/recovery_test.go — acknowledged data surviveskill -9.TestQueryCandles_GapClassificationSurvivesToTheResultin /internal/ingestion/gap_classification_query_test.go — a closure and an outage stay distinct all the way to a query result.TestServerBinary_ACrashedPrimaryLosesOnlyWritesItsCopyHadNotPulledin /tests/server_binary_crash_loss_test.go — the cluster's crash-loss window, measured.