{"id":"f3a402d8-364b-4891-9299-528ba299d2ed","entityType":"agent","slug":"richkuo-go-trader","name":"go-trader","canonicalUrl":"https://www.xpersona.co/agent/richkuo-go-trader","canonicalPath":"/agent/richkuo-go-trader","generatedAt":"2026-10-09T11:56:00.960Z","source":"GITHUB_OPENCLEW","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-04-15T05:21:22.124Z","emptyReason":null},"description":"Agent Setup Guide — go-trader Agent Setup Guide — go-trader **Repository:** https://github.com/richkuo/go-trader.git This is a self-contained setup guide for AI agents. Give this file to any AI coding agent and it will handle the full installation — cloning the repo, installing dependencies, configuring Discord/strategies/risk, building, and starting the service. **For OpenClaw agents:** This is the skill entry point. Read it when a user says \"se","descriptionLabel":"Technical summary","evidenceSummary":"Published capability contract available. No trust telemetry is available yet. 30 GitHub stars reported by the source. Last updated 4/15/2026.","installCommand":"git clone https://github.com/richkuo/go-trader.git","sourceUrl":"https://github.com/richkuo/go-trader","homepage":null,"primaryLinks":[{"label":"View Source","url":"https://github.com/richkuo/go-trader","kind":"source"}],"safetyScore":100,"overallRank":37.050000000000004,"popularityScore":37,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Agent Setup Guide — go-trader Agent Setup Guide — go-trader **Repository:** https://github.com/richkuo/go-trader.git This is a self-contained setup guide for AI"},"coverage":{"evidence":{"source":"capability-contract + public-profile","verified":true,"confidence":"high","updatedAt":"2026-02-24T19:47:36.167Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[{"label":"also","status":"self-declared"},{"label":"be","status":"self-declared"},{"label":"change","status":"self-declared"},{"label":"post","status":"self-declared"}],"verifiedCount":0,"selfDeclaredCount":5,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"},{"key":"also","type":"capability","support":"supported","confidenceSource":"profile","notes":"Declared in agent profile metadata"},{"key":"be","type":"capability","support":"supported","confidenceSource":"profile","notes":"Declared in agent profile metadata"},{"key":"change","type":"capability","support":"supported","confidenceSource":"profile","notes":"Declared in agent profile metadata"},{"key":"post","type":"capability","support":"supported","confidenceSource":"profile","notes":"Declared in agent profile metadata"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile capability:also|supported|profile capability:be|supported|profile capability:change|supported|profile capability:post|supported|profile"}},"adoption":{"evidence":{"source":"GITHUB OPENCLEW","verified":false,"confidence":"medium","updatedAt":"2026-04-15T05:21:22.124Z","emptyReason":null},"stars":30,"forks":10,"downloads":null,"packageName":null,"latestVersion":null,"tractionLabel":"30 GitHub stars"},"release":{"evidence":{"source":"agent-index","verified":false,"confidence":"medium","updatedAt":"2026-02-23T21:13:06.418Z","emptyReason":null},"lastUpdatedAt":"2026-04-15T05:21:22.124Z","lastCrawledAt":"2026-02-23T21:13:06.418Z","lastIndexedAt":null,"nextCrawlAt":"2026-02-24T21:13:06.418Z","lastVerifiedAt":null,"highlights":[]},"execution":{"evidence":{"source":"capability-contract","verified":true,"confidence":"high","updatedAt":"2026-02-24T19:47:36.167Z","emptyReason":null},"installCommand":"git clone https://github.com/richkuo/go-trader.git","setupComplexity":"low","setupSteps":["Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"ready","authModes":["api_key"],"requires":["openclew","lang:typescript","streaming"],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":true,"inputSchemaRef":"https://github.com/richkuo/go-trader#input","outputSchemaRef":"https://github.com/richkuo/go-trader#output","dataRegion":"global","contractUpdatedAt":"2026-02-24T19:47:36.167Z","sourceUpdatedAt":"2026-02-24T19:47:36.167Z","freshnessSeconds":19584504},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/richkuo-go-trader/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/richkuo-go-trader/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/richkuo-go-trader/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/richkuo-go-trader/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/richkuo-go-trader/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/richkuo-go-trader/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"GITHUB_OPENCLEW","generatedAt":"2026-10-09T11:56:00.960Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/richkuo-go-trader/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/richkuo-go-trader/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/richkuo-go-trader/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/richkuo-go-trader/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":[],"safeUseWhen":["Contract is available with explicit auth and schema references.","Trust confidence is not low and verification freshness is acceptable."],"riskFlags":["trust_data_unavailable"],"operationalConfidence":"medium"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"GITHUB OPENCLEW","verified":false,"confidence":"high","updatedAt":"2026-04-15T05:21:22.124Z","emptyReason":null},"readme":"# Agent Setup Guide — go-trader\n\n**Repository:** `https://github.com/richkuo/go-trader.git`\n\nThis is a self-contained setup guide for AI agents. Give this file to any AI coding agent and it will handle the full installation — cloning the repo, installing dependencies, configuring Discord/strategies/risk, building, and starting the service.\n\n**For OpenClaw agents:** This is the skill entry point. Read it when a user says \"set up go-trader\", \"install go trading bot\", or \"configure go-trader\".\n\n---\n\n## Step 1: Prerequisites\n\nCheck each prerequisite. Install anything missing (ask user before installing).\n\n### 1a. Python 3.12+\n```bash\npython3 --version\n```\nIf missing or < 3.12, ask:\n> Python 3.12+ is required. Want me to install it?\n\n### 1b. uv (Python package manager)\n```bash\nuv --version 2>/dev/null || echo \"NOT_INSTALLED\"\n```\nIf missing, install:\n```bash\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n```\n\n### 1c. Go runtime (1.23+)\n```bash\ngo version 2>/dev/null || /usr/local/go/bin/go version 2>/dev/null || echo \"NOT_INSTALLED\"\n```\nIf missing, ask:\n> Go 1.23+ is required to build the scheduler. Want me to install it?\n\nInstall with:\n```bash\ncurl -sL https://go.dev/dl/go1.23.6.linux-amd64.tar.gz | tar -C /usr/local -xzf -\n```\nNote: Go may not be in PATH. Use `/usr/local/go/bin/go` if `go` doesn't resolve.\n\n### 1d. Git\n```bash\ngit --version\n```\n\n---\n\n## Step 2: Clone Repository\n\nCheck if already installed:\n```bash\ntest -d go-trader/scheduler && echo \"EXISTS\" || echo \"FRESH\"\n```\n\n**If EXISTS**, ask:\n> go-trader is already installed. Do you want to:\n> 1. Reconfigure (keep code, redo setup)\n> 2. Update (pull latest + rebuild)\n> 3. Fresh install (delete and start over)\n\n**If FRESH**, clone from GitHub:\n```bash\ngit clone https://github.com/richkuo/go-trader.git\ncd go-trader\n```\n\n**If the clone fails** (private repo or auth issue), ask:\n> I couldn't clone the repository. Do you have a GitHub token or SSH key configured?\n> You can also download it manually: https://github.com/richkuo/go-trader\n\n---\n\n## Step 3: Install Python Dependencies\n\n```bash\ncd go-trader\nuv sync\n```\n**Verify:** `.venv/bin/python3` should exist after this.\n\nNo user input needed for this step.\n\n---\n\n## Step 4: Discord Configuration\n\nAsk:\n> Do you want Discord trade alerts? The bot will post summaries and trade notifications to Discord channels.\n>\n> (yes / no)\n\n### If no:\nSet `discord.enabled = false` in config. Skip to Step 5.\n\n### If yes:\n\n#### 4a. Discord Bot Token\nAsk:\n> I need your Discord bot token. This is used to post trade alerts.\n>\n> Where to find it: [Discord Developer Portal](https://discord.com/developers/applications) → your application → Bot → Token\n>\n> **Security:** I'll store this as a systemd environment variable, not in config files.\n>\n> Paste your bot token:\n\nStore the token for use in Step 8 (systemd service). Do NOT write it to config.json.\n\n#### 4b. Spot Alerts Channel\nAsk:\n> Which Discord channel should receive **spot trading** alerts?\n>\n> This channel will get:\n> - Hourly summaries showing PnL for each spot strategy (BTC/ETH/SOL)\n> - Immediate notifications when a spot trade executes\n>\n> I need the **channel ID** — right-click the channel → \"Copy Channel ID\"\n> (Enable Developer Mode in Discord Settings → Advanced if you don't see this option)\n>\n> Spot channel ID:\n\n#### 4c. Options Alerts Channel\nAsk:\n> Which Discord channel should receive **options trading** alerts?\n>\n> This channel will get:\n> - Per-check summaries split by exchange (Deribit + IBKR)\n> - Individual strategy PnL with recent trade history\n> - Immediate trade notifications\n>\n> This can be the same channel as spot, or a different one.\n>\n> Options channel ID:\n\n#### 4d. Discord Server (Guild) ID\nAsk:\n> What's the Discord server (guild) ID where these channels are?\n>\n> Right-click the server icon → \"Copy Server ID\"\n>\n> Server ID:\n\nStore this for OpenClaw allowlist configuration in Step 7.\n\n#### 4e. Summary Frequency\nAsk:\n> How often should spot summaries post to Discord?\n>\n> 1. **Hourly** (recommended) — one summary per hour, trades posted immediately\n> 2. **Per check** — summary every 5 minutes (can be noisy)\n>\n> Options summaries always post per check (every 20 minutes).\n>\n> Your preference: (1 or 2, default: 1)\n\nMap response:\n- 1 or blank → `\"hourly\"`\n- 2 → `\"per_check\"`\n\n---\n\n## Step 5: Trading Configuration\n\n#### 5a. Trading Mode\nAsk:\n> Do you want to run in paper trading mode (simulated) or live trading?\n>\n> **Paper mode** (recommended): No real money. Simulates trades with virtual capital. Good for testing strategies before going live.\n>\n> **Live mode**: Requires exchange API keys. Real trades with real money.\n>\n> (paper / live, default: paper)\n\n**If live**, prompt for exchange API keys:\n> Binance API key:\n> Binance API secret:\n\nStore these for the systemd environment in Step 8.\n\n#### 5b. Per-Strategy Capital\nAsk:\n> How much starting capital per strategy (in USD)?\n>\n> Default is $1,000 per strategy. With 30 strategies, that's $30,000 total paper capital.\n>\n> You can change individual strategy amounts later in the config.\n>\n> Capital per strategy: (default: 1000)\n\n#### 5c. Risk Tolerance — Max Drawdown\nAsk:\n> What's your maximum drawdown tolerance? When a strategy's losses exceed this percentage, a circuit breaker pauses trading for 24 hours.\n>\n> - **Spot strategies** default: 60%\n> - **Options strategies** default: 40% (measured from peak value)\n>\n> Do you want to customize these, or use the defaults?\n>\n> 1. Use defaults (recommended)\n> 2. Set custom values\n>\n> (1 or 2, default: 1)\n\n**If 2:**\n> Max drawdown for spot strategies (%, default: 60):\n> Max drawdown for options strategies (%, default: 20):\n\n---\n\n## Step 6: Strategy Selection\n\nAsk:\n> go-trader comes with 30 strategies across three groups:\n>\n> **Spot (14 strategies)** — BTC, ETH, SOL on Binance\n>   momentum, RSI, MACD, volume-weighted, pairs spread\n>\n> **Deribit Options (8 strategies)** — BTC, ETH options\n>   vol mean reversion, momentum, puts, calls, wheel, butterfly\n>\n> **IBKR/CME Options (8 strategies)** — BTC, ETH options (CME Micro)\n>   Same 6 strategies as Deribit, for head-to-head comparison\n>\n> Do you want to:\n> 1. **Run all 30** (recommended for paper trading)\n> 2. **Choose by group** (enable/disable spot, Deribit, IBKR)\n> 3. **Pick individual strategies**\n>\n> (1, 2, or 3, default: 1)\n\n### If 1 (all strategies):\nUse the full default strategy set. Skip to Step 6b.\n\n### If 2 (by group):\nAsk for each group:\n> Enable **spot strategies** (momentum, RSI, MACD, volume-weighted, pairs on BTC/ETH/SOL)? (yes/no, default: yes)\n> Enable **Deribit options** (vol MR, momentum, puts, calls, wheel, butterfly on BTC/ETH)? (yes/no, default: yes)\n> Enable **IBKR/CME options** (same strategies as Deribit, CME Micro contracts)? (yes/no, default: yes)\n\n### If 3 (individual):\nPresent each strategy and ask yes/no. Group them for readability:\n\n> **Spot Strategies** (5-minute checks):\n>\n> | # | Strategy | Assets | Description | Enable? |\n> |---|----------|--------|-------------|---------|\n> | 1 | momentum | BTC, ETH, SOL | Rate of change breakouts | (y/n) |\n> | 2 | rsi | BTC, ETH, SOL | Buy oversold, sell overbought | (y/n) |\n> | 3 | macd | BTC, ETH | MACD/signal crossovers | (y/n) |\n> | 4 | volume_weighted | BTC, ETH, SOL | Trend + volume confirmation | (y/n) |\n> | 5 | pairs_spread | BTC/ETH, BTC/SOL, ETH/SOL | Spread z-score stat arb | (y/n) |\n>\n> Which spot strategies do you want? (e.g., \"1,2,4\" or \"all\" or \"none\")\n\nThen repeat for options:\n> **Deribit Options** (20-minute checks, BTC + ETH each):\n>\n> | # | Strategy | Description | Enable? |\n> |---|----------|-------------|---------|\n> | 1 | vol_mean_reversion | High IV → sell strangles, Low IV → buy straddles | (y/n) |\n> | 2 | momentum_options | ROC breakout → directional options | (y/n) |\n> | 3 | protective_puts | Buy 12% OTM puts, 45 DTE | (y/n) |\n> | 4 | covered_calls | Sell 12% OTM calls, 21 DTE | (y/n) |\n> | 5 | wheel | Sell 6% OTM puts, 37 DTE | (y/n) |\n> | 6 | butterfly | ±5% wing butterfly spread, 30 DTE | (y/n) |\n>\n> Which Deribit strategies? (e.g., \"1,3,6\" or \"all\" or \"none\")\n\n> **IBKR/CME Options** — Same strategies as Deribit but using CME Micro contracts:\n>\n> Run the same selection as Deribit, or choose differently?\n> 1. Same as Deribit\n> 2. Choose individually\n> 3. None\n>\n> (1, 2, or 3)\n\n### 6b. Theta Harvesting (Options)\nOnly ask if any options strategies were enabled:\n\nAsk:\n> **Theta harvesting** lets the bot close sold options early instead of holding to expiry:\n> - **Profit target**: Close when X% of premium captured (e.g., 60%)\n> - **Stop loss**: Close if loss exceeds X% of premium (e.g., 200% = 2× premium)\n> - **Min DTE**: Force-close when fewer than N days to expiry (avoid gamma risk)\n>\n> Do you want to configure theta harvesting?\n> 1. **Enable with defaults** (60% profit, 200% stop, 3 days min DTE) — recommended\n> 2. **Custom values**\n> 3. **Disable** (options ride to expiry or circuit breaker)\n>\n> (1, 2, or 3, default: 1)\n\n**If 2:**\n> Profit target (% of premium to capture before closing, default: 60):\n> Stop loss (% of premium loss before closing, default: 200):\n> Minimum DTE to force-close (days, default: 3):\n\n---\n\n## Step 7: Write Configuration\n\nUsing all gathered inputs, generate `scheduler/config.json`.\n\n### 7a. Build config.json\n\nStart from `scheduler/config.example.json` as a template. For each enabled strategy, add an entry with:\n- `id`: Use the naming convention `{strategy}-{asset}` for spot, `deribit-{strategy}-{asset}` or `ibkr-{strategy}-{asset}` for options\n- `type`: `\"spot\"` or `\"options\"`\n- `script`: `\"scripts/check_strategy.py\"` (spot), `\"scripts/check_options.py\"` (Deribit), `\"scripts/check_options_ibkr.py\"` (IBKR)\n- `args`: Strategy-specific arguments (see config.example.json for format)\n- `capital`: User's chosen amount\n- `max_drawdown_pct`: User's chosen value (spot default: 60, options default: 40)\n- `interval_seconds`: 300 for spot, 1200 for options\n- `theta_harvest`: If enabled, include the config block\n\nDiscord config:\n- `discord.enabled`: true/false based on Step 4\n- `discord.token`: Always `\"\"` (token comes from env var)\n- `discord.channels.spot`: Channel ID from Step 4b\n- `discord.channels.options`: Channel ID from Step 4c\n- `discord.spot_summary_freq`: From Step 4e\n- `discord.options_summary_freq`: `\"per_check\"`\n\n### 7b. OpenClaw Discord Allowlist (if applicable)\n\nIf the agent is running inside OpenClaw and Discord was configured, add the channels to OpenClaw's guild allowlist so the bot can post:\n\n```bash\n# Using OpenClaw gateway config.patch:\n# channels.discord.guilds.<GUILD_ID>.channels.<SPOT_CHANNEL>.requireMention = false\n# channels.discord.guilds.<GUILD_ID>.channels.<OPTIONS_CHANNEL>.requireMention = false\n```\n\nOr via CLI:\n```bash\nopenclaw config set \"channels.discord.guilds.${GUILD_ID}.channels.${SPOT_CHANNEL}.requireMention\" false\nopenclaw config set \"channels.discord.guilds.${GUILD_ID}.channels.${OPTIONS_CHANNEL}.requireMention\" false\n```\n\n### 7c. Confirm with User\n\nShow the user a summary before proceeding:\n> Here's your configuration:\n>\n> **Mode:** Paper trading\n> **Strategies:** {N} total ({spot_count} spot, {deribit_count} Deribit, {ibkr_count} IBKR)\n> **Capital:** ${amount} per strategy (${total} total)\n> **Risk:** {spot_drawdown}% max drawdown (spot), {options_drawdown}% (options)\n> **Theta harvesting:** {enabled/disabled} {details if enabled}\n> **Discord:** {enabled/disabled}\n>   📈 Spot alerts → #{channel_name} ({freq})\n>   🎯 Options alerts → #{channel_name} (per check)\n>\n> Proceed? (yes / no)\n\nIf no, ask which part they want to change and loop back to the relevant step.\n\n---\n\n## Step 8: Build & Install\n\n### 8a. Build Go Binary\n```bash\ncd scheduler\n/usr/local/go/bin/go build -o ../go-trader .\ncd ..\n```\nIf `go` is in PATH, just use `go build`. Check both.\n\n**Verify:** `./go-trader --help` should print usage.\n\n### 8b. Test Run\n```bash\n./go-trader --config scheduler/config.json --once\n```\nCheck for errors. If Discord is configured, a summary should appear in the channels.\n\n### 8c. Install systemd Service\n\nCreate or update the service file. Include the Discord token and any exchange API keys as environment variables:\n\n```ini\n[Unit]\nDescription=Go Trading Scheduler\nAfter=network.target\n\n[Service]\nType=simple\nWorkingDirectory={PROJECT_DIR}\nExecStart={PROJECT_DIR}/go-trader --config scheduler/config.json\nEnvironment=\"DISCORD_BOT_TOKEN={token}\"\nRestart=always\nRestartSec=10\nStandardOutput=append:{PROJECT_DIR}/logs/scheduler.log\nStandardError=append:{PROJECT_DIR}/logs/scheduler.log\n\n[Install]\nWantedBy=multi-user.target\n```\n\nIf live trading, also add:\n```ini\nEnvironment=\"BINANCE_API_KEY={key}\"\nEnvironment=\"BINANCE_API_SECRET={secret}\"\n```\n\n```bash\nmkdir -p logs\nsudo cp go-trader.service /etc/systemd/system/\nsudo systemctl daemon-reload\nsudo systemctl enable go-trader\nsudo systemctl start go-trader\n```\n\n### Step 8d: Auto-Update (Git Pull)\n\nAsk the user which update method they prefer:\n\n- **A) Cron job** — daily automatic pull, no code change\n- **B) Heartbeat** — integrated into scheduler loop, requires Go change\n- **C) Manual** — pull on demand when needed\n\n#### Option A: Cron Job (recommended — no code change)\n\nAdd a cron entry to pull once a day (e.g. at 03:00). Only rebuilds and restarts if there are actual changes:\n```bash\ncrontab -e\n# Add this line:\n0 3 * * * cd /root/.openclaw/workspace/go-trader && git pull --ff-only | grep -q 'Already up to date' || (cd scheduler && /usr/local/go/bin/go build -o ../go-trader . && systemctl restart go-trader) >> /var/log/go-trader-autoupdate.log 2>&1\n```\n\n> Logs to `/var/log/go-trader-autoupdate.log`. Rebuild and restart only trigger when upstream has changes.\n\n#### Option B: Heartbeat in Scheduler Loop (integrated — requires Go change)\n\nAdd a `git_pull_interval_cycles` field to `scheduler/config.json` (e.g., `12` = every ~1 hour at 5-min cycles), then add a `runGitPull()` call in the scheduler's main loop that fires every N cycles.\n\n> **Note:** Same caveat — Go source changes still need a rebuild + restart to take effect even with this enabled. This option is best for Python/config-only workflows.\n\n#### Option C: Manual\n\nNo configuration needed. Pull whenever you push changes:\n```bash\ncd /path/to/go-trader && git pull --ff-only\nsudo systemctl restart go-trader  # only needed for Go source or config changes\n```\n\nAfter adding the cron or heartbeat, verify it works:\n```bash\n# Cron: check the log after the scheduled time\ntail /tmp/go-trader-pull.log\n\n# Heartbeat: check scheduler logs after N cycles\njournalctl -u go-trader -f | grep -i \"git pull\"\n```\n\n---\n\n## Step 9: Verification\n\n### 9a. Service Running\n```bash\nsystemctl is-active go-trader\n```\nExpected: `active`\n\n### 9b. Status Endpoint\n```bash\ncurl -s localhost:8099/status | python3 -c \"\nimport json, sys\nd = json.load(sys.stdin)\nprint(f'Cycle: {d[\\\"cycle_count\\\"]}')\nprint(f'Strategies: {len(d[\\\"strategies\\\"])}')\nfor sym, price in d.get('prices', {}).items():\n    print(f'  {sym}: \\${price:,.2f}')\n\"\n```\n\n### 9c. Discord Check\nIf Discord is enabled, wait for the first cycle to complete (~5 minutes) and verify messages appear in the configured channels.\n\n### 9d. Report to User\n\n> ✅ **go-trader is running!**\n>\n> **Mode:** {paper/live}\n> **Strategies:** {N} active\n> **Status:** `curl localhost:8099/status`\n> **Logs:** `journalctl -u go-trader -f`\n>\n> Spot strategies check every 5 minutes (summaries {freq}).\n> Options strategies check every 20 minutes (summaries per check).\n> Trades post immediately to Discord.\n>\n> **Useful commands:**\n> - Stop: `sudo systemctl stop go-trader`\n> - Restart: `sudo systemctl restart go-trader`\n> - Status: `curl -s localhost:8099/status | python3 -m json.tool`\n> - Reset positions: `cp scheduler/state.example.json scheduler/state.json && sudo systemctl restart go-trader`\n\n---\n\n## Backtesting\n\nRun historical simulations using scripts in `backtest/`. All require `.venv/bin/python3` since dependencies (ccxt, pandas, numpy) are installed in the venv.\n\n### Spot Strategy Backtest (`backtest/run_backtest.py`)\n\nRequires `PYTHONPATH=core:strategies` to resolve imports.\n\n```bash\n# Single strategy run\nPYTHONPATH=core:strategies .venv/bin/python3 backtest/run_backtest.py \\\n  --strategy <name> --symbol BTC/USDT --timeframe 1h --mode single\n\n# Compare two strategies\nPYTHONPATH=core:strategies .venv/bin/python3 backtest/run_backtest.py \\\n  --strategy <name> --symbol BTC/USDT --timeframe 1h --mode compare\n\n# Multi-symbol sweep\nPYTHONPATH=core:strategies .venv/bin/python3 backtest/run_backtest.py \\\n  --strategy <name> --timeframe 1h --mode multi\n\n# Parameter optimization\nPYTHONPATH=core:strategies .venv/bin/python3 backtest/run_backtest.py \\\n  --strategy <name> --symbol BTC/USDT --timeframe 1h --mode optimize\n\n# Limit history (e.g. last 90 days)\nPYTHONPATH=core:strategies .venv/bin/python3 backtest/run_backtest.py \\\n  --strategy <name> --symbol BTC/USDT --timeframe 1h --since 90\n```\n\nKey flags: `--strategy`, `--symbol`, `--timeframe`, `--mode` (single/compare/multi/optimize), `--since` (days)\n\n### Options Backtest (`backtest/backtest_options.py`)\n\nSelf-contained (only imports ccxt).\n\n```bash\n.venv/bin/python3 backtest/backtest_options.py \\\n  --underlying BTC --since 90 --capital 10000\n\n# Verbose output\n.venv/bin/python3 backtest/backtest_options.py \\\n  --underlying BTC --since 90 --capital 10000 --verbose\n```\n\nKey flags: `--underlying`, `--since` (days), `--capital`, `--verbose`\n\n### Theta Harvest Comparison (`backtest/backtest_theta.py`)\n\nSelf-contained.\n\n```bash\n.venv/bin/python3 backtest/backtest_theta.py \\\n  --underlying BTC --since 90 --capital 10000\n```\n\nKey flags: `--underlying`, `--since` (days), `--capital`\n\n---\n\n## Reconfiguration\n\nThese can be done after initial setup without re-running the full guide.\n\n### Change Discord Channels\nEdit `scheduler/config.json` → `discord.channels`, then restart:\n```bash\nsudo systemctl restart go-trader\n```\nIf new channels, also add to OpenClaw allowlist.\n\n### Change Discord Token\n```bash\nsudo systemctl edit go-trader\n# Add: Environment=\"DISCORD_BOT_TOKEN=new_token_here\"\nsudo systemctl restart go-trader\n```\n\n### Add/Remove Strategies\nEdit `scheduler/config.json` → `strategies` array, then restart. Removed strategies are auto-pruned from state. New strategies initialize with fresh capital.\n\n### Adjust Risk Settings\nEdit `max_drawdown_pct` per strategy in config.json, then restart.\n\n### Enable/Disable Theta Harvesting\nAdd or remove the `theta_harvest` block from individual strategy entries in config.json, then restart.\n\n### Enable/Disable Auto-Pull (Git Pull)\n\n**Cron-based:** Add or remove the cron entry (`crontab -e`). No restart needed.\n\n**Heartbeat-based:** Set or remove `git_pull_interval_cycles` in config.json, then restart.\n\n### Switch Paper → Live\nAdd exchange API keys to systemd environment:\n```bash\nsudo systemctl edit go-trader\n# [Service]\n# Environment=\"BINANCE_API_KEY=...\"\n# Environment=\"BINANCE_API_SECRET=...\"\nsudo systemctl restart go-trader\n```\n\n---\n\n## `/go-trader` Command\n\nWhen the user says `/go-trader`, \"check bot status\", \"show strategy health\", or \"how are the bots doing\", run this:\n\n```bash\ncurl -s localhost:8099/status | python3 -c \"\nimport json, sys\nd = json.load(sys.stdin)\nprices = d.get('prices', {})\nstrats = d.get('strategies', {})\n\nprint(f'=== GO-TRADER (Cycle {d[\\\"cycle_count\\\"]}) ===')\nfor sym, p in sorted(prices.items()):\n    print(f'  {sym}: \\${p:,.2f}')\n\ntotal_val = sum(s['portfolio_value'] for s in strats.values())\ntotal_cap = sum(s['initial_capital'] for s in strats.values())\ntotal_pnl = total_val - total_cap\npct = (total_pnl/total_cap)*100 if total_cap else 0\nprint(f'\\nPortfolio: \\${total_cap:,.0f} → \\${total_val:,.0f} ({total_pnl:+,.0f} / {pct:+.1f}%)')\nprint(f'Strategies: {len(strats)}')\n\n# Circuit breakers\ncb_active = [(id,s) for id,s in strats.items()\n             if s['risk_state'].get('circuit_breaker_until','').startswith('20')]\nprint(f'Circuit breakers active: {len(cb_active)}')\n\n# Rank by PnL\nranked = sorted(strats.items(), key=lambda x: x[1]['pnl_pct'], reverse=True)\nprint(f'\\nTop 5:')\nfor id, s in ranked[:5]:\n    print(f'  {id}: {s[\\\"pnl_pct\\\"]:+.1f}% (\\${s[\\\"pnl\\\"]:+,.0f}) | {s[\\\"trade_count\\\"]} trades')\nprint(f'\\nBottom 5:')\nfor id, s in ranked[-5:]:\n    print(f'  {id}: {s[\\\"pnl_pct\\\"]:+.1f}% (\\${s[\\\"pnl\\\"]:+,.0f}) | {s[\\\"trade_count\\\"]} trades')\n\n# Dead strategies\ndead = [id for id,s in strats.items() if s['trade_count'] == 0]\nif dead:\n    print(f'\\nDead (0 trades): {len(dead)} — {dead}')\n\n# Circuit breaker details\nif cb_active:\n    print(f'\\nCircuit breaker details:')\n    for id, s in cb_active:\n        rs = s['risk_state']\n        print(f'  {id}: dd={rs[\\\"current_drawdown_pct\\\"]:.1f}% / max={rs[\\\"max_drawdown_pct\\\"]:.0f}% | until {rs[\\\"circuit_breaker_until\\\"][:19]}')\n\"\n```\n\nPresent the output to the user in a readable format. Highlight any circuit breakers, dead strategies, or notable PnL changes.\n\n---\n\n## Adjustable Settings Reference\n\nAll settings live in `scheduler/config.json`. After any change, restart the service:\n```bash\nsudo systemctl restart go-trader\n```\n\nConfig changes are synced to state on startup — no need to reset positions.\n\n### Global Settings\n\n| Setting | Key | Default | Description |\n|---------|-----|---------|-------------|\n| Check interval | `interval_seconds` | 300 (5 min) | Global default cycle interval in seconds |\n| State file path | `state_file` | `scheduler/state.json` | Where positions and trade history are stored |\n\n### Per-Strategy Settings\n\nEach entry in the `strategies` array supports:\n\n| Setting | Key | Default | Description |\n|---------|-----|---------|-------------|\n| Capital | `capital` | 1000 | Starting capital in USD for this strategy |\n| Max drawdown | `max_drawdown_pct` | Spot: 60, Options: 40 | Circuit breaker triggers when drawdown from peak exceeds this %. Measured from the strategy's peak portfolio value, not initial capital. |\n| Check interval | `interval_seconds` | Uses global | How often this strategy checks for signals (seconds). 0 = use global default. Spot typically 300 (5 min), options 1200 (20 min). |\n| Theta harvest | `theta_harvest.enabled` | false | Enable early exit on sold options |\n| Theta profit target | `theta_harvest.profit_target_pct` | 60 | Close sold option when this % of premium is captured |\n| Theta stop loss | `theta_harvest.stop_loss_pct` | 200 | Close sold option if loss exceeds this % of premium (200 = 2× premium) |\n| Theta min DTE | `theta_harvest.min_dte_close` | 3 | Force-close positions with fewer than N days to expiry |\n\n### Discord Settings\n\n| Setting | Key | Default | Description |\n|---------|-----|---------|-------------|\n| Enable Discord | `discord.enabled` | true | Turn Discord notifications on/off |\n| Spot channel | `discord.channels.spot` | — | Channel ID for spot trading summaries |\n| Options channel | `discord.channels.options` | — | Channel ID for options trading summaries |\n| Spot frequency | `discord.spot_summary_freq` | `\"hourly\"` | How often spot summaries post: `\"hourly\"` or `\"per_check\"` |\n| Options frequency | `discord.options_summary_freq` | `\"per_check\"` | How often options summaries post: `\"per_check\"` or `\"hourly\"` |\n\n### Environment Variables\n\nSet via systemd override (`sudo systemctl edit go-trader`):\n\n| Variable | Description |\n|----------|-------------|\n| `DISCORD_BOT_TOKEN` | Discord bot token (never store in config.json) |\n| `STATUS_AUTH_TOKEN` | Optional: require Bearer token for /status endpoint |\n| `BINANCE_API_KEY` | Binance API key (live trading only) |\n| `BINANCE_API_SECRET` | Binance API secret (live trading only) |\n\n### Example: Adjusting a Strategy\n\nTo change deribit-vol-btc to $2,000 capital with 50% max drawdown and theta harvesting:\n\n```json\n{\n  \"id\": \"deribit-vol-btc\",\n  \"type\": \"options\",\n  \"script\": \"scripts/check_options.py\",\n  \"args\": [\"vol_mean_reversion\", \"BTC\"],\n  \"capital\": 2000,\n  \"max_drawdown_pct\": 50,\n  \"interval_seconds\": 1200,\n  \"theta_harvest\": {\n    \"enabled\": true,\n    \"profit_target_pct\": 60,\n    \"stop_loss_pct\": 200,\n    \"min_dte_close\": 3\n  }\n}\n```\n\nThen restart: `sudo systemctl restart go-trader`\n\n**Note:** Changing `capital` on an existing strategy does NOT reset its positions or cash. It only changes the `initial_capital` reference for PnL calculations. To fully reset a strategy, delete it from `scheduler/state.json` and restart.\n\n---\n\n## Strategy Reference (for config generation)\n\n### Spot Strategy Entries\n\nEach spot strategy needs entries for each asset it supports:\n\n```json\n{\"id\": \"momentum-btc\", \"type\": \"spot\", \"script\": \"scripts/check_strategy.py\", \"args\": [\"momentum\", \"BTC/USDT\", \"1h\"], \"capital\": 1000, \"max_drawdown_pct\": 60, \"interval_seconds\": 300}\n{\"id\": \"momentum-eth\", \"type\": \"spot\", \"script\": \"scripts/check_strategy.py\", \"args\": [\"momentum\", \"ETH/USDT\", \"1h\"], \"capital\": 1000, \"max_drawdown_pct\": 60, \"interval_seconds\": 300}\n{\"id\": \"momentum-sol\", \"type\": \"spot\", \"script\": \"scripts/check_strategy.py\", \"args\": [\"momentum\", \"SOL/USDT\", \"1h\"], \"capital\": 1000, \"max_drawdown_pct\": 60, \"interval_seconds\": 300}\n```\n\n**Strategies and their assets:**\n- `momentum`: BTC, ETH, SOL\n- `rsi`: BTC, ETH, SOL\n- `macd`: BTC, ETH\n- `volume_weighted`: BTC, ETH, SOL\n- `pairs_spread`: Requires two assets — `args: [\"pairs_spread\", \"BTC/USDT\", \"1d\", \"ETH/USDT\"]`\n\n**Pairs strategy IDs and args:**\n```json\n{\"id\": \"pairs-btc-eth\", \"args\": [\"pairs_spread\", \"BTC/USDT\", \"1d\", \"ETH/USDT\"], \"interval_seconds\": 86400}\n{\"id\": \"pairs-btc-sol\", \"args\": [\"pairs_spread\", \"BTC/USDT\", \"1d\", \"SOL/USDT\"], \"interval_seconds\": 86400}\n{\"id\": \"pairs-eth-sol\", \"args\": [\"pairs_spread\", \"ETH/USDT\", \"1d\", \"SOL/USDT\"], \"interval_seconds\": 86400}\n```\n\n### Deribit Options Entries\n\nEach Deribit strategy runs on BTC and ETH:\n\n```json\n{\"id\": \"deribit-vol-btc\", \"type\": \"options\", \"script\": \"scripts/check_options.py\", \"args\": [\"vol_mean_reversion\", \"BTC\"], \"capital\": 1000, \"max_drawdown_pct\": 40, \"interval_seconds\": 1200}\n{\"id\": \"deribit-vol-eth\", \"type\": \"options\", \"script\": \"scripts/check_options.py\", \"args\": [\"vol_mean_reversion\", \"ETH\"], \"capital\": 1000, \"max_drawdown_pct\": 40, \"interval_seconds\": 1200}\n```\n\n**Strategy arg names:** `vol_mean_reversion`, `momentum_options`, `protective_puts`, `covered_calls`, `wheel`, `butterfly`\n\n**ID convention:** `deribit-{strategy_short}-{asset}` where strategy_short is:\n- `vol_mean_reversion` → `vol`\n- `momentum_options` → `momentum`\n- `protective_puts` → `puts`\n- `covered_calls` → `calls`\n- `wheel` → `wheel`\n- `butterfly` → `butterfly`\n\n### IBKR/CME Options Entries\n\nSame as Deribit but with different script and ID prefix:\n\n```json\n{\"id\": \"ibkr-vol-btc\", \"type\": \"options\", \"script\": \"scripts/check_options_ibkr.py\", \"args\": [\"vol_mean_reversion\", \"BTC\"], \"capital\": 1000, \"max_drawdown_pct\": 40, \"interval_seconds\": 1200}\n```\n\n**ID convention:** `ibkr-{strategy_short}-{asset}` (same short names as Deribit)\n","readmeExcerpt":"Agent Setup Guide — go-trader **Repository:** https://github.com/richkuo/go-trader.git This is a self-contained setup guide for AI agents. Give this file to any AI coding agent and it will handle the full installation — cloning the repo, installing dependencies, configuring Discord/strategies/risk, building, and starting the service. **For OpenClaw agents:** This is the skill entry point. Read it when a user says \"se","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"python3 --version"},{"language":"bash","snippet":"uv --version 2>/dev/null || echo \"NOT_INSTALLED\""},{"language":"bash","snippet":"curl -LsSf https://astral.sh/uv/install.sh | sh"},{"language":"bash","snippet":"curl -LsSf https://astral.sh/uv/install.sh | sh"},{"language":"bash","snippet":"go version 2>/dev/null || /usr/local/go/bin/go version 2>/dev/null || echo \"NOT_INSTALLED\""},{"language":"bash","snippet":"curl -sL https://go.dev/dl/go1.23.6.linux-amd64.tar.gz | tar -C /usr/local -xzf -"}],"parameters":{},"dependencies":[],"permissions":[],"extractedFiles":[],"languages":["typescript"],"docsSourceLabel":"GITHUB OPENCLEW","editorialOverview":"Agent Setup Guide — go-trader Agent Setup Guide — go-trader **Repository:** https://github.com/richkuo/go-trader.git This is a self-contained setup guide for AI agents. Give this file to any AI coding agent and it will handle the full installation — cloning the repo, installing dependencies, configuring Discord/strategies/risk, building, and starting the service. **For OpenClaw agents:** This is the skill entry point. Read it when a user says \"se","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":374,"uniquenessScore":67,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-04-15T05:21:22.124Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-04-15T05:21:22.124Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-09T11:56:00.960Z","emptyReason":null},"items":[{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-10T18:48:31.762Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/github_openclew","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}