The document demonstrates a broker wrapper that checks orders and portfolio state before forwarding trades. Its controls include per-order share and value caps, position exposure limits, order-rate limits, asset allow and block lists, and an emergency halt.…
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
4,613 documents
This notebook turns 21-day forward ETF returns into an up-or-down target and evaluates L1- and L2-regularized logistic regression on chronological walk-forward folds. It scales features using each fold’s training data, then assesses predictions with…
This notebook investigates why two backtesting engines can produce different results from identical signals. It holds a precomputed ETF strategy fixed, forms a deterministic portfolio from its predictions, and changes execution settings one at a time. The…
This notebook explains how market impact grows with order size and uses the square-root participation model to frame strategy capacity. It distinguishes inputs available from market data, such as volatility and average daily volume, from the impact…
This notebook examines how return forecasts for ETFs can express uncertainty, comparing Monte Carlo dropout with deep ensembles. Dropout remains active across repeated inference passes, while an ensemble measures disagreement among separately trained…
This notebook connects position sizing with analysis of maximum adverse and favorable excursions. It demonstrates fixed-fractional sizing, where shares are determined by a per-trade risk budget and entry-to-stop distance, subject to a concentration cap. It…
This notebook compares six allocation methods on crypto perpetual strategies that have already passed a baseline selection funnel. It keeps each strategy’s predictions and entry rules fixed, then changes how capital is assigned: one allocator uses model…
This notebook derives Kelly sizing for a binary wager by maximizing expected log wealth, then illustrates how stake size changes the distribution of simulated wealth paths. It extends the framework to continuous returns and multi-asset portfolios, where the…
This notebook evaluates a previously selected ETF strategy on a reserved holdout period. It retrieves the matching predictions from their training identity and checkpoint, applies the strategy specification and trading costs established earlier, and…
The document describes a validation-stage comparison of fixed and trailing stop rules for FX strategies. For each return label, it selects a parent strategy from a sealed cohort of signal and allocation results, then varies the declared position-level risk…
This case study compares alternative position sizing methods for CME futures against an equal weight baseline. It explains how inverse volatility sizing uses each contract’s own volatility, while covariance based methods also account for relationships…
This notebook builds prediction intervals around gradient boosting forecasts and compares split conformal prediction with quantile regression, conformalized quantile regression, and adaptive conformal inference. Split conformal uses a chronological training…
This notebook tests whether model-based position sizing improves on equal weighting in a US firm characteristics strategy. It compares score weighting, which allocates more to names with higher predicted scores, with conformal weighting, which reduces…
This notebook compares ways to exit long ETF trades: fixed profit targets and stops, trailing stops, ATR-scaled barriers, machine-learning signals, and combinations. It builds indicators and trade simulations, then summarizes trade returns, win rates,…
This notebook introduces futures backtesting mechanics through a long-short momentum example across several asset classes. It explains how contract specifications convert price movements into dollar profit and loss through multipliers, and how notional…
This notebook evaluates position-level stop losses, trailing stops, and time exits on the allocation lineage that ranks highest by validation Sharpe among eligible full-coverage candidates. Each overlay is compared with its own no-overlay parent, isolating…
This notebook compares portfolio weighting rules for an S&P 500 options strategy that sells straddles. It holds the selected symbols and other strategy settings fixed while replacing the equal-weight baseline with allocators that use either model predictions…
This chapter presents risk management as part of strategy design and live operations. It covers tail risk measurement with value at risk and conditional value at risk, drawdown depth and recovery, exposure decomposition, stress testing, adaptive controls,…
This notebook shows how to tune stop-loss, take-profit, and trailing-stop rules for a momentum portfolio while preserving a chronological holdout. It compares one-dimensional parameter sweeps, joint rule grids, and stop or target priors derived from…
This shared allocation module turns cross-sectional predictions into portfolio weights. It ranks assets by score to select long positions or top and bottom baskets for long-short portfolios. Position weights can reflect conformal prediction widths, where…
This notebook compares portfolio sizing methods for leading S&P 500 equity signal configurations. It first selects each configuration’s strongest full-coverage checkpoint using validation Sharpe, then applies alternative allocators—including score weighting,…
The document explains three rules for closing positions before a portfolio’s scheduled rebalance: a fixed loss stop, a trailing stop measured from the position’s best price, and a time exit that closes after a set holding period. Because overlays only remove…
This notebook presents a workflow for asking whether six-month skip-recent momentum affects 21-day forward returns and whether the effect changes with market volatility. It estimates effects on training data using double machine learning, with volatility and…
This notebook describes how to evaluate a previously selected FX strategy on holdout predictions. It reuses the selected configuration’s registered backtest specification, keeping the signal, allocation, risk controls, rebalance rule, costs, and account…