This notebook uses principal component analysis on a liquid subset of US stocks to build gross-normalized eigenportfolios and study their role as latent risk factors. It examines explained variance, interprets components through sector ETF correlations,…
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
715 documents
This notebook compares linear models for predicting ETF returns from overlapping price-derived features. Since multiple return horizons and indicator families can encode similar information, ordinary least squares may assign unstable opposing coefficients to…
This guide maps causal questions to Python libraries and clarifies the distinction between estimating effects under an assumed causal structure and discovering possible structures from data. It introduces double machine learning for adjusted treatment…
This framework demonstrates data-quality checks on daily US equity OHLCV data. Structural validation tests price relationships, positive prices, nonnegative volume, missing values, duplicate dates, chronological order, stale prices, and extreme returns. The…
This notebook introduces a stochastic discount factor model for pricing a cross-section of ETFs. Instead of separately estimating fund exposures and factor returns, it trains networks to find a common discount-factor series whose covariation with fund…
This notebook applies TabM, a weight-sharing neural ensemble, to a panel of cryptocurrency perpetual-futures features. Its members share a neural backbone but have separate scaling vectors and output layers, combining efficient ensembling with nonlinear…
This notebook reconstructs the prevailing best bid and offer for each AAPL trade during a single March 2020 session, then applies the Lee–Ready method to infer whether buyers or sellers initiated trades. It interleaves quote and trade events in timestamp…
This notebook screens financial and model-derived features for their ability to rank ETFs by subsequent returns. It calculates a date-by-date information coefficient by comparing each feature’s cross-sectional ranks with forward-return ranks, then examines…
This notebook examines whether SHAP feature attributions are stable enough to support model pruning, risk decisions, or reporting. Using an ETF prediction task, it first searches for test samples whose predictions are close while their SHAP profiles differ.…
This notebook evaluates candidate features for 20 currency pairs one at a time against forward returns. It limits the analysis to walk-forward validation periods, stamps each session with its fold, and leaves a buffered gap before the holdout so labels…
This notebook explains how to combine probability forecasts from multiple agents and how to calibrate the resulting probabilities. It presents Neyman extremization, which moves the mean forecast away from a base rate according to panel size and an assumed…
This data utility supports work with the Chen, Pelger, and Zhu asset-pricing dataset, which includes stock returns, firm characteristics, macroeconomic series, and pre-split characteristic tensors. Its conversion method builds Parquet files from the…
This notebook examines whether financial features help explain a 10-session delta-hedged options return label. It compares Ridge models using one implied-volatility feature, groups of implied-volatility-dependent and independent features, and the full…
This module describes a shared way to prepare walk-forward training and validation folds for multiple model families. It separates expensive, model-independent work—slicing time windows, applying fold-specific model-based features, removing rows with missing…
This notebook compares validation predictions from multiple model families for perpetual-futures funding research. It explains that information coefficient measures rank association between predictions and subsequent returns, AUC measures ranking for up or…
This implementation describes how to construct batched sequence windows for panel data used in deep-learning studies. Windows follow the panel’s expected calendar rather than compressing each asset’s observations into consecutive rows. Missing sessions…
This notebook presents practical cleaning methods for market and firm data, including duplicate handling, gap flags, domain filters, reversal-based spike detection, outlier clipping, categorical encoding, and alignment across datasets with different…
This notebook examines whether SHAP attributions remain stable when predictions are similar or when models are refitted with different random seeds and architectures. Using ETF forward returns, it searches for sample pairs whose predictions are close but…
This notebook compares Polymarket’s crypto-settled event contracts with Kalshi’s regulated contracts, focusing on how access rules and listing policies shape the prices and questions each venue represents. It inspects a small Polymarket snapshot, checks how…
This notebook demonstrates a trade-level diagnostic workflow that links realized failures to a model’s SHAP explanations. It trains a LightGBM model on lagged price and volatility features plus macro inputs to forecast next-session SPY returns. A fixed…
This notebook compares behavior cloning with inverse reinforcement learning (IRL) for learning from execution records. Its demonstrations come from a TWAP schedule, whose risk-neutral objective is known: spread trades evenly to limit impact while accepting…
The notebook presents the Almgren–Chriss framework for scheduling a large liquidation. It measures implementation shortfall against the arrival price and models two competing costs: market impact, which rises with trading intensity, and timing risk, which…
This case study explains how to construct forward-return labels for a cross-sectional foreign-exchange strategy that ranks currency pairs and buys or sells according to their relative ordering. It first maps four-hour spot bars into trading sessions using a…
The code computes standardized performance metrics from out-of-sample prediction tables, separately by fold and as headline aggregates. It supports regression and classification, including information coefficient, error measures, discrimination metrics, and…