Before you build anything, understand what you're building, why it matters, and exactly what each tool in the stack costs. Numbers up front. No surprises.
What an Autonomous Trading Firm Actually Is
A trading "firm" in this course is a collection of small autonomous AI agents β one for research, one for risk, one for execution, one for communications β coordinated by a CEO agent. Each agent has a single job, a defined personality, and the authority to act within its lane. Together they run a real trading operation while you sleep.
This isn't a chat interface. It's an operational system: agents wake up on a schedule, do their jobs, log their work, alert you to anything that needs attention, and shut down. No human in the loop unless something breaks.
By the End of This Course
You will have a working, autonomous, paper-trading firm running on your own machine. Six agents. Two strategies. Live IBKR paper account. Daily Telegram alerts. Auto-deploying public dashboard. Total monthly cost: ~$5-15 in AI tokens.
The Full Stack β What Each Tool Costs
Required Tools & Real Pricing (May 2026)
Tool
What It Does
Cost
Paperclip
Agent orchestration platform β runs your agents
Free
Claude API
Powers each agent's reasoning
~$0.25β$3 / M tokens
Codex / GPT-4o
Alternative LLM if you prefer OpenAI
~$5 / M tokens
IBKR (Interactive Brokers)
Paper + live broker β the only one we use
Free paper account
yfinance
Historical & live market data
Free
Telegram Bot API
Trade alerts to your phone
Free
Cloudflare Workers
Hosts your dashboard publicly
Free tier
Python 3.14 + packages
The runtime that ties it all together
Free
Binance US
Optional β crypto trading
Free API
Realistic Monthly Cost
A typical firm running 2 strategies, scoring 50β200 stocks/day, sending Telegram alerts, and refreshing a dashboard every 5 minutes spends roughly:
$5β15/month on Claude Haiku for routine scoring
$0β5/month on Claude Sonnet for complex reasoning (only when invoked)
$0 on everything else
Cost Optimization Tip
Use Claude Haiku 4.5 for bulk scoring (cheap, fast, good enough). Only escalate to Sonnet 4.6 when a decision genuinely needs better reasoning β strategy design, anomaly explanation, weekly review. This single rule cuts the API bill by 80%.
What You Need Before Starting
A Mac, Linux machine, or Windows WSL β anything that runs Python 3.14
Install Paperclip, scaffold your firm's directory structure, and lay the foundation that every later module builds on.
Install Paperclip
Paperclip is the open-source agent orchestration platform we use. It runs as a single process on your machine, provides a chat UI, manages agent state, and exposes a clean Python API.
terminal β install paperclip
npm install -g paperclipai
# Verify install
paperclip --version
# Start the local server
paperclip start
# Visit the UI
open http://localhost:3100
Firm Directory Structure
Set up a clean directory layout from day one. The whole firm lives under a single folder you can version, back up, and migrate between machines:
config/ibkr.json mode must stay "paper" at all times until your strategy has passed all validation gates. Every executor in the firm hard-blocks on this value. Switching to live requires explicit board approval. Add the file to .gitignore so secrets never get committed.
Track 01 β Autonomous SystemsM-03
Designing Your Agents
Six agents. Each one with a single job. Each one with a written identity file. Together they run an entire firm.
The Hub-and-Spoke Topology
Agents do not talk directly to each other. They talk to the CEO agent, which routes work to whichever spoke agent is responsible. This keeps the system simple, traceable, and debuggable.
The Six-Agent Firm
Agent
Role
Authority
CEO
Orchestrates the firm. Routes work, sets daily focus.
Approves strategy changes, sets risk limits
Research
Screens universe, identifies candidates
Recommends, never trades directly
Risk Management
Sizes positions, sets stops, monitors drawdown
Can veto any trade
Execution
Places, monitors, cancels orders via IBKR
Only acts on Risk-approved trades
Communications
Telegram alerts, daily summaries, error reports
Read-only across firm
Compliance
Audits trades, checks for policy violations
Can halt the firm
The AGENTS.md File
Every agent has a single Markdown file that defines its identity: role, responsibilities, allowed tools, escalation rules, and tone. This is the agent's constitution. Get this right and everything downstream becomes easy.
agents/execution/AGENTS.md
# Execution Agent
## Role
You are the Execution Agent for a paper-trading firm. You place orders at
Interactive Brokers via the IBKRExecutor module. You are the only agent
that can submit, modify, or cancel orders.
## Authority
- Place bracket orders (entry + stop + target) when Risk approves
- Cancel orders on Risk or Compliance request
- Close positions on Risk override
## Hard Rules
1. NEVER trade without explicit Risk Agent approval
2. NEVER trade if config/ibkr.json mode != "paper"
3. NEVER place a position larger than risk_thresholds.json::max_position_pct
4. ALWAYS log every action to logs/execution.log
## Tools Available
- IBKRExecutor.place_bracket()
- IBKRExecutor.close_position()
- IBKRExecutor.cancel_all()
- IBKRExecutor.get_positions()
## Escalation
- TWS unreachable for >60s: alert CEO and Comms
- Order rejection: include rejection reason in escalation
- Daily P&L exceeds threshold: halt and escalate to Compliance
## Tone
Terse. Factual. No editorializing. Log line per action.
Design Principle
Agents should have narrow authority and broad observability. Each agent can read everything but write only in its lane. This makes failures localized and the system explainable.
Track 01 β Autonomous SystemsM-04
Strategy Design
A trading strategy is a contract: under condition X, take action Y, with stop Z. Here's how to write that contract so the agents can execute it without ambiguity.
The Two Live Strategies
This course teaches you to build two complementary strategies that the firm currently runs:
Active Strategy Portfolio
Strategy
Capital Share
Universe
Rebalance
Momentum v10
75%
40 large-cap US equities
Weekly (5-day cadence)
Lev ETF v2
25%
11 curated 2x/3x leveraged ETFs
Weekly (5-day cadence)
The Strategy Spec β A Real Example
Every strategy is a Markdown document in strategies/active/. The format is rigid because the agents read it programmatically:
strategies/active/momentum-v10.md
# Momentum v10
## Universe
40 large-cap US equities with avg daily volume >$500M.
Symbols: AAPL, NVDA, MSFT, GOOGL, AMZN, META, TSLA, ... (see config)
## Signal
Rank universe by 30-day total return (anti-lookahead: use .shift(1)).
Top 5 ranked stocks become candidates.
## Filter Layer
- VIX must be < 25 (or scale size to half)
- SPY must be above its 50-day SMA (regime filter)
- Each candidate scored 0-100 by Research Agent via Claude Haiku
## Entry
Market buy at next session open, equal weight among top 3 by score.
## Risk Template
- Stop loss: -8% from entry
- Profit target: +20% from entry
- Max position: 25% of strategy capital
- Max concurrent positions: 5
## Exit Rules
- Stop or target hit (broker bracket order)
- Stock falls out of top 10 by rank β close at next open
- Strategy capital drawdown > 15% β halt all new entries
## Capital
75% of trading capital (config/trading_capital.json)
The Three Strategy Templates
For risk consistency, the firm uses only three pre-defined risk templates. Every position must fit one:
Risk Templates
Template
Stop
Target
Max Position
Use For
Conservative
-5%
+10%
10% capital
Position trades, low-vol stocks
Standard
-8%
+20%
25% capital
Momentum names, mid-vol
Aggressive
-12%
+30%
40% capital
Lev ETFs, crypto
Track 01 β Autonomous SystemsM-05
Backtesting
Before any strategy gets paper capital, it must survive a brutal backtest. Here's the framework β including the lookahead-bias trap that kills most retail strategies.
The Anti-Lookahead Rule
The single most common backtesting mistake is using today's data to make today's decision. In real life, today's close prints after the market closes β you can only act on it the next day. Every signal calculation in the firm uses .shift(1).
scripts/backtest_momentum.py
import yfinance as yf
import pandas as pd
UNIVERSE = ["AAPL","NVDA","MSFT","GOOGL","AMZN","META","TSLA","NFLX","AVGO","AMD"]
# Pull 2 years of daily data
data = yf.download(UNIVERSE, period="2y", interval="1d")["Close"]
# Compute 30-day return signal β SHIFTED to prevent lookahead bias
signal = data.pct_change(30).shift(1)
# Each day, rank symbols by signal, pick top 3
top3 = signal.apply(lambda row: row.nlargest(3).index.tolist(), axis=1)
# Compute forward 5-day returns for those picks
fwd_returns = data.pct_change(5).shift(-5)
# Realized strategy return
strategy_returns = []
for date, picks in top3.items():
if not isinstance(picks, list): continue
daily_avg = fwd_returns.loc[date, picks].mean()
strategy_returns.append(daily_avg)
# Stats
import numpy as np
returns = pd.Series(strategy_returns).dropna()
sharpe = (returns.mean() / returns.std()) * np.sqrt(252)
print(f"Sharpe: {sharpe:.2f}")
print(f"Win rate: {(returns > 0).mean()*100:.1f}%")
print(f"Total return: {(1+returns).prod()-1:.2%}")
The Validation Gates
A strategy must pass all of these on the backtest before earning paper capital. These are non-negotiable.
Backtest Gates
Metric
Minimum
Reason
Trades over backtest
> 50
Statistical significance
Win rate
> 52%
Edge over coin flip
Profit factor
> 1.25
Wins must significantly exceed losses
Sharpe ratio
> 1.0
Risk-adjusted return
Max drawdown
< 25%
Survivability
Cost/Gross ratio
< 100%
Strategy survives transaction costs
The Walk-Forward Test
A passing backtest is not a passing strategy. Always do a walk-forward test: optimize on Jan 2020 β Dec 2023, then test untouched on Jan 2024 β present. If performance collapses out-of-sample, you've overfit. Re-design or kill.
Track 01 β Autonomous SystemsM-06
Live Execution
Now the Execution Agent comes online. This is where signals become orders, orders become positions, and the firm starts trading paper capital.
The Bracket Order Pattern
Every position the firm opens is a bracket order: one atomic submission containing the entry, the stop-loss, and the profit target. If you place these separately, you risk a partial fill leaving you exposed. Bracket = atomic = safe.
Newer IBKR ibapi versions default eTradeOnly=True and firmQuoteOnly=True. Paper accounts reject these silently with error 10268. Always set both to False on every order, every leg.
The Daily Execution Loop
The Execution Agent runs once per day at market open + 5 minutes. Here's what it does:
The Kelly Criterion tells you the mathematically optimal bet size β but full Kelly bankrupts you on the first bad streak. The firm uses quarter-Kelly: take 25% of what Kelly recommends. Significantly safer, captures most of the geometric return.
Every 5 minutes, a heartbeat script writes the current firm state to dashboard/trades.json and sends an OK to Telegram if anything changed. If three consecutive heartbeats fail, the Comms Agent escalates to your phone with a π΄ alert.
The Validation Gates β Paper to Live
The firm stays on paper until it earns the right to go live. The gates are absolute β no exceptions:
Paper β Live Gates
Gate
Threshold
Why
Completed trades
> 30
Sample size
Win rate
> 52%
Edge
Profit factor
> 1.25
Wins exceed losses
Max drawdown
< 15%
Survivability
Consecutive trading days clean
> 20
Operational reliability
Board approval
Explicit sign-off
Human in the loop
When You Flip the Switch
Going live is a one-line change: config/ibkr.json::mode from "paper" to "live", and config/ibkr.json::port from 7497 to 7496. Then restart all agents. Every executor was built to fail closed on missing config β so flipping is safe but should never be done without all gates passing.
You've Built the Firm. Now Get the Prompts.
This course gave you the architecture. The Prompt Arsenal gives you every copy-paste prompt used to build it β agent identities, executor code, backtest logic, dashboard infrastructure.
DeadCatFound is an educational platform only. We are not a registered financial advisor, broker-dealer, investment advisor, or financial institution of any kind. Nothing in this course constitutes financial advice, investment advice, or any recommendation to buy or sell any security.
All content is for educational and informational purposes only. Trading involves substantial risk of loss. Always consult a licensed financial professional. By accessing this course you acknowledge that DeadCatFound bears no liability for any financial outcomes.