This notebook demonstrates an Alphalens workflow for evaluating a daily stock factor based on the gap between the prior close and current open. It defines an example universe of large-cap equities with sector labels, calculates the gap, and aligns the factor…
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
6 documents
Alphalens is a Python library for evaluating predictive stock factors. It turns a factor signal and pricing data into a structured dataset of forward returns, optionally assigning observations to quantiles and groups such as sectors. The resulting analysis…
This example adapts Alphalens return analysis to study a discrete stock event rather than rank a cross-section of securities. It defines an event when a stock’s opening price crosses below a specified dollar threshold after being at or above it the prior…
This notebook illustrates factor evaluation with Alphalens using a large-cap equity universe assigned to sectors. It compares a baseline factor based on each stock’s recent ten-day performance with a second factor constructed from future price changes. The…
This tutorial shows how to evaluate a stock factor with Alphalens and then examine a portfolio built from its strongest and weakest ranked groups with Pyfolio. Its example defines a mean-reversion signal from the negative five-day change in opening prices,…
This notebook constructs artificial price and factor data to demonstrate the input structure expected by Alphalens and to provide a controlled setting for factor analysis. It creates daily prices for six assets with different deterministic paths, assigns…