Skip to main content
skill Claude Code CX Codex Cursor GitHub Copilot

trader-backtest — Claude Code skill: what it does, how to install

Runs historical backtests using neural-trader and Ed25519-signs output artifacts to secure paper-to-live promotion gates.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add ruvnet/ruflo --skill trader-backtest -a claude-code
Open on GitHub

What trader-backtest does

The skill executes historical backtests via the neural-trader Rust/NAPI CLI engine with walk-forward validation. It tracks performance figures such as Sharpe ratio, Sortino ratio, max drawdown, and profit factor. When the Sharpe ratio exceeds 1.5, the pattern is persisted into agentdb.

Data integrity is strictly verified before storing. If live data fetching fails, the engine falls back to synthetic bars. In that case, the skill flags the run as synthetic: true and refuses cryptographic signing. Signing requires a 32-byte Ed25519 key from RUFLO_WITNESS_KEY_PATH or verification/witness-key.json. Without that key, artifacts drop to an unsigned degraded mode.

What it helps with

  • run historical strategy backtests with walk-forward validation
  • sign backtest artifacts with Ed25519 to prevent tampering before live trading
  • detect synthetic market data fallbacks to block unverified promotions
  • store profitable trading patterns when the Sharpe ratio exceeds 1.5

Example prompts for the agent

  • Run a backtest for momentum strategy on ticker SPY with walk-forward validation
  • Execute multi-indicator backtest for AAPL with market data check

How to install trader-backtest

1Skills CLI (Vercel)

npx skills add ruvnet/ruflo --skill trader-backtest -a claude-code

2Manually: put the files in place

~/.claude/skills/trader-backtest/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/trader-backtest/

From the same set104

The whole set →
ruflo ruvnet This skill adds multi-agent orchestration, memory, routing, and MCP tools to a project. Use it for swarm tasks and multi-step workflows. Claude Code CX Codex Cursor +1 4,000installs Swarm Orchestration ruvnet Skill for managing agent swarms with parallel execution, dynamic topology, and automatic load balancing. Use when a single agent is not enough and you need to orchestrate specialists of different types. Claude Code CX Codex Cursor +1 2,100installs github-project-management ruvnet Turns issue triage and board upkeep into gh and ruv-swarm calls: labels, subtasks, duplicate lookup. Useful when the tracker holds more tickets than order. Claude Code CX Codex Cursor +1 1,400installs github-workflow-automation ruvnet Automates GitHub Actions with AI agent coordination. Generates optimised pipelines, manages pull requests, analyzes failed runs, and deploys updates with risk assessment. Claude Code CX Codex Cursor +1 1,300installs github-code-review ruvnet Runs a swarm of specialized AI agents to inspect GitHub pull requests for security, performance, and architecture issues. Claude Code CX Codex Cursor +1 1,300installs stream-chain ruvnet Chains sequential agent steps together using streaming JSON flow and provides ready-to-run pipelines. Claude Code CX Codex Cursor +1 1,200installs flow-nexus-swarm ruvnet Deploy cloud-based AI agent swarms and define event-driven workflows with message queues. Use it to coordinate tasks, inspect runs, and scale a swarm. Claude Code CX Codex Cursor +1 1,200installs performance-analysis ruvnet Detects bottlenecks in Claude Flow swarms, profiles agent operations, and generates reports with actionable optimization recommendations. Claude Code CX Codex Cursor +1 1,200installs

Similar

