Skip to content

Why we built Trinity

Two facing walls of thin horizontal green lines of light, separated by a narrow dark gap that one bright line bridges, on a dark field.
Generated illustration
Published
Reading
4 min read
Written by
NSi4

Every product at NSi4 started with a problem in front of us. The first one was our own money.

Trinity is our arbitrage system. It trades the studio's own capital, around the clock, and it is not for sale. This post is about why it exists and what building it taught us. It opens a series on why each NSi4 product exists, told from the need that started it.

In arbitrage, a late decision is a loss

An arbitrage window opens when the same asset is priced differently on two exchanges. It closes the moment someone else acts on it.

Acting on it takes two orders, not one: a buy on one exchange and a sell on the other, sent together and meant to fill together. If one leg fills and the other does not, the system holds a position it never wanted.

So the system has to be fast and careful at once. A slow decision misses the window. A careless one takes the position. Both cost real money.

What it had to live with

We set the constraints before we wrote the system, and they have not moved.

  • Our own money, never a client's. Every engineering decision in Trinity has a price, and we pay it.
  • No maintenance window. The market runs every hour of every day, so Trinity does too.
  • Three exchanges, three dialects. Each streams its own feed format and takes orders through its own API.
  • Risk before every order, not after. Nothing is sent until it has passed its checks.
  • A record of every decision. Any trade can be traced and reviewed after the fact.

One pipeline, built risk-first

Trinity is one path from market data to order.

  1. Feed. Order books and trades from each exchange are parsed as they arrive.
  2. Evaluate. Every update re-evaluates the pair across both books.
  3. Check. Each order is checked against its limits and the balances it moves.
  4. Send. Two orders go out, one per exchange.
  5. Record. Every decision is stored with its timing.

Speed comes from what the hot path does not do. Trinity's parsers allocate no memory on it, so the garbage collector never pauses a decision.

Care comes from the record. A recorder keeps every exchange's order book and trade feed hour by hour, and a batch runner replays a full day of it, pair by pair, to show where the opportunities were.

Measured by Trinity itself

We publish two figures, both from Trinity's own counters.

  • 500 ns to 10 µs to evaluate one arbitrage opportunity.
  • 15 to 30 ms for an order's round trip to the exchange.

They measure different clocks. The first is ours: how long Trinity takes to decide. The second runs through the network and the exchange.

Trinity also ships often, and carefully. Between 13 and 19 April 2026 the trader went from version 2.8.43 to 2.8.92: forty-nine builds, each one watched against the one before it.

Symbols, venues, order sizes and results stay private. That is a rule, not modesty.

What it gave the rest of the studio

Trinity gave us a standard. When a mistake can cost money the same afternoon, you stop trusting what you cannot trace, and you check before you act rather than after.

Everything we built afterwards carries that standard. Tycho, the IDE our agents work in, and AliveMD, the record every task lives in, run the engineering behind Trinity today.

Next in this series: why we built Tycho, and why a chat window is the wrong place to let an AI agent change a production system.

Trinity is not a product

Trinity is in production at NSi4. It is not for sale or licensing. The engineering behind it is what we offer, through everything else we build.

More from the blog

Keep reading.