Silvic V3 System Documentation

How the AI trading desk works, from data collection to on-chain execution.

Overview

Silvic V3 is an autonomous AI trading desk that trades spot crypto on DEXs with real funds. Claude Sonnet analyzes markets and makes trading decisions. Hard-coded risk limits prevent catastrophic losses. A persistent Order Management System handles real-time stop-losses, trailing stops, and conditional entries between AI cycles.

Arbitrum + Base
Chains
Uniswap V3
DEX
13 whitelisted
Tokens
Every 4 hours
Cycle
Core Philosophy
Real-time by default. Event-driven, not batch. Stops execute in seconds.
AI autonomy within guardrails. The AI decides what to trade. The Risk Manager enforces limits.
On-chain is truth. Wallet balances reconciled every cycle. Redis is cache.
No leverage. Spot only. Real tokens in a real wallet.

Schedule & Timing

What happens and when. All times in PST. The system has three layers of timing: scheduled cycles, real-time OMS, and event-driven triggers.

Recurring Schedules

WhatWhen (PST)DurationCost
Full AI CycleEvery 4hMidnight, 4a, 8a, 12p, 4p, 8p
Fast ScreenerEvery 2h (odd)1a, 3a, 5a, 7a, 9a, 11a, 1p, 3p, 5p, 7p, 9p, 11p
Data CollectionEvery 2hRuns inline at start of each cycle
StrategistSunday midnightWeekly playbook evolution (Opus)
Shadow OutcomesDaily 10 PMChecks counterfactual P&L on skipped trades
Regime ScoreEvery 2h5 min after data collection

What Happens Every Cycle

Full Cycle (every 4h, ~$0.27-0.77)
Kill switch check, data collection (6 sources), screener (R1/R1b/R4/R5/R6), Analyst (Sonnet, 7 tools), PM (Sonnet or Opus if conviction >0.7), Risk Manager (13 checks), executor queue. Can open new positions, close existing, adjust stops, place conditionals.
Fast Cycle (every 2h, ~$0.12)
Kill switch check, data collection, screener only (no Analyst). PM reviews open positions using screener data. Can adjust stops, close positions, place conditionals. Cannot open new positions (no analyst views). Primary purpose: profit management between full cycles.

What Happens in Real-Time (OMS, every price tick)

Price Monitoring
WebSocket (Arbitrum WETH/PENDLE) + API polling every 15s (all other tokens, both chains). Runs 24/7.
Stop-Loss Execution
Every price tick is checked against stops. Fires within seconds. No AI cycle needed.
Trailing Stop Ratchet
Max price tracked on every tick. Trailing stop = max_price * (1 - trail%). Automatically tightens as price rises. Never loosens.
Auto-Breakeven
When position gains 5%+, fixed stop moves to entry price automatically. No AI cycle needed.
Trail Tightening
When position gains 15%+, trailing stop % tightens from 10% to 6%. Locks in more profit on big winners.
Take-Profit
If price reaches take_profit_price, position is closed immediately. Safety net for between-cycle moves.
Conditional Order Fills
Limit-like entries trigger when price crosses the target. Deviation check prevents bad fills.

Event-Driven Triggers (30-min cooldown)

Emergency Drawdown
Fires when any position drops 8%+ from entry OR daily portfolio drawdown exceeds 3%. Informational alert to Discord (no AI cycle invoked yet -- planned for next sprint).
Opportunity Upside
Fires when any position gains 10%+ unrealized. Same: Discord alert only.
Volatility Event
Fires when any token moves 5%+ in 1 hour. Same: Discord alert only.

Quick Reference: What protects your money while you sleep?

The OMS runs 24/7 and handles: stop-losses (seconds), trailing stops (every tick), auto-breakeven (+5%), trail tightening (+15%), take-profit targets, and conditional order fills. None of these need an AI cycle. The AI only runs on schedule (every 2-4h) to make strategic decisions: new entries, thesis evaluation, stop adjustments.

Architecture

Six decoupled components communicate via Redis pub/sub. Each can fail independently without taking down the others.

