Explore more topics
AI trading workflows

Research and test trading strategies with Codex

See Codex validate a dividend-growth strategy, run a historical backtest and compare the completed curve with SPY. Copy the exact rules to try the workflow.

Jump to a section

TL;DR

Codex validated and saved an inactive dividend-growth strategy, then ran a NexusTrade backtest from January 2, 2025 through October 7, 2026. A simulated $10,000 grew to $14,614.84 (46.15%), versus $13,405.37 (34.05%) for SPY. The chart below shows the completed run. Historical S&P 500 membership at each date was not separately verified.

Codex tested a strategy against SPY

Portfolio value (USD)

Codex backtest: five dividend growers versus SPY, January 2, 2025 to October 7, 2026$14.7K$7.9KLargest decline in plotted observations: 24.33%, 2025-02-13, 16:00:00 EST to 2025-04-07, 09:30:00 EDT2025-01-022026-10-07
Five dividend growers 2026-10-07, 16:00:00 EDT
$14,614.84
SPY buy and hold 2026-10-07, 16:00:00 EDT
$13,405.37

Five dividend growers: 24.33% largest decline in plotted observations. 2025-02-13, 16:00:00 EST ($10,415.39) to 2025-04-07, 09:30:00 EDT ($7,881.71).

Five dividend growersSPY buy and holdHistorical simulationDates shown in New York time

Codex completed this test on October 18, 2026. From $10,000, the strategy returned 46.15% versus SPY's 34.05% over January 2, 2025 through October 7, 2026.

The rules select the five largest S&P 500 companies meeting a ten-year annual dividend-increase filter and weight them equally. Allocation is reviewed when portfolio value equals starting value or 30 days have passed since a filled buy.

Both curves reinvest dividends. Strategy stock transactions cost 0.1% per fill ($24.14 total); the full-capital SPY benchmark pays no candidate commissions. Reported strategy maximum drawdown was 24.33%.

Historical S&P 500 membership at each date was not separately verified. This is one retrospective window; the original example includes earlier snapshots, including a 2014 start where SPY finished ahead.

What Codex did, from rules to result

Inspect the request

Connect Codex before trying the workflow. The copy button supplies the exact strategy JSON for validation first; the linked guide walks through saving your own draft and approving one historical test.

  1. Validated and saved the strategy

    Codex sent the exact configuration to build_portfolio, received valid:true with no issues, and saved an inactive chat draft with create_portfolio. A get_portfolio read confirmed automated trading was off.

  2. Submitted one historical test

    Codex called backtest_portfolio with the returned draft ID, the dates above, daily evaluation, $10,000, SPY, reinvested dividends and a 0.1% stock fee. Detailed event capture was off.

  3. Read the completed comparison

    Codex polled the same accepted backtest ID until COMPLETE, then read query_backtest_history. It used the returned strategy value and comparisonValue fields to draw both curves. The draft remains inactive.

A real Codex request, with a filing you can open

Inspect the request

On October 12, 2026, Codex called NexusTrade's sec_edgar tool for one Apple filing. The response identified Apple Inc.'s 10-Q filed July 31, 2026, covering the period ended June 27, 2026.

The request and selected response fields are shown below. Open the returned SEC document to read the original filing, or connect Codex and copy the request to try it yourself. A fresh request may return a later filing.

JSON
{
  "request": {
    "action": "list_filings",
    "ticker": "AAPL",
    "limit": 1
  },
  "returnedFields": {
    "entityName": "Apple Inc.",
    "form": "10-Q",
    "filed": "2026-07-31",
    "periodEnd": "2026-06-27"
  }
}

Choose what you want to do next

Read a company filing, inspect a completed historical comparison, or follow a paper portfolio through its controls. Each guide includes the evidence and steps for that task.

Connect Codex and try the request

codex mcp add nexustrade --url https://nexustrade.io/api/mcp
codex mcp login nexustrade

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

For the CLI, run these commands, complete NexusTrade sign-in in your browser, then start Codex and open /mcp to see the connected tools. Copy the filing request above into Codex.

The desktop app and IDE extension share the local MCP configuration. The full setup guide covers the desktop settings path. ChatGPT web uses a separate connection.

Turn your strategy rules into a testable draft

Give Codex your universe, entry rules, position sizes and exits. Ask it to produce an explicit portfolio definition and keep the assumptions and source notes beside it in your workspace. Review that draft before submitting a historical test.

Replace "these rules" in the prompt below with your own specification. Include a baseline and the historical window you want to compare.

Prompt
Create a new paper-only candidate from these rules. Show the exact universe, entries, sizing and exits. Keep a research note with the strategy configuration and source links. After I approve the draft, submit one historical test, preserve its operation ID, and explain its warnings. Do not edit or deploy an existing live portfolio.

Keep each experiment easy to compare

Save the portfolio definition, returned portfolio and backtest IDs, dates, assumptions and warnings together. Compare a parameter change over the same historical window and costs, then test a separate period.

For paper trading, record the new paper deployment ID separately from the draft ID. Keep the reason you advanced or rejected each candidate with its results.

Before working with an owned portfolio

Optional account checklist and read-only prompt

Use this checklist when you move from public filings to your own portfolios.

  1. Read the account once

    Ask Codex to list your portfolios and inspect one returned ID. Compare its name, strategies and deployment type with your NexusTrade account.

  2. Resolve a mismatch before changes

    An authenticated empty list is valid for a new account. If the identity is wrong or access fails, resolve sign-in before saving a draft or changing a portfolio.

Prompt
Use only NexusTrade read tools. Call fetch_portfolios, then get_portfolio with one returned portfolio ID. Report the ID, name, strategies and deployment type. If the authenticated list is empty, report that result. Do not create, edit, backtest, deploy or place orders.

If NexusTrade tools do not appear

Open /mcp and check that NexusTrade is listed. If it is missing, check the server URL and restart the connection. For an authentication error, run codex mcp login nexustrade and complete browser sign-in, then retry the read.

Full recorded filing reference

Inspect the five recorded filing fields

These are the filing fields returned by NexusTrade in the October 12, 2026 Codex request shown above.

Returned fieldRecorded result
CompanyApple Inc.
Form10-Q
Filing date2026-07-31
Period ended2026-06-27
Accession0000320193-26-000020

Exact historical test inputs

Inspect the submitted settings and reproduction placeholder

These settings match the completed Codex run. Replace the portfolio placeholder with the ID returned for your own validated draft. The original accepted ID is retained with the experiment record.

JSON
{
  "portfolio_id": "REPLACE_WITH_YOUR_RETURNED_DRAFT_ID",
  "start_date": "2025-01-02",
  "end_date": "2026-10-07",
  "interval": "Day",
  "initial_value": 10000,
  "baseline_symbol": "SPY",
  "dividend_policy": "reinvest",
  "fee_config": {
    "Stock": {
      "amount": 0.1,
      "type": "percent"
    }
  },
  "generate_events": false
}

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.