AI Trading Agent with Risk Guardrails for Educational Investing

A developer has built an AI-powered trading assistant that connects Claude to a brokerage account with a risk engine positioned between the AI and the money. Every trade must pass through safety checks before execution.
Key Features and Implementation
The system includes multiple risk controls:
- Blocks trades attempting to allocate 50% of portfolio to a single stock
- Automatically shuts off trading when down 3% in a day
- Includes a kill switch that stops everything at 20% drawdown
- Uses fractional Kelly Criterion for position sizing ("don't bet more than the math says you should")
The setup begins with $100K in fake money using Alpaca paper trading (free to set up). Users can interact through multiple interfaces:
- Talking to Claude in terminal
- Web dashboard with charts and watchlist
- CLI commands
The AI can analyze positions and provide buy/sell/hold recommendations, with clear disclaimers that this is educational and not financial advice.
Technical Details
The project works as an MCP server, allowing integration with Claude Code. According to the developer: "If you use Claude Code, you can drop it into your setup in about 2 minutes and just start talking to it." Example commands include:
- "What's my portfolio look like?"
- "Buy 5 shares of AAPL."
- "Why did you block that trade?"
Transitioning from paper to live trading requires flipping one environment variable. The same guardrails apply with real stakes.
The project is available on GitHub under MIT license, includes 129 tests, and works on Mac/Linux/WSL. The developer is seeking feedback on whether the risk limits feel appropriate for learning and what additional features users would want.
📖 Read the full source: r/ClaudeAI
👀 See Also

LLM Cost Profiler: Open-source tool tracks API spending to make case for local models
LLM Cost Profiler is a Python tool that tracks every API call to OpenAI/Anthropic, showing exactly what you're spending and where. It exposes tasks that are overpriced relative to their complexity, providing concrete dollar amounts to justify moving to local models.

Flotilla v0.5.0 Overhauls Background Execution to Beat Claude SDK Credit Caps
Flotilla v0.5.0 replaces sequential agent execution with non-blocking parallel loops, 30-minute per-agent timeouts, and local delegation to cut SDK credit usage.

Claude Code v2.1.90 adds mouse support with CLAUDE_CODE_NO_FLICKER flag
Anthropic released Claude Code v2.1.90 with a new feature that enables mouse support in the chat interface. Users can activate it by setting the CLAUDE_CODE_NO_FLICKER=1 environment variable before running claude.
Needle: A 26M Parameter Function-Calling Model That Runs at 6000 tok/s on Mobile
Cactus open-sources Needle, a 26M parameter model for single-shot function calling, achieving 6000 tok/s prefill and 1200 tok/s decode on consumer devices. Built with Simple Attention Networks (no FFNs), it beats several larger models on tool-use benchmarks.