ORDER MANAGEMENTPersistent, Real-timePrice Monitor (WS+API)Stop ManagerTrailing StopsConditional OrdersTrigger EngineAI TRADING DESKScheduled 4h + EventsAnalyst (Sonnet)Portfolio Manager (Sonnet)Risk Manager (No AI)Screener (Deterministic)Strategist (Opus, Weekly)DATA LAYER6 Collectors, 1-4hFunding Rates (Binance/Bybit)Exchange Flows (CryptoQuant)Sentiment (Reddit)Macro (F&G, Calendar)On-chain (DeFiLlama)REDIS (Cloud)EXECUTORUniswap Trade APIPermit2 ApprovalsFRONTENDsilvic.app (Vercel)SWR polling, SSE eventsNOTIFIERDiscord WebhooksTrade + Cycle + Kill alerts

Order Management System

Persistent process. WebSocket price feeds (Arbitrum) + API polling (Base). Executes stops, trailing stops, conditional orders in real-time. Triggers AI cycles on emergency/volatility events.

AI Trading Desk

Scheduled every 4h + event-triggered. Pipeline: Data Collection, Analyst (market views), PM (trade decisions), Risk Manager (validation), Executor Queue.

Data Layer

6 parallel collectors fetch funding rates, exchange flows, sentiment, macro indicators, on-chain metrics, and price history. Stored in Redis with TTLs.

Executor

Reads approved actions from Redis queue. Executes swaps via Uniswap Trade API with Permit2 signatures. Validates contract targets against allowlist.

Notifier

Subscribes to Redis pub/sub channels. Sends Discord webhooks for trades, stops, cycle summaries, kill switch events, and system alerts.

Strategist

Weekly Opus review of trade outcomes. Evolves the playbook (max 20 rules). Patterns require 10+ trades for statistical significance.

AI Cycle Pipeline

Each cycle flows through 8 stages. Total time: 2-4 minutes, dominated by LLM API calls.

Kill SwitchCheck<1sDataCollection10-30sPre-flightChecks1-2sPre-Screener(Deterministic)<1sAnalyst(Sonnet)60-120sPortfolio Mgr(Sonnet)30-60sRisk Manager(13 checks)<1sExecutorQueue<1s
1. Kill Switch Check
If active, abort immediately. No API calls, no actions.
2. Data Collection
6 collectors run in parallel (funding, flows, sentiment, macro, on-chain, price history). Guarantees fresh data for the analyst.
3. Pre-flight Checks
Circuit breaker status, trigger cooldowns, portfolio value, gas balance.
4. Pre-Screener
Deterministic filter. Matches tokens against funding rate, momentum, and other signals using cached Redis data. Zero LLM cost. Focuses the Analyst on promising candidates.
5. Analyst (Claude Sonnet)
7 tools: prices, funding, sentiment, macro calendar, on-chain metrics, recent large swaps, exchange flows. Scans all tokens including Base chain. Produces MarketViews with asset, direction, conviction, and key factors.
6. Portfolio Manager (Sonnet or Opus)
Receives analyst views, portfolio state, bucket exposure, playbook rules, regime score, and benchmark context. Auto-upgrades to Opus when analyst conviction >= 0.7. Decides: open positions (with mandatory trailing stop + take-profit), close positions, adjust stops, place conditional entries, or no action.
7. Risk Manager
13 deterministic checks. No AI. First failure rejects the action. Checks: whitelist, params, stop-loss required, position size, exposure, correlation, pool liquidity, price impact, idempotency, daily loss, drawdown, lifetime drawdown.
8. Executor Queue
Approved actions are pushed to Redis. The executor consumes and executes on-chain via Uniswap Trade API.

Screener Rules

The pre-screener runs before the AI analyst. It uses cached data from Redis to flag tokens that match playbook rules. Zero LLM cost. The analyst prioritizes flagged tokens but also scans all others.

