CRYPTYX x Kraken — Conviction-to-Execution Pipeline
From natural language thesis to executed trade in 8 steps.
A conviction engine that translates trading intuition into backtested, regime-validated, drawdown-sized Kraken orders.
Key Capabilities
- 8-step pipeline (INTERPRET → DISCOVER → DEFINE → VALIDATE → SCAN+NEAR-MISS → CROSS-CHECK → RANK → EXECUTE)
- 21 CRYPTYX intelligence tools (full surface)
- Natural language input — 6 pre-built scenarios + freeform
- Near-miss detection — relaxed threshold scan surfaces assets about to trigger
- Explicit conviction scoring — 0-100 formula
- Drawdown-based position sizing — P95 max DD → stop-loss → size
- Mandatory regime filtering — explicit contradiction rules
- Structured rationale per trade
The Core Idea
Every step leads toward an ACTUAL trade, not just a score.
"capitulation reversal on majors" ← Natural language
↓ INTERPRET
VOL_RV_7D > 2.0 + FLOW_TAKER < -1.5 + FUT_FR < -1.0 ← Metric conditions
↓ DISCOVER
Each metric validated individually (IC > 0, HR > 50%) ← Edge confirmed
↓ DEFINE
3 conditions across 3 factor classes (VOL + FLOW + FUT) ← Multi-factor thesis
↓ VALIDATE
Composite backtest across 8 holding horizons ← Backtested edge
Horizon picked by risk-adjusted return, DD P95 reported ← Risk quantified
↓ SCAN + NEAR-MISS
5 exact matches + 3 near-misses (within 30% of trigger) ← Universe scanned
↓ CROSS-CHECK
Regime: mean-reverting ✓ | Factor breadth: 6/8 ✓ ← Context confirmed
Signals: 2 confirming ✓ | Liquidity: $240k @ 100bp ✓ ← Execution feasible
↓ RANK
Conviction: 78/100 | Risk budget: 1.5% | Stop: 8.4% ← Sized by drawdown
Position: $17,857 (1.5% / 8.4% * $100k) ← Math, not intuition
↓ EXECUTE
BTC: Buy $17,857 on Kraken @ market ← Actionable trade
Architecture
┌─────────────────────┐ ┌──────────────────────┐
│ CRYPTYX MCP │ │ Kraken REST API │
│ 21 Intelligence │ │ 5 Execution Tools │
│ Tools │ │ │
│ │ │ - get_balance │
│ - Metric Slicer │ │ - get_price │
│ - Composite Test │ │ - place_spot_order │
│ - Universe Scan │ │ - get_open_orders │
│ - Signal Sim │ │ - get_trade_history │
│ - Regime Analysis │ │ │
│ - Factor Scores │ └───────────┬───────────┘
│ - Signal Triggers │ │
│ - Asset Liquidity │ │
│ - 13 more... │ │
└────────┬────────────┘ │
│ │
▼ ▼
┌──────────────────────────────────────────────────┐
│ AI Agentic Loop │
│ INTERPRET → DISCOVER → DEFINE → VALIDATE │
│ → SCAN+NEAR-MISS → CROSS-CHECK → RANK │
│ → EXECUTE │
│ │
│ Conviction Score (0-100) + Drawdown Sizing │
└──────────────────────────────────────────────────┘
Pre-Built Scenarios
Instead of starting from scratch, use a scenario that maps to validated metric conditions:
| Scenario | NL Trigger | Direction | Regime |
|---|---|---|---|
| Capitulation Reversal | "capitulation reversal on majors" | Long | Mean-reverting |
| Trend Continuation | "momentum continuation with funding support" | Long | Trending |
| Vol Compression Breakout | "volatility compression about to break" | Long | Any |
| Correlation Breakdown | "ETH decorrelation with independent momentum" | Long | Any |
| Funding Stress Short | "overleveraged longs funding squeeze" | Short | Volatile |
| OB Fragility | "order book fragility with selling exhaustion" | Long | Mean-reverting |
Scenario Scorecard
Representative backtests from the composite metric slicer across the scenario library.
| Scenario | Asset | Sharpe | Hit Rate | Episodes | Horizon | DD P95 |
|---|---|---|---|---|---|---|
| Trend Continuation | BTC | 2.68 | 65% | 52 | 30d | 17.6% |
| Correlation Breakdown | BTC | 3.14 | 69% | 71 | 14d | 17.5% |
Backtests run against the CRYPTYX composite slicer API, April 2026, and independently validated. Full methodology — Sharpe calculation, horizon selection, episode independence, inclusion criteria — lives on the CRYPTYX methodology page. Scenarios absent from the table above remain part of the agent's runtime library; they are excluded from the public scorecard where episode counts or overlap characteristics make a single quoted Sharpe misleading rather than informative.
# Use a pre-built scenario
npx tsx conviction-trader.ts --scenario "capitulation reversal"
# Or describe your own thesis — the agent will interpret it
npx tsx conviction-trader.ts
# Then the agent asks: "What trading thesis would you like to test?"
Conviction Scoring (0-100)
Every trade candidate gets a numeric score. The score gates entry and determines risk budget.
| Component | Range | What Drives It |
|---|---|---|
| Backtest quality | 0-30 | Sharpe (0-15) + hit rate (0-10) + episodes (0-5) |
| Regime alignment | 0-20 | Aligned + high confidence = 20, misaligned = 0 |
| Factor support | 0-20 | factor_breadth / 8 classes * 20 |
| Signal confirmation | 0-15 | min(confirming_signals, 3) * 5 |
| Near-miss penalty | -15 to 0 | -15 * normalized distance to trigger |
| Liquidity bonus | 0-15 | Tiered by OB depth at 100bp |
Conviction < 40 = no trade. No exceptions.
Drawdown-Based Position Sizing
This is the most important innovation. Position size is NOT arbitrary — it's derived from historical drawdown data.
risk_budget = f(conviction)
conviction >= 80 → 2.0% of portfolio
conviction >= 60 → 1.5% of portfolio
conviction >= 40 → 1.0% of portfolio
stop_distance = max_dd_p95 from composite backtest
(P95 worst intra-horizon drawdown across ALL episodes — winning AND losing)
position_size = portfolio * risk_budget / stop_distance
capped at 25% of portfolio
Example:
$100k portfolio, conviction 78, max_dd_p95 = 8.4%
risk_budget = 1.5%
position_size = $100k * 0.015 / 0.084 = $17,857 (17.9%)
stop_loss = entry_price * (1 - 0.084)
Why this matters: A thesis with 2.5 Sharpe but 18% max DD gets a SMALLER position than a thesis with 1.5 Sharpe but 4% max DD. The Sharpe boosts conviction (entry gate), but the drawdown constrains size (risk management). This is how professional traders size positions.
Setup
Prerequisites
- Node.js 18+
- CRYPTYX API key (
cx_...) — get one at cryptyx.ai - Anthropic API key (
sk-ant-...) - Kraken API key + secret (for live trading only)
Install
cd integrations/kraken
npm install
Environment Variables
# Required
export ANTHROPIC_API_KEY="sk-ant-..."
export CRYPTYX_API_KEY="cx_..."
# Required for --execute mode only
export KRAKEN_API_KEY="..."
export KRAKEN_SECRET="..."
# Optional: override CRYPTYX API base
export CRYPTYX_API_URL="https://cryptyx-ai.vercel.app"
Run
# Demo mode (simulated Kraken execution)
npm run demo
# Demo with specific scenario
npm run demo:scenario -- "capitulation reversal"
# Live trading (requires Kraken credentials)
npm run trade:live
Dual-MCP Configuration (Claude Desktop / Claude Code)
Copy claude-desktop-config.json to your Claude config directory, or add via CLI:
# Add CRYPTYX intelligence MCP
claude mcp add cryptyx -- npx @cryptyx/mcp-server
# The Kraken execution is built into this integration's agentic loop
# No separate Kraken MCP needed — it calls Kraken REST API directly
CRYPTYX Tools Reference (21 tools)
Metric Slicer (4 tools — the hero)
| Tool | Purpose |
|---|---|
get_featured_metrics | Top metrics by IC — start here |
analyze_metric | Single-metric backtest with forward returns + drawdowns |
analyze_metrics_composite | Multi-factor intersection test with drawdown stats |
scan_metric_universe | Scan all 200+ assets for z-score extremes |
Signal Forge (7 tools)
| Tool | Purpose |
|---|---|
get_signal_triggers | Today's active firings |
get_signal_catalog | All signals with params |
get_signal_explanation | Why a signal fired/didn't |
backtest_signal | Signal backtest over date range |
fork_signal | Create parameter variant |
simulate_signal | Test threshold changes (near-miss detection) |
Market Context (8 tools)
| Tool | Purpose |
|---|---|
get_factor_scores | 8-class factor t-scores |
get_regime_analysis | Regime classification |
get_composite_rankings | Full agent context snapshot |
get_market_snapshot | Asset universe overview |
get_market_pulse | Factor breadth across universe |
get_price_history | Daily OHLCV candles |
get_live_prices | 15-min spot prices |
get_asset_liquidity | OB depth at 50/100/200bp |
Utility (2 tools)
| Tool | Purpose |
|---|---|
search_assets | List all tracked assets |
get_competition_leaderboard | CRYPTYX Challenge rankings |
Near-Miss Detection
After finding exact matches, the pipeline scans at relaxed thresholds to surface assets that are almost triggering:
For condition: VOL_RV_7D gt 2.0
Exact scan: VOL_RV_7D gt 2.0 → 5 matches
Relaxed scan: VOL_RV_7D gt 1.4 → 12 matches (threshold * 0.7)
Near-misses: 7 assets with z between 1.4 and 2.0
Each near-miss annotated with:
distance_to_trigger = |z - 2.0| / |2.0|
e.g. z = 1.7 → distance = 0.15 → conviction penalty = -2.25 points
Near-misses are valuable intelligence: they tell you what's about to trigger and might trigger tomorrow.
File Structure
integrations/kraken/
├── types.ts # All shared TypeScript interfaces
├── kraken-symbols.ts # CRYPTYX ↔ Kraken pair mapping
├── kraken-auth.ts # HMAC-SHA512 signing + REST client
├── conviction-score.ts # Conviction formula + drawdown sizing
├── scenarios.ts # 6 pre-built NL scenarios + fuzzy matcher
├── conviction-trader.ts # Main 8-step agentic loop (26 tools)
├── package.json # Standalone npm project
├── claude-desktop-config.json # Dual-MCP configuration
└── README.md # This file
Technical Notes
Kraken Auth
Kraken uses HMAC-SHA512 with a nonce and base64-decoded secret:
- Scheme:
HMAC-SHA512(path + SHA256(nonce + postData))with base64-decoded secret key
Kraken Symbol Mapping
Kraken uses irregular pair names (XXBTZUSD, XETHZUSD for legacy assets, SOLUSD for modern ones). The kraken-symbols.ts module handles bidirectional mapping. Assets not listed on Kraken are filtered out during the SCAN step.
Drawdown Computation
The composite backtest API (analyze_metrics_composite) now returns max intra-horizon drawdown for every trigger episode, computed from daily OHLCV high/low prices. This tracks the worst peak-to-trough movement during the holding period — critical because a trade that ends +15% at 30d may have been -12% at day 8.
Token Budget Management
The 8-step pipeline makes many tool calls per run. Tool results are truncated to 4000 chars to manage the token budget. The max turn limit is 40.