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,70 @@
---
description: "Builds a long-only trend-following portfolio across multiple asset classes using ETFs, allocating weights proportional to cumulative momentum and optionally risk-adjusted by historical volatility, with an optional MA filter."
tags: [etfs, trend-following, multi-asset, momentum, long-only]
---
# Multi-Asset Trend Following
**Section**: 4.6 | **Asset Class**: ETFs | **Type**: Trend-Following / Multi-Asset
## Overview
ETFs allow efficient diversification across sectors, countries, asset classes, and factors in a relatively small number of instruments. This strategy constructs a long-only trend-following portfolio across multiple ETFs (and thus multiple asset classes) by allocating weights based on cumulative momentum, optionally filtered by a moving average, and weighted by historical volatility to manage risk.
## Construction / Signal
**Step 1 — Compute cumulative returns** over a T-month formation period (T = 612 months):
```
R_i^cum = P_i(t) / P_i(t+T) - 1
```
**Step 2 — Filter**: Keep only ETFs with positive `R_i^cum` (positive momentum required for long-only).
**Step 3 — Optional MA filter**: Additionally keep only ETFs whose last closing price P_i exceeds their moving average MA_i(T') (typically T' = 100200 days):
```
P_i > MA_i(T')
```
**Step 4 — Assign weights** to all surviving ETFs (not just top decile, since the universe is small):
Option A — proportional to cumulative return:
```
w_i = gamma_1 * R_i^cum (371)
```
Option B — momentum divided by volatility (Sharpe-like weighting):
```
w_i = gamma_2 * R_i^cum / sigma_i (372)
```
Option C — momentum divided by variance (Sharpe ratio optimization for diagonal covariance):
```
w_i = gamma_3 * R_i^cum / sigma_i^2 (373)
```
where `sigma_i` is historical ETF volatility and normalization coefficients `gamma_1`, `gamma_2`, `gamma_3` are computed to satisfy `sum_{i=1}^{N} w_i = 1` (N = number of ETFs with nonzero weights after filtering).
Option C (Eq. 373) optimizes the Sharpe ratio of the ETF portfolio assuming a diagonal covariance matrix `C_ij = diag(sigma_i^2)` (ignoring cross-ETF correlations).
## Entry / Exit Rules
- **Entry**: At each rebalance, apply momentum and MA filters, compute weights, and enter long positions in all surviving ETFs.
- **Exit**: Rebalance monthly (or per the formation period schedule); ETFs with negative cumulative momentum or below their MA are dropped (weight set to zero).
- **Position cap**: Bounds `w_i <= w_i^max` can be imposed to prevent overweighting of any single volatile ETF.
## Key Parameters
- **Formation period T**: 612 months
- **MA filter length T'**: 100200 days (optional; aligns with sector momentum rotation MA filter)
- **Weighting scheme**: Equal (Eq. 371), volatility-adjusted (Eq. 372), or variance-adjusted/Sharpe-optimal (Eq. 373)
- **Position cap**: Maximum weight per ETF (optional; mitigates concentration risk)
- **Holding period**: Monthly rebalancing typical
## Variations
- **No MA filter**: Use only positive cumulative return filter
- **With position caps**: Add `w_i <= w_i^max` to prevent overweighting high-momentum volatile ETFs
- **Sector rotation overlay**: Combine with sector momentum rotation (Section 4.1) by restricting the universe to top-ranked sectors
## Notes
- Eq. (371) is the simplest weighting; it overweights volatile ETFs since on average `R_i^cum ∝ sigma_i`.
- Eq. (372) mitigates volatility overweighting by dividing by sigma_i.
- Eq. (373) is the optimal Sharpe ratio solution under the assumption of uncorrelated (diagonal covariance) ETF returns.
- The key advantage of ETFs for multi-asset trend following: a small number of instruments (tens of ETFs) can provide exposure to many asset classes, sectors, geographies, and factors simultaneously.
- Long-only construction avoids shorting complexity; the MA filter prevents buying ETFs in absolute downtrends even if they have relative momentum.
- For some literature on multi-asset portfolios, dynamic asset allocation, and related topics: Bekkers, Doeswijk and Lam (2009), Black and Litterman (1992), Faber (2015, 2016), Mladina (2014).