Explore more topics
AI trading walkthrough

I connected Codex to a trading API and stress-tested an NVDA strategy

An experiment in using Codex beyond coding. Research NVDA, freeze intraday rules, and inspect walk-forward selection, fee sensitivity, and a trade audit.

As of 2026-10-14

Worked strategy
NVDA intraday momentum and NVD breakdown
Evidence status
Retrospective walk-forward development evidence; continuous NVDA comparison
Jump to a section

Follow this worked strategy

I connected Codex to the NexusTrade trading API and had it research NVDA, freeze intraday momentum rules, and inspect a five-fold walk-forward study with fee reruns and a trade audit. The agent operated this workflow through NexusTrade's MCP server; it did not build the integration. Native selection returned 14.13% against continuous NVDA at 49.20%, and one replay discrepancy stays open.

Follow the full journey

Step 1 of 6

Connect Codex

Add the NexusTrade server

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

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

In the desktop app, open Settings, then MCP servers and Add server. Enter nexustrade as the name, choose Streamable HTTP and paste the URL shown above. Save, select Restart and choose Authenticate when the server requests OAuth. Sign in to NexusTrade in the browser. Type /mcp in the composer to check connected servers.

Sign in to your NexusTrade account

codex mcp login nexustrade

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

Complete browser sign-in, then start Codex and use /mcp to inspect the connected server. The desktop app, CLI and IDE extension share the local MCP configuration. ChatGPT web does not read this local configuration.

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 NVDA and the NVD inverse ETF

Read NVIDIA company filings and the NVD daily inverse objective separately. The bearish rule buys actual NVD shares, whose daily reset and price tape matter.

What you should see

A dated brief names the instrument, original sources and assumptions that matter to this strategy.

Inspect the request

Step 3 of 6

Inspect the frozen intraday candidate

Preview the latest fixed research candidate copied from its saved rules: NVDA momentum or NVD breakdown, one position at a time, session entry limits and day-end exits. The quarterly selection study below uses separate winners by fold.

NVDA entry
5-minute return ≥ 0.75%; above VWAP; relative volume ≥ 1.5; buy 99% of buying power while flat
NVD entry
NVDA below prior 60-minute low, VWAP and 5-calendar-day observed-price mean; relative volume ≥ 1.5; buy 49.5% while flat
Session
Enter 10:00 to before 15:20 Eastern; liquidate at 15:40; skip specified early closes
Exits
NVDA: 1% loss / 3% gain. NVD: 2% loss / 2% gain; inspect the saved rule JSON.
What you should see

The preview contains four exact entry/exit rules. The latest fixed candidate uses a five-calendar-day observed-price mean and 2% NVD stop and profit thresholds.

Five-fold historical NAV: strategy ends at $11,412.66; continuous NVDA at $14,920.4815.5K9.6K2025-07-022026-09-30
Quarterly strategy selection (native) 2026-09-30, 00:00:00 UTC
11,412.66
Continuous NVDA 2026-09-30, 00:00:00 UTC
14,920.48
Quarterly strategy selection (native)Continuous NVDAHistorical simulation
Five-fold native selection, 2025-07-02 through 2026-09-29 Eastern. Each fold has its own selected candidate; the fixed draft is a separate experiment.
Step 4 of 6

Inspect the walk-forward study and cost sensitivity

The chart chains five separately selected quarterly candidates. It is evidence about that selection procedure, not a backtest of the latest fixed candidate above. Inspect the shorter ordinary replays and fee sensitivity below.

First recorded mark
Jul 2, 2025 · 08:01:00 UTC
Last recorded mark
Sep 30, 2026 · 00:00:00 UTC
Vertical axis range (USD)
9644.75 to 15521.98
What you should see

The five-fold native selection returned 14.13% versus continuous NVDA 49.20%. The shorter ordinary replay returned 16.38% versus 14.17%, with a first-fold native/replay discrepancy still open.

Inspect the request

Step 5 of 6

Observe NVDA intraday momentum and NVD breakdown in paper trading

Observe the fixed four-rule candidate with minute evaluations and Eastern session limits. Record the signal-to-fill delay and check that the day-end liquidation closes both instruments.

Inspect before accepting an order
One NVDA/NVD holding at a time, the filled-buy cooldown, minute evaluation, early-close exclusions and day-end liquidation.
What you should see

Your paper portfolio has its own ID, start date, schedule and dated history. These forward observations begin with your own run.

Inspect the request

Step 6 of 6

Review NVDA intraday momentum and NVD breakdown for live deployment

Review equity and inverse-ETF support together with evaluation timing and account restrictions. The live target must preserve the fixed rules you actually observed in paper.

Open the live deployment walkthrough
Account and instrument review
NVDA/NVD eligibility, fractional support, buying power, minute scheduling, session exits, early closes and order approval.
What you should see

The review identifies the target account, supported instruments, rule changes and approval settings before confirmation.

Inspect the request

Follow the Codex session

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

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

This guide runs on NexusTrade's MCP server. Codex 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 walk-forward study, the fee reruns, and the trade audit below, including the unresolved first-fold replay difference.

Show the table · 6 rows, 4 columns

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

Connect Codexsec_edgar list_filings for AAPL with limit 1Public read only. No portfolios, ingested filings, or changes.Filing company, form, date, and source URL
Research NVDA and NVDNVDA filings plus the NVD fund prospectusDated brief with sources. The NVD daily reset and allocations stay explicit.Dated NVDA and NVD brief
Draft the rulesbuild_portfolio preview, then one create_portfolioApprove the rules before saving. Stop before paid tests.Returned draft ID with a readback
Test historyMinute backtest inside supported data and compute limits at $10,000Show dates, rules, and estimated cost before submission.Fixed-candidate result, kept separate from the selection study
Trade on paperSeparate paper-only deployment at $10,000Show the plan. Verify the portfolio is paper.Running paper ID and dated history
Review liveLive deployment review against the actual accountLive trading stays unchanged until explicit confirmation.Reviewed plan, or a stop report when unsupported

Where Codex 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 agent reads the actual account and broker capabilities first and keeps live trading unchanged until explicit confirmation. It reports an unsupported instrument or action and stops.

The nine-month lead and its replay discrepancy

Three-fold ordinary replay NAV: strategy ends at $11,637.93; continuous NVDA at $11,416.9813.5K9.7K2025-07-022026-04-01
Selected strategies (ordinary replay) 2026-04-01, 00:00:00 UTC
11,637.93
Continuous NVDA 2026-04-01, 00:00:00 UTC
11,416.98
Selected strategies (ordinary replay)Continuous NVDAHistorical simulation
Show the table · 3 rows, 4 columns

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

2025-07-02 to 2025-09-300.65%0.80%28
2025-10-01 to 2025-12-305.51%5.51%39
2025-12-31 to 2026-03-319.43%9.43%39

The native optimizer reported 16.20% across the first three test blocks. Separate ordinary backtests of the selected rules reported 16.38%, versus continuous NVDA's 14.17%. The last two folds matched exactly, including all 77 daily NAV samples in each. The first fold differed by 0.15821 percentage points despite the same 28 round trips. Its cause remains unresolved.

The chart below uses ordinary replay NAV. Its 230 matched observations gave 5.08% sampled drawdown versus 21.25% for NVDA. The longer chart uses the native five-fold path. Keeping the paths separate avoids silently substituting the more favorable replay result into the native study.

The comparison curve is continuous NVDA rather than SPY because the candidate trades NVDA and its inverse ETF. Keep that benchmark scope attached to the return and drawdown figures.

Higher costs erased the limited-period lead

The same selected replay portfolios were rerun at higher fees without another optimization. They retained the same round-trip counts. At 6 basis points per fill, the compounded return was 14.95%, still just above NVDA's 14.17%. At 10 basis points it fell to 9.40%.

