The document asks how to divide capital between the long and short legs of a pairs trade and whether using a hedge ratio implies equal dollar allocations. Its answer explains that the appropriate split depends on which exposures a trader wants the portfolio…
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
The discussion compares a price-based pairs trading framework with the statistical arbitrage approach described by Avellaneda and Lee. In the former, log prices are related through a fitted spread, cointegration tests such as Johansen's can identify…
The document examines how cointegration residuals can generate pairs trading signals and why equal dollar positions do not guarantee a profitable convergence trade. The questioner estimates a linear relation between two asset prices with an intercept, then…
The document raises practical questions about testing whether two nonstationary stock prices share a long-run equilibrium. Its proposed Engle–Granger sequence first checks that each series is integrated of order one, estimates a long-run regression, and…
The document describes a pairs-trading screening problem: applying the Johansen test to pairs of daily log stock prices, selecting rank-one cointegration candidates from trace statistics, and then checking the resulting spreads with ADF and KPSS tests. The…
The document discusses cointegration among more than two assets, using yield curve rates as its main example. It describes principal component analysis of yields: the first components represent level, slope, and curvature, while a later component can capture…
This script describes a mean-reversion strategy for two related futures contracts. It collects daily closes over a rolling window, standardizes each contract’s prices separately, and defines the spread as the difference between those standardized series. It…
This alpha model forms every eligible pair from the selected securities and tracks the ratio of the first asset’s price to the second’s. It smooths that ratio with an exponential moving average and sets upper and lower bands using a configurable percentage…
This multi-coin futures strategy compares each altcoin’s price relative to Bitcoin with a benchmark index of those relative prices. It shorts coins trading above the index and buys those below it, scaling target exposure with the size of each deviation. A…
The document introduces pair trading as a long-short approach that seeks to profit when two related assets’ prices move back toward their usual relationship. It discusses selecting correlated assets, using moving averages or other indicators to identify…
This strategy forms a spread from two instruments using hedge weights estimated with the Johansen cointegration procedure on a rolling lookback. It recalculates those weights daily, then measures the spread against its rolling mean and standard deviation. A…
This framework trades the relative price of the PAXG and XAUT gold-linked tokens. It expresses their difference as a percentage, then estimates a rolling mean and standard deviation from minute closes. A spread beyond two standard deviations prompts a…
This framework example wires a Pearson correlation pairs alpha model into a complete algorithm workflow. The model extends a base pairs model and ranks candidate pairs using Pearson correlation, then selects the top candidate to trade. The example uses a…
This Python strategy constructs a spread from two instrument prices weighted by configurable leg ratios. It updates the spread periodically and, after collecting enough observations, calculates a rolling mean and standard deviation over a 20-observation…
This demonstration explores monitoring the relative price of Bitcoin and Ether as a possible cross-asset hedge or arbitrage signal. It computes a fee-adjusted ratio from the two markets’ mid-prices, aggregates observations into hourly values, and plots the…
This example trades a soybean crush spread using soybean, soybean meal, and soybean oil futures. It estimates a weighted spread from the component prices and contract multipliers, using a 10:8:2 ratio to approximate processing yields. A rolling history…
This document provides a trading implementation for two crypto futures instruments on OKX, with an explicit requirement for one-way position mode. It calculates an average historical price ratio from hourly candles, then compares the live ratio with that…
This strategy models the relationship between Brent crude and the Norwegian krone with a rolling ordinary least squares regression. It fits the model on a recent window, accepts it only when its R-squared exceeds a chosen threshold, then estimates the…
This script outlines a long-side statistical arbitrage approach for a pair of instruments. It retrieves the second instrument’s price series, standardizes each instrument’s price against its own rolling mean and standard deviation, and subtracts the…
This example builds a relative-value spread from live hog futures and the estimated feed inputs of corn and soymeal. It scales each contract’s price by its contract multiplier and a production ratio, then defines the feeding margin as hog value minus feed…
This charting tool compares two selected swap markets against a chosen base market. For each bar, it divides each instrument’s close by the base close, then divides those two normalized values to form a relative spread series. It plots that series alongside…
This intraday pairs strategy trades the spread between the front-month and next-month futures contracts. It builds separate buy-side and sell-side spread prices using the relevant bid and ask quotes, then calculates rolling Bollinger Bands over a 60-minute…
This document describes a two-asset crypto pairs strategy that compares each instrument’s price change over the current candle. When the difference exceeds a threshold, it opens a position in one direction on the second asset, aiming to profit as the…
This Binance perpetual-futures strategy maintains short exposure across a selected altcoin basket and offsets it with long exposure in Bitcoin or other chosen assets. It repeatedly checks account positions and prices, then adjusts contracts when their values…