← Ken BarryAuTokenLureCryptoAIBuggyCV (PDF)kenneth.aidan.barry@gmail.com

CryptoAI

A market-microstructure research platform I designed, built and ran on my own: live feeds from fourteen exchanges, a terabyte-scale order-book recorder, replay simulators, learned predictors and a live pricing service.

14
exchange connectors, spot and futures
51,169
lines of Java I wrote, in 317 files
1.5 TB
of recorded order books and derived data
935
generated research reports
432
commits across five build phases
Why I built it

Crypto publishes everything. That makes it the honest place to test a trading idea.

I spent years building pricing, trading and risk systems for betting exchanges, where the edge lives in who sees a price move first and who is left quoting a stale one. Crypto has the same shape with far better data: dozens of venues list the same instrument, every order book is public in real time, and the fees and latencies are documented.

So I set out to answer a concrete question with measurement rather than intuition: when BTC moves on one exchange, how long do the others take to follow, and is that delay large enough to trade after fees, latency and real queue positions?

Answering it properly meant building the whole stack myself: connectors that survive days of streaming, a recorder that captures full depth, a replay engine that reproduces the books tick for tick, simulators with deliberately pessimistic fill models, and reports that make it hard to fool myself.

“Find a repeatable strategy with positive expected value after realistic fees, latency, top-of-book depth, partial fills, rejects, rate limits, and operational overhead.”the North Star of the project's profitability roadmap, May 2026
What it does

One pipeline from raw exchange sockets to a decision.

A single Spring Boot application runs in different profiles over one shared market model: record to capture data, train and test to replay it into predictors, view and live to watch markets with the models attached, and book to publish live prices over REST and WebSocket. Research runners and two Swing workbenches sit on the same code.

EXCHANGES Binance · Bybit · OKX Coinbase · Kraken · MEXC Gate · HTX · KuCoin Bitget · Bitfinex WhiteBIT · Crypto.com Dukascopy public WebSockets, up to 500 book levels Connectors freshness watchdog self-restart MarketPlace normalised books per venue, per side Recorder binary snapshot + delta Market viewer depth, trades, predictions Book service REST + WebSocket odds Lag-capture trader shadow by default REPLAY + RESEARCH train / test splits KD-tree + Weka predictors RL trading agents maker simulator taker lag search capacity audits HTML reports MEXC futures signed REST + WS
The interfaces

Everything it measures, it can also show.

Every screenshot below was taken on 15 September 2026 from the running application or from reports it generated. None are mock-ups.

CryptoAI market viewer showing live Binance BTCUSDT futures order book depth as a cyan and magenta heatmap, with a venue latency panel and trader state
Live

Market viewer

profile view · Swing + FlatLaf

Live order-book depth for Binance BTCUSDT futures: cyan is resting ask liquidity, magenta resting bids, the white line the midpoint. Every level of every update is drawn as it arrives, so walls appearing and pulling are visible second by second.

The panel at the bottom left is the part I used most: each venue's tick rate and how stale its last update is, so a slow feed can't masquerade as a price leader. Top right is the simulated trader's state.

CryptoAI market viewer replaying recorded Binance BTCUSDT futures with the 5-second predictor attached: prediction value, mean and range, and an 89-cell feature grid
Replay

Predictions in the viewer

profile test · recorded test hour · 89 features

The same viewer replaying a recorded hour with a trained predictor attached. At the bottom right is the 5-second predictor's current output with its running mean, spread and range. Under it, a grid of its 89 input features is coloured by how far each sits from its training statistics. The features are exchange-rate EMAs, RSI, ARIMA forecasts, cross-venue route deltas and volume skew.

The honest numbers: this model reaches a correlation of 0.17 and a relative absolute error of 99.6%, measured in-sample on data that includes this test hour. That is barely better than predicting no move, which is why predictions ended up as a filter around stronger triggers rather than a signal of their own.

CryptoAI book board showing live fair probabilities and decimal odds for BTC, ETH and SOL up-or-down markets over 5 and 15 minute windows
Live

Book service

profile book · Spring MVC + WebSocket · port 8091

The newest part: a pricing service for rolling BTC, ETH and SOL "up or down" markets over 5 and 15 minute windows, aligned to Polymarket's boundaries and settled against the same Chainlink feed Polymarket uses. It locks each window's price to beat, then prices both sides with a lognormal model on the live Chainlink stream, with order books from five exchanges wired in as source feeds.

Prices stream over WebSocket only when they move by at least one basis point, with a heartbeat otherwise. This board is a small page I wrote on top of that stream.

CryptoAI maker playback workbench replaying recorded MEXC BTCUSDT futures books with simulated maker quotes
Replay

