- trader/alpaca/: Full Trader interface implementation for Alpaca
- Paper/Live trading support (market orders, stop/limit)
- GetBalance, GetPositions, GetMarketPrice via Alpaca API
- Fractional share support (4 decimal places)
- Commission-free trading
- Agent trade routing: stock symbols (AAPL, TSLA) → Alpaca
- isStockSymbol() heuristic to distinguish crypto vs stock
- execute_trade tool updated for stock buy/sell semantics
- get_market_price works for both crypto and stocks
- TraderManager + API: Alpaca registered as exchange type
- Factory case in auto_trader.go
- Config mapping in trader_manager.go
- Temp trader creation in handler_trader.go for balance query
- Frontend: PositionsPanel distinguishes stock vs crypto
- US flag emoji for stock positions
- Dollar prefix for stock PnL/prices
- 'Shares' label instead of 'Qty' for stocks
- System prompts updated for stock trading capabilities
Security:
- Remove /api/crypto/decrypt from public routes. The endpoint allowed
anyone to decrypt ciphertext without authentication. Internal callers
(exchange/model handlers) use the service directly and are behind auth.
Reliability:
- Add safe.Go / safe.GoNamed panic recovery wrapper (safe/go.go).
Previously 31 goroutines had zero recover() calls — a single panic
in any trader goroutine would crash the entire process.
- Apply safe.GoNamed to all trader launch paths:
- StartAll, RestoreRunning, LoadSingleTrader auto-start
- API handler start/restart endpoints
- Panics are now logged with full stack traces instead of crashing.
- Add strict data truthfulness rules to system prompt (CN + EN)
- Positions MUST come from get_positions tool only
- Balance MUST come from get_balance tool only
- Looking up a stock price != user owns it
- Fix unused variable warnings in hyperliquid trader