This article explains how to profile an R workflow that calculates rolling pairwise correlations across S&P 500 constituents. It outlines possible ways to address memory limits, including chunking data, choosing compact data structures, using memory-focused…
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
31 documents
This article argues that traders should begin with a workable strategy and build technology in response to problems encountered in live trading. Elaborate systems designed before trading can consume time without generating market feedback, and the imagined…
This article walks through implementing a price-spread pairs trade in Zorro using GDX and GLD as an example. It defines the spread as one asset’s price minus a hedge-ratio-adjusted price of the other, then standardises the spread with a rolling z-score. The…
This article demonstrates ways to speed up a portfolio backtest implemented in R. It begins with profiling a cash backtest that processes prices and target weights across dates, updates holdings using a no-trade buffer, accounts for commissions, and records…
The article presents a research philosophy for systematic trading centered on identifying genuine market mechanisms and combining modest opportunities. An edge should have an explanation for why another participant accepts the other side of the trade, such…
The article examines practical limits of traditional market-neutral pairs trading. Each trade consumes capital on two legs, incurs spreads and commissions on both, and may use capital on a fairly valued leg even when the opportunity is concentrated in the…
The article describes Apache Beam as a framework for building a systematic trading data pipeline. Its outlined workflow collects data from APIs, stores it, transforms and enriches records, calculates features, loads results into an analytical database, and…
The document summarizes proposed cross-sectional signals for judging whether equity options are relatively cheap or expensive. Its central comparison is implied volatility against volatility that later realizes: options may be candidates to buy when implied…
This article outlines common ways systematic trading experiments can mislead. It names look-ahead bias, where a test uses information unavailable at the time of a trade; overfitting, where rules or parameters are tuned to historical noise; and data-mining or…
The article explains why market making is demanding for beginners. A market maker posts bids and asks around an estimate of fair value, seeking to earn the spread while providing liquidity. The example shows how a mistaken estimate can attract trades on the…
The article demonstrates how to compute the rolling average of pairwise stock correlations across S&P 500 constituents in R, then divide the work into overlapping date chunks. The workflow prepares prices and returns, forms stock pairs, calculates rolling…
The article explains why a new trader may struggle to profit by competing directly for obvious mispricings. Attractive prices tend to draw skilled, fast participants, while less competitive offers may remain available because they are poor trades. Repeatedly…
The article compares systematic trading with discretionary order flow and chart analysis. It argues that these approaches seek the same underlying opportunity: a pricing inefficiency created when buying or selling pressure pushes a market away from a…
This tutorial explains join features introduced in dplyr 1.1.0, with examples drawn from market data preparation. It first shows how to express ordinary key-based joins, then demonstrates inequality joins and rolling “closest” joins. These tools can attach…
This short note lists ways traders can lose money: excessive trading increases fees and market impact, oversized positions can impair compounding or cause ruin, and shorting positive drift or risk premia can create persistent losses. It also cautions against…
The document outlines using Google Compute Engine virtual machines to run trading software, with R and Zorro as examples, and connecting the system to a broker through Interactive Brokers Gateway. It frames cloud hosting as a way to avoid maintaining local…
This guide explains how a Python application communicates with Interactive Brokers through Trader Workstation or Gateway. It covers the requirement that one of those desktop applications remain running, restart and reauthentication behavior, native API…
The article introduces rsims, an R package for fast portfolio backtests that emphasizes translating target weights into trades while accounting for costs and constraints. It describes a threshold rule: trade toward a target only when the current weight moves…
A no-trade region places a buffer around a strategy’s target position. The portfolio is left alone while its current holding remains inside the buffer, and a trade is made only after it moves beyond the boundary. With minimum commissions, the example rule…
The document offers practical guidelines for trading equity options, emphasizing that the many contracts available on one underlying tend to have thinner liquidity and wider spreads than the underlying stock. It recommends using options when the trading…
The document presents statistical arbitrage as a broader portfolio problem than trading matched pairs. It ranks assets by expected cheapness or expensiveness, then builds long and short positions intended to capture relative value convergence while…
This article argues that self-taught quant traders can spend too much effort on specialized modeling and statistical techniques before establishing whether a market effect is real and useful. It recommends beginning with the simplest tool that addresses the…
The document presents a judgment-based framework for deciding whether to adopt a trading strategy, emphasizing that there is no universal performance threshold or checklist. The first question is whether the effect has a plausible explanation and a reason to…
This article develops intuition for using convex optimisation to turn forecasts into portfolio positions under practical constraints. It begins with a long-only, unlevered return-maximisation example, then adds existing holdings and transaction costs to show…