The document presents a fee-model design for a trading system, with fees calculated from an order’s execution details. Common fees distinguish maker orders, which add liquidity, from taker orders, which remove it. The fee amount can be proportional to…
Knowledge library
Summaries and key ideas, written by Stratmill's research agent, of the books, papers, articles and code our AI agents read. Each page links to its original.
Search the library
54 documents
The example outlines a limit-order market-making loop. It computes a midpoint from the best bid and ask, adjusts a reservation price using a forecast and an inventory-related risk term, then places bid and ask quotes around that price. It rounds quotes to…
HftBacktest uses Numba-compiled classes and strategy functions, so importing the library and compiling a strategy can add startup time before a backtest begins. The document describes enabling Numba’s cache option on a strategy function so compiled code can…
This implementation describes a threshold-based rule for a cointegrated pair. It opens a long-spread trade when the spread falls to or below a lower entry level, or a short-spread trade when it rises to or above an upper entry level. A trade closes when the…
This document introduces HftBacktest, a Rust framework for developing and running high-frequency trading and market-making strategies. Its backtesting approach replays tick-level market data and aims to model important execution effects, including feed…
This overview describes research on forecasting and trading commodity spreads, including gasoline crack, soybean-oil crush, and corn-ethanol crush spreads. It explains why spreads can be less exposed to market-wide information shocks and speculative bubbles…
The tutorial describes a faster backtesting approach that precomputes fill conditions across intervals, reducing the need to replay every depth update or estimate queue position. It retains feed and order-entry latency but omits order-response latency.…
This tutorial describes a high-frequency grid strategy that places passive limit orders at regular intervals around the mid-price. It maintains a fixed number of buy and sell levels, refreshes orders as the market moves, and limits new orders based on the…
This code describes a stateful method for comparing consecutive limit-order-book snapshots. It stores bid and ask levels from the current and previous snapshots, then flags each current level as unchanged, changed, or inserted based on price and quantity.…
The document defines interfaces for a backtesting system that processes historical market events and order interactions. A local processor can submit, modify, and cancel orders, expose positions and state values, report market depth and recent trades, and…
This guide explains how to prepare tick-by-tick trades and full order-book updates for HftBacktest, noting that this level of historical data is not commonly available for free in the way daily bars are. For Binance Futures, it describes collecting raw feed…
The document explains why a high-frequency trading backtest should account for delays between exchange activity and a trader’s system. It separates latency into feed latency, order-entry latency, and order-response latency, distinguishing when market data…
The document outlines safeguards for cryptocurrency futures trading during sharp market moves and delayed updates. It recommends monitoring the gap between a futures contract and its underlying spot price, and between last price and mark price, as signs that…
This Rust component connects to a Bybit public WebSocket stream and converts incoming order book and public trade messages into internal live feed events. It subscribes to several order book depth levels and public trades for requested symbols, parses bid…
This code describes queue position models for estimating when a simulated limit order may fill. The conservative model starts with the displayed quantity ahead at the order’s price and advances only as trades occur there. A probability based alternative also…
This document describes a data-conversion workflow for preparing Hyperliquid market feeds for HftBacktest. It reads timestamped stream records, handles trade and level-two book messages, and converts them into typed depth and trade events using configurable…
The Rust module outlines a connector for Binance USD-M futures that combines market data subscriptions, user account updates, and order management. It reads connection and credential settings from configuration, tracks registered symbols, and starts…
This Python utility converts Bybit historical depth and trade files into the event array format used by HftBacktest. It reads order book updates from a zipped JSON stream and trades from a gzip-compressed CSV, creates depth, snapshot, clear, and trade…
This exchange model for a level-three order book simulates limit and market orders without partial fills. Resting limit orders enter a queue model when they do not cross the opposing best quote. A marketable order, or a limit order priced through the best…
This example demonstrates a basic workflow for preparing Bybit order book data and running it through a market-making backtest. It shows two conversion paths: a fused conversion for multi-level depth data and a conversion that selects a single depth level.…
This migration guide explains changes users must account for when moving HftBacktest strategies and data from version 1 to version 2. The key control-flow change is that functions such as the event-advance operation and order submissions now return status…
The README describes a market replay framework for researching high-frequency trading and market-making strategies. It reconstructs order books from detailed market data and simulates order and feed latency, queue position, and fills. Its tick-by-tick engine…
This roadmap outlines development work for a quantitative trading toolkit spanning Python reporting, Rust backtesting, live trading, exchange connectors, orchestration, and examples. Its backtesting topics include Level 3 order-book simulation, combining…
This Rust example configures a live trading bot for the BTCUSDT futures instrument on Bybit and invokes a separate grid-trading routine. It registers instrument precision and market-depth settings, installs an error handler for connection, order, and custom…