Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

trader-portfolio-cg

Skill by ruvnet

Solves mean-variance portfolio optimization with Conjugate Gradient instead of the legacy Neumann series. Aimed at traders and developers who compute portfolio weights with the neural-trader package.

  • Score 91
  • 83k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install trader-portfolio-cg

Built from the published package, never by AI.

git clone --depth 1 https://github.com/ruvnet/ruflo /tmp/ruflo && mkdir -p ~/.claude/skills && cp -r /tmp/ruflo/plugins/ruflo-neural-trader/skills/trader-portfolio-cg ~/.claude/skills/trader-portfolio-cg

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install trader-portfolio-cg in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

The trader-portfolio-cg skill solves the mean-variance optimization equation Σ · x = μ using Conjugate Gradient (CG) instead of the legacy Neumann series. The source reports about 816 ns for CG against about 50 µs for Neumann at n=256, a 40 to 60 times speedup, with parity within 1e-4 on a fixed seed.

The skill reads a covariance matrix and expected-return vector, then calls a SublinearAdapter. The adapter uses the native mcp__ruflo-sublinear__solve tool when reachable and a local JavaScript CG otherwise. If the input is not symmetric positive-definite or the adapter fails, it falls back to npx neural-trader --portfolio optimize and records the method in the stored artifact. It is aimed at traders and developers who manage portfolio weights with the neural-trader package.

Written from the project's SKILL.md and checked against it.

What it can do

  • Solve covariance systemSolves Σ · x = μ with Conjugate Gradient and returns weights, iterations and residual.
  • Native solver dispatchCalls mcp__ruflo-sublinear__solve when reachable, otherwise a local JavaScript CG.
  • Legacy fallbackFalls back to npx neural-trader --portfolio optimize when the CG path cannot run.
  • mcp__plugin_ruflo-core_ruflo__memory_storeSaves weights and method metadata to the trading-risk namespace.
  • mcp__plugin_ruflo-core_ruflo__memory_searchLooks up a stored covariance matrix and expected returns from prior runs.
  • mcp__plugin_ruflo-core_ruflo__agentdb_pattern-searchCompares new weights with historical patterns as an optional cross-check.

What you need

  • npm
  • neural-trader package (installed with npm if missing)
  • Covariance matrix and expected-return vector from the user or a prior AgentDB run
  • ruflo memory tools for the trading-risk namespace

Try asking

  • Optimize my portfolio weights using my covariance matrix and expected returns
  • Solve the mean-variance problem with CG and show which method was used
  • Check my new portfolio weights against historical patterns in trading-risk

Good to know

  • neural-trader 2.8.11 does not return a covariance matrix or expected returns, so inputs must come from the user or AgentDB.
  • The source says the returns matrix is not wired in neural-trader 2.8.11.
  • If weights differ by more than 30% in any one asset from the historical median, the skill flags them for human review.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: plugins/ruflo-neural-trader/skills/trader-portfolio-cg/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

Allowed tools: Bash Read mcp__ruflo-sublinear__solve mcp__plugin_ruflo-core_ruflo__memory_store mcp__plugin_ruflo-core_ruflo__memory_retrieve mcp__plugin_ruflo-core_ruflo__memory_search mcp__plugin_ruflo-core_ruflo__agentdb_pattern-search

  • SKILL.md7 KB

Alternatives to trader-portfolio-cg

All alternatives →

Compare with meme-rush, okx-market or saas-metrics-coach

trader-portfolio-cg: common questions

Why use Conjugate Gradient instead of Neumann?

The source says CG takes about 816 ns at n=256 versus about 50 µs for the legacy Neumann series, a 40 to 60 times speedup.

What happens if the native solver is unavailable?

The adapter falls back to a local JavaScript CG and records method as cg-local in the artifact metadata.

How do I turn off the CG path?

Set RUFLO_NEURAL_TRADER_DISABLE_CG=1 to skip CG and use the legacy Neumann route.

How do I install trader-portfolio-cg?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is trader-portfolio-cg free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is trader-portfolio-cg safe to use?

It scores 91 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to trader-portfolio-cg?

Similar skills: meme-rush, okx-market, saas-metrics-coach, sec-edgar.

trader-portfolio-cg Install

Add to stack

Loading.