DEV Community

Paarthurnax
Paarthurnax

Posted on

OpenClaw Paper Trading: 30-Day Setup Guide for Complete Beginners

OpenClaw Paper Trading: 30-Day Setup Guide for Complete Beginners

OpenClaw paper trading lets you test cryptocurrency strategies with fake money and real market prices — so you can learn what works without losing anything real. This 30-day guide takes you from zero to a fully operational paper trading agent, step by step. No prior coding experience required.

What Is Paper Trading?

Paper trading simulates real trades without using actual money. Your agent watches live cryptocurrency prices and tracks what would have happened if you had bought or sold at specific moments. After 30 days, you have real performance data — win rate, total return, best and worst trades — without having spent a dollar.

It's the difference between gambling and learning.

Why 30 days? Thirty days covers multiple market conditions: a few volatile days, some flat periods, maybe a trend move. It's enough data to see whether a strategy has any edge — or whether it's just noise.

What You Need Before Day 1

Before starting, gather these free accounts and tools:

Required (free):

  • OpenClaw installed on your computer (download at openclaw.ai)
  • Python 3.10 or newer
  • A CoinGecko API key (free at coingecko.com/en/api)
  • A Telegram account + bot (created via @botfather)
  • 30 minutes for initial setup

Optional but recommended:

  • An Etherscan free API key (for on-chain data)
  • Notion or Google Sheets (for extra tracking)

What you DON'T need:

  • A crypto exchange account
  • Real money
  • Technical analysis experience
  • Paid data feeds

Week 1 (Days 1-7): Setup and Baseline

Day 1: Install OpenClaw and Configure Your Agent

First, install OpenClaw and verify it's working:

# Install OpenClaw (follow the official installer for your OS)
# Then verify:
openclaw status
Enter fullscreen mode Exit fullscreen mode

Create your paper trading configuration file:

# Save as: paper_trading_config.py

PAPER_TRADING_CONFIG = {
    "starting_capital": 10000,  # Simulated $10,000
    "currency": "USD",
    "coins_to_watch": ["bitcoin", "ethereum", "solana"],
    "report_time": "09:00",  # Daily report at 9 AM
    "telegram_alerts": True,
    "risk_per_trade": 0.05,  # Max 5% of portfolio per trade
}
Enter fullscreen mode Exit fullscreen mode

Day 2: Set Up Price Monitoring

Install the CryptoScanner skill from the marketplace: https://paarthurnax970-debug.github.io/cryptoclawskills/

Or set up basic price monitoring manually:

import requests
import json
from datetime import datetime

def get_prices(coins=["bitcoin", "ethereum", "solana"]):
    """Fetch current prices from CoinGecko free API."""
    url = "https://api.coingecko.com/api/v3/simple/price"
    params = {
        "ids": ",".join(coins),
        "vs_currencies": "usd",
        "include_24hr_change": "true"
    }
    return requests.get(url, params=params).json()

def log_prices():
    """Log current prices to local file."""
    prices = get_prices()
    timestamp = datetime.utcnow().isoformat()

    with open("paper_trading_log.jsonl", "a") as f:
        f.write(json.dumps({"timestamp": timestamp, "prices": prices}) + "\n")

    return prices

# Test it
prices = log_prices()
print(f"BTC: ${prices['bitcoin']['usd']:,.0f} ({prices['bitcoin']['usd_24h_change']:.1f}%)")
Enter fullscreen mode Exit fullscreen mode

Day 3: Create Your Paper Portfolio Tracker

import json
from pathlib import Path

PORTFOLIO_FILE = Path("paper_portfolio.json")

def initialize_portfolio(starting_capital=10000):
    """Create a fresh paper trading portfolio."""
    portfolio = {
        "cash": starting_capital,
        "starting_capital": starting_capital,
        "positions": {},  # coin -> {amount, avg_buy_price, buy_date}
        "trades": [],
        "created": datetime.utcnow().isoformat()
    }
    PORTFOLIO_FILE.write_text(json.dumps(portfolio, indent=2))
    print(f"✅ Paper portfolio created with ${starting_capital:,} starting capital")
    return portfolio

def load_portfolio():
    if PORTFOLIO_FILE.exists():
        return json.loads(PORTFOLIO_FILE.read_text())
    return initialize_portfolio()