These are actual fee reruns on submitted notional, not a deduction estimated from trade counts. Next-bar price changes are already reflected in modeled fills. A larger flat fee does not establish quote-based spread and market-impact realism. The NVDA benchmark is a continuous holding-price path without repeated strategy trading fees; this comparison does not separately certify dividend total returns.

Show the table · 3 rows, 3 columns

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

5 bps16.38%14.17%
6 bps14.95%14.17%
10 bps9.40%14.17%

How the walk-forward selection worked

Training expands from January 2, 2025. Each fold has an earlier training window, a five-day embargo, a validation window and then a 91-calendar-day test block. The exhaustive grid has 36 settings: rolling means of 5, 20, 50 or 100 calendar days; inverse stops of 1%, 2% or 4%; and inverse profit targets of 2%, 4% or 6%. The other entry rules, long exits, sizing and fees stay fixed. Validation percent return selects the winner before its next test block.

The five-fold continuation preserves the first three fold calendars. The first three winners use a five-calendar-day mean and 2% inverse profit target, with inverse stops of 2%, 1% and 2%. The last two use means of 5 and 50 calendar days, 4% inverse stops and 2% profit targets.

Chronological splitting limits within-study lookahead, but the researchers inspected these historical dates repeatedly while changing strategy families. All reported results are retrospective development evidence. They are not a fresh independent out-of-sample test. A future test would require freezing both the rules and the selection procedure before observing new data.

Show the table · 5 rows, 5 columns

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

12025-05-212025-05-22 to 2025-05-262025-05-27 to 2025-07-012025-07-02 to 2025-09-30
22025-08-022025-08-03 to 2025-08-072025-08-08 to 2025-09-302025-10-01 to 2025-12-30
32025-10-142025-10-15 to 2025-10-192025-10-20 to 2025-12-302025-12-31 to 2026-03-31
42025-12-262025-12-27 to 2025-12-312026-01-01 to 2026-03-312026-04-01 to 2026-06-30
52026-03-082026-03-09 to 2026-03-132026-03-14 to 2026-06-302026-07-01 to 2026-09-29

Exact calendar dates in Eastern time. The embargo sits between training and validation. Training starts January 2, 2025 in every fold.

What the trade audit established

The three ordinary replays produced 212 filled orders and 106 closed round trips. The audit reconciled cash, quantities and fees, found no direct stock shorts or simultaneous NVDA/NVD positions, and confirmed that all audited positions closed each day. Entries met the time limits. Eighteen sampled signal events had expected trigger values and no indicator errors; the full signal-causality history was not audited.

A representative NVD sale was about 763 shares. Twelve surrounding minute bars showed 1.45 million shares traded and no zero-volume bars, but the probe returned no bid/ask quote. That checks activity near one order, not the spread or impact of every fill. The first-fold replay difference remains open. The two additional native test folds were not independently certified with an exhaustive order audit.

Show the table · 3 rows, 5 columns

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

13$403.9925$-323.60
29$348.6030$202.04
37$254.7032$687.87

Dollar P&L from independently audited round trips in each replay, which starts with $10,000. These dollar amounts are not a continuously compounded portfolio attribution.

Inspect the session and execution settings

Inspect exact session settings

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

Initial capital and shares$10,000; fractional shares; one NVDA or NVD position at a time
Entry windowAt or after 10:00 and before 15:20 Eastern
Filled-buy cooldownMore than 60 minutes for NVDA; more than 720 minutes for NVD on the shared filled-buy clock
Daily entry boundSix buys; observed maximum three, with at most one bearish buy
NVDA exitsPosition loss reaches 1%, gain reaches 3%, or 15:40 Eastern liquidation signal
NVD exitsSelected stop or profit threshold, or 15:40 Eastern liquidation signal
Early closesSkip July 3, December 24 and the Friday after Thanksgiving when markets close early
Modeled executionObserved audit delays of 1 to 2 minutes; thresholds trigger orders and do not guarantee fill prices
Base fee5 basis points (0.05%) per fill on submitted notional

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.