- Go 50.3%
- Rust 32.4%
- HTML 5.2%
- JavaScript 4.3%
- TypeScript 2.7%
- Other 5.1%
| algorithm | ||
| cartography | ||
| claude | ||
| deploy | ||
| features | ||
| notification | ||
| rust-trader | ||
| src/provider | ||
| ticker | ||
| types | ||
| web-ui | ||
| .dockerignore | ||
| .env.template | ||
| .gitignore | ||
| Dockerfile | ||
| economic-cartogrophy.tsx | ||
| go.mod | ||
| go.sum | ||
| go.work | ||
| go.work.sum | ||
| index.html | ||
| LICENSE | ||
| main.go | ||
| makefile | ||
| readme.md | ||
| run-tests.bat | ||
| run-tests.sh | ||
| style.css | ||
| technical_requirements_document.md | ||
Go Trader
A sophisticated algorithmic trading platform built in Go, powered by Alpaca Markets API and Claude AI.
Overview
Go Trader is a full-stack algorithmic trading platform that:
- 🌐 Connects to Alpaca Markets API for real-time market data and paper/live trading
- 🧠 Uses Claude AI to generate intelligent trading signals based on market conditions
- 📊 Implements configurable trading algorithms with risk management capabilities
- 📈 Streams real-time market data through a WebSocket server
- 🖥️ Provides a simple web UI for monitoring trades and portfolio performance
Architecture
The application consists of several key components:
- Main Server: Coordinates all components and exposes a REST API
- Ticker Server: Streams real-time market data from Alpaca
- Claude Integration: Generates trading signals using AI analysis
- Trading Algorithm: Executes trades based on signals with risk management
- Web UI: Visualizes market data, positions, and trading activity
Prerequisites
- Go 1.19 or higher
- Alpaca Markets account (paper trading account is sufficient)
- Claude API key (for AI trading signals)
Setup
-
Clone the repository:
git clone https://github.com/yourusername/go-trader.git cd go-trader -
Create a
.envfile from the template:cp .env.template .env -
For live Alpaca-backed operation, edit the
.envfile with your API keys:PAPER_ALPACA_API_KEY=your_alpaca_api_key_here PAPER_ALPACA_SECRET_KEY=your_alpaca_secret_key_here CLAUDE_API_KEY=your_claude_api_key_hereFor local development without external credentials, either set
GO_TRADER_MOCK=truein.envor run with-mock. -
Install dependencies:
go mod download cd web-ui && npm install
Running the Application
Start the application with real paper-trading credentials:
go run main.go
Or start in safe local mock mode without credentials:
go run main.go -mock
Run the web UI dev server in another terminal:
cd web-ui && npm run dev
Or with custom backend options:
go run main.go -port 8080 -symbols "AAPL,MSFT,TSLA,GOOG,AMZN"
Command-line Options
-port: HTTP server port (default: 8080)-symbols: Comma-separated list of ticker symbols to track (default: "AAPL,MSFT,TSLA")-paper: Use paper trading (default: true)-mock: Run with deterministic mock data and no Alpaca credentials-alpaca-key: Alpaca API key (overrides env var)-alpaca-secret: Alpaca secret key (overrides env var)
API Endpoints
The application exposes the following REST API endpoints:
GET /api/account: Get account informationGET /api/positions: List open positionsGET /api/orders: List recent ordersGET /api/tickers: Get current tracked symbolsPOST /api/tickers: Update tracked symbolsGET /api/signals: Get trading signals (optionally filtered by symbol)GET /api/risk-parameters: Get current risk parametersPOST /api/risk-parameters: Update risk parameters
WebSocket API
Real-time market data is available via WebSocket:
- Connect to:
ws://localhost:8081/ws - Receive real-time ticker data as JSON objects
Risk Management
The trading algorithm implements several risk management features:
- Maximum position size per symbol
- Maximum percentage of account allocation
- Stop loss percentage
- Take profit percentage
- Daily loss limit
- Maximum number of open positions
These parameters can be configured via the API.
Running in Production
For production deployment, consider:
- Using a process manager like systemd or supervisor
- Setting up HTTPS with a reverse proxy (Nginx, Caddy, etc.)
- Switching from paper trading to live trading by updating the Alpaca API URL
- Implementing more sophisticated logging and monitoring