In development · not released

Test it on history. Trade it with the same code.

The FTH Trading Engine is a deterministic, event-driven trading core written in Rust at FTH Trading. A strategy runs against recorded market data in a backtest, and the same strategy runs against a live venue through the same engine loop. Today the only live venue is the XRPL testnet.

Engine coreRuns, 249 testsReal
BacktestsSimulated venueSimulation
XRPL venue2 transactions runTestnet
Stocks, commodities, energyNo broker connectedPlanned
PackagesNone publishedNot released
One engine

Research and live share one loop.

The engine is generic over a venue. A backtest gives it the simulated venue; a live session gives it a venue adapter. Strategy code, risk checks and order handling do not change between the two.

Real

Write a strategy

A strategy reacts to quotes, trades, bars, timers and order events, and asks the engine to submit, cancel or set timers. It never talks to a venue directly.

Simulation

Backtest it

The simulated venue matches orders against top-of-book quotes, with fees and latency. Each run gives fills, an equity curve, run statistics and a static HTML tear sheet.

Testnet

Run it on a ledger

The XRPL testnet venue signs orders locally and turns validated ledger results into fills. Two testnet transactions, each named in advance and approved before sending, have been accepted by the ledger; one was an order placed through the engine and this venue.

Real

Bring in data

CSV quotes and trades import into a Parquet catalog: one file per instrument per day, exact integer prices, and a SHA-256 check on every file before it is read.

Real

Restart without guessing

Before the first strategy callback, the engine imports the venue's open orders and positions, so a restarted session picks up what is already working.

Real

Check before sending

Every order passes pre-trade risk checks before it can reach a venue: a maximum order size and a switch that halts all new orders. Wider limits are planned.

Architecture

One ordered event loop.

A clock, a cache and a message bus sit between data and execution. In a backtest the clock follows the data and the venue is simulated; live, time comes from a real clock and the venue is an adapter.

Market data and the data catalog feed the message bus; the bus serves the clock, cache and strategies; orders pass risk checks and the execution engine to a venue, simulated or XRPL testnet. Market dataData catalog Message bus ClockCacheStrategies Risk checksExecution Venue from a venueParquet + SHA-256 ordered, typed events test or live timeinstruments, quotes, ordersyour code pre-tradeorder lifecycle sim or testnet

Prices and quantities are fixed-precision integers end to end. There is no way to build one from a floating-point number. More on the architecture.

Determinism and performance

Same input, same run.

Every run produces a digest of each message the bus delivered, in order. Continuous integration runs both example backtests on Linux and Windows and fails if either digest moves.

No throughput or latency benchmark has been measured in the repository, so none is shown here.

Recorded run digests of the example backtests
Example (synthetic data)Run digest
ema_crossd0ddcad5f5f532cc
breakout_bracket0790db61a817d1d2

The digest is a 64-bit FNV-1a hash for comparing runs. It is not tamper evidence.

Venues and integrations

Two venues exist. The rest is labelled.

A venue adapter turns one venue's API into the engine's order events. FTH Trading has no agreement with any broker, exchange or data vendor, so none is named here.

Venues and integrations with their status
Venue or integrationCoversStatus
Simulated venueBacktests of any instrument the cache can describeSimulation
XRPL DEXXRP against an issued token on the ledger's order book, testnet onlyTestnet
CSV importQuotes and trades into the Parquet catalogReal
Regulated broker or futures commission merchantStocks, futures, commodities, energy, with accounts in the trader's own namePlanned
Event-contract venuesBinary outcome contractsPlanned
XRPL mainnetReal assets on the public ledgerNot built
Testing

249 tests, failure cases first.

Logic is written test-first. Safety properties are tested on the refusal path as well as the happy path. Independent reviewers wrote tests that broke the code; those tests stay in the suite.

Verification layers and their status
CheckWhat it showsStatus
Test suite249 passed, 0 failed at the last review (cargo test)Real
Run digestsBoth examples reproduce their digests on Linux and Windows CIReal
XRPL encodingsByte-for-byte equal to the reference ripple-binary-codec 2.11.0 outputReal
Independent reviewOne reviewer for M1 to M4; two reviewers and a re-review of the fixes for M5 and M6Done
Live failure pathsNot exercised on testnet; no transactions were approved for reviewOpen
Get started

No package is published yet.

The engine builds from source with Rust's own tools. These commands run from a checkout of the source repository. Both examples use synthetic data.

From a source checkoutReal
cd fth-engine
cargo test                        # full suite
cargo run --example ema_cross     # example backtest
cargo run --release --example breakout_bracket -- --html tearsheet.html

Talk to FTH Trading about the engine.

Ask about the build, the roadmap or the testnet work. Every status on this site is labelled; ask about any of them.