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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
| Example (synthetic data) | Run digest |
|---|---|
ema_cross | d0ddcad5f5f532cc |
breakout_bracket | 0790db61a817d1d2 |
The digest is a 64-bit FNV-1a hash for comparing runs. It is not tamper evidence.
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.
| Venue or integration | Covers | Status |
|---|---|---|
| Simulated venue | Backtests of any instrument the cache can describe | Simulation |
| XRPL DEX | XRP against an issued token on the ledger's order book, testnet only | Testnet |
| CSV import | Quotes and trades into the Parquet catalog | Real |
| Regulated broker or futures commission merchant | Stocks, futures, commodities, energy, with accounts in the trader's own name | Planned |
| Event-contract venues | Binary outcome contracts | Planned |
| XRPL mainnet | Real assets on the public ledger | Not built |
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.
| Check | What it shows | Status |
|---|---|---|
| Test suite | 249 passed, 0 failed at the last review (cargo test) | Real |
| Run digests | Both examples reproduce their digests on Linux and Windows CI | Real |
| XRPL encodings | Byte-for-byte equal to the reference ripple-binary-codec 2.11.0 output | Real |
| Independent review | One reviewer for M1 to M4; two reviewers and a re-review of the fixes for M5 and M6 | Done |
| Live failure paths | Not exercised on testnet; no transactions were approved for review | Open |
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.
cd fth-engine cargo test # full suite cargo run --example ema_cross # example backtest cargo run --release --example breakout_bracket -- --html tearsheet.html
Ask about the build, the roadmap or the testnet work. Every status on this site is labelled; ask about any of them.