portfolio-optimize

portfolio-optimize is a skill for Claude Code, Codex from AlgoChains/algochains-mcp-server. It costs 0 tokens per session (486 once invoked), scanned A, original, MIT.

A research tool that recommends how to divide capital among several trading bots using their past returns, relationships, and the investor’s risk tolerance. It compares risk-based allocation methods and applies per-bot limits.

In plain words
What is it for?
Use it for monthly or on-demand portfolio recommendations across bots such as MNQ, CL, MES, and NQ. It is for research and does not place live trades.
Why use it?
It helps avoid allocating money based only on each bot’s individual results, since bots may be exposed to similar risks.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for monthly or on-demand portfolio recommendations across bots such as MNQ, CL, MES, and NQ. It is for research and does not place live trades.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/algochains/algochains-mcp-server/portfolio-optimize
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add AlgoChains/algochains-mcp-server --skill portfolio-optimize
Clone the repo
git clone --depth 1 https://github.com/AlgoChains/algochains-mcp-server

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for portfolio-optimize

README.md
[![agentmods](https://agentmods.dev/badge/skills/algochains/algochains-mcp-server/portfolio-optimize.svg)](https://agentmods.dev/skills/algochains/algochains-mcp-server/portfolio-optimize)
Your own site
<a href="https://agentmods.dev/skills/algochains/algochains-mcp-server/portfolio-optimize"><img src="https://agentmods.dev/badge/skills/algochains/algochains-mcp-server/portfolio-optimize.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 486 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.00486
Opus 5 $0.00000 $0.00243
Sonnet 5 $0.00000 $0.00097
Haiku 4.5 $0.00000 $0.00049

Measured 7d ago against content hash 47db2b4daa4f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

portfolio-optimize scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

algoclaw/skills/portfolio-optimize/SKILL.md · 48 lines

What it actually says

portfolio-optimize

Tier: 1 (research, no live money)
Trigger: Monthly, on-demand for subscriber portfolio recommendations
MCP Tool: run_algoclaw_skill("portfolio-optimize", {"bots":["MNQ","CL","MES","NQ"],"capital":50000})
Source Pattern: Riskfolio-Lib HRP + PyPortfolioOpt

What It Does

Computes optimal capital allocation across AlgoChains bots using:

  1. HRP (Hierarchical Risk Parity) — groups correlated bots, allocates inversely to risk
  2. Min-Variance — minimizes portfolio volatility for given return target
  3. Conservative dual — takes minimum weight per bot across both methods

Input

  • Bot performance history (pulled from live logs or Supabase)
  • Correlation matrix between bot returns
  • Subscriber's risk tolerance and capital

Algorithm (pure Python, no Riskfolio dependency required)

# Pure HRP implementation using scipy + numpy
# 1. Compute correlation matrix from bot return histories
# 2. Build hierarchical linkage tree (Ward / single)
# 3. Recursive bisection: allocate capital proportional to cluster variance
# 4. Apply min 5% / max 40% per-bot constraints

Output

{
  "capital": 50000,
  "method": "HRP",
  "allocations": {
    "MNQ": {"weight": 0.38, "capital_usd": 19000, "sharpe": 4.61},
    "CL":  {"weight": 0.28, "capital_usd": 14000, "sharpe": 2.8},
    "MES": {"weight": 0.18, "capital_usd": 9000,  "sharpe": 2.1},
    "NQ":  {"weight": 0.16, "capital_usd": 8000,  "sharpe": 2.3}
  },
  "portfolio_sharpe_est": 3.2,
  "correlation_note": "MNQ+NQ 96% correlated — HRP auto-reduces both",
  "rebalance_frequency": "monthly"
}
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 48 lines · 0 tokens per session scan A 47db2b4daa4f

Subscribe to this mod's changes

portfolio-optimize is a skill published in the GitHub repository AlgoChains/algochains-mcp-server (1 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 486 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories