Miles Free AI Library
← Back to resources
GuideMiles FinanceSep 21, 2026

Build a 12 Person Claude Paper Trading Desk

Set up TradingAgents with Claude Code and an Alpaca paper account to research tickers, save structured verdicts, prepare conditional order plans, require manual approval, and run a killable─

Get the full MD

Download the complete paper trading desk setup guide

Free
Download MD

Build a 12 Person Claude Paper Trading Desk

Set up TradingAgents, connect an Alpaca paper account, generate labelled research reports, and prepare conditional order plans with explicit approval controls.

What you will achieve

You will have a local research desk that analyzes tickers, saves structured verdicts, converts its own price levels into paper order plans, and supports a manual daily workflow with a kill switch.

Who this is for

Claude Code users who are comfortable with a terminal and want to experiment with agent based trading research without risking real money.

Difficulty: Advanced

Short tutorial

Set up TradingAgents, connect an Alpaca paper account, generate labelled research reports, and prepare conditional order plans with explicit approval controls.

Guide: Build a 12 Person Claude Paper Trading Desk

Time: 45 to 90 minutes for setup, plus about 1

What you will build

This tutorial uses the open source TradingAgents project to organize Claude into a research workflow with four analysts, bull and bear researchers, a research manager, a trader, three risk perspectives, and a portfolio manager.

You will also connect Alpaca's official MCP server to a paper account. The resulting workflow can:

  1. Research a ticker and debate the case for and against it.
  2. Save the complete analysis as Markdown and the final verdict as JSON.
  3. Convert the verdict into conditional paper orders using only levels from the report.
  4. Require you to type YES before submitting an order.
  5. Run a manual daily loop with dry run output, optional Telegram summaries, and a STOP file kill switch.

The fastest implementation method is to give Claude Code the complete setup prompt below. Claude Code should inspect the current repositories before writing scripts, ask for credentials only when required, and report which steps passed or failed.

TradingAgents is a research tool, not a reliable signal or profit system. Repeated runs can produce different conclusions. Keep this setup on Alpaca paper trading.

1. Prepare the required tools

You need the following:

RequirementPurposeSource
Claude CodeRuns the installation and scriptshttps://docs.claude.com/en/docs/claude-code
Python 3.12Runs TradingAgentshttps://www.python.org/downloads
GitClones the repositorieshttps://git-scm.com/downloads
uvRuns the Alpaca MCP serverhttps://docs.astral.sh/uv/getting-started/installation
Anthropic API keyPays for the Claude model callshttps://console.anthropic.com
Alpaca paper accountReceives simulated ordershttps://alpaca.markets
FRED API key, optionalAdds rates, CPI, and yield datahttps://fred.stlouisfed.org/docs/api/api_key.html

Confirm the local tools are available:

Shell
claude --version
python3.12 --version
git --version
uv --version

If a repository README differs from this tutorial, follow the current README.

2. Create the Alpaca paper account

Complete this part in a browser before running the main setup.

  1. Open https://alpaca.markets and create a free account.
  2. In the dashboard, switch the account from Live to Paper.
  3. Open the paper dashboard at https://app.alpaca.markets/paper/dashboard/overview.
  4. Review the starting paper balance. The default described in the source setup is $100,000.
  5. If you want another starting balance, use Reset before placing orders. Resetting removes existing positions.
  6. Find API Keys, select Generate New Keys, and copy both the API key and secret key.
  7. Store the keys securely. The secret is shown only once.

Use paper keys only. Do not generate or configure live trading keys for this tutorial.

3. Run the complete setup prompt in Claude Code

Open Claude Code, paste the following prompt, or save this tutorial locally and drag it into the Claude Code terminal. The prompt instructs Claude Code to inspect the actual project interfaces instead of guessing them.

TEXT
I'm setting up TradingAgents (https://github.com/TauricResearch/TradingAgents) so Claude runs as a trading research desk, and connecting it to my Alpaca PAPER account. Work in ~/trading-desk.

Before writing code, read the repository README and tradingagents/default_config.py. Use the API names the repository actually exposes. Do not guess. Stop and ask whenever you need a key. Never configure live trading. Never place an order unless I type YES first. If a step fails twice, log the failure and continue to the next step.

STEP 1: Install TradingAgents

Clone the repository into ~/trading-desk/tradingagents. Create a Python 3.12 virtual environment inside it and run `pip install .`.

Ask me for my Anthropic API key and set ANTHROPIC_API_KEY through local configuration. Confirm that the free Yahoo Finance data path works by pulling five days of BTC-USD data.

Inspect the repository and tell me which Claude model IDs it supports for deep_think_llm and quick_think_llm. Select the strongest supported model for deep thinking and a faster supported model for quick thinking.

