CLAUDE-TRADING.md - Trading System Operations
Purpose: Trading strategies, risk rules, and multi-account management for Schwab + Alpaca
Multi-Account Trading Protocol (MANDATORY)
Lesson Learned: On 2025-12-09, orders failed due to placing all orders on Schwab only,
even though Alpaca Live had $1,607 available. Check ALL accounts before trading.
Your Trading Accounts
| Account |
Type |
Typical Cash |
Use Case |
| Schwab ...6800 |
LIVE |
~$2,000 |
Long-term positions |
| Alpaca Live |
LIVE |
~$1,600 |
Quick trades |
| Alpaca Paper |
PRACTICE |
~$65,000 |
Strategy testing |
Before ANY Live Trade
# Step 1: Run pre-trade check (MANDATORY - NO EXCEPTIONS)
uv run python3 tools/pre_trade_check.py
# Step 2: If placing multiple orders, plan distribution:
uv run python3 tools/pre_trade_check.py --orders "NVDA:5,CVNA:2,O:18"
The Checklist
- Run
pre_trade_check.py to see ALL account balances
- Calculate TOTAL order cost across ALL orders
- Distribute orders across accounts based on available cash
- NEVER place all orders on one account if it exceeds that account's cash
Trading Safety Rules
- Paper test first: 24-48hr minimum, no exceptions
- Stop losses: Required on ALL positions
- Risk limits: Max 1% per trade, 2% daily loss limit
- Market hours: Check before orders (market closed = orders fail)
- Live trading: Requires explicit user approval
Paper Test Workflow
1. Backtest
uv run python3 tools/strategy_tester.py
Required thresholds:
- Sharpe Ratio > 2.0
- Win Rate > 35%
2. Paper Deploy
- Minimum 24-48 hours on Alpaca Paper account
- Monitor for unexpected behavior
3. Validate
- No critical bugs
- Metrics match backtest expectations
4. Go/No-Go
- User explicitly approves live deployment
- Never auto-deploy to live
Risk Management
Position Sizing
| Strategy |
Max Position |
Stop Loss |
| Micro-cap |
$1,000 |
ATR-based (15-24%) |
| Standard |
$2,000 |
9% trailing |
| Dividend |
$3,000 |
5% hard stop |
Portfolio Limits
- Single strategy: Max 20% of capital
- Daily loss limit: 2% of capital
- Total exposure: Track across ALL accounts
Trading Commands
# View all portfolios (Schwab + Alpaca)
uv run python3 tools/portfolio_fetcher.py
# Paper trader status
tail -f /tmp/micro_cap_paper_trader.log
# Trading analytics
uv run python3 tools/trading_analytics.py
# Schwab authentication (if expired)
uv run python3 tools/schwab_auth.py
# Health check (includes trading infrastructure)
make health-check
Active Trading Strategies
Micro-Cap Momentum
- Status: Running on Alpaca Paper
- Positions: 0-3 active
- Monitor:
/tmp/micro_cap_paper_trader.log
- Reference:
docs/status/MICRO_CAP_STATUS_SUMMARY.md
Phase 3D Financial Services
- Status: Deployed on Alpaca Paper
- Positions: ~20 positions
- Strategy: Dividend yield + value
- Reference:
~/Development/trading-platform/docs/
Troubleshooting
| Issue |
Check |
Fix |
| Order rejected |
Account balance |
Distribute across accounts |
| Schwab auth failed |
Token expiry |
uv run python3 tools/schwab_auth.py |
| Market closed |
API response |
Wait for market hours |
| Position not showing |
API sync |
Wait 30s, refresh |
| Stop loss not triggering |
Order status |
Check order type (stop vs limit) |
API Credentials (Trading)
| Service |
Location |
Notes |
| Schwab |
~/.schwab_tokens.json |
7-day token expiry |
| Alpaca |
~/.env.alpaca |
Paper + Live keys |
| Redis (capital tracking) |
Docker container |
docker start trading-redis |
See also:
- CLAUDE.md - Main development guide
- docs/architecture/trading-multi-agent-design.md - Trading system architecture
- tools/portfolio_fetcher.py - Portfolio aggregation code