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: "Combines multiple stock-selection factors (e.g., value and momentum) by blending factor rankings or allocating capital across factor sub-portfolios, reducing single-factor risk."
tags: [stocks, multifactor, momentum, value]
---
# Multifactor Portfolio
**Section**: 3.6 | **Asset Class**: Stocks | **Type**: Multifactor
## Overview
A multifactor portfolio buys and shorts stocks based on multiple factors simultaneously — such as value and momentum — which are often negatively correlated with each other, providing diversification benefits. Combining factors can add value relative to any single-factor strategy. The holding period depends on which factors are combined.
## Construction / Signal
Two primary approaches to combining F factors:
**Approach 1 — Capital allocation across sub-portfolios**
Each of F factor portfolios is built independently (as in Sections 3.13.5). Capital is allocated with weights `w_A` (A = 1,...,F):
```
sum_{A=1}^{F} w_A = 1 (275)
```
Investment level for factor A: `I_A = w_A * I`
Simple uniform weights: `w_A = 1/F`
Volatility-weighted: `w_A ∝ 1/sigma_A` or `w_A ∝ 1/sigma_A^2`, where `sigma_A` is the historical volatility of factor portfolio A (uniformly normalized per dollar invested).
Alternatively, optimize weights using an invertible F×F covariance matrix of the F factor portfolio returns.
**Approach 2 — Blended ranking scores**
Define demeaned ranks for factor A across N stocks:
```
s_{Ai} = rank(f_{Ai}) - (1/N) * sum_{j=1}^{N} rank(f_{Aj}) (276)
```
where `f_{Ai}` is the numeric value of factor A for stock i. Average the ranks across factors:
```
s_i = (1/F) * sum_{A=1}^{F} s_{Ai} (277)
```
Sort stocks by the combined score `s_i` and construct a long/short portfolio (top decile long, bottom decile short).
## Entry / Exit Rules
- **Entry**: At rebalance date, compute factor scores, blend them (via capital allocation or rank averaging), and enter long/short positions.
- **Exit**: Hold for the relevant factor horizon; rebalance monthly (or per factor schedule).
- **Tie-breaking**: If ambiguity exists at decile boundaries (e.g., tied combined scores), resolve by preferring one factor's ranking.
## Key Parameters
- **Number of factors F**: Typically 25 (e.g., value + momentum; or value + momentum + low-vol)
- **Factor weights w_A**: Uniform (1/F) or volatility-suppressed
- **Combining method**: Capital allocation vs. rank averaging
- **Holding period**: Depends on the factors combined
## Variations
- **Two-factor momentum + value**: Sort top/bottom quintiles by momentum, then split by value (or vice versa), creating 4 sub-portfolios
- **Weighted rank averaging**: Non-uniform weights in Eq. (277) using Manhattan or Euclidean distance minimization
- **Portfolio optimization**: Fix weights w_A by optimizing expected returns using an invertible F×F covariance matrix
## Notes
- Value and momentum are empirically negatively correlated, making them natural complements that reduce portfolio volatility.
- Uniform rank averaging (Eq. 277) minimizes the sum of squared Euclidean distances between the combined N-vector s_i and the K individual N-vectors s_{Ai}.
- Holding period depends on the slowest factor; mixing monthly and annual factors requires careful rebalancing scheduling.
- Transaction costs increase with the number of factors if rebalancing frequencies differ.