
Trader Backtest
FreeRun historical backtests with cryptographic integrity.
Free · Opens the source repo
What Trader Backtest does
The Trader Backtest skill enables users to perform historical backtesting of trading strategies using the neural-trader engine, which leverages Rust/NAPI for enhanced performance. This skill is particularly useful for traders and developers looking to validate their trading strategies over historical data with a focus on speed and reliability. By integrating walk-forward validation, users can ensure that their strategies are robust across different market conditions.
A key feature of this skill is its ability to sign backtest results using Ed25519 cryptography. This provides tamper evidence for the transition from paper trading to live trading, ensuring that the integrity of the backtest results is maintained. The signing process involves generating a signed artifact that includes crucial performance metrics and can be verified before any promotion to live trading.
The skill walks users through a series of steps that include checking for existing strategy configurations, running backtests via the command line, capturing performance metrics, and deduplicating prior backtests. This structured approach ensures that users can efficiently manage their backtesting process while maintaining a clear record of their trading strategies and results.
Overall, Trader Backtest is designed for developers and traders who require a reliable and efficient way to backtest and validate their trading strategies, while also ensuring that the results are secure and verifiable.
When to use it
Use this skill when you need to backtest trading strategies and require a secure method to validate the results before live trading.
When not to use it
This skill may not be suitable for users who do not require cryptographic signing of backtest results or those looking for a simple backtesting tool without advanced features.
What you can build with it
Validating a New Trading Strategy
Use the Trader Backtest skill to backtest a new trading strategy against historical data to assess its viability before going live.
Ensuring Compliance for Live Trading
Run backtests and sign the results to maintain a verifiable record, ensuring compliance with trading regulations.
Optimizing Strategy Performance
Utilize the skill's metrics to refine and optimize trading strategies based on past performance data.
How to install Trader Backtest
View source1. Install with the skills CLI
npx skills add ruvnet/ruflo/trader-backtest --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by ruvnetRun 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:
- Ensure neural-trader is available:
npm ls neural-trader 2>/dev/null || npm install --ignore-scripts neural-trader - 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 }) - Run backtest via neural-trader CLI:
For multi-indicator strategies:npx neural-trader --backtest --strategy <name> --symbol <TICKER> --period <range> --walk-forwardnpx neural-trader --backtest --strategy multi-indicator --position-sizing kelly --symbol SPY --period 2020-2024 - Capture performance metrics from output: total return, annualized return, Sharpe ratio, Sortino ratio, max drawdown, win rate, profit factor, number of trades.
- Dedup prior backtests for the same
(strategyId, paramsHash)before storing the fresh one (ADR-125 lifecycle / ADR-126 Phase 2 —keep-newestsemantics):- 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 storedparamsHashequals 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/memory@3.0.0-alpha.18runs every 6h and will eventually converge. Doing it inline keepsmemory_searchresults deterministic immediately after a re-run.)
- Search:
- Sign the artifact (ADR-126 Phase 4):
- Build the
SignedBacktestArtifactbody —{ strategyId, paramsHash, dataRange: {from,to}, metrics, runsHash, generatedAt }— whereparamsHash = sha256(canonical params JSON),runsHash = sha256(canonical runs array JSON), andgeneratedAt = new Date().toISOString(). - Resolve the witness signing key. The skill reads the key path in this order; the FIRST that resolves wins:
RUFLO_WITNESS_KEY_PATHenv var — points to a JSON file with{ "privateKey": "<hex>" }.verification/witness-key.json(the ADR-103 default path, if present).
- If the key resolves: call
signBacktestArtifact(body, privateKeyHex)fromplugins/ruflo-neural-trader/src/signed-artifact.mjs. The returned value is aSignedBacktestArtifactwithschema,witnessPublicKey: "ed25519:<hex>", andwitnessSignature: "<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.
- Build the
- Store the (possibly signed) artifact to the canonical
trading-backtestsnamespace:mcp__plugin_ruflo-core_ruflo__memory_store({ key: "backtest-STRATEGY-TIMESTAMP", value: JSON.stringify(signedArtifact), namespace: "trading-backtests" })The stored value containswitnessSignature+witnessPublicKeywhen signed; downstream consumers (trader-cloud-backtest) MUST callverifyBacktestArtifact(artifact, trustedPublicKey)before promoting any artifact to live. - If Sharpe > 1.5, store as successful pattern:
mcp__plugin_ruflo-core_ruflo__agentdb_pattern-store({ pattern: "profitable-STRATEGY_TYPE", data: "PARAMS_AND_RESULTS" }) - Train SONA on the outcome:
mcp__plugin_ruflo-core_ruflo__neural_train({ patternType: "trading-strategy", epochs: 10 })
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 byRUFLO_WITNESS_KEY_PATH. Keep it OUT of the repo. For local development, generate one once withnode -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
trustedPublicKeytoverifyBacktestArtifact(...)— never trust thewitnessPublicKeyfield 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.
Frequently asked questions about Trader Backtest
Similar skills
Python PyPI Package Builder
Streamline the process of creating and publishing Python packages.
Minecraft Plugin Development
Streamline your Minecraft server plugin creation.
MCP Server Builder
Easily build .NET MCP servers with the latest standards.
CommunityToolkit.Mvvm Messenger
Decoupled communication for ViewModels in .NET applications.
MVVM Toolkit DI
Streamline ViewModel integration with Dependency Injection in .NET.
MCP Apps Builder
Essential guidelines for MCP server development.
