This document describes the data model and calculations behind a synthetic multi-leg spread. Each leg stores its market quotes, contract details, and position state. Configurable price multipliers define the spread price, while trading multipliers define how…
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
765 documents
This guide explains spread trading across related instruments, contrasting it with single-instrument trend strategies. It presents several approaches: latency-sensitive arbitrage between equivalent markets, threshold or Bollinger Band mean-reversion trades…
This document explains how to represent a multi-leg spread using separate price and trading multipliers. It derives synthetic bid and ask prices from each leg’s best quotes, reversing which side of a leg’s market contributes when its price multiplier is…
The document considers whether two cointegrated price series can be combined into a stationary spread and modeled with an Ornstein-Uhlenbeck process. The proposed workflow estimates a hedge coefficient through regression, constructs the residual spread, and…
The document frames an out-of-sample estimation question for a cointegration pairs strategy. In sample, the proposed workflow applies the Engle–Granger two-step procedure, estimates a hedge coefficient for the spread, and standardizes that spread using its…
The discussion collects several ways to transform stock prices for analysis. Suggested measures include log prices, price deviations from a mean, standardized deviations using a standard deviation, log-price deviations from a mean, log returns, percentage…
The document asks whether performance statistics such as profit factor and Sharpe ratio should be computed for each leg of a pairs trade separately or for the combined position. Its example shows that the measured profit factor differs depending on whether…
The document explores exit choices for a crypto pairs trade entered after finding a cointegrated relationship. The trader reports that cointegration tests can stop indicating a relationship and later signal it again, while a simple exit at zero z-score has…
The document raises a pairs-trading question about estimating hedge ratios with rolling ordinary least squares on two stocks’ log returns. The author observes that when the stocks have very different share prices, the estimated ratio can still be near zero…
The document addresses how to calculate value at risk for a dollar-neutral long-short position in two correlated stocks. Its central correction is that dollar neutrality does not eliminate risk: the long and short positions are exposures to different assets,…
The document compares constructing a pairs trading spread from a price difference with using a price ratio. Its practical answer is to calculate the spread for the position the strategy will actually trade, since alternative leg weightings produce different…
The discussion examines how adjusted and unadjusted stock prices affect backtests, especially cointegrated pairs trading. Adjusted prices can remove artificial jumps from splits and dividends, which helps when measuring returns or momentum. But later…
The document considers how to automate a spread strategy when the charting platform does not execute the user’s full rules automatically. The example strategy buys one instrument and sells another when their spread falls below a lower Bollinger Band, then…
The document raises a data-continuity question for a pair-trading model using futures contracts. It says the training series for each contract has been forward-adjusted and asks whether live prices should receive the same adjustment when the model is tested.…
The document contrasts two approaches to pairs trading. One estimates a hedge ratio between nonstationary price levels so their linear combination is stationary, then models that spread as autoregressive or mean reverting. The other combines asset returns,…
The document answers a question about how to define entry and exit signals for a pairs trade. It recommends tracking the moving average and standard deviation of the log price ratio between two stocks, rather than comparing a single period’s return…
The document raises a practical issue in a cryptocurrency perpetual-swap pair-trading strategy: a spread estimated by regression on log returns can produce opposite signals in consecutive observations. The author calculates the spread from rolling historical…
The discussion explains why cointegration test p-values can change sharply when the start and end dates change. If the underlying data-generating process is stable, using the longest available sample can improve a test’s statistical power. If the process…
The document explains why cointegration among asset prices does not necessarily conflict with market efficiency. Market efficiency concerns whether future returns can be predicted reliably from available information, while cointegration describes a stable…
The document compares two ways to measure a relationship between two stocks for pairs trading. A price ratio represents a dollar-neutral position: the trader invests equal dollar amounts in each asset. A regression-based spread instead uses a hedge ratio,…
The document discusses narrowing a large universe of candidate equity pairs after an Augmented Dickey–Fuller test and half-life calculation leave many candidates. Suggested filters include liquidity, trading costs, backtesting with cross-validation, and…
The discussion addresses how to estimate or manage the time a mean-reversion trade takes to return toward its mean. It notes the Ornstein–Uhlenbeck process as one way to model half-life, but shifts attention to whether a candidate spread has a credible…
The document asks whether potential pairs can be screened faster than testing every stock pair across every tick. It describes a theoretical approach based on fast matrix multiplication, which can reduce the asymptotic cost of computing a correlation matrix.…
The document outlines a proposed workflow for applying an Ornstein–Uhlenbeck process to a pair of potentially cointegrated stocks. The suggested steps are to estimate a linear relationship by OLS, form a residual or auxiliary series, fit an AR(1) model to…