Skip to content

Agent

Auto-trading agent with built-in risk management and Algorithm Agent (MCP) reference

Reversion has two AI agents, both built into the web app and both connectable via MCP/API:

AgentWhat It Does
Auto-Trading AgentAutonomous market watching, chart analysis, trade execution, and position management with built-in risk management
Algorithm Agent (MCP)60+ tools for building algorithms, backtesting, optimization, and trading via natural language. Connect from Claude Desktop, Cursor, VS Code, or any MCP-compatible app

For a hands-on setup guide, see the Agent Walkthrough →

On this page: Auto-Trading Agent · Algorithm Agent (MCP)


A fully autonomous trading agent that watches markets, analyzes charts with vision, executes trades, and manages positions — with risk management enforced at the system level so the agent literally cannot place an unprotected trade.

The agent operates in two continuous loops:

Market Watch Loop

  1. You (or the agent) set price alerts on markets of interest, with a thesis and proposed trade setup for each direction
  2. When price hits a level, an alert thread spawns automatically
  3. The agent analyzes the current chart to validate whether the setup is still valid
  4. If valid → executes the trade with mandatory stop loss and position sizing derived from your risk settings
  5. If invalid → re-arms the watch at updated levels

Trade Management Loop

  1. Every active trade has three automatic alerts: early warning (soft invalidation), profit target, and stop loss verification
  2. When an alert triggers, a management thread spawns with a mandatory first action
  3. The agent evaluates the situation: tighten the stop loss, take partial profit, trail into profit, or hold
  4. Alerts are refreshed at new levels — the cycle continues until the position closes

The core principle: you set your maximum risk in USD per trade, and everything else is derived.

When the agent places a trade, it specifies an entry price, stop loss, target, and risk amount. The system automatically calculates:

position size = risk amount / distance from entry to stop loss

This means a tighter stop loss → larger position, wider stop loss → smaller position. Your maximum dollar loss is always what you specified, regardless of leverage or position size.

What the system enforces (not the agent — the system):

RuleWhat It Means
Every trade has a mandatory stop lossPlaced on the exchange atomically with the entry — impossible to have an unprotected position
Stop loss can only tightenAfter entry, the SL can move closer to price (reducing risk) but never further away
Risk caps are hard limitsPer-trade and portfolio-wide caps checked before every execution — violations are rejected
Minimum reward-to-risk ratioTrades below your min R:R are rejected before execution

Configure from the risk panel in Agent mode:

SettingDescriptionSuggested Start
Max risk per tradeMaximum USD at risk on any single trade$10-50
Max portfolio riskTotal USD at risk across all open trades combined$50-200
Min R:RMinimum reward-to-risk ratio for any trade setup1.0
Loss decay (minutes)After a losing trade, the effective risk cap shrinks and recovers linearly over this many minutes. Prevents revenge trading.5 min
Max drawdown %Hard lockout — blocks all new trades if equity drops this much from peak. Requires manual reset.20%
Margin modeIsolated (risk capped per position) or Cross (shared collateral)Isolated
Max entry deviation %How far price can move from the intended entry before the system aborts0.5%
Execution timeoutHow long to wait for a limit order fill before chasing with a market order3s
Auto-risk adjustmentLet the agent periodically adjust the portfolio risk cap within bounds you setOff
ModeDescription
CopilotThe agent proposes trades and you approve or reject each one via a popup. Analysis, market watching, and note-taking proceed without approval — only trade execution is gated.
Full AutonomyAll trades execute immediately. The agent operates as a closed-loop system — watching markets, executing trades, managing positions, and re-arming alerts — even while you’re disconnected.

The agent uses vision to analyze candlestick charts across multiple timeframes. When evaluating a setup, it:

  1. Renders charts with candles, volume, and volume profile (price density)
  2. Reads the chart image to identify market structure (trend, range, breakout, consolidation)
  3. Identifies key price levels (support, resistance, high-volume nodes, liquidity zones)
  4. Proposes a trade setup with specific entry, stop loss, and target — or determines no valid setup exists

This structured analysis feeds directly into trade execution. The agent doesn’t guess at levels — it reads the chart.

Every trade follows this path:

StageWhat Happens
WatchAgent monitors a market with paired price alerts (upper and lower bounds) and a thesis per direction
AlertPrice hits a watch level → alert thread spawns automatically
ValidateAgent analyzes the current chart to check if the proposed setup is still valid
ExecuteSmart execution places the entry (market or limit, auto-determined) and stop loss atomically
ManageThree auto-created alerts monitor the trade: early warning, profit target, SL verification
AdjustOn alert trigger: tighten stop, take partial profit, trail into profit, or hold
ClosePosition closes via stop loss hit, profit target, or manual close. Risk is freed for new trades.

