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…
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
30 documents
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 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…
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 applies the Guéant–Lehalle–Fernandez-Tapia market-making model to grid quoting. It derives bid and ask quote depths from a fair price, volatility, trading intensity, and inventory. The resulting quotes combine a half-spread with an…
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.…
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…
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 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 document describes a latency interface for high-frequency trading backtests, separating the delay from submitting an order to exchange processing from the delay between exchange processing and receiving a response. A constant model assigns fixed values…
The document presents a simplified high-frequency grid market-making approach inspired by GLFT. Rather than dynamically estimating order-arrival intensity to set spreads and skew, it uses recent price volatility to determine quote distance. Inventory is…
The document presents an implementation of a limit order book that stores level-two depth in bid and ask vectors over a configured range of price ticks. It maps prices to array indices using the tick size, aggregates quantities at each level, and tracks best…
This tutorial introduces a workflow for inspecting market data and orders in HftBacktest. It shows how to configure an asset with historical tick data, an optional starting snapshot, contract and tick sizes, latency, queue position, exchange fill behavior,…
This document describes a Rust framework for developing high-frequency and market-making strategies in backtests and live trading. Its replay approach uses tick-level market data and reconstructed order books, including both market-by-price and…
This document describes preprocessing checks for event data that records both exchange timestamps and local receipt timestamps. One routine detects when the local clock appears ahead of the exchange clock, then shifts local timestamps by the largest observed…
This tutorial adapts a GLFT-based grid market-making backtest to multiple futures assets. It normalizes order size to a common notional amount, sets inventory limits in units of that order size, estimates trade-arrival intensity and price volatility from…
This utility reconstructs an order book from a supplied sequence of market-data files and returns the market-depth state at the end of that data. It configures a backtest asset with the relevant tick size and lot size, and can optionally seed reconstruction…
This Rust example shows how to wrap HftBacktest’s local processor to add custom handling around market events and order responses. The wrapper implements the local processor interface by forwarding order submission, modification, cancellation, state, depth,…
This example generates order-latency records for a crypto trading backtest from historical feed data. It first keeps events that contain both exchange and local timestamps, then aggregates to one record per second using the last timestamps in each interval.…
This document develops order book imbalance as an alpha input for a crypto market-making strategy. It defines static and standardized imbalance, then compares related measures: volume-adjusted mid-price (VAMP), weighted-depth order book price, and a hybrid…
The code excerpt outlines a Rust live-trading bot builder and event-processing loop. A builder registers instruments with connector and symbol details, tick and lot sizes, and market-depth storage; it can also attach error handlers and order-response hooks…