back to home

richkuo / go-trader

Crypto trading bot — backtesting, paper trading, live trading with risk management

View on GitHub
63 stars
18 forks
8 issues

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing richkuo/go-trader in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/richkuo/go-trader)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

go-trader — Crypto Trading Bot A Go + Python hybrid trading system. A single Go binary (~8MB RAM) orchestrates 50+ paper trading strategies across spot, options, perpetual futures, and CME futures markets by spawning short-lived Python scripts. **Spot markets** via Binance US (CCXT): SMA/EMA crossovers, momentum, RSI, Bollinger Bands, MACD, and pairs spread strategies on BTC, ETH, and SOL. **Options markets** via Deribit + IBKR/CME: volatility mean reversion, momentum, protective puts, and covered calls on BTC and ETH — running head-to-head across both exchanges. **Perpetual futures** via Hyperliquid: full spot strategy suite on any HL-listed asset, with paper and live trading support. **CME futures** via TopStep: momentum, mean reversion, RSI, MACD, breakout on ES, NQ, MES, MNQ, CL, GC — paper mode uses Yahoo Finance, live mode via TopStepX API. **Discord alerts**: Per-platform channels for spot, options, hyperliquid, and topstep summaries, with immediate trade notifications. When a new release is detected, the bot DMs you directly — reply **yes** and it upgrades, rebuilds, and restarts itself automatically. Supported platforms: Binance US, Deribit, IBKR/CME, Hyperliquid, TopStep. Community Join the Discord: https://discord.gg/46d7Fa2dXz --- Getting Started AI Agent Setup (Recommended) The fastest way to get running. Give your AI agent the Agent Setup Guide — it's fully self-contained with the repo URL, step-by-step instructions, and exact prompts. The agent will clone the repo, install dependencies, walk you through configuration (Discord channels, strategy selection, risk settings), build the binary, and start the service. **Raw link for agents:** Using OpenClaw? Just say: > "Set up go-trader" Interactive Setup (go-trader init) After building the binary, run the interactive config wizard — the easiest way to generate a config without manual JSON editing: The wizard walks you through asset selection, strategy types (spot/options/perps), platform selection, capital and risk settings, and Discord configuration, then writes a ready-to-use . For scripted/automated deployments (e.g. from OpenClaw or CI), use to generate a config non-interactively: Manual Setup --- Architecture Python gets the quant libraries (pandas, numpy, scipy, CCXT). Go gets memory efficiency. 50+ strategies cost ~220MB peak for ~30 seconds, then ~8MB idle. --- Strategies Spot (10 strategies, 1h interval, BTC/ETH/SOL) | Strategy | Description | |----------|-------------| | | Simple moving average crossover | | | Exponential moving average crossover | | | Rate of change breakouts | | | Buy oversold, sell overbought | | | Mean reversion at band extremes | | | MACD/signal line crossovers | | | Statistical mean reversion | | | Trend + volume confirmation | | | Triple EMA crossover | | | RSI and MACD confluence | | | BTC/ETH, BTC/SOL, ETH/SOL spread z-score stat arb (1d) | Options (4 strategies, 4h interval, BTC/ETH) Same 4 strategies on both Deribit and IBKR/CME for comparison: | Strategy | Description | |----------|-------------| | | High IV → sell strangles, Low IV → buy straddles | | | ROC breakout → buy directional options | | | Buy 12% OTM puts, 45 DTE | | | Sell 12% OTM calls, 21 DTE | New options trades are scored against existing positions for strike distance, expiry spread, and Greek balancing. Max 4 positions per strategy, min score 0.3 to execute. Perps (10 strategies, 1h interval, any HL-listed asset) Full spot strategy suite on Hyperliquid perpetual futures. Strategies are auto-discovered at time: , , , , , , , , , . Live mode requires env var. Paper mode simulates trades without a key. Futures (5 strategies, 1h interval, ES/NQ/MES/MNQ/CL/GC) | Strategy | Description | |----------|-------------| | | Rate of change breakouts | | | Statistical mean reversion | | | Buy oversold, sell overbought | | | MACD/signal line crossovers | | | Price breakout detection | CME futures on TopStep. Live mode requires , , env vars. Paper mode uses Yahoo Finance for price data. --- Platforms | Platform | Type | Assets | Features | |----------|------|--------|----------| | Binance US | Spot | BTC, ETH, SOL | CCXT, paper trading | | Deribit | Options | BTC, ETH | Live quotes, real expiries/strikes | | IBKR/CME | Options | BTC, ETH | CME Micro contracts, Black-Scholes pricing | | Hyperliquid | Perps | BTC, ETH, SOL | Paper + live trading via SDK | | TopStep | Futures | ES, NQ, MES, MNQ, CL, GC | Paper (yfinance) + live trading via TopStepX API | --- Configuration Reference Use (interactive) or (scripted) to generate this file. The full structure: Portfolio Risk | Field | Description | Default | |-------|-------------|---------| | | Kill switch — halt all trading if portfolio drops this % from peak | 25 | | | Hard cap on total notional exposure (0 = disabled) | 0 | Correlation Tracking Monitor portfolio-level directional exposure across all strategies. Disabled by default — opt in by setting . | Field | Description | Default | |-------|-------------|---------| | | Enable correlation tracking and warnings | false | | | Warn when one asset exceeds this % of portfolio gross exposure | 60 | | | Warn when more than this % of strategies on an asset share a direction | 75 | When thresholds are exceeded, warnings are sent to all active Discord channels and DM'd to the owner (if configured). The correlation snapshot is also available via the endpoint. Auto-Update & DM Upgrades Set in config to enable automatic update checks: | Value | Behavior | |-------|----------| | | No automatic checking (default) | | | Check once per day | | | Check every scheduler cycle | When an update is found, all active Discord channels receive a notification. If is set, the bot also **DMs you directly**: Reply **yes** → the bot runs , rebuilds the binary, and restarts itself. Reply **no** or ignore → skipped. After a restart following an upgrade, any new config fields introduced since your are collected via DM…