After a trade closes, the market can optionally return to the Watch stage — creating a continuous autonomous loop.

The agent can open multiple trades on the same market, each with independent risk parameters. Each trade has its own stop loss, entry, and target. When adding layers:

  • Previous trade stop losses should be tightened (moved to breakeven or profit)
  • Total portfolio risk is checked against your cap
  • Each trade is tracked separately in the ledger

The agent maintains persistent trading notes — a hierarchical notes system that serves as its memory across all threads. Notes contain:

  • Market thesis and analysis
  • Active trade management instructions
  • Strategy context that persists across alert threads

Only a table of contents is loaded into the agent’s context by default — full notes are read on demand to keep context lean. Notes auto-prune when total size exceeds budget.

ProviderModels
AnthropicClaude (recommended for chart analysis)
OpenAIGPT models
GoogleGemini models
xAIGrok models
GroqFast inference models

Multi-provider fallback is supported — if your primary provider has an outage, the system automatically falls back to the next provider in your chain.

The agent runs multiple concurrent threads:

Thread TypeLifetimeTriggered By
ChatPersistentYour messages — the main conversational interface
AlertEphemeral (auto-completes)Price alerts, trade management alerts, or scheduled time alerts

Up to 8 alert threads can run concurrently. Excess alerts are queued and processed in order. Each alert thread has a mandatory first action (e.g., update the trade setup) before it can take other actions — ensuring critical responses are never skipped.


The Algorithm Agent is an open-source Model Context Protocol server built into the Reversion platform. Connect from Claude Desktop, Cursor, VS Code, or any MCP-compatible app — describe what you want in natural language and the agent picks the right tool.

Agent App (Claude Desktop, Cursor, etc.)
↕ stdio or HTTP
reversion-mcp
↕ HTTP (Bearer token auth)
Reversion Backend
├── Trading, algos, market data (direct)
└── Charting, backtesting, optimization (proxied to compute worker)

Your AI app talks to the MCP server, which talks to the Reversion backend. No API keys or private keys are exposed to the AI — only a scoped API token.

The MCP server is stateless — no local storage, no sessions. You can restart it anytime or run multiple instances safely.

The fastest way to get started:

Terminal window
npx -y reversion-mcp

See the Agent Walkthrough for full config examples per app (Claude Desktop, Cursor, VS Code).

Requires Bun runtime. Use this if you want to modify the MCP server or contribute:

Terminal window
git clone https://github.com/reversion-trade/reversion-mcp.git
cd reversion-mcp
bun install

Config:

{
"mcpServers": {
"reversion": {
"command": "bun",
"args": ["run", "/path/to/reversion-mcp/src/index.ts"],
"env": {
"REVERSION_API_TOKEN": "rvt_your_token_here",
"REVERSION_BACKEND_URL": "http://localhost:3001"
}
}
}
}

For remote or web-based agents:

Terminal window
REVERSION_API_TOKEN=rvt_... bun run src/index.ts --transport http --port 3002

Connect over HTTP:

{
"mcpServers": {
"reversion": {
"type": "streamable-http",
"url": "http://localhost:3002/mcp"
}
}
}

Health check: GET http://localhost:3002/health

VariableRequiredDefaultDescription
REVERSION_API_TOKENYesAPI token (rvt_...) from the web app
REVERSION_BACKEND_URLNohttp://localhost:3001Backend URL. Use https://api.reversion.trade for production

The MCP server never touches your private keys. Here’s the flow:

  1. Connect wallet (MetaMask, etc.) to reversion.trade via SIWE
  2. Backend creates an API wallet — a separate encrypted keypair for trade execution
  3. Approve the API wallet on Hyperliquid (builder fee approval)
  4. Generate an API token (rvt_...) scoped to your account
  5. MCP server uses the token to authenticate; backend resolves your user and trades via the API wallet
ScopeWhat It Grants
readAccount overview, watchlist, market data, economic calendar
tradeOrder placement & cancellation, position management, leverage & margin
algoAlgorithm CRUD, charting, backtesting, optimization

Tokens are SHA-256 hashed in the database. The plaintext is shown once at creation. Tokens support optional expiry and can be revoked at any time.

The Algorithm Agent exposes 60+ tools organized by scope. You don’t need to memorize these — just describe what you want in natural language and the agent picks the right tool.

Manage your account and track markets:

