Skip to main content
This example shows how a Telegram trading bot powered by OpenClaw + Horizon looks in practice. The same skill works identically on WhatsApp, Discord, and Slack.

Setup

# 1. Install Horizon
pip install horizon-sdk   # or: uv pip install horizon-sdk

# 2. Copy skill to OpenClaw
cp -r skills/horizon-trader/ /path/to/openclaw/skills/

# 3. Set environment
export HORIZON_API_KEY="your-key"
export HORIZON_EXCHANGE="paper"  # or "polymarket" / "kalshi"

Conversation: Full Trading Session

Here’s a real conversation flow showing discovery, analysis, trading, and risk management through Telegram.

Market Research

User: Hey, what bitcoin prediction markets are available?

Bot: Let me search for you.

     📊 Found 6 BTC markets on Polymarket:

     1. Will BTC hit $100k by March 2026?
        ID: will-btc-hit-100k | Active ✅

     2. Will BTC hit $120k by March 2026?
        ID: will-btc-hit-120k | Active ✅

     3. Will BTC close above $90k in February?
        ID: btc-above-90k-feb | Active ✅

     4. Will BTC dominance exceed 60%?
        ID: btc-dominance-60 | Active ✅

     Which one interests you?
User: Check Kalshi too for BTC markets

Bot: 📊 Found 3 BTC markets on Kalshi:

     1. KXBTC-26MAR31 - BTC above $100k on March 31
     2. KXBTC-26FEB28 - BTC above $95k on Feb 28
     3. KXBTC-26APR30 - BTC above $110k on April 30

Kelly Analysis

User: I think there's a 68% chance BTC hits 100k by March.
      Market is at 52 cents. I have $3000 to work with.

Bot: 🧮 Kelly sizing analysis:

     Your edge: +16 cents (68% vs 52%)
     Quarter Kelly optimal: 100 contracts
     Edge per contract: $0.16

     At $0.52 per contract, you'd risk $52 total.
     Expected value: +$16 per contract × 100 = +$1,600

     ⚠️ This is quarter Kelly - conservative sizing.
     Full Kelly would be 400 contracts, but that's too aggressive.

     Want me to place the order?

Placing Orders

User: Yeah, buy 100 at 0.52

Bot: ✅ Order submitted!

     📋 Details:
     • Order ID: p1
     • Market: will-btc-hit-100k
     • Side: BUY
     • Price: 0.52
     • Size: 100 contracts
User: Also set a stop loss at 35 cents and take profit at 75

Bot: ✅ Protection orders set!

     🛡️ Stop-loss:
     • Trigger: 0.35
     • Action: Sell 100 YES contracts
     • Max loss if triggered: ~$17

     🎯 Take-profit:
     • Trigger: 0.75
     • Action: Sell 100 YES contracts
     • Profit if triggered: ~$23

     Your position is now bracketed.

Monitoring

User: How's everything looking?

Bot: 📊 Engine Status:

     💰 PnL: +$3.50 today
     • Realized: $0.00
     • Unrealized: +$3.50

     📈 Positions (1):
     • will-btc-hit-100k: 100 YES @ 0.52
       Unrealized: +$3.50

     📋 Open Orders: 0
     🛡️ Pending SL/TP: 2 armed

     ⏱️ Uptime: 25 minutes
     🔴 Kill switch: OFF
User: Show me my stop loss and take profit

Bot: 🛡️ Contingent Orders (2):

     1. Stop-Loss (pending)
        Market: will-btc-hit-100k
        Trigger: 0.35 → Sell 100 YES
        Status: Armed, waiting

     2. Take-Profit (pending)
        Market: will-btc-hit-100k
        Trigger: 0.75 → Sell 100 YES
        Status: Armed, waiting

Adding to the Position

User: Market moved to 0.48, I want to average down. Buy 50 more at 0.48

Bot: ✅ Order submitted!

     📋 Details:
     • Order ID: p2
     • Market: will-btc-hit-100k
     • Side: BUY
     • Price: 0.48
     • Size: 50 contracts

     Your total position is now 150 YES contracts
     (avg entry will update once this fills).

Emergency Stop

User: STOP EVERYTHING

Bot: 🚨 KILL SWITCH ACTIVATED

     All orders canceled immediately.
     Reason: user emergency request

     Your positions remain open but no new orders
     will be accepted until you resume.

     Send "resume trading" to deactivate the kill switch.
User: Ok resume trading

Bot: ✅ Kill switch deactivated.

     Trading is back to normal.
     Your positions and contingent orders are still intact.

End of Day

User: Cancel all orders and show final status

Bot: 📋 Canceled 0 orders (none were open).

     📊 Final Status:
     💰 Daily PnL: +$7.20
     • Realized: $0.00
     • Unrealized: +$7.20

     📈 Position:
     • will-btc-hit-100k: 150 YES @ avg 0.507
       Unrealized: +$7.20

     🛡️ Stop-loss at 0.35 and take-profit at 0.75 still armed.

     Good day! 📈

Multi-Platform Parity

The same skill works on every OpenClaw platform:
PlatformFormatNotes
TelegramFull markdown, emojisBest experience - supports tables and code blocks
WhatsAppPlain text with emojisNo markdown rendering, but fully functional
DiscordMarkdown with embedsRich formatting, channel-based trading
SlackMarkdownThread-based conversations, good for team trading

CLI Equivalent

Every bot conversation maps to CLI commands:
# Market research
python3 scripts/horizon.py discover polymarket "bitcoin"
python3 scripts/horizon.py discover kalshi "KXBTC"

# Kelly sizing
python3 scripts/horizon.py kelly 0.68 0.52 3000

# Trading
python3 scripts/horizon.py quote will-btc-hit-100k buy 0.52 100
python3 scripts/horizon.py quote will-btc-hit-100k buy 0.48 50

# Risk management
python3 scripts/horizon.py kill-switch on "user emergency"
python3 scripts/horizon.py kill-switch off

# Monitoring
python3 scripts/horizon.py status
python3 scripts/horizon.py positions
python3 scripts/horizon.py contingent
python3 scripts/horizon.py cancel-all

Next Steps

OpenClaw Skill Reference

Full command reference and installation guide.

MCP Portfolio Assistant

Similar workflow using Claude Code instead of Telegram.

Bracket Orders

Deep dive into stop-loss and take-profit mechanics.

Kelly Sizing

Kelly criterion theory and all sizing functions.