Explore more topics
AI trading walkthrough

I connected Claude Code to a trading API and tested a GOOG trend strategy

An experiment in using Claude Code beyond coding. Research GOOG, build 50/200-day trend rules, backtest four windows including a 6.01% loss, then review paper and live deployment.

As of 2026-10-14

Worked strategy
GOOG 50/200-day trend
Evidence status
Four historical development tests; SPY baseline not recorded
Jump to a section

Follow this worked strategy

I connected Claude Code to the NexusTrade trading API and had it research GOOG, turn a 50/200-day trend idea into explicit rules, and test them across four recorded windows. The agent operated this workflow through NexusTrade's MCP server; it did not build the integration. One window lost 6.01% with a 21.46% drawdown. These are development tests on examined dates. Judge frozen rules on dates you have not used yet.

Follow the full journey

Step 1 of 6

Connect Claude Code

Add the NexusTrade server

claude mcp add --transport http nexustrade https://nexustrade.io/api/mcp

Scroll horizontally to read the full command, or copy it.

Run this command in your project terminal to add NexusTrade for the current project.

Sign in to your NexusTrade account

claude mcp login nexustrade

Scroll horizontally to read the full command, or copy it.

Complete browser sign-in using the same project folder as the add command. Start Claude Code and use /mcp to inspect the connected server and its tools. For a connection across projects, add --scope user before the server name when registering it.

What you should see

The result identifies Apple's company filing, filing date and source URL. The connection check makes no account changes.

Inspect the request

Step 2 of 6

Research the company

Build a dated GOOG brief from filings before writing a trading rule. Keep the source dates and missing fields with the brief.

What you should see

A company brief identifies the reporting period, units and original sources.

Inspect the request

GOOG entry and exit rules in NexusTrade's actual strategy display
The strategy display renders the saved GOOG rules used in the historical example.
Step 3 of 6

Turn the idea into explicit rules

Buy whole GOOG shares with available buying power when its 50-day average is above its 200-day average and no GOOG is held. Close the holding below the opposite threshold. Equality takes no action.

What you should see

The preview shows both trend comparisons and holding guards. Saving returns your own draft ID.

Inspect the request

Step 4 of 6

Inspect historical behavior

Read the losing window as well as the stronger ones. These windows have already been examined; freeze the candidate before choosing dates you have not used.

What you should see

A completed test returns its own ID, curve, drawdown and recorded statistics. Inspect the losing example below.

Inspect the request

Paper trading evaluation control in Deployment Center
The current paper controls are shown with example data. Your forward history starts when your own paper portfolio runs.
Step 5 of 6

Observe the same rules in paper trading

Create a separate paper portfolio from the reviewed GOOG draft. Record its start date and evaluation schedule. Review pending simulated orders, then follow holdings and dated values while keeping the rules fixed.

What you should see

The running paper portfolio has a separate ID, evaluation schedule and forward observation log.

Inspect the request

Port to Live shows the selected account, incoming GOOG rules and existing rule to disable
This current Port to Live screen uses an example Alpaca account. It shows the review before confirmation.
Step 6 of 6

Review the move to your broker

From the reviewed paper portfolio, open Deployment Center and select Port to Live. Compare the selected account, incoming rules and any existing rules that will be disabled. Confirmation enables the live target and activates the copied rules.

Follow the visual live-deployment guide
What you should see

The app shows the broker account and exact strategy changes before you confirm the move.

Follow the Claude Code session

claude mcp add --transport http nexustrade https://nexustrade.io/api/mcp

Scroll horizontally to read the full command, or copy it.

This guide runs on NexusTrade's MCP server. Claude Code operated the trading workflow below, from connection to the live review. The agent's role here is operating the workflow through that server.

The table names the tool call, the approval checkpoint, and the artifact to keep at each stage. Placeholders such as a returned draft ID stand for values your own run returns. This page records no IDs from anyone else's run.

The recorded anchor is the four-window table below. It includes the window that lost 6.01% with a 21.46% maximum drawdown.

Show the table · 6 rows, 4 columns

Scroll sideways to compare all columns. Select a heading to sort.

Connect Claude Codesec_edgar list_filings for AAPL with limit 1Public read only. No portfolios, ingested filings, or changes.Filing company, form, date, and source URL
Research GOOGFiling and company tools for the latest GOOG filingResearch-only step. Dates, units, and missing values stay with the brief.Dated GOOG company brief
Draft the rulesbuild_portfolio preview, then create_portfolioApprove the rules before saving. Stop before tests.Returned draft ID with a readback
Test historyDaily backtest from 2024-08-15 to 2025-04-23 at $10,000 with an SPY baselineShow the request and estimated cost. Submit once and poll the same test.Returned backtest ID, curve, and drawdown
Observe on paperSeparate paper-only deployment from the reviewed draft at $10,000Show the plan, then verify the portfolio is paper.Running paper ID and dated history
Review liveDeployment Center Port to Live review in the appCompare the account and rule changes before confirmation.Reviewed live target

Where Claude Code stops for approval

Each consequential action in this guide waits at an approval gate. The agent previews first and acts only after explicit approval.

The rules preview returns valid and issues before anything is saved. The agent resolves problems and re-previews instead of saving a candidate with open problems.

  1. Approve the rules before the agent saves them

    The agent previews the configuration with build_portfolio and shows entry, sizing, exits, valid, and issues. It saves with create_portfolio only after approval and reads the returned draft back.

  2. Approve the test cost before the agent submits once

    Historical tests are paid runs. The agent shows the exact request and estimated cost for approval before submitting once, then polls the same returned test ID until complete.

  3. Approve the paper plan and verify it is paper

    The paper deployment is a separate portfolio with its own ID. The agent shows the plan for approval, verifies the deployment type, and leaves brokerage accounts unchanged.

  4. Confirm the live move explicitly, or nothing moves

    The move to live happens in Deployment Center. The app shows the selected account, the incoming rules, and the existing rules that would be disabled before confirmation enables anything.

Read the four recorded historical tests

The same GOOG rules across four recorded windows

Scale: −70.86 to +70.86 % · zero baseline

2023-03-30 to 2023-12-06

  • Strategy return+26.23%

2023-12-07 to 2024-08-14

  • Strategy return+18.61%

2024-08-15 to 2025-04-23

  • Strategy return-6.01%

2025-04-24 to 2025-12-31

  • Strategy return+70.86%

These independent development tests each restart with $10,000, whole shares, cash dividends and 0.1% stock transaction fees. The third window lost 6.01%. The stored windows carry no SPY baseline.

Show the table · 4 rows, 6 columns

Scroll sideways to compare all columns. Select a heading to sort.

2023-03-302023-12-0626.23%Not recorded13.19%0
2023-12-072024-08-1418.61%Not recorded18.27%0
2024-08-152025-04-23-6.01%Not recorded21.46%4
2025-04-242025-12-3170.86%Not recorded8.67%0

These four windows are development tests on dates the researchers already examined. They are not independent out-of-sample evidence. Freeze the rules before testing dates you have not used. The stored windows record strategy return only, without an SPY baseline.

Keep the experiment together

Keep the company brief, saved rules, backtest ID, paper observation dates and live account review together. Paper positions, cash and performance history stay on the paper portfolio when you port its strategies.

Continue exploring

Discussion

Sign in or create a free account to join the discussion.

No comments yet.

Aurora · AI research assistant

Try this in Aurora

Edit the request, then open it in Aurora. You choose when to send it.