Expand model tag support: add GLM-5.1, simplify Anthropic IDs, scan tags anywhere in message

- Flink update_bars debouncing
- update_bars subscription idempotency bugfix
- Price decimal correction bugfix of previous commit
- Add GLM-5.1 model tag alongside renamed GLM-5
- Use short Anthropic model IDs (sonnet/haiku/opus) instead of full version strings
- Allow @tags anywhere in message content, not just at start
- Return hasOtherContent flag instead of trimmed rest string
- Only trigger greeting stream when tag has no other content
- Update workspace knowledge base references to platform/workspace and platform/shapes
- Hierarchical knowledge base catalog
- 151 Trading Strategies knowledge base articles
- Shapes knowledge base article
- MutateShapes tool instead of workspace patch
This commit is contained in:
2026-04-28 15:05:15 -04:00
parent d41fcd0499
commit 47471b7700
184 changed files with 9044 additions and 170 deletions

View File

@@ -0,0 +1,68 @@
---
description: "Applies price-momentum to the residuals of a Fama-French factor regression rather than raw returns, isolating stock-specific momentum from common factor exposures."
tags: [stocks, momentum, residual, fama-french]
---
# Residual Momentum
**Section**: 3.7 | **Asset Class**: Stocks | **Type**: Momentum
## Overview
Residual momentum replaces raw stock returns in the price-momentum strategy with the residuals of a serial regression of stock returns on common risk factors (e.g., the 3 Fama-French factors). This isolates the stock-specific component of momentum, removing the influence of market, size, and value factor exposures. The approach is attributed to Blitz, Huij and Martens (2011).
## Construction / Signal
**Step 1 — Factor regression** (36-month estimation period, with 1-month skip):
```
R_i(t) = alpha_i + beta_{1,i} MKT(t) + beta_{2,i} SMB(t) + beta_{3,i} HML(t) + epsilon_i(t) (278)
```
where:
- `MKT(t)` = excess market return (market portfolio minus risk-free rate)
- `SMB(t)` = Small Minus Big (size factor)
- `HML(t)` = High Minus Low (book-to-market factor)
Estimated over a 36-month period to get coefficients `alpha_i`, `beta_{1,i}`, `beta_{2,i}`, `beta_{3,i}`.
**Step 2 — Compute residuals** for the 12-month formation period (S=1 skip):
```
epsilon_i(t) = R_i(t) - beta_{1,i} MKT(t) - beta_{2,i} SMB(t) - beta_{3,i} HML(t) (279)
```
Note: `alpha_i` is excluded from this computation (it was estimated over the 36-month period, not the 12-month formation period).
**Step 3 — Risk-adjusted residual return**:
```
epsilon_i^mean = (1/T) * sum_{t=S}^{S+T-1} epsilon_i(t) (280)
R_tilde_i^risk.adj = epsilon_i^mean / sigma_tilde_i (281)
sigma_tilde_i^2 = 1/(T-1) * sum_{t=S}^{S+T-1} (epsilon_i(t) - epsilon_i^mean)^2 (282)
```
Construct a dollar-neutral portfolio by buying stocks in the top decile by `R_tilde_i^risk.adj` and shorting stocks in the bottom decile.
## Entry / Exit Rules
- **Entry**: At rebalance, buy top-decile stocks by risk-adjusted residual return; short bottom-decile stocks.
- **Exit**: Hold for typically 1 month (can be longer).
- **Skip period**: S=1 month.
## Key Parameters
- **Factor model**: 3 Fama-French factors (MKT, SMB, HML); Carhart 4-factor model (adding MOM) is an alternative
- **Regression estimation period**: 36 months
- **Formation period T**: 12 months
- **Skip period S**: 1 month
- **Holding period**: Typically 1 month
- **Portfolio construction**: Dollar-neutral long/short decile
## Variations
- **4-factor model**: Add Carhart momentum factor MOM(t) to regression
- **Alternative factor models**: Industry factors, principal components, other risk models
## Notes
- Alpha_i is deliberately excluded from the residual computation for the formation period, as it was estimated over the longer 36-month window.
- Typical holding period is 1 month but can be extended.
- The strategy removes common factor momentum (e.g., sector momentum) and isolates idiosyncratic stock momentum.
- Risk: residual momentum can be sensitive to the choice of factor model and estimation period.