Published: 2026-04-17
Summary

I Turned Claude Opus 4.7 Into a 24/7 Trading Agent Using Routines

Chapters / key moments (click to jump — plays here on the page)

Nate Herk upgrades his stock-trading agent from Opus 4.6 to 4.7 and wires it to Claude Code's new routines feature — a cron-style scheduler that lets the agent run market research, place trades via Alpaca, journal its decisions, and push an end-of-day summary to ClickUp, all without any human intervention. His first 30-day run with the same setup (on 4.6) beat the S&P 500 by 8%.

Source video

"I Turned Claude Opus 4.7 Into a 24/7 Trader" by Nate HerkWatch on YouTube →

Key Takeaways

  • Claude Code routines are the unlock: a built-in cron scheduler that fires the agent on a defined schedule (pre-market, market open, midday, close). The agent doesn't need to be manually triggered — it wakes up, does its work, and goes back to sleep.
  • Opus 4.7 is specifically designed for this use case. Anthropic describes it as built for "full throttle agentic work, judgment over ambiguity, and self-verifying outputs" — the exact properties you need for autonomous, unsupervised financial decisions.
  • The agent loop: pre-market research → place trades via Alpaca API → journal decisions into a file (persistent context for future sessions) → end-of-day summary pushed to ClickUp. The journaling step is what makes the agent get better over time rather than starting cold every day.
  • Tech stack is deliberately minimal: Claude Code (runtime + scheduler), Opus 4.7 (model), Alpaca API (trade execution), ClickUp (reporting). No separate orchestration framework required.
  • Custom skills define the agent's behaviors: how it does market research, how it makes decisions, how it places trades, how it writes logs. These are plain files — not magic — that you build and refine over time.
  • First 30-day result (Opus 4.6): $10,000 deployed, beat the S&P 500 by ~8%. The upgrade to 4.7's improved reasoning is expected to widen that gap.

The Routine Architecture

A "routine" in Claude Code is a scheduled trigger that fires the agent at specific times. Nate configures four daily firing times: pre-market (research window), market open (initial positioning), midday (rebalance check), and market close (end-of-day summary). Each firing loads the agent's skills and journaling context so it has memory of previous sessions.

The Alpaca API handles the actual brokerage integration: placing orders, checking positions, pulling account balance. The agent uses this as its "hands" — it can't just decide to trade, it has to call the Alpaca API correctly. This creates a useful guardrail: the agent is limited to what the API allows.

The journaling skill is what separates this from a one-shot agent. After every session the agent writes structured notes about what it researched, what it bought, why, and what it plans to monitor. This file is loaded at every subsequent session, so the agent builds on prior reasoning rather than starting from scratch.

Related on OpenClawDatabase

What you can actually set up from this

Extracted from the video's own transcript — the specifics the original summary left out.

Reproducible steps

  1. The architecture: routines as the scheduler

    A Claude Code project that runs on a schedule rather than on demand. The demonstrated cadence is <strong>four runs per weekday</strong> &mdash; pre-market, market open, midday and close &mdash; visible on a calendar in the desktop app, with a different schedule on Fridays.

  2. The component list

    <strong>Routines</strong> as scheduler; <strong>Opus 4.7</strong> as the model; <strong>skills</strong> written as you go for research, decision-making, trade placement and logging; <strong>Alpaca</strong> as the brokerage API; <strong>Perplexity</strong> for research (the native web fetch and search would also work); and a task tool for the end-of-day summary. All of these are named as interchangeable.

  3. Start on paper, not with money

    Alpaca gives a <strong>paper trading account</strong> immediately &mdash; the demo runs $100k of paper money. A funded account requires verification that can take days. <strong>The credentials work identically either way</strong>, which means you can build and run the entire system against paper before any real money is involved.

  4. Collect the credentials you will need

    From Alpaca: an endpoint, an API key <em>and</em> a secret key, generated together under the trading API section. <strong>Copy both immediately</strong> &mdash; the secret is shown once and then hidden. The task tool and Perplexity keys both live under their respective settings pages.

  5. Make the agent journal so it can learn

    Part of the loop is writing context into a file after each run. That is what turns four scheduled invocations a day into something with continuity rather than four unrelated sessions.

Gotchas

  • <strong>This is an experiment with real financial risk, and nothing here is financial advice.</strong> The stated goal is beating an index over a long horizon, not day trading, and the presenter's reported result &mdash; $10,000 beating the S&P by about 8% over 30 days &mdash; is a single short run on one account. A month is not a track record.
  • An agent with brokerage API credentials can place trades. Paper trading first is not a suggestion.
  • Alpaca also offers an MCP server for natural-language trading; the presenter deliberately uses raw endpoints instead.
  • Every platform keeps API keys somewhere in settings and the layouts move &mdash; the general advice given is to search or ask the agent rather than following a video's click path.

← Back to News digest · See also: OpenClaw guide

📬 Weekly Digest — In Your Inbox

One email a week: top news, releases, and our deepest new guide. No spam. Same content via RSS if you prefer.