asset-allocation
What it does
This skill explains the main ways to split money across assets and how to run the built-in portfolio optimizers. It is for investors and analysts who want to understand allocation theory and apply it.
When to use it
- ✓When you want to split a portfolio across several assets using a clear method.
- ✓When you want to combine market views with a baseline allocation.
- ✓When you want to use the optimizers and save the output to a config file.
Skill link
https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/asset-allocation/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Build a risk-balanced allocation for these five ETFs, explain the method, and write the weights into the config file.”
5 new skills a week. 1 minute to read.
How it works
The agent explains the chosen method, such as mean-variance or risk budgeting, including its strengths and weaknesses. It then runs the matching optimizer with your constraints and writes the resulting weights into a configuration file.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Asset Allocation and Portfolio Optimization
Overview
From asset allocation theory to practical implementation, this skill covers classical frameworks (MPT, BL, risk budgeting, all-weather) and the usage of the four optimizers built into this system. The output can be written directly into config.json.
Asset Allocation Theory
1. Modern Portfolio Theory (MPT, Markowitz)
Core idea: maximize expected return for a given level of risk (the efficient frontier).
Optimization problem:
min w'Σw (portfolio variance)
s.t. w'μ = target_return
Σw = 1
w ≥ 0 (no shorting)
| Advantages | Disadvantages |
|---|---|
| Mathematically rigorous | Extremely sensitive to inputs (garbage in, garbage out) |
| Efficient frontier is visualizable | Concentrated-allocation problem (often produces extreme weights) |
| Foundational framework | Assumes normality and ignores fat tails |
Practical advice: do not use raw MPT directly. Add constraints (upper/lower bounds, sector limits) or use a regularized version.
2. Black-Litterman Model
Core idea: start from market equilibrium and incorporate investor views.
Steps:
1. Reverse-imply market equilibrium returns: π = δΣw_mkt
2. Build the view matrices: P (selection matrix), Q (view returns), Ω (view uncertainty)
3. Blend the posterior: μ_BL = [(τΣ)^-1 + P'Ω^-1 P]^-1 [(τΣ)^-1 π + P'Ω^-1 Q]
4. Run Markowitz optimization using posterior μ_BL
Example views:
- Absolute view: "China A-shares will return 10% over the next year" →
P=[1,0,0], Q=[0.10] - Relative view: "China A-shares will outperform US equities by 5%" →
P=[1,-1,0], Q=[0.05]
Parameter guidance:
τ(uncertainty scaling):0.025-0.05Ω: set according to view confidence, where higher confidence = smaller variance
3. Risk Budgeting
Core idea: allocate by risk contribution rather than by capital share.
Risk contribution: RC_i = w_i × (Σw)_i / σ_p
Target: RC_i / σ_p = budget_i (for all i)
| Strategy | Risk Budget | Best Use Case |
|---|---|---|
| Equal risk contribution | Each asset 1/N | When you do not know which asset is best |
| Equity-tilted risk budget | Stocks 60%, bonds 30%, commodities 10% | When you want equities to contribute more risk |
| Dynamic risk budget | Adjust dynamically by signal strength | When you have market-timing ability |
4. All-Weather Strategy
Bridgewater framework: allocate risk equally across economic environments.
Economic environment Asset allocation
───────── ─────────
Growth rising Equities + commodities + corporate bonds
Growth falling Government bonds + inflation-protected bonds
Inflation rising Commodities + inflation-protected bonds + EM debt
Inflation falling Equities + government bonds
Simplified allocation example for China-focused portfolios:
- 30% CSI 300 / CSI 500
- 40% government bonds / credit bonds
- 15% gold
- 15% commodities / REITs
Guide to the 5 Optimizers
Overview of the Built-In Optimizers
Configure them in config.json through optimizer and optimizer_params:
| optimizer | Display Name | Core Idea | Best Use Case |
|---|---|---|---|
equal_volatility |
Equal Volatility | Allocate weights by inverse volatility | Simple and effective baseline |
risk_parity |
Risk Parity | Equalize risk contribution while accounting for correlation | Long-term robust allocation |
mean_variance |
Mean-Variance | Maximize Sharpe ratio or minimize variance | When return forecasts are available |
max_diversification |
Maximum Diversification | Maximize the diversification ratio | When pursuing a low-correlation portfolio |
turnover_aware |
Turnover-Aware | Mean-variance utility with an L1 penalty on weight changes vs the previous rebalance | When trading costs matter; tune turnover_penalty to your data frequency |
1. equal_volatility
{
"optimizer": "equal_volatility",
"optimizer_params": {
"lookback": 60
}
}
Principle: w_i = (1/σ_i) / Σ(1/σ_j)
| Parameter | Default | Description |
|---|---|---|
| lookback | 60 | Volatility calculation window (trading days) |
Advantages: simple and fast, no return forecast required, no correlation matrix required.
Disadvantages: ignores cross-asset correlation.
2. risk_parity
{
"optimizer": "risk_parity",
"optimizer_params": {
"
FAQ
Is raw mean-variance optimization enough?
The skill warns against using it alone, since results are very sensitive to inputs, and recommends adding constraints.
What is Black-Litterman?
It starts from a market baseline and adjusts it with your own views on specific assets.
Can the weights be used directly?
They can be written into the configuration file, but they should be reviewed before any real use.
Details
Original description by the author
Asset allocation theory and optimizer usage — MPT / Black-Litterman / risk budgeting / all-weather strategy, including guides for 5 optimizers and rebalancing rules.
repo: HKUDS/Vibe-Trading
Popularity
- GitHub stars
- 37k
- Ranking position
- #7498
- License
- MIT
- Updated
- 11/1/2026
Comments
- …
More skills from this repository
vibe-trading
37kGives your agent a full finance research toolkit, covering backtests, factor analysis, options pricing and market data across many markets.
adr-hshare
37kShows your agent how to compare the price of a Chinese company listed in several markets, such as a US ADR and a Hong Kong share.
akshare
37kLets your agent pull free market data for Chinese and global stocks, futures, forex and economic indicators, with no API key needed.
alpha-zoo
37kLets your agent browse a library of ready-made stock factors and test how well a whole set of them predicts returns on a chosen market.
Similar skills
gitcrawl
394kLets your agent search a saved archive of GitHub issues and pull requests, group duplicates, and check their current status on GitHub.
slacrawl
394kLets your agent search and count messages in a local Slack archive, check how fresh that archive is, and refresh it when needed.
goplaces
394kHelps your agent search for places, get their details and reviews, and resolve place names using Google Places, with JSON output for scripts.