RuleNameConditionsSignal
R1Funding SqueezeFunding < -0.02% AND 7d range < 0.30Shorts crowded, squeeze incoming. Requires CEX perp data (Arb tokens only).
R1bPrice Squeeze7d range < 0.15 AND 30d range < 0.20Extreme lows on both timeframes. Works for Base tokens (no funding needed). Weaker signal.
R4CapitulationRegime score <= -2 AND 30d range < 0.15Everything bearish AND token at multi-month lows. Rare, high-conviction. Wider stops (3x ATR).
R5Momentum LagWETH 4h change > 3% AND token < 1%ETH pumped but this token didn't follow. Catch-up expected. Quick trade (1-3 days).
R6Volume Spike3x+ large swaps in 4h vs baseline AND 7d range < 0.40Abnormal large-swap activity at low prices = smart money accumulating. Free signal from OMS data.

R3: Signal Convergence

R3 is not a screener rule but an entry requirement. For direct swap entries (not conditionals), the PM requires 2+ confirming signals (e.g., R1 + R5, or R1b + R6). Single-signal setups only qualify for conditional entries at 7d/30d lows.

Profit Management

Three layers of profit protection: OMS real-time automation, AI cycle evaluation, and trailing stop mechanics. The goal is to let winners run while never giving back significant gains.

At Entry (PM sets these)

Trailing Stop5-15%

1.5x the token's 24h range. Auto-ratchets as price rises.

Initial Take-Profit2-3x stop dist

Safety net. PM can raise it if momentum continues.

Breakeven Threshold+5%

OMS auto-moves stop to entry price when reached.

Tighten Threshold+15%

OMS auto-tightens trail from 10% to 6% on big winners.

Position Lifecycle Example

Entry: Buy AAVE at $88.40, stop at $74.59 (15.6%), trail 8%, TP $110

+5% ($92.82): OMS auto-moves stop to $88.40 (breakeven). You can't lose money now.

+10% ($97.24): Trailing stop is at $89.46 (8% below peak). Thesis still valid, PM holds.

+15% ($101.66): OMS tightens trail from 8% to 6%. Stop now at $95.56. Locked in +8% minimum.

+20% ($106.08): Trail stop at $99.72. PM raises TP to $120 (thesis strengthening).

Price reverses to $99.72: Trail stop fires. Exit at +12.8% ($11.32 profit). Never gave back more than 7.2%.

Thesis Hold Periods

Mean reversion theses need time. The PM will not exit before the minimum hold unless the stop is hit or the thesis is fundamentally broken.

R1 Funding
3 days min
Exit: Funding turns positive
R4 Capitulation
5 days min
Exit: Regime turns bullish
R5 Momentum
1-3 days
Exit: Catch-up achieved or failed

Order Management System

The OMS runs continuously, independent of AI cycles. It protects the downside and captures profits in real-time.

Price Monitoring
WebSocket connection to Uniswap V3 pool events (Arbitrum WETH/PENDLE). API polling every 15s for all other tokens on both chains. Prices cached in Redis with 5-min TTL.
Stop-Loss Execution
Every price tick is checked against open positions. If price hits the stop level, the position is closed immediately via the executor. Secondary price verification prevents false triggers.
Trailing Stops
MFE (max price since entry) tracked on every tick. Trailing stop = max_price * (1 - trail%). Ratchets up only, never down. Locks in profits while allowing upside.
Auto-Breakeven
When a position gains 5%+ from entry, the fixed stop automatically moves to the entry price. You can't lose money on that trade anymore. Persists to Redis immediately.
Dynamic Trail Tightening
When a position gains 15%+, the trailing stop percentage tightens (e.g., from 10% to 6%). Locks in more profit on big winners. One-way ratchet, persists immediately.
Take-Profit Execution
If price reaches the take_profit_price, position is closed in real-time. The PM sets an initial TP at entry and can raise it on each cycle if momentum continues.
Conditional Orders
Limit-like entries with TTL. When price hits the target, the order executes. Expired orders are cleaned up automatically. Deduplication prevents double entries for the same token.
Trigger Engine
Monitors for emergency drawdown (8% position loss or 3% daily portfolio loss), volatility spikes (5% 1h move), and opportunity signals (10% unrealized gain). Currently informational (Discord alerts with 30-min cooldown). Event-driven AI cycles planned for next sprint.