If I provide a FRED API key, set FRED_API_KEY. Otherwise skip it because the desk must still work without FRED.

STEP 2: Create research_floor.py

Write a script using TradingAgentsGraph. It must accept:

* --ticker
* --date, defaulting to today
* --rounds, defaulting to 3

Use this configuration:

* llm_provider: anthropic
* deep_think_llm and quick_think_llm: the supported models selected in Step 1
* Enable all four analysts
* max_debate_rounds: the value supplied through --rounds
* max_risk_discuss_rounds: 2
* debug: True

As each stage finishes, print a clear heading and the result in this exact order:

1. Memory
2. Market Analyst
3. Sentiment Analyst
4. News Analyst
5. Fundamentals Analyst
6. Bull Case, separated by round
7. Bear Case, separated by round
8. Research Manager
9. Trader
10. Risk Team, separated by persona and round
11. Portfolio Manager

Before each stage, print one line identifying the agent currently working.

End with these five summary lines:

* Verdict
* Conviction
* Strongest bull point
* Strongest bear point
* What would flip the verdict

Save the full output to:

./reports/<ticker>-<date>.md

Save the structured verdict to:

./reports/<ticker>-<date>.json

Print total run time and approximate cost. Test the script once with BTC-USD and --rounds 1.

STEP 3: Verify memory

Inspect the code and confirm where TradingAgents stores its decision log and reflections. The expected default location is under ~/.tradingagents/.

If the repository exposes a supported function for recording the realized return of a past decision, connect it to research_floor.py. A new run for a ticker should settle the previous call for that ticker and show the resulting reflection before the Portfolio Manager decides.

Do not invent an unsupported memory API.

STEP 4: Connect the Alpaca MCP server

Read the current README at https://github.com/alpacahq/alpaca-mcp-server.

Register Alpaca's official MCP server with Claude Code at user scope using the README's current instructions. The expected command structure is:

claude mcp add alpaca --scope user --transport stdio uvx alpaca-mcp-server --env ALPACA_API_KEY=... --env ALPACA_SECRET_KEY=...

Ask me for my PAPER API key and PAPER secret key. Leave ALPACA_PAPER_TRADE at its default value of true.

Verify the server appears in:

claude mcp list

Then use it to show my paper account balance and confirm whether any paper positions are open.

STEP 5: Create trade_from_verdict.py

Write a script that reads:

./reports/<ticker>-<date>.json

It must convert the verdict into an Alpaca paper order plan using these rules:

* Use only price levels explicitly produced by the research desk, including breakout trigger, pullback zone, and stop.
* Never invent a price.
* Never use market orders.
* Use only limit or stop-limit orders.
* Make orders good till cancelled.
* Size each order at 10 percent of current cash.
* Never allocate more than 20 percent to one ticker across all open and proposed orders.
* For Hold with a breakout trigger and pullback zone, create a stop-limit buy at the breakout, with the limit 0.4 percent above it, plus a limit buy in the lower half of the pullback zone.
* For Buy with medium or higher conviction, create a limit buy at or just below today's close and attach the desk's stop as a bracket.
* For Sell when the account has no position, take no action.

Before submission, print a table containing:

* Ticker
* Verdict
* Order type
* Trigger
* Limit
* Quantity
* Dollar value
* Attached stop
* Exact report line that supplied each level

After printing the table, wait for me to type YES. Submit nothing for any other response.

Add a --dry-run flag that prints the table and exits without placing an order. Test it in dry run mode using the JSON created in Step 2.

STEP 6: Create run_daily.sh, but do not schedule it

Write a shell script that:

1. Exits immediately if ~/trading-desk/STOP exists.
2. Cancels open conditional paper orders left from the previous day.
3. Runs research_floor.py for every ticker in a TICKERS variable with --rounds 2.
4. Runs trade_from_verdict.py with --dry-run for each result.
5. Sends each ticker's five line summary to Telegram only when TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID are configured.
6. Appends one row per ticker to ./reports/daily_log.csv.

The CSV columns must be:

 date, ticker, verdict, conviction, action, account equity

Show me an example launchd entry for macOS or cron entry for other systems that would run the script at 9:00 AM local time on weekdays. Do not install or enable the schedule.

STEP 7: Hand off the finished setup

Return a table showing:

* Component
* Passed or failed
* File path
* Verification performed
* Any unresolved issue

Then show the three commands I should run for:

1. A labelled research run
2. An order plan
3. The daily loop by hand

Finally, report the measured or estimated token usage and approximate cost of the completed test run. Do not claim an exact token count unless it is available from the API or logs.

When prompted for credentials, provide only the requested paper or API credentials through the local setup flow. Never commit secrets to Git or place them in generated reports.

4. Verify the generated files

