This QuantConnect example demonstrates a basic algorithm framework setup for testing insight-weighted portfolio construction. It selects SPY manually, generates recurring upward price insights with a fixed weight, converts those insights into 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
5,922 documents
This simple allocation routine estimates the portfolio share held in stock by valuing the stock position at the latest ticker price and comparing it with total account value, including cash. It uses a target stock allocation and a tolerance band: when the…
This example shows how a framework-based trading algorithm can combine two alpha models: one based on RSI and another on EMA crossovers. It manually registers several US equities, then uses a manual universe selection model to include those securities. The…
This script outlines a basket strategy that ranks eight configurable equity symbols by rate of change over a lookback period and combines relative leadership with a price breakout. Its settings include a momentum lookback, breakout window, optional…
This quick-start example demonstrates a daily long-short stock strategy for a changing NASDAQ-100 universe. For each eligible stock, it compares a 20-day simple moving average with a 200-day average: the stock receives a positive allocation when the shorter…
This example shows how to assemble a futures trading algorithm from separate framework components. It selects a futures chain each day, filters the universe to front-month contracts, emits constant upward price insights for futures, converts those insights…
This educational strategy tracks the value of a base currency and each traded asset, then compares each asset’s portfolio value with a target allocation. When an asset rises beyond its target by a configured sell threshold, the strategy sells toward the…
This document presents a price-channel strategy intended as a simple, rule-based approach for investors who cannot monitor markets continuously. It calculates the highest high and lowest low over a rolling lookback window, set to 21 periods by default. The…
This note describes a rule-based strategy that keeps an asset allocation near a target position. It opens at the target, then adds or reduces exposure when the current position moves beyond a specified band. Each adjustment uses a fixed share of equity, and…
This machine-learning strategy selects the 15 least volatile liquid S&P 500 stocks and uses a fully connected neural network to estimate whether each will rise over the next day. Inputs combine ATR as a share of closing price, normalized RSI readings across…
This example assembles a portfolio algorithm from separate framework components. A historical-returns alpha model supplies investment insights, and a mean-variance portfolio construction model turns those insights into portfolio weights intended to follow…
This example shows how to build a daily equities universe from coarse fundamental data by ranking available securities on dollar volume and selecting the top five. A security initializer sets each selected security to raw price normalization and applies a…
This example demonstrates a daily equity universe selection process using fundamental data. It filters for securities with available fundamental data and a price above $1, sorts the remaining names by daily dollar volume, then ranks them by P/E ratio and…
This short QuantConnect Lean example shows how to assemble an algorithm around a mean-reversion portfolio construction model. It initializes a historical simulation with daily data for SPY and AAPL, sets cash and a test window, and registers a security…
This proposed system uses a large language model to generate and revise candidate price-and-volume factors for a cross-sectional long-short portfolio of USDT perpetual contracts. It screens liquid instruments, classifies market conditions using Bitcoin…
The article describes Hierarchical Equal Risk Contribution (HERC), a portfolio allocation method that combines hierarchical clustering with cluster-aware capital allocation and risk balancing. It first groups assets from their return correlations, selects a…
The article explains CorrGAN, a generative adversarial network designed to create synthetic financial correlation matrices. The motivation is that historical market data can be costly, restricted, biased toward the events that occurred, and sparse in extreme…
This article presents a pairs trading method that selects stocks using correlations between their returns. In a formation period, it calculates monthly returns, finds each stock’s most correlated peers, and forms an equal-weighted peer portfolio. Regression…
The article explains a stochastic control framework for convergence trades between cointegrated assets. Earlier approaches constrain positions to be delta-neutral and fix the relative stock weights; the generalized approach allows individual asset weights to…
The article reviews a proposed arbitrage portfolio that combines equity mean reversion with momentum across stock market indices. Its study separates data into an in-sample period from November 2005 to October 2007 and an out-of-sample period from November…
This lecture series surveys advanced pairs and statistical arbitrage methods. Topics include distance-based pair selection and dependence measures, cointegration with mean first-passage time for choosing trading boundaries, PCA strategies, machine learning…
The document introduces Hierarchical Risk Parity (HRP) as a portfolio allocation method intended to reduce sensitivity to noisy return estimates and covariance-matrix inversion in traditional mean-variance optimization. It explains HRP in three stages:…
This tutorial explains Hierarchical Equal Risk Contribution (HERC), a portfolio allocation method that combines hierarchical clustering with risk-based weighting. It motivates the approach by describing how conventional mean-variance optimization can be…
This broad introduction defines pairs trading as taking opposing positions in co-moving assets when their relative prices depart from an equilibrium, with the expectation that the relationship will persist and prices will converge. It distinguishes pairs…