Maker playback workbench

4 h train / 1 h test split · 5 venues · MEXC target

Replays recorded books and draws a market-making strategy's own quotes over the real depth: magenta is recorded bid depth, cyan recorded ask depth, and the yellow and orange lanes are the lifetimes of the strategy's bid and ask quotes. The fill tape underneath records each fill with its slippage against the midpoint. It trains its fill, toxicity, direction and volatility models on the first four hours and tests on the fifth, so the strategy never sees its test data.

Eleven strategies and nine fill models are selectable, from "fill whenever touched" to a realistic queue model that only fills when the recorded book proves the queue ahead has gone.

Market lead-lag report with network latency context and fastest-feed ranking
Report

Who leads BTC

730,934 top-of-book changes across eight feeds, scored for which venue moves first and which follows, with TCP round-trip probes from Cork to every endpoint so network position isn't mistaken for price leadership. Bybit spot came out as the driver; MEXC futures as the clearest follower.

Leader-lag alpha search report with cross-validated rows across lookback, horizon and latency
Report

Alpha search, cross-validated

A grid over lookback, horizon, simulated latency and trigger thresholds, trained on one period and validated on a later, separate one. Each row shows one-taker and round-trip markout in basis points, with a confidence figure, so the cost of paying to exit is always in view.

Maker simulation report for an EV-gated asymmetric strategy under a realistic queue fill model
Report

Maker simulation

A full account of one run: 17,513 ticks, 1,774 orders, 257 fills, inventory limits and markouts. Under the realistic queue model this expected-value-gated strategy ended an hour down 1.78 on a 10,000 account. It is shown here because it lost; that is what the simulator was built to catch.

Cross-venue large move lead-lag audit listing leader counts and response lag by venue
Report

Large-move audit

The thirty biggest BTC moves in a test hour, each traced across eight books. Bybit futures led most often; MEXC futures answered last, on average 411 ms behind. That gap is the opportunity the rest of the research tried to capture.

The attempts, in order

Five phases, each one retiring an idea the data didn't support.

  1. Connectors, the live viewer and learned predictors

    Streaming connectors for Binance, Coinbase and Dukascopy first, then the rest of the fourteen, all normalised into one order-book model, with the Swing viewer to watch them. Within the first fortnight came a situation model that turns the whole marketplace into a feature vector on every tick, and time- and tick-horizon predictors trained on recorded data with KD-tree lookups and Weka. 175 commits in the first month.

  2. Reinforcement-learning traders

    Epsilon-greedy, softmax and UCB agents, with and without eligibility traces, next to a rule-based baseline, each trading a simulated leveraged account from the predictor's signal, with replay-based reinforcement iterations over recorded data.

  3. Execution and exits

    A month on the trading loop itself: opening and closing thresholds, exit handling and commission accounting. It was the first sign of what the 2026 research later measured precisely, that the exit is where most of the cost hides.

  4. Microstructure at full depth

    Rebuilt recording to capture up to 500 levels from eight venues in a compact binary snapshot-plus-delta format: the largest capture alone is 617 GB of books from under a week in May. On top of it, the lead-lag reports, a maker simulator with eleven strategies and nine fill models, taker lag-capture sweeps, capacity audits, and a MEXC futures account connector with signed REST, private WebSocket and IOC orders, guarded so nothing trades unless two separate switches are on.

  5. Live pricing

    The book service: rolling up-or-down markets aligned to Polymarket's windows, settled on Chainlink, priced on the live Chainlink stream and streamed to clients over WebSocket. Verified live against Polymarket's own candle opens.

Engineering notes

The parts that took the longest to get right.

Feeds that stay up for days

Every connector tracks freshness. A socket that goes quiet is restarted, repeated failures escalate, and the recorder can replace its own process when a writer stalls, so a week-long capture survives exchange disconnects.

Replay you can trust

A binary snapshot-plus-delta format with a split tool that cuts recordings into train and test windows while keeping each book reconstructible, so simulators see exactly what the live system saw.

Pessimism by default

Nine fill models, from optimistic to REALISTIC_QUEUE, which only books a fill when the recorded book proves the queue ahead was consumed. Results are quoted under the harsh model.

Latency as a first-class input

Sweeps at 0, 25, 50, 75, 100 and 125 ms of simulated delay, plus TCP probes from Cork to each endpoint, so a strategy that only works at zero latency is caught early.

Capacity, not just edge

Depth-aware audits cap every simulated trade at a share of displayed top-of-book, turning "+613 bps" into the euros it could actually earn.

Live, but guarded

The MEXC futures path signs REST requests, listens on the private WebSocket and sends IOC orders, and it stays in shadow mode unless both the account switch and the strategy switch are on.