ToolDescription
get_account_overviewAccount snapshot: balance, positions, open orders, TWAPs, recent fills, algo runs, wallet status
get_watchlistGet tracked trading pairs
add_to_watchlistAdd a trading pair
remove_from_watchlistRemove a trading pair

Get real-time and historical market information:

ToolDescription
get_tickerCurrent price, bid, ask, 24h volume and change
search_marketsSearch available trading pairs
get_orderbookOrderbook bids and asks
get_candlesOHLCV candlestick data
get_funding_rateCurrent funding rate
get_mark_priceMark price for PnL/liquidation
get_open_interestCurrent open interest

Place and manage orders:

ToolDescription
place_market_orderImmediate fill at market price
place_limit_orderFill at specific price or better
place_stop_lossStop-loss trigger order (market or limit)
place_take_profitTake-profit trigger order (market or limit)
place_twap_orderSplit execution over a duration
cancel_orderCancel a specific order
cancel_all_ordersCancel all open orders
cancel_twap_orderCancel an active TWAP

Control leverage, margin, and open positions:

ToolDescription
set_leverageSet leverage multiplier
set_margin_modeSet cross or isolated margin
close_positionClose via reduce-only market order

Generate charts and explore indicators visually:

ToolDescription
generate_chartCandlestick chart (PNG) with indicators and overlays
explore_indicatorTest indicator + trigger against real data
fetch_candles_jsonRaw OHLCV data as columnar JSON

Create, read, and update algorithm configurations:

ToolDescription
list_indicatorsList available indicator types
get_indicator_schemaParameter schema for an indicator
list_algorithmsList all algorithm configs
get_algorithmFull algorithm config
create_algorithmCreate a new algorithm
update_algorithmUpdate algorithm (creates new version)

Run backtests, cross-validation, and view results:

ToolDescription
run_backtestRun a backtest; returns run ID
get_backtest_resultsGet metrics for a completed backtest
plot_backtestGenerate equity curve + drawdown chart (PNG)
rolling_cv_backtestRolling cross-validation backtest
list_runsList runs (backtests and live) with status
update_run_statusUpdate run status (STOPPED, CANCELLED)

Run and monitor parameter optimization:

ToolDescription
bayesian_optimizeHands-off Bayesian optimization (Optuna TPE)
get_optimization_statusPoll progress, best score/params, trial history
stop_optimizationEarly-stop; results preserved
bo_suggestAgent-driven BO step: get next suggested params
compute_backtest_scoreRun custom scoring function on results
plot_optimizationGenerate optimization trajectory charts

Stay ahead of market-moving events:

ToolDescription
get_economic_calendarQuery events by date, impact, currency
get_upcoming_eventsEvents in the next N hours
get_high_impact_eventsHigh-impact events (FOMC, NFP, CPI)
get_market_hoursTrading hours for exchanges
is_market_openCheck if an exchange is currently open
"What's the current funding rate and open interest for ETH?"
"Show me a 1h chart for SOL with MACD and volume"
"Search for all available markets on Hyperliquid"
"List available indicators"
"Explore RSI on BTC 4h with oversold threshold at 30 — show me the signals"
"Create a mean reversion algorithm for ETH using Bollinger Bands"
"Backtest my algorithm over the last 6 months"
"Plot the equity curve for that backtest"
"Run a rolling cross-validation with 30-day train and 10-day test windows"
"Optimize my RSI algorithm — try 20 trials varying the period and thresholds"
"What's the optimization status?"
"Plot the optimization trajectory"
"Buy 0.1 ETH at market"
"Place a limit buy for 1 SOL at $120"
"Set a stop loss at $3,200 for my ETH position"
"Close my BTC position"

The MCP server includes built-in skill prompts that guide structured workflows:

  • reversion-skill-algo-researcher — full pipeline from market analysis to optimized strategy
  • reversion-skill-trader — trading-focused workflows
  • reversion-skill-general — general platform interaction
  • Hyperliquid — native perpetual futures (all listed pairs)
  • HIP-3 XYZ DEX markets — perpetual markets for tradfi assets on Hyperliquid’s HIP-3 protocol

The exchangeId parameter defaults to hyperliquid across all tools.

  • Single dependency — only needs REVERSION_BACKEND_URL
  • Stateless — safe to restart or run multiple instances
  • Auth forwarding — API token sent as Authorization: Bearer rvt_... on every request
  • Production — point REVERSION_BACKEND_URL to https://api.reversion.trade

Want to…Go to
Walk through agent setupAgent Walkthrough →
Take your algorithm liveDeploy Features →