This module constructs a continuous futures series by identifying contract roll dates and calculating the price gap between the expiring contract and the next contract. It accumulates those gaps through time and can align the adjusted series at its end. A…
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
24 documents
This tutorial examines how probabilistic queue-position assumptions affect simulated limit-order fills and market-making results. It implements a grid quoting strategy based on a GLFT-style market-making model, estimates order-arrival intensity from observed…
This script builds a universe of Binance futures contracts using 24-hour ticker data and exchange metadata. It joins weighted average price and quote volume with contract onboarding date, price tick size, and order quantity constraints. It then excludes…
This example builds a BTCUSDT futures market-making strategy whose fair price is estimated from a spot reference price plus a smoothed spot–futures basis. It resamples spot and futures book-ticker mid-prices, carries observations forward, and calculates a…
This tutorial compares a high-frequency grid market-making strategy across cryptocurrency exchanges, emphasizing that different order flows can change results even for the same trading pair and parameters. The strategy places layered limit bids and offers…
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 strategy forecasts the future value of a spread between cointegrated assets, then compares the forecast with the current spread to generate trades. The document describes three approaches: trading predicted spread returns directly, following spread…
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…
This tutorial develops a market-making approach that estimates a futures contract’s fair price from spot-market returns. Its basic arbitrage pricing theory relationship assumes futures and spot returns move one-for-one with no intercept; the strategy uses…
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…
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 example shows how to combine a spot BTCUSDT mid-price series with US dollar margined futures order book data in an hftbacktest simulation. It parses spot book ticker messages into local timestamps and mid prices, then, at each backtest timestamp,…
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…
This guide explains why futures contracts for the same underlying can have different prices at successive expiries. It defines contango and backwardation and links the price gap to carrying costs such as financing, dividends, or storage. Because a continuous…
This module describes calendar rules for rolling several futures series: crude oil, NBP natural gas, refined products including RBOB, grains, and ethanol. The rules use contract-specific termination conventions, such as dates near the 25th or 15th of a…
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 document defines a common interface for calculating trade amount and account equity, then supplies formulas for linear and inverse assets. For a linear contract, amount scales with contract size, execution price, and quantity; equity adds the marked…
This order manager handles exchange order updates arriving through separate REST and WebSocket channels, which may arrive late or out of sequence. It keeps each order’s state and applies an update only when its exchange timestamp is at least as recent as the…
The document introduces the Commodity Channel Index (CCI), describing it as a statistical technical indicator that compares price movement with a typical range. It notes that the indicator was first used in futures analysis and later applied to equities. CCI…
This document explains the role of a connector in an algorithmic trading system: it provides a communication point between bots and exchanges, brokers, or market-data providers. A system can manage multiple bots, and each bot can connect to several…
This tutorial presents a workflow for evaluating a high-frequency grid market-making approach on Binance Futures. It covers selecting trading pairs, obtaining historical depth and trade data, converting that data into the backtester’s format, modeling…
This document contains a dated daily price series identified as RB, with fields for opening, high, low, last, and settlement prices. The visible records begin in 1994 with missing values across the price fields, while later entries show populated prices…
This example sets up a historical simulation for a grid trading strategy on the linear 1000SHIBUSDT contract. It loads daily market data and latency files for a date range, initializes market depth from a start-of-day snapshot, and configures the backtest…
This example shows how a live grid trading bot can respond to errors while trading SOLUSDT on a futures venue. Its handler distinguishes interrupted connections, critical connection failures, order errors, and custom error codes. It logs connection and order…