Building a Trading Bot with OpenClaw
- OpenClaw is suited for trading monitoring and alerts — price notifications, portfolio P&L reports, and news sentiment analysis — not for automated trade execution
- Always create read-only API keys on your exchange; never grant trading or withdrawal permissions to any automation tool
- The news-monitor and csv-analysis skills handle financial news summarization and broker CSV parsing, delivering structured reports via Telegram
- A daily morning market digest can be scheduled with cron inside Docker Compose, running automatically on weekdays at 8am without any manual intervention
- Auto-trading with LLMs is inadvisable due to hallucination risk, latency, regulatory exposure, and the absence of a human kill switch — keep humans in the decision loop
- Total running cost is $8–14 per month (Anthropic API + VPS), making this far cheaper than any commercial trading information service
- The complete setup — alerts, digest, portfolio report, and on-demand analysis — takes roughly 2–3 hours to configure and requires minimal ongoing maintenance
OpenClaw can monitor crypto and stock markets in real-time, analyze price movements using AI, and send instant Telegram alerts when your conditions are met — all running 24/7 on your own server with no subscription fees beyond the AI model API costs ($3–15/month).
Disclaimer
This guide is for educational and informational purposes only. OpenClaw is not a licensed financial advisor, and nothing in this article constitutes financial advice. The workflows described here are for monitoring, alerting, and data analysis — not automated trading execution. You are solely responsible for any financial decisions you make. Always consult a qualified professional before making investment decisions.
With that said: building a personal market monitoring assistant with OpenClaw is a genuinely useful project that can save hours of manual work every week.
---
What OpenClaw Can Actually Do for Trading
Let's be clear about what is realistic and what is not.
OpenClaw CAN:- Monitor price movements and send you alerts when thresholds are crossed
- Pull your portfolio data and generate P&L reports
- Summarize financial news and estimate market sentiment
- Create daily or weekly digest emails/Telegram messages
- Analyze CSV exports from your broker and identify patterns
- Answer questions like "which of my positions is down more than 10% this week?"
- Place trades on your behalf automatically
- Guarantee any prediction accuracy
- Replace professional financial analysis
- Safely manage real money without human oversight
---
Required Skills
Before building your trading assistant, make sure you have these OpenClaw skills configured:
trading-bot — Core skill for interacting with price data APIs and exchange endpoints. Handles authentication, rate limiting, and data formatting.
news-monitor — Fetches and filters financial news from RSS feeds, Reddit, and news APIs. Can apply keyword filters and summarize multiple articles in one pass.
csv-analysis — Parses broker CSV exports and generates structured reports. Handles different date formats, currency symbols, and column mappings from popular brokers.
Optional but useful:
telegram-notify— Sends formatted messages and alerts to your Telegram chatscheduler— Runs tasks on cron schedules (daily digest, weekly report)web-search— Looks up real-time data when the primary APIs do not have it
---
Setting Up Exchange API Access (Read-Only Keys!)
This step is critical: always use read-only API keys. Most exchanges let you create API keys with granular permissions. Choose only:
- Read account balance
- Read order history
- Read market data
- Read positions
Example: Binance
Adding to OpenClaw .env
# Exchange credentials (READ-ONLY) BINANCE_API_KEY=your_read_only_key BINANCE_API_SECRET=your_read_only_secretOr for Coinbase Advanced
COINBASE_API_KEY=your_key COINBASE_API_SECRET=your_secretAlpha Vantage for stocks (free tier available)
ALPHA_VANTAGE_KEY=your_key
Store these in your .env file and never commit it to git. Add .env to .gitignore immediately.
---
Configuring Price Alerts via Telegram
Price alerts are the most immediately useful feature. Here is how to set them up:
1. Create a Telegram bot
@BotFather/newbot and follow the promptshttps://api.telegram.org/bot/getUpdates 2. Add credentials to .env
TELEGRAM_BOT_TOKEN=1234567890:AAxxxxxxxxxxxxxxxxxxxxxx TELEGRAM_CHAT_ID=987654321
3. Configure an alert rule in OpenClaw
Create a file config/alerts.json:
{
"alerts": [
{
"id": "btc-drop",
"asset": "BTC/USDT",
"condition": "price_below",
"threshold": 60000,
"notify": "telegram",
"cooldown_minutes": 60
},
{
"id": "eth-spike",
"asset": "ETH/USDT",
"condition": "price_above",
"threshold": 4000,
"notify": "telegram",
"cooldown_minutes": 120
},
{
"id": "aapl-daily-move",
"asset": "AAPL",
"condition": "daily_change_pct_above",
"threshold": 3,
"notify": "telegram",
"cooldown_minutes": 480
}
]
}The cooldown_minutes field prevents alert spam — once triggered, the same alert will not fire again for that period.
---
Building a Daily Market Digest with Cron
A daily digest saves you from spending 30 minutes every morning skimming financial news. OpenClaw can compile and send it automatically.
Digest prompt (save as config/digest-prompt.txt)
You are a financial news analyst assistant. Compile a concise morning market digest:
Keep the total under 400 words. Use plain language, no jargon. Format for Telegram (use bold with ** and bullet points with -).
Cron schedule (in docker-compose.yml)
digest-scheduler:
image: openclaw/agent:latest
container_name: openclaw_digest
restart: unless-stopped
env_file: .env
environment:
OCL_TASK: daily-digest
OCL_SCHEDULE: "0 8 1-5" # 8am, weekdays
OCL_PROMPT_FILE: /app/config/digest-prompt.txt
volumes:
- ./config:/app/config
- ./logs/digest:/app/logsThe digest runs every weekday at 8am and sends the summary to your Telegram chat.
---
Portfolio Tracking and P&L Reports
Most brokers let you export your transaction history as CSV. OpenClaw's csv-analysis skill can parse these and generate meaningful reports.
Example workflow
data/portfolio/transactions.csvAnalyze my portfolio CSV at data/portfolio/transactions.csv. Report:
- Current positions and quantities
- Total cost basis vs current value
- P&L by asset (realized and unrealized)
- Best and worst performers this month
- Any positions down more than 15%
Sample output format
Weekly Portfolio Report — Week 14, 2025 Positions:
- BTC: 0.45 units | Cost: $22,500 | Now: $27,000 | +$4,500 (+20%)
- ETH: 2.0 units | Cost: $6,000 | Now: $6,400 | +$400 (+6.7%)
- AAPL: 10 shares | Cost: $1,750 | Now: $1,920 | +$170 (+9.7%)
---
News Sentiment Analysis Workflow
Sentiment analysis is where large language models genuinely shine. OpenClaw can read 20 news articles and give you a calibrated summary in seconds — something that would take a human analyst an hour.
Setup
Configure news sources in config/news-sources.json:
{
"sources": [
{"type": "rss", "url": "https://feeds.reuters.com/reuters/businessNews"},
{"type": "rss", "url": "https://feeds.bloomberg.com/markets/news.rss"},
{"type": "reddit", "subreddit": "investing", "limit": 10},
{"type": "reddit", "subreddit": "wallstreetbets", "limit": 5}
],
"keywords": ["bitcoin", "federal reserve", "inflation", "earnings"],
"max_articles": 20
}Sentiment prompt
Read the following news articles and financial discussions. For each asset in my watchlist (BTC, ETH, AAPL, TSLA), rate market sentiment:
- Score: -2 (very bearish) to +2 (very bullish)
- Key driver: one sentence explaining the dominant narrative
- Confidence: low / medium / high
This runs as part of the daily digest or on-demand when you want a quick market read.
---
Risk Management: Why NOT to Auto-Trade
It might be tempting to close the loop — let OpenClaw not just alert you but actually place the trade. Here is why that is a bad idea, even technically:
Latency. An LLM-based agent adds hundreds of milliseconds of latency. High-frequency strategies are impossible; even moderate-frequency strategies suffer. Hallucination risk. LLMs can misread data or misunderstand context. A hallucination in a monitoring tool means a wrong alert. A hallucination in an auto-trading tool means a real financial loss. No kill switch. Automated trading without a human in the loop can compound losses faster than you can intervene — especially in volatile markets. Regulatory and legal risk. Depending on your jurisdiction, fully automated trading systems may have compliance requirements. The right architecture is: OpenClaw identifies an opportunity and sends you an alert with analysis. You review it, decide, and place the trade manually. The human stays in the loop for the decision that costs money.---
Cost Breakdown
One of the best things about this setup is how affordable it is.
| Component | Cost/Month |
|---|---|
| Anthropic API (claude-haiku-4-5 for most tasks) | $3–8 |
| Alpha Vantage free tier (stocks) | $0 |
| Exchange API (Binance, Coinbase) | $0 |
| VPS for hosting OpenClaw | $5–6 |
| Telegram bot | $0 |
| Total | $8–14/month |
Compare that to Bloomberg Terminal at $2,000/month or even basic trading software subscriptions at $30–100/month.
---
Example Setup Walkthrough
Here is the full picture of a minimal but complete trading assistant:
What you will have after setup:- BTC and ETH price alerts in Telegram (fires within 5 minutes of threshold breach)
- Daily weekday digest at 8am with market overview and sentiment
- Weekly portfolio P&L report every Monday morning
- On-demand portfolio analysis via web UI
openclaw-trading/
├── docker-compose.yml
├── .env # API keys (never commit)
├── config/
│ ├── alerts.json # Price alert rules
│ ├── news-sources.json # RSS and Reddit feeds
│ └── digest-prompt.txt # Morning digest instructions
└── data/
└── portfolio/
└── transactions.csv # Your broker exportThis is a legitimate productivity win — you stay informed without screen time, and you make decisions with better context than you would have by scanning headlines manually.