Data Sources

The Analyst has 9 tools to query market data. All data is pre-cached in Redis by the collector.

SourceProviderRefreshCoverage
PricesUniswap V3 (WS + API)Real-time / 15sAll 13 tokens
Funding RatesBinance, Bybit1h6 major tokens
Exchange FlowsCryptoQuant2hWETH, WBTC (ref only)
SentimentReddit (aggregate)1hMarket-wide
MacroAlternative.me, Calendar4hFear & Greed, FOMC/CPI dates
On-chainDeFiLlama2hTVL by protocol
Price HistoryCoinGecko1h7d/30d OHLCV

Regime Score

A 5-factor composite score that adjusts position sizing and conviction thresholds:

Realized Vol
High vol = bearish
Funding Rate
Negative = contrarian bull
Fear & Greed
Extreme fear = buy
Price vs Avg
ETH + BTC position
TVL Trend
Rising = bullish

Risk Controls

All risk limits are hard-coded constants. The AI cannot override them. 13 sequential checks, first failure rejects the action.

ControlLimitBehavior
Max single position40%15% during cold start (first 5 trades)
Max total exposure80%Sum of all open positions
Correlation bucket50%Per bucket: BTC / ETH / Other
Stop-loss requiredAlwaysEvery entry must have a stop
Max stop distance20%Stop can't be more than 20% below entry price
Trailing stop requiredAlways5-15% trail, computed from 24h range
Max daily loss5%Rolling 24h, auto-resume next day
Max drawdown15%From peak. Close all, manual reset
Lifetime drawdown30%Permanent halt. Code change to resume
Price impact<3%Validated from Uniswap quote at execution
Max slippage2%AI can request less, never more
Idempotency5 minPrevents duplicate swaps

Kill Switch

Accessible from CLI, Discord, and this dashboard. Halts all AI cycles and executor processing. The OMS continues running to execute pending stop-losses. Manual reset required.

Capital Protection Checks Fail Closed

Daily loss, drawdown, and lifetime drawdown checks reject trades if Redis is unavailable. The system will not trade if it cannot verify safety limits. Other checks (liquidity, idempotency) fail open to avoid unnecessary blocking.

Execution Flow

Swap Execution
AI proposes trade with token, size, stop, and thesis. Risk Manager validates. Approved actions go to Redis queue. Executor reads queue, gets Uniswap API quote, validates price impact <3%, validates contract target against allowlist, signs Permit2 permit, broadcasts transaction, waits for receipt.
Contract Allowlist
Every transaction target (both approval and swap) is validated against a hardcoded set of known Uniswap contracts (Universal Router, SwapRouter02, Permit2). Transactions to unknown addresses are blocked. Prevents wallet drain if the API is compromised.
Multi-chain
Arbitrum (7 tokens) and Base (6 tokens). Chain resolved per-trade from token config. Separate RPC connections and nonce managers per chain.
Token Whitelist
Arbitrum: WETH, PENDLE, UNI, ARB, LINK, CRV, AAVE. Base: WETH, AERO, VIRTUAL, MORPHO, ZORA, LINK. WBTC is reference-only (benchmarks, regime) but never traded.

Model Assignment

RoleModelTempPurpose
Analystclaude-sonnet-4-60Multi-source market analysis, 9 tools
PMclaude-sonnet-4-60Trading decisions, position management
PM (Upgraded)claude-opus-4-60Auto-upgraded for emergency/volatility triggers OR analyst conviction > 0.7
Strategistclaude-opus-4-61.0Weekly playbook evolution, pattern discovery

Normal cycle: ~$0.17 (Analyst) + ~$0.12 (PM Sonnet) = ~$0.29. High-conviction cycle: ~$0.17 + ~$0.53 (PM Opus) = ~$0.70. Fast screener: ~$0.12 (PM only). Estimated daily: ~$3-5 depending on Opus upgrades.