def paper_buy(coin_id, amount_usd):
    """Simulate buying a coin with paper money."""
    portfolio = load_portfolio()
    prices = get_prices([coin_id])

    current_price = prices[coin_id]["usd"]

    if amount_usd > portfolio["cash"]:
        print(f"❌ Insufficient paper cash: ${portfolio['cash']:,.2f} available, ${amount_usd:,} requested")
        return False

    if amount_usd <= 0:
        print("❌ Amount must be positive")
        return False

    coin_amount = amount_usd / current_price

    # Update position
    if coin_id in portfolio["positions"]:
        # Average down/up existing position
        existing = portfolio["positions"][coin_id]
        total_coins = existing["amount"] + coin_amount
        total_cost = (existing["amount"] * existing["avg_buy_price"]) + amount_usd
        portfolio["positions"][coin_id]["amount"] = total_coins
        portfolio["positions"][coin_id]["avg_buy_price"] = total_cost / total_coins
    else:
        portfolio["positions"][coin_id] = {
            "amount": coin_amount,
            "avg_buy_price": current_price,
            "buy_date": datetime.utcnow().isoformat()
        }

    portfolio["cash"] -= amount_usd

    # Log trade
    portfolio["trades"].append({
        "type": "buy",
        "coin": coin_id,
        "price": current_price,
        "amount_usd": amount_usd,
        "coin_amount": coin_amount,
        "timestamp": datetime.utcnow().isoformat()
    })

    PORTFOLIO_FILE.write_text(json.dumps(portfolio, indent=2))
    print(f"✅ PAPER BUY: {coin_amount:.6f} {coin_id} @ ${current_price:,.2f} (${amount_usd:,.2f})")
    return True

def paper_sell(coin_id, percent=100):
    """Simulate selling a percentage of a position."""
    portfolio = load_portfolio()

    if coin_id not in portfolio["positions"]:
        print(f"❌ No position in {coin_id}")
        return False

    prices = get_prices([coin_id])
    current_price = prices[coin_id]["usd"]

    position = portfolio["positions"][coin_id]
    sell_amount = position["amount"] * (percent / 100)
    sell_value = sell_amount * current_price
    profit_loss = (current_price - position["avg_buy_price"]) * sell_amount

    # Update portfolio
    portfolio["cash"] += sell_value

    if percent == 100:
        del portfolio["positions"][coin_id]
    else:
        portfolio["positions"][coin_id]["amount"] -= sell_amount

    portfolio["trades"].append({
        "type": "sell",
        "coin": coin_id,
        "price": current_price,
        "sell_value": sell_value,
        "profit_loss": profit_loss,
        "percent_sold": percent,
        "timestamp": datetime.utcnow().isoformat()
    })

    PORTFOLIO_FILE.write_text(json.dumps(portfolio, indent=2))

    pl_emoji = "" if profit_loss > 0 else ""
    print(f"{pl_emoji} PAPER SELL: {sell_amount:.6f} {coin_id} @ ${current_price:,.2f}")
    print(f"   P&L: ${profit_loss:+,.2f} ({(profit_loss / (position['avg_buy_price'] * sell_amount)) * 100:+.1f}%)")
    return True

# Initialize your portfolio
initialize_portfolio(10000)
Enter fullscreen mode Exit fullscreen mode

Days 4-7: Choose Your First Strategy

Pick ONE simple strategy and commit to testing it for 30 days. Common starting points:

Strategy A: RSI Mean Reversion

  • Buy when RSI(14) drops below 35
  • Sell when RSI(14) rises above 65
  • Good for sideways/ranging markets

Strategy B: Moving Average Crossover

  • Buy when MA20 crosses above MA50
  • Sell when MA20 crosses below MA50
  • Good for trending markets

Strategy C: Fixed Schedule DCA

  • Buy a fixed dollar amount every Monday
  • Sell 25% of position when up 30%
  • Good for reducing decision fatigue

Write down your strategy rules BEFORE the 30 days start. Don't change them mid-test. That's the discipline that makes the data meaningful.

Week 2 (Days 8-14): Add Telegram Alerts

By week 2, you should have your portfolio tracker running. Now add Telegram notifications so you see signals in real time:

import os

