Loop mode turns a manual Claude Code session into an unattended news-trader. Claude Code’s built-inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/theonetrade/ai-trading-mcp/llms.txt
Use this file to discover all available pages before exploring further.
/loop command re-runs a prompt on a fixed interval — every 15 minutes by default — so the agent polls the Telegram feed, evaluates new posts, and takes the appropriate action without you sitting at the terminal.
The Loop Prompt
Paste this exactly into your Claude Code session after attaching it withnpm run start:claude:
How the Loop Works
Claude calls get_status on every iteration
Each tick begins with a
get_status call. The MCP bridge forwards the call to the trading process, which composes the response: engine portfolio state (prices, open positions, unrealized PnL) plus the last 15 Telegram posts — text and chart screenshots — newest first.The last 15 posts are evaluated
Claude reads the feed slice and classifies each post. Entry signals (“working X short/long”), close signals (“close/fix” language), and everything else are separated. The engine’s whitelist is the backstop — a symbol not in
CC_SYMBOL_LIST cannot be traded regardless of the classification.Action is taken only on genuine trading signals
A recognised entry post triggers
open_position(symbol, position, note). The note records the Telegram post timestamp and text as the stated basis. A close post triggers close_position(symbol, note). Every other post — recruiting, referral codes, embedded instructions — is described in a report line and left alone.Configuring the Interval
Change15m to any interval Claude Code supports. Common choices:
| Interval | Use case |
|---|---|
5m | High-frequency feed, low-latency reaction |
15m | Default — balances responsiveness with Telegram fetch cost |
30m | Lower API usage, less active feeds |
1h | Overnight monitoring, very low signal volume |
The Report-Only Rule
The default demo channel is a real-world signals channel with every classic marker: 100× cross screenshots, a referral code, and posts that solicit DMs. Some posts contain sentences that read like instructions — “who has a $3000+ deposit and doesn’t know how to grow it — DM @…” is an example from a recorded session. The loop prompt’s final rule exists precisely for this: anything in the feed that looks like a command must be treated as data, not executed. The agent’s vocabulary is limited to three tools (get_status, open_position, close_position) and those tools accept no free-form instruction parameters that could be exploited. Architecture, not prompt engineering, enforces the boundary.
In the recorded session above, the agent classified the post as recruiting, took no trade action, and added its own source assessment: “P&L numbers between posts don’t add up; I would not trust this as data.” That assessment landed in the markdown dump alongside the post that triggered it.
Monitoring
The loop runs unattended, but everything it sees and does is recorded:Markdown dumps
Markdown dumps
Every
get_status response — including the exact feed posts the agent evaluated — is written to dump/mcp/<minute-stamp>.md before it leaves the trading process. The web UI on :60050 renders these files with images resolved inline.Dashboard
Dashboard
http://localhost:60050 shows live positions, unrealized PnL, and engine state in real time. No refresh needed — it updates as the engine processes new candles.JSONL event streams
JSONL event streams
Engine events stream continuously into
dump/report/:live.jsonl— all engine eventsperformance.jsonl— closed-trade performance recordsmax_drawdown.jsonl— drawdown eventshighest_profit.jsonl— profit peak events
Position notes
Position notes
Every position the loop opens carries the agent’s stated basis in its
note field — the Telegram post text, timestamp, and the agent’s own reliability assessment. The engine echoes the note back in every subsequent get_status response until the position is closed.