Claude Code should create or confirm files similar to these:

TEXT
~/trading-desk/
├── STOP
└── tradingagents/
    ├── .venv/
    ├── research_floor.py
    ├── trade_from_verdict.py
    ├── run_daily.sh
    └── reports/
        ├── BTC-USD-<date>.md
        ├── BTC-USD-<date>.json
        └── daily_log.csv

The STOP file does not need to exist during normal operation. Creating it should prevent run_daily.sh from doing anything.

Use this checklist before proceeding:

  • [ ] TradingAgents installed inside a Python 3.12 virtual environment.
  • [ ] BTC-USD data retrieval succeeded.
  • [ ] The supported Anthropic model IDs came from the repository configuration.
  • [ ] A one round test produced both Markdown and JSON reports.
  • [ ] Alpaca MCP appears in claude mcp list.
  • [ ] The displayed Alpaca account is a paper account.
  • [ ] trade_from_verdict.py --dry-run submits nothing.
  • [ ] Every planned price includes its source line from the report.
  • [ ] Orders require an explicit YES before submission.
  • [ ] run_daily.sh checks for ~/trading-desk/STOP first.
  • [ ] No schedule was installed automatically.

5. Run the desk manually

Activate the environment and run a three round analysis:

Shell
cd ~/trading-desk/tradingagents
source .venv/bin/activate
python research_floor.py --ticker BTC-USD --rounds 3

Use symbols such as BTC-USD or ETH-USD for crypto. Use symbols such as META or NVDA for stocks.

One round is useful for testing. Three rounds allow the bull and bear researchers to respond to each other. The source setup estimates about 14 minutes and roughly $1.75 for a full three round run, but actual time and API cost depend on the supported models and generated token usage.

Inspect the generated Markdown report and its five line summary before creating any order plan.

6. Produce a paper order plan

Always test the result first:

Shell
python trade_from_verdict.py reports/BTC-USD-<date>.json --dry-run

Confirm that:

  1. Every trigger, limit, and stop came from the report.
  2. No market order appears.
  3. The proposed allocation respects the 10 percent per order and 20 percent per ticker limits.
  4. The account is still the Alpaca paper account.
  5. The quantity and dollar calculations are reasonable.

To allow the script to prepare submission, omit --dry-run:

Shell
python trade_from_verdict.py reports/BTC-USD-<date>.json

The script must still wait for the exact confirmation YES before submitting anything.

7. Run the daily loop by hand

Do not schedule the loop until you have reviewed its contents and tested it repeatedly in dry run mode.

Run it manually with:

Shell
cd ~/trading-desk/tradingagents
./run_daily.sh

Stop future manual or scheduled runs by creating the kill switch:

Shell
touch ~/trading-desk/STOP

Reenable the loop by removing it:

Shell
rm ~/trading-desk/STOP

The generated loop should retain --dry-run unless you deliberately decide to allow paper order submission.

Useful Claude Code commands

Analyze two tickers and prepare paper plans

TEXT
Run research_floor.py on BTC-USD and META for today with 3 rounds. When both finish, read the two JSON reports and turn each verdict into a concrete order plan for my Alpaca PAPER account using trade_from_verdict.py's rules: only the desk's own levels, no market orders, 10 percent of cash per order, 20 percent maximum per ticker, and good till cancelled. Show me the table with the source line for every level. Wait for YES. Then place them through the Alpaca MCP and show me the open orders.

Review the desk's recorded decisions

TEXT
Read ~/.tradingagents/memory/trading_memory.md and give me a table of every recorded call: date, ticker, verdict, what the price did afterward, and the recorded lesson. Then identify which lessons were applied in later calls and which were not. If the file or fields differ, inspect the repository's actual memory structure and explain the difference instead of guessing.

Compare two research debates

TEXT
Run research_floor.py on ETH-USD and SOL-USD for today with 2 rounds. Show both five line summaries side by side. Tell me which ticker had the stronger bear case and explain why using the generated reports.

Cancel all paper orders

TEXT
Using the Alpaca MCP, cancel all open orders on my paper account and then show me the open order list so I can confirm it is empty. Do not access a live account.

Nonnegotiable safety rules

  • Use an Alpaca paper account only.
  • Never generate or configure live keys for this workflow.
  • Never place market orders.
  • Never use a price that is absent from the desk's report.
  • Keep order submission behind explicit YES confirmation.
  • Start with --rounds 1 and --dry-run while validating the setup.
  • Remember that every run bills the Anthropic API key.
  • Create ~/trading-desk/STOP whenever the daily loop must be disabled.
  • Treat every verdict as research, not financial advice or a guaranteed signal.
  • Paper results over a short period are not evidence that the workflow will perform with real money.
Continue exploring

What to watch next