TELEGRAM_TOKEN = os.environ.get("TELEGRAM_BOT_TOKEN")
TELEGRAM_CHAT_ID = os.environ.get("TELEGRAM_CHAT_ID")

def send_portfolio_report():
    """Send daily portfolio status to Telegram."""
    portfolio = load_portfolio()
    prices = get_prices(list(portfolio["positions"].keys()) + ["bitcoin"])

    # Calculate portfolio value
    positions_value = sum(
        portfolio["positions"][coin]["amount"] * prices.get(coin, {}).get("usd", 0)
        for coin in portfolio["positions"]
    )
    total_value = portfolio["cash"] + positions_value
    pnl = total_value - portfolio["starting_capital"]
    pnl_pct = (pnl / portfolio["starting_capital"]) * 100

    # BTC benchmark
    btc_change = prices.get("bitcoin", {}).get("usd_24h_change", 0)

    message = (
        f"📊 Paper Portfolio Report\n\n"
        f"Total Value: ${total_value:,.2f}\n"
        f"Cash: ${portfolio['cash']:,.2f}\n"
        f"P&L: ${pnl:+,.2f} ({pnl_pct:+.1f}%)\n"
        f"BTC 24h: {btc_change:+.1f}%\n\n"
    )

    if portfolio["positions"]:
        message += "Positions:\n"
        for coin, pos in portfolio["positions"].items():
            current_price = prices.get(coin, {}).get("usd", 0)
            pos_pnl = (current_price - pos["avg_buy_price"]) / pos["avg_buy_price"] * 100
            message += f"  {coin}: {pos_pnl:+.1f}%\n"

    url = f"https://api.telegram.org/bot{TELEGRAM_TOKEN}/sendMessage"
    requests.post(url, json={"chat_id": TELEGRAM_CHAT_ID, "text": message})
Enter fullscreen mode Exit fullscreen mode

Week 3 (Days 15-21): Run and Document

This is the hardest week: just watch and document. Don't change your strategy. Don't chase.

Keep a trading journal:

Day 15: BTC dropped 8%. RSI hit 28. Signal fired. Bought $500 worth.
Day 16: BTC -3% more. Down $65 on position. Not changing strategy.
Day 18: BTC recovered. RSI back to 48. Position up $30.
Enter fullscreen mode Exit fullscreen mode

The journal is where the real learning happens. You'll notice you WANT to break your rules when the strategy is losing. That's the discipline test.

Week 4 (Days 22-30): Analyze and Decide

On Day 30, run your performance analysis:

def analyze_30_day_performance():
    """Comprehensive 30-day performance report."""
    portfolio = load_portfolio()
    trades = portfolio["trades"]

    buy_trades = [t for t in trades if t["type"] == "buy"]
    sell_trades = [t for t in trades if t["type"] == "sell"]

    # Win rate
    profitable_sells = [t for t in sell_trades if t.get("profit_loss", 0) > 0]
    win_rate = len(profitable_sells) / max(len(sell_trades), 1) * 100

    # Total P&L
    total_pnl = sum(t.get("profit_loss", 0) for t in sell_trades)

    print(f"=== 30-DAY PAPER TRADING RESULTS ===")
    print(f"Total Trades: {len(buy_trades)} buys, {len(sell_trades)} sells")
    print(f"Win Rate: {win_rate:.1f}%")
    print(f"Total P&L: ${total_pnl:+,.2f}")
    print(f"Starting Capital: ${portfolio['starting_capital']:,}")
    print(f"Is this strategy worth pursuing? Win rate > 55% AND beats buy-and-hold BTC")
Enter fullscreen mode Exit fullscreen mode

The Skills Marketplace Shortcut

Rather than building all this from scratch, you can install the DCA Companion and PortfolioTracker skills from the OpenClaw Skills Hub: https://paarthurnax970-debug.github.io/cryptoclawskills/

These pre-built skills include the portfolio tracking, daily reports, and Telegram alerts — ready to go in minutes.


Want the complete paper trading kit? The Home AI Agent Kit includes everything in this guide pre-configured, plus example strategies to start testing.


Disclaimer: Paper trading results do not predict real trading results. Markets can behave unexpectedly. This guide is for educational purposes only and does not constitute financial or investment advice. Real cryptocurrency trading involves substantial risk of loss.

Top comments (0)