gmgn-token GMGNAI Researches a token by address through the GMGN API, covering price, liquidity, holders and contract risk. Use it before assessing a token purchase. Claude Code CX Codex Cursor +1 17,700installs gmgn-portfolio GMGNAI Skill analyzes crypto wallets by address via GMGN API: shows holdings, realized and unrealized P&L, win rate, trade history, and tokens created by a developer wallet. Works on Solana, BSC, Base, and Ethereum. Claude Code CX Codex Cursor +1 17,500installs gmgn-track GMGNAI Stream real-time trades from large wallets, KOLs, and your followed accounts via GMGN API. Spot what smart money is buying and copy trades across Solana, BSC, Base, Ethereum. Claude Code CX Codex Cursor +1 17,100installs okx-dex-market okx Read-only DEX skill version 4.6.6 for querying token liquidity, holder clusters, whale signals, wallet PnL, and sniper bundles. Claude Code CX Codex Cursor +1 19,100installs churn-prevention coreyhaines31 A Claude Code skill for subscription churn: an exit survey at cancellation, an offer matched to the stated reason, and recovery of failed payments. Claude Code CX Codex Cursor +1 120,600installs revops coreyhaines31 This skill helps design RevOps workflows for lead stages, scoring, routing, and marketing-to-sales handoffs. Use it when CRM processes need clear rules. Claude Code CX Codex Cursor +1 113,000installs community-marketing coreyhaines31 Builds and grows branded communities on Discord or Slack to drive product retention and turn users into advocates. Claude Code CX Codex Cursor +1 89,100installs ads coreyhaines31 Guides paid advertising campaigns across Google Ads and Meta. It connects agents to rigorous playbooks and forbids guessing missing numbers. Claude Code CX Codex Cursor +1 82,200installs

Questions about trader-backtest

How to install trader-backtest in Claude Code?

Run npx skills add ruvnet/ruflo --skill trader-backtest -a claude-code in your terminal.

What does trader-backtest do?

The skill runs strategy backtests via neural-trader, computes risk metrics, and signs artifacts with Ed25519 for promotion gates.

Why is the backtest artifact stored unsigned?

Signing is blocked when market data contains synthetic bars, or when no witness key exists in RUFLO_WITNESS_KEY_PATH or verification/witness-key.json.

Source text

SKILL.md · MIT
---
name: trader-backtest
description: Run a historical backtest using npx neural-trader with Rust/NAPI engine (8-19x faster) and walk-forward validation; Ed25519-sign the result for paper→live tamper evidence (ADR-126 Phase 4)
allowed-tools: Bash Read 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__memory_delete mcp__plugin_ruflo-core_ruflo__neural_train mcp__plugin_ruflo-core_ruflo__agentdb_pattern-store
argument-hint: "<strategy-name> --symbol <TICKER> [--period 2020-2024]"
---
Run a historical backtest using the `neural-trader` Rust/NAPI engine, then Ed25519-sign the result so the paper→live promotion gate has cryptographic tamper evidence (ADR-126 Phase 4 + CWE-347 pattern).

Steps:
1. Ensure neural-trader is available:
   `npm ls neural-trader 2>/dev/null || npm install --ignore-scripts neural-trader`
2. Check for saved strategy config:
   `mcp__plugin_ruflo-core_ruflo__memory_retrieve({ key: "strategy-STRATEGY_NAME", namespace: "trading-strategies" })`
   If not found, list available: `mcp__plugin_ruflo-core_ruflo__memory_search({ query: "strategy", namespace: "trading-strategies", limit: 10 })`
3. Run backtest via neural-trader CLI:
   ```bash
   npx neural-trader --backtest --strategy <name> --symbol <TICKER> --period <range> --walk-forward --live
   ```
   For multi-indicator strategies:
   ```bash
   npx neural-trader --backtest --strategy multi-indicator --position-sizing kelly --symbol SPY --period 2020-2024
   ```
3b. **Check the data source.** Without `--live` the backtest runs on synthetic bars, and when the live fetch fails it silently falls back to them. Read `dataSource` for every symbol in the result. Only `yahoo-finance` is real data. If any symbol is `synthetic` or `mixed`, store the result with `synthetic: true` in the body, do NOT sign it for paper→live promotion, and tell the user why.
4. Capture performance metrics from output: total return, annualized return, Sharpe ratio, Sortino ratio, max drawdown, win rate, profit factor, number of trades.
5. Dedup prior backtests for the same `(strategyId, paramsHash)` before storing the fresh one (ADR-125 lifecycle / ADR-126 Phase 2 — `keep-newest` semantics):
   - Search: `mcp__plugin_ruflo-core_ruflo__memory_search({ query: "backtest STRATEGY paramsHash:PARAMS_HASH", namespace: "trading-backtests", limit: 10 })`
   - For each hit whose key matches `backtest-STRATEGY-*` AND whose stored `paramsHash` equals the current run's hash, delete it: `mcp__plugin_ruflo-core_ruflo__memory_delete({ key: "OLD_KEY", namespace: "trading-backtests" })`
   - (Note: even without this proactive step, the `MemoryConsolidator.dedup('keep-newest')` background pass introduced in `@claude-flow/[email protected]` runs every 6h and will eventually converge. Doing it inline keeps `memory_search` results deterministic immediately after a re-run.)
6. **Sign the artifact (ADR-126 Phase 4):**
   - Build the `SignedBacktestArtifact` body — `{ strategyId, paramsHash, dataRange: {from,to}, metrics, runsHash, generatedAt }` — where `paramsHash = sha256(canonical params JSON)`, `runsHash = sha256(canonical runs array JSON)`, and `generatedAt = new Date().toISOString()`.
   - Resolve the witness signing key. The skill reads the key path in this order; the FIRST that resolves wins:
     1. `RUFLO_WITNESS_KEY_PATH` env var — points to a JSON file with `{ "privateKey": "<hex>" }`.
     2. `verification/witness-key.json` (the ADR-103 default path, if present).
   - If the key resolves: call `signBacktestArtifact(body, privateKeyHex)` from `plugins/ruflo-neural-trader/src/signed-artifact.mjs`. The returned value is a `SignedBacktestArtifact` with `schema`, `witnessPublicKey: "ed25519:<hex>"`, and `witnessSignature: "<hex>"` populated.
   - If NEITHER path resolves: log a loud warning — `"[WARN] ruflo-neural-trader: no witness signing key found (RUFLO_WITNESS_KEY_PATH unset, verification/witness-key.json missing) — storing backtest artifact in UNSIGNED degraded mode. paper→live promotion will be refused by trader-cloud-backtest until a signed artifact replaces this one."` — and store the body unsigned. NEVER silently fall back.
7. **Store the (possibly signed) artifact** to the canonical `trading-backtests` namespace:
   `mcp__plugin_ruflo-core_ruflo__memory_store({ key: "backtest-STRATEGY-TIMESTAMP", value: JSON.stringify(signedArtifact), namespace: "trading-backtests" })`
   The stored value contains `witnessSignature` + `witnessPublicKey` when signed; downstream consumers (`trader-cloud-backtest`) MUST call `verifyBacktestArtifact(artifact, trustedPublicKey)` before promoting any artifact to live.
8. If Sharpe > 1.5, store as successful pattern:
   `mcp__plugin_ruflo-core_ruflo__agentdb_pattern-store({ pattern: "profitable-STRATEGY_TYPE: PARAMS_AND_RESULTS", type: "trading-strategy", confidence: 0.8 })` (the tool takes `pattern`, `type`, `confidence`; a `data` field is ignored)
9. Train SONA on the outcome (skip for synthetic runs):
   `mcp__plugin_ruflo-core_ruflo__neural_train({ modelType: "moe", epochs: 10 })` (`modelType` is required; there is no `patternType`)

### Key sourcing & key rotation (ADR-103)

- The witness key is a 32-byte Ed25519 private key, stored as `{ "privateKey": "<64-hex-chars>" }` in a JSON file referenced by `RUFLO_WITNESS_KEY_PATH`. Keep it OUT of the repo. For local development, generate one once with `node -e "import('@noble/ed25519').then(async ed=>{const sk=crypto.getRandomValues(new Uint8Array(32));console.log(Buffer.from(sk).toString('hex'))})"` and write it to `~/.ruflo/witness-key.json`.
- Production deployments pin the corresponding PUBLIC key in project config and supply it as `trustedPublicKey` to `verifyBacktestArtifact(...)` — never trust the `witnessPublicKey` field on the artifact itself (CWE-347 / #1922).
- Key rotation: re-sign existing backtest entries with the new key OR explicitly mark pre-rotation artifacts as non-promotable. Same pattern as ADR-103.

© ruvnet · MIT · ruvnet/ruflo

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor