Tech Series — Part 1 of 6

The Automated Trading Stack

From manual chart-staring to a fully autonomous pipeline that scans 8,000+ tickers nightly, scores setups across 6 dimensions, and delivers only A++ trade recommendations to your Discord. You do nothing except follow the alerts.

Claude Code CLI MCP Protocol 6-Layer Scoring Discord Delivery Expert Level
Automated Trading with Claude Code 1/6
The Vision Architecture Tech Stack A++ Criteria Daily Pipeline Project Setup What's Next

The Vision

Every evening at 23:00, while you are asleep, an autonomous AI agent wakes up. It connects to live market data feeds, scans over 8,000 tickers across US, European, and Asia-Pacific exchanges, runs multi-strategy screening algorithms, scores every candidate through a 6-dimensional quality filter, and delivers 3 meticulously researched trade recommendations to your Discord channel. By the time you check your phone in the morning, the work is done. All you need to do is decide whether to execute.

This is not a fantasy. This is what we have been running in production at DailyTickers since January 2026. The system has generated over 200 scanner reports, each containing 10 A+ setups, with a documented hit rate tracked through weekly retrospectives. And it is built entirely on tools that are available to any retail investor today: Claude Code, the Model Context Protocol (MCP), and a handful of well-configured servers.

What This Series Will Teach You

Over 6 parts, you will build the exact same pipeline we use. Not a simplified version. Not a toy demo. The real thing. By the end, you will have a fully operational automated trading research system that runs on your own machine, uses your own analysis criteria, and delivers results wherever you want them.

The Problem With Manual Trading Research

If you are a retail trader doing your own research, your workflow probably looks something like this: you open TradingView, flip through a watchlist of 30-50 tickers, check RSI and MACD on each, maybe read some news, glance at earnings dates, and then try to synthesize all of that into a trade decision. On a good day, this takes 2-3 hours. On a busy day, you skip it entirely.

The problems with this approach are structural, not personal:

Manual Workflow

  • 30-50 tickers screened
  • 2-3 hours daily
  • 1-2 dimensions checked
  • Inconsistent criteria
  • No systematic tracking
  • Emotional bias
  • Missed opportunities

Automated Pipeline

  • 8,000+ tickers scanned
  • 0 hours (runs at 23:00)
  • 6 dimensions scored
  • Deterministic criteria
  • Weekly retrospectives
  • Zero emotional input
  • Global coverage

What "Automated" Actually Means

Let us be precise about terminology, because "automated trading" means different things to different people:

This distinction matters enormously. Our system is a research automation pipeline, not a trading bot. It replaces the analyst, not the trader. You retain full control over execution, sizing, and risk management. The AI handles the tedious, high-volume, multi-dimensional screening work that no human can do consistently at scale.

Critical Disclaimer

Nothing in this series constitutes financial advice. The system we describe is a research tool. Every trade recommendation it produces must be independently validated before execution. Past scanner performance (tracked in our retrospectives) does not guarantee future results. You are solely responsible for your own trading decisions.

The End State

When you finish all 6 parts of this series, here is what your daily life as a trader will look like:

  1. 23:00 — A cron job fires. Claude Code wakes up and begins its nightly scan.
  2. 23:05 — The MCP Gateway returns market regime analysis (Risk-On, Risk-Off, Neutral, Transition).
  3. 23:08 — Three parallel screener strategies run: oversold reversals, momentum breakouts, and mean-reversion setups. 150+ candidates identified.
  4. 23:12 — Each candidate is scored across 6 layers. Only setups scoring 85+ make the first cut (typically 20-30).
  5. 23:18 — AI re-ranking via DeepSeek analysis reduces the list to 10 A+ setups.
  6. 23:22 — The top 3 A++ setups are packaged as Discord alerts with entry zones, stop losses, take-profit targets, and risk/reward ratios.
  7. 23:25 — Discord notifications land on your phone. A full HTML report is committed to GitHub Pages for the permanent record.
  8. 07:00 next day — You wake up, review the 3 recommendations over coffee, and decide which (if any) to execute at market open.

The entire pipeline takes less than 30 minutes and requires zero human intervention. Let us build it.

8,000+
Tickers Scanned Nightly
6
Scoring Dimensions
3
A++ Setups Delivered
0 min
Human Time Required

Architecture Overview

The system follows a classic ETL pattern — Extract, Transform, Load — with an AI agent at the center acting as the orchestrator. But unlike traditional ETL where each step is a discrete service, our entire pipeline is a single Claude Code session that makes tool calls through the Model Context Protocol.

The 30,000-Foot View

There are four major subsystems, each exposed to Claude Code as an MCP server:

graph TB subgraph Trigger["Trigger Layer"] CRON["Cron / Discord Bot
Schedule: 23:00 daily"] end subgraph Brain["AI Brain (Claude Code)"] CC["Claude Code CLI
claude -p 'scan du jour'"] PROMPT["System Prompt
CLAUDE.md instructions"] CC --> PROMPT end subgraph Data["Data Layer (MCP Servers)"] MW["DailyTickers Gateway
58 data types"] WEB["Web Search
News & catalysts"] end subgraph Analysis["Analysis Layer"] SCREEN["RunAutoScreener
Regime detection"] DSL["RunScreener
3 DSL strategies"] SCORE["6-Layer Scoring
Technical + Fundamental
+ Social + Sector
+ Macro + AI"] LLM["LLMAnalysis
DeepSeek re-ranking"] end subgraph Delivery["Delivery Layer"] DISCORD["Discord MCP
Alert messages"] GHPAGES["GitHub Pages
HTML reports"] ALERTS["Market Alerts MCP
Price triggers"] end CRON -->|"triggers"| CC CC -->|"MCP calls"| MW CC -->|"tool calls"| WEB CC --> SCREEN CC --> DSL SCREEN --> SCORE DSL --> SCORE SCORE --> LLM LLM -->|"top 3 A++"| DISCORD LLM -->|"full report"| GHPAGES LLM -->|"price alerts"| ALERTS classDef trigger fill:#fef3c7,stroke:#f59e0b,stroke-width:2px classDef brain fill:#ecfdf5,stroke:#10b981,stroke-width:2px classDef data fill:#eff6ff,stroke:#3b82f6,stroke-width:2px classDef analysis fill:#f5f3ff,stroke:#8b5cf6,stroke-width:2px classDef delivery fill:#fef2f2,stroke:#ef4444,stroke-width:2px class CRON trigger class CC,PROMPT brain class MW,WEB data class SCREEN,DSL,SCORE,LLM analysis class DISCORD,GHPAGES,ALERTS delivery

Data Flow in Detail

Let us trace a single execution from trigger to delivery. Understanding this flow is essential before we start building, because every architectural decision serves a specific purpose in this chain.

Trigger

A Discord bot (or cron job) executes claude -p "scan du jour" inside a tmux session. The -p flag runs Claude Code in non-interactive (pipe) mode, meaning it reads the prompt, executes, and exits. The working directory is the articles repository, so Claude Code automatically loads CLAUDE.md as its system prompt.

Regime Detection

Claude Code's first MCP call is RunAutoScreener. This is not a simple stock screener — it first analyzes the current market regime by examining VIX levels, yield curves, sector rotation patterns, and breadth indicators. The regime (Risk-On, Risk-Off, Neutral, Transition, Early Risk-On, Early Risk-Off) determines which screening strategies to prioritize. In a Risk-Off regime, for example, the system increases allocation to short setups and hedges (GLD, TLT, SH, SQQQ).

Multi-Strategy Screening

Three RunScreener calls execute in sequence, each with a different DSL (Domain-Specific Language) strategy: oversold reversals, momentum continuation, and breakout setups. Additional screeners target EU equities (VGK, EWG, EWQ, SAP, ASML), APAC names (EWJ, EWY, FXI), and thematic ETFs (XLF, XLE, GLD, ARKK). The combined candidate pool typically contains 100-200 names.

Data Enrichment

For every candidate that passes initial screening, Claude Code calls QueryData with types including quote, insider_transactions, sentiment_overall, trading_signals, support_resistance, and volume_profile. This enrichment step is where most of the API calls happen — easily 50+ calls per scan. The MCP Gateway handles batching and rate limiting internally.

6-Layer Scoring

Each enriched candidate is scored across six dimensions (detailed in Section 4). Claude Code computes a composite score using weights that adapt to the current regime. Only candidates scoring above 85/100 survive this filter. Typically, 20-30 out of 150+ candidates make the cut.

AI Re-Ranking

The survivors are passed to LLMAnalysis (DeepSeek) for a second-opinion AI analysis. This catches edge cases that the scoring system might miss — for example, a ticker with great technicals but a pending SEC investigation, or a setup that looks like a value trap. The AI re-ranking reduces the list to the final 10 A+ setups.

Delivery

Three outputs are generated simultaneously: (1) a full HTML report committed to GitHub Pages via git add/commit/push, (2) Discord alerts for the top 3 A++ setups via the Discord MCP server, and (3) price-level alerts via the Market Alerts MCP server that will fire when entry zones are hit.

Why MCP is the Key Enabler

The Model Context Protocol is what makes this entire architecture possible. Before MCP, connecting an LLM to external data sources required custom API wrappers, prompt engineering for tool calling, and fragile output parsing. MCP standardizes the interface: every data source, every action, every delivery mechanism exposes the same JSON-RPC protocol. Claude Code does not know (or care) whether it is talking to a market data API, a Discord webhook, or a Git repository. It just makes tool calls.

This has three profound implications for our architecture:

  1. Composability. Adding a new data source (say, on-chain crypto data) means adding a new MCP server. Zero changes to the pipeline code, zero changes to the prompt. Claude Code discovers the new tools automatically.
  2. Reliability. MCP servers handle their own retry logic, rate limiting, and error handling. The AI agent sees clean tool responses, not raw HTTP errors.
  3. Testability. Each MCP server can be tested in isolation. You can mock the DailyTickers Gateway to run the pipeline on historical data for backtesting.

MCP in 30 Seconds

The Model Context Protocol (MCP) is an open standard created by Anthropic for connecting AI models to external tools and data. Think of it like USB for AI: a universal connector that lets any AI model talk to any data source. An MCP server exposes "tools" (functions the AI can call) and "resources" (data the AI can read). Claude Code is an MCP client that can connect to multiple servers simultaneously, composing their capabilities into a single workflow.

Architecture Constraints

Before we move on, it is important to document the deliberate constraints in this architecture, because they prevent common mistakes:

The Tech Stack

Let us break down every component in the stack, what it does, and why we chose it. This is an opinionated stack — there are alternatives for every layer — but these components work together exceptionally well.

Claude Code CLI

The central orchestrator. Claude Code is Anthropic's official CLI for the Claude model family. Unlike the web interface or API, Claude Code can execute shell commands, read and write files, and — critically — connect to MCP servers. When invoked with claude -p "prompt", it runs in non-interactive pipe mode: it reads the prompt, processes it using the system instructions from CLAUDE.md, makes whatever tool calls are necessary, and exits. This makes it perfect for scheduled automation.

Claude Code also maintains a CLAUDE.md file in the project root that acts as persistent memory. Our CLAUDE.md is over 400 lines of instructions that define the scanning methodology, scoring criteria, output format, and delivery mechanism. The AI follows these instructions deterministically on every run.

Model Context Protocol (MCP)

The communication layer. MCP is a JSON-RPC-based protocol that standardizes how AI models interact with external tools. Each MCP server exposes a set of "tools" (callable functions) that the AI can invoke. The protocol handles serialization, transport (stdio or HTTP/SSE), and error propagation. Our pipeline uses three MCP servers simultaneously, and Claude Code manages the connections automatically.

Key MCP concepts: Tools are functions the AI calls (e.g., GetMarketOverview). Resources are data the AI reads (e.g., a JSON dataset). Prompts are templates that structure AI interactions. We primarily use tools.

DailyTickers MCP Gateway

The data layer. This is our custom MCP server that provides access to 58 types of market data via a unified interface. Under the hood, it aggregates data from multiple providers (Yahoo Finance, Alpha Vantage, Polygon, Finnhub, social sentiment APIs) into a consistent schema. The key tools are:

  • GetMarketOverview — Full market snapshot: indices, commodities, crypto, rates, VIX, sentiment, regime classification, and top news stories.
  • QueryData — Flexible data query supporting 58 types: quotes, OHLCV bars, technicals, financials, earnings, insider transactions, options chains, analyst actions, support/resistance levels, volume profiles, sentiment scores, and more.
  • RunAutoScreener — Intelligent screener that first detects the market regime, then runs regime-appropriate screening strategies.
  • RunScreener — Custom screener using a DSL (Domain-Specific Language) for defining screening criteria.
  • GetInstruments — Deep analysis of specific symbols, returning comprehensive data across all 58 types.
  • LLMAnalysis — Secondary AI analysis via DeepSeek for cross-validation.

Discord MCP Server

The notification layer. A lightweight MCP server that exposes Discord API operations as tools. Claude Code can send messages, embeds, and attachments to specified channels. For our pipeline, the Discord server is configured to post to a #scanner-alerts channel with rich embeds that include the ticker, setup type, entry/stop/TP levels, the score breakdown, and a link to the full report on GitHub Pages.

The Discord server also serves as the trigger mechanism: a Discord bot listens for scheduled commands (e.g., every weekday at 23:00 articles scan du jour) and invokes Claude Code via claude -p in a tmux session.

Market Alerts MCP Server

The monitoring layer. This server manages persistent price alerts that fire when specific conditions are met. When the scanner identifies an A++ setup with an entry zone at $45.20-$45.80, it creates an alert that monitors the price in real-time. When the price enters the zone, a Discord notification fires immediately, giving you a heads-up that the setup is actionable. Alerts support multiple condition types: price above/below, percentage change, volume spike, and custom expressions.

Scheduling (Discord Bot + tmux)

The trigger layer. Rather than using system cron (which has limited error handling and no easy way to inspect logs), we use a custom Discord bot that manages schedules via a JSON configuration file. The bot runs Claude Code inside tmux sessions, which means: (1) sessions persist even if the bot restarts, (2) you can attach to a running session to inspect progress in real-time, and (3) output is captured for debugging. The bot supports day-of-week filters, time zones, and manual trigger commands (run #1 to execute a schedule immediately).

GitHub Pages (Reporting)

The archive layer. Every scanner report, every analysis, every weekly briefing is a static HTML file committed to a Git repository and served via GitHub Pages. This gives us: (1) an immutable audit trail of every recommendation, (2) free hosting with global CDN, (3) version history via Git, and (4) easy integration with the pipeline (Claude Code can git add, git commit, and git push as part of its normal tool calls). The report site serves as both the public-facing archive and the internal dashboard for tracking scanner performance.

Why Not Use [Alternative X]?

Before someone says "you could just use a Python script with yfinance" — yes, you could. Here is why we do not:

Approach Coverage Analysis Depth Adaptability Maintenance
Python script + yfinance US only Technicals only Hardcoded rules High (code changes for every strategy tweak)
TradingView alerts Broad Technicals only Pine Script Medium (visual but limited logic)
Commercial screener (Finviz, TC2000) US mostly Tech + some fundamental Preset filters Low (but no AI layer)
Claude Code + MCP Global (US/EU/APAC/Crypto) 6 dimensions Natural language Zero (update CLAUDE.md)

The fundamental advantage of the Claude Code approach is that strategy changes are prompt changes, not code changes. When you want to add a new scoring dimension (say, options flow analysis), you add a paragraph to CLAUDE.md. You do not write new code, you do not deploy a new service, you do not update a database schema. The AI reads the new instructions and adapts its behavior on the next run.

This is a paradigm shift. Traditional quantitative systems require engineering effort proportional to the complexity of the strategy. AI-orchestrated systems require engineering effort proportional to the complexity of the data plumbing — and MCP already handles that.

The Full Stack Diagram

graph LR subgraph Scheduling["Scheduling Layer"] BOT["Discord Bot
(Node.js)"] TMUX["tmux sessions"] SCHED["schedules.json"] BOT --> TMUX BOT --> SCHED end subgraph Orchestration["Orchestration Layer"] CLI["Claude Code CLI
(claude -p)"] CMD["CLAUDE.md
(400+ lines)"] MEM["Memory
(MEMORY.md)"] CLI --> CMD CLI --> MEM end subgraph MCP_Servers["MCP Servers"] direction TB GW["DailyTickers
Gateway"] DC["Discord
MCP"] AL["Market Alerts
MCP"] FS["Filesystem
MCP"] end subgraph Outputs["Output Layer"] GH["GitHub Pages
(HTML reports)"] DIS["Discord
(#scanner-alerts)"] PRA["Price Alerts
(real-time)"] end TMUX -->|"claude -p"| CLI CLI -->|"MCP stdio"| GW CLI -->|"MCP stdio"| DC CLI -->|"MCP stdio"| AL CLI -->|"MCP stdio"| FS GW -->|"report HTML"| GH DC -->|"embed"| DIS AL -->|"trigger"| PRA classDef sched fill:#fffbeb,stroke:#f59e0b classDef orch fill:#ecfdf5,stroke:#10b981 classDef mcp fill:#eff6ff,stroke:#3b82f6 classDef out fill:#fef2f2,stroke:#ef4444 class BOT,TMUX,SCHED sched class CLI,CMD,MEM orch class GW,DC,AL,FS mcp class GH,DIS,PRA out

Component Versions

For reproducibility, here are the exact versions we run in production:

versions.txt
Claude Code CLI    : 1.0.17 (claude --version)
Claude Model       : claude-opus-4-6
Node.js            : v22.x LTS
MCP SDK            : @modelcontextprotocol/sdk 1.12.x
Discord.js         : 14.x
GitHub CLI (gh)    : 2.x
OS                 : macOS Sequoia 15.x / Ubuntu 24.04 LTS
Shell              : zsh (macOS) / bash (Linux)
Git                : 2.43+

A++ Selection Criteria

This is the heart of the system. Everything else — the MCP plumbing, the scheduling, the Discord delivery — is infrastructure. The scoring system is the actual edge. It determines what gets recommended and what gets filtered out. Getting this right is the difference between a system that produces noise and one that produces alpha.

Our scoring model evaluates every candidate across 6 independent dimensions. Each dimension produces a score from 0 to 100. The composite score is a weighted average, with weights that shift based on the current market regime. A candidate must score above 85 on the composite AND above the individual threshold on EVERY dimension to qualify as A+. The top 3 candidates by composite score are labeled A++.

Why 6 Dimensions?

Single-dimension screening is how you blow up your account. A stock with a perfect RSI oversold signal means nothing if the company is going bankrupt (fundamentals), the sector is rotating out (sector), the overall market is crashing (macro), social media is screaming about fraud (social), and the AI detects an earnings trap (conviction). Every dimension is a veto gate. All 6 must pass. This is what makes A++ setups so rare — and so reliable.

1
Technical Confluence
Threshold: >= 4 signals aligned

We require at least 4 independent technical signals to confirm the setup. This is not "RSI is oversold, buy." This is multi-timeframe confluence:

  • Price at key support/resistance (S/R from volume profile)
  • RSI divergence (bullish or bearish) on daily AND weekly
  • MACD crossover or histogram reversal
  • Volume confirmation (above 20-day average on signal bar)
  • EMA alignment (8 > 21 > 50 for bullish, inverse for bearish)
  • Bollinger Band squeeze breakout
  • Fibonacci retracement to 0.618 or 0.786 level
  • Candlestick pattern (hammer, engulfing, morning star)

The system checks all 8 signals and requires at least 4 to be present and aligned in the same direction. Conflicting signals (e.g., bullish RSI divergence but bearish EMA alignment) reduce the technical score.

2
Fundamental Quality
Threshold: score >= 80/100

Fundamental analysis prevents us from buying cheap garbage. The fundamental score aggregates:

  • Earnings quality: EPS trend (last 4 quarters), earnings surprise history, revenue growth rate
  • Balance sheet: Debt/equity ratio, current ratio, free cash flow yield
  • Valuation: Forward P/E vs. sector median, PEG ratio, EV/EBITDA
  • Insider activity: Net insider buying in last 90 days (strong signal when executives buy with their own money)
  • Analyst consensus: Mean target vs. current price, number of recent upgrades/downgrades

For ETFs and crypto, the fundamental score adapts: ETFs are scored on tracking error, expense ratio, and AUM. Crypto is scored on network activity, TVL, and developer activity.

4
Sector Trend
Threshold: sector outperforming SPY on 5d/20d

Swimming against the sector tide is a losing strategy. We want our picks in sectors that are gaining relative strength:

  • Relative strength: Sector ETF performance vs. SPY over 5-day and 20-day windows
  • Fund flows: Net inflows/outflows to sector ETFs (XLK, XLF, XLE, etc.)
  • Rotation signal: Which sectors are gaining/losing institutional allocation (derived from 13F filings and ETF flows)
  • Earnings season: If the sector is mid-earnings season, have the early reporters beaten or missed?

A setup in a sector that is underperforming SPY by more than 2% over 20 days gets an automatic downgrade, regardless of how good the individual stock looks.

5
Macro Regime
Threshold: compatible with detected regime

The macro layer ensures we are not fighting the market. The regime detection algorithm classifies the current environment into one of six states:

  • Risk-On: VIX < 18, yield curve positive, breadth > 60%. Favor growth, momentum, high-beta.
  • Early Risk-On: VIX declining from spike, breadth recovering. Favor oversold quality names.
  • Neutral: Mixed signals. Favor sector leaders and range-bound strategies.
  • Transition: Regime change in progress. Reduce position sizes, favor hedges.
  • Early Risk-Off: VIX rising, breadth deteriorating. Start building short/hedge positions.
  • Risk-Off: VIX > 25, yield curve flat/inverted, breadth < 40%. Favor shorts, puts, GLD, TLT.

A long-only momentum setup in a Risk-Off regime fails the macro check automatically. The system will not even score it further — it is immediately rejected.

6
AI Conviction
Threshold: conviction >= 85%

The final layer is the AI's own judgment, applied after all quantitative scores are computed. Claude Code synthesizes all available information and assigns a conviction percentage:

  • Pattern recognition: Has the AI seen this setup pattern before? What was the historical outcome?
  • Risk/reward asymmetry: Does the entry-to-stop distance justify the potential reward?
  • Catalyst timing: Is there an upcoming earnings, FDA decision, or macro event that could invalidate the setup?
  • Cross-validation: Does the DeepSeek second-opinion analysis agree with the primary scoring?
  • Anti-trap detection: Is this a value trap, a dead cat bounce, or a short squeeze setup that reverses violently?

The AI conviction layer is deliberately subjective. It captures the holistic reasoning that quantitative scores cannot — the "this just does not look right" instinct that experienced traders develop over decades.

Composite Score Calculation

The composite score is a weighted average that adapts to market regime. Here are the weight profiles:

scoring-weights.json
{
  "Risk-On": {
    "technical": 0.25,
    "fundamental": 0.15,
    "social": 0.10,
    "sector": 0.20,
    "macro": 0.10,
    "ai_conviction": 0.20
  },
  "Risk-Off": {
    "technical": 0.30,
    "fundamental": 0.10,
    "social": 0.05,
    "sector": 0.15,
    "macro": 0.25,
    "ai_conviction": 0.15
  },
  "Neutral": {
    "technical": 0.25,
    "fundamental": 0.20,
    "social": 0.10,
    "sector": 0.15,
    "macro": 0.15,
    "ai_conviction": 0.15
  },
  "Transition": {
    "technical": 0.20,
    "fundamental": 0.15,
    "social": 0.05,
    "sector": 0.15,
    "macro": 0.30,
    "ai_conviction": 0.15
  }
}

Notice how the weights shift: in Risk-Off, macro weight jumps to 0.30 because fighting the macro trend is suicidal. In Risk-On, sector weight rises to 0.20 because riding the right sector wave amplifies returns. Social sentiment weight drops in Risk-Off because social media becomes unreliable in panics (too much noise).

From A+ to A++

The scoring system produces A+ setups (composite >= 85, all dimensions pass). But we go one step further to identify A++ — the absolute cream. The A++ designation requires:

  1. Composite score >= 90 (not just 85)
  2. No dimension below 75 (no weak links)
  3. R:R >= 2:1 (the reward must be at least 2x the risk)
  4. AI re-ranking confirmation (DeepSeek must independently rate the setup as "high conviction")
  5. No upcoming binary event within 5 trading days (no earnings, FDA, FOMC directly ahead that could invalidate the thesis)

On any given night, the scanner might produce 10 A+ setups but only 2-3 A++ setups. Some nights produce zero A++. That is fine — we would rather miss a mediocre opportunity than recommend one. A++ is about precision, not recall.

The Anti-Recency Bias Filter

One critical filter that is easy to overlook: the system maintains a "recently recommended" list. Any ticker that appeared in the last 3 scanner reports is automatically deprioritized unless it has a materially different setup type (e.g., it was a momentum play last week but is now an oversold reversal). This prevents the scanner from falling in love with the same names and ensures at least 70% fresh tickers per scan.

Example Scoring Breakdown

To make this concrete, here is how a real A++ setup might score:

Dimension Score Detail
Technical 92 5/8 signals aligned: RSI bullish divergence (daily+weekly), MACD histogram reversal, price at Fib 0.618, volume spike 2.3x average. EMA alignment pending (8 below 21 but crossing).
Fundamental 88 4 consecutive EPS beats, revenue growing 18% YoY, forward P/E 15x (sector median 22x), 3 insider buys in last 30 days totaling $2.1M.
Social 78 StockTwits bullish ratio 68% (up from 52% last week), Reddit mentions +40% but below hype threshold. News sentiment neutral-positive.
Sector 85 XLK outperforming SPY by 1.8% over 20 days. Tech earnings reporters beating at 72% rate. Fund flows positive.
Macro 90 Regime: Risk-On (VIX 14.2, breadth 68%, yield curve +42bps). All conditions favorable for long momentum.
AI Conviction 91 Strong asymmetric R:R (2.8:1), no binary events within 2 weeks, DeepSeek confirms "high conviction — clean pullback to rising support with institutional accumulation signals."

Composite Score: 0.25(92) + 0.15(88) + 0.10(78) + 0.20(85) + 0.10(90) + 0.20(91) = 23.0 + 13.2 + 7.8 + 17.0 + 9.0 + 18.2 = 88.2 (A+)

With all dimensions above 75 and R:R at 2.8:1, this qualifies as A++.

The Daily Pipeline Flow

Now let us trace the entire pipeline in chronological order, from the moment the cron fires to the moment Discord alerts land on your phone. This is the operational blueprint that Parts 2-6 will implement in detail.

1
23:00:00

Trigger: Discord Bot Fires

The Discord bot reads schedules.json, matches the current time to the "Scanner Quotidien" schedule (weekdays 23:00), and spawns a new tmux session:

shell
tmux new-session -d -s scanner-20260305 \
  "cd /Users/marketwatchxyz/GolandProjects/articles && \
   claude -p 'scan du jour' \
   --model claude-opus-4-6 \
   2>&1 | tee /tmp/scanner-20260305.log"

The -p flag puts Claude Code in pipe mode. The tee captures output for debugging. The session name includes the date for easy identification.

2
23:00:05

Initialization: CLAUDE.md Loading

Claude Code boots up, reads CLAUDE.md from the project root (400+ lines of instructions), and identifies the "Scanner" command section. This section specifies the complete scanning methodology, including:

  • Read all previous retrospectives to learn from past mistakes
  • Read the most recent scan for the anti-doublon filter
  • Geographic diversification requirements (min 5 US + 2 EU + 1 APAC + 2 ETFs)
  • Regime-adaptive strategy allocation
  • Output format and delivery requirements

The AI has everything it needs to execute autonomously. No human input required from this point forward.

3
23:00:30

Retrospective Learning

Before scanning anything, Claude Code reads every file in scanner/retrospective/*/index.html. These are weekly performance reviews that grade the scanner. From each retrospective, the AI extracts:

  • Hit rate by strategy type (oversold, momentum, breakout)
  • Average P&L by sector
  • Tickers that consistently underperformed (blacklist candidates)
  • Stops that were too tight or too loose
  • Pattern-level learnings (e.g., "small-cap biotech oversold reversals have 30% hit rate — reduce allocation")

This is the feedback loop that makes the system improve over time. A strategy that underperforms in 2+ consecutive retrospectives gets its weight reduced automatically.

4
23:01:00

Previous Scan Analysis

Claude Code reads the most recent scanner/YYYYMMDD/index.html to extract the 10 tickers from the last scan. These go into the anti-doublon filter: the new scan must contain at least 70% fresh tickers. This prevents the scanner from recommending the same names night after night.

anti-doublon logic (conceptual)
previous_tickers = extract_tickers(last_scan)  # e.g., [AAPL, NVDA, GLD, ...]
new_candidates = score_and_rank(all_candidates)

# Enforce 70% freshness
fresh_count = 0
for candidate in new_candidates:
    if candidate.ticker in previous_tickers:
        candidate.score *= 0.7  # 30% penalty for repeat
    else:
        fresh_count += 1

# If fresh_count < 7, expand screening to find more unique names
5
23:02:00

Market Regime Detection

The first MCP call fires:

MCP Tool Call
Tool: mcp__dailytickers__RunAutoScreener
Parameters: {}

RunAutoScreener returns a comprehensive regime analysis including:

RunAutoScreener Response (abbreviated)
{
  "regime": {
    "current": "Risk-On",
    "confidence": 0.82,
    "vix": 14.2,
    "vix_trend": "declining",
    "breadth": {
      "above_200sma": 0.68,
      "advance_decline": 1.85,
      "new_highs_lows": 3.2
    },
    "yield_curve": {
      "2y10y_spread": 0.42,
      "trend": "steepening"
    },
    "sector_rotation": {
      "leading": ["XLK", "XLY", "XLC"],
      "lagging": ["XLU", "XLP", "XLRE"]
    }
  },
  "recommended_strategies": [
    "momentum_continuation",
    "breakout_volume",
    "oversold_quality"
  ],
  "candidates": [
    // ... initial candidate list
  ]
}

Based on the regime, Claude Code selects weight profiles and strategy allocation. In Risk-On with 82% confidence, the system allocates 40% to momentum, 35% to breakout, and 25% to oversold quality names.

6
23:04:00

Multi-Strategy Screening

Three RunScreener calls execute with different DSL strategies:

Strategy 1: Oversold Quality Reversals
Tool: mcp__dailytickers__RunScreener
Parameters: {
  "dsl": "RSI(14) < 35 AND SMA(50) > SMA(200) AND Volume > SMA_Volume(20) * 1.5 AND MarketCap > 1B",
  "universe": "US_LARGE_MID"
}
Strategy 2: Momentum Breakout
Tool: mcp__dailytickers__RunScreener
Parameters: {
  "dsl": "Close > SMA(20) AND SMA(20) > SMA(50) AND RSI(14) BETWEEN 55 AND 75 AND ADX(14) > 25 AND Volume > SMA_Volume(20) * 1.2",
  "universe": "US_ALL"
}
Strategy 3: Mean-Reversion Breakout
Tool: mcp__dailytickers__RunScreener
Parameters: {
  "dsl": "Close > BB_Upper(20,2) AND Volume > SMA_Volume(20) * 2 AND ATR(14)/Close < 0.05",
  "universe": "US_ALL"
}

Additional screeners target international markets:

EU + APAC + ETF Screening
// European equities
Tool: mcp__dailytickers__RunScreener
Parameters: {
  "symbols": ["VGK","EWG","EWQ","EWU","SAP","ASML","BBVA","TTE","SIE","LVMHF"],
  "dsl": "RSI(14) < 40 OR (Close > SMA(20) AND ADX(14) > 20)"
}

// Asia-Pacific
Tool: mcp__dailytickers__RunScreener
Parameters: {
  "symbols": ["EWJ","EWY","EWH","FXI","MCHI"],
  "dsl": "RSI(14) < 40 OR (Close > SMA(20) AND ADX(14) > 20)"
}

// Thematic ETFs
Tool: mcp__dailytickers__RunScreener
Parameters: {
  "symbols": ["XLF","XLE","XLK","XLV","XLI","GLD","SLV","TLT","ARKK","ICLN"],
  "dsl": "RSI(14) < 35 OR (Close > SMA(20) AND Volume > SMA_Volume(20) * 1.3)"
}

The combined output from all screeners typically yields 100-200 candidates. These are deduplicated and passed to the enrichment step.

7
23:08:00

Data Enrichment

For the top 30 candidates (ranked by raw screening score), Claude Code calls QueryData with comprehensive data types:

Data Enrichment Call
Tool: mcp__dailytickers__QueryData
Parameters: {
  "symbols": ["AAPL", "NVDA", "TSLA", ...],  // top 30 candidates
  "types": [
    "quote",                    // Current price, volume, change
    "bars_daily",               // 90 days OHLCV
    "insider_transactions",     // Last 90 days insider buys/sells
    "sentiment_overall",        // Aggregated sentiment score
    "trading_signals",          // Technical signal summary
    "support_resistance",       // Key S/R levels
    "volume_profile",           // Volume at price distribution
    "stats",                    // Beta, avg volume, 52w range
    "analyst_actions",          // Recent upgrades/downgrades
    "financials",               // Latest quarterly financials
    "earnings_quarterly"        // EPS history and surprises
  ]
}

This is the most API-intensive step. Each ticker requires data from multiple providers, aggregated by the MCP Gateway. The Gateway handles caching (60-second TTL for quotes, 24-hour for financials) and rate limiting internally.

8
23:12:00

6-Layer Scoring

Claude Code now has all the data needed to score each candidate. It computes the 6 dimension scores, applies the regime-adjusted weights, and calculates the composite score. This is where the AI's reasoning ability matters — it is not just running formulas, it is interpreting the data contextually:

Scoring Logic (Claude Code's internal reasoning)
For each candidate:
  1. Technical Score
     - Count aligned signals from trading_signals + support_resistance
     - Check multi-timeframe confirmation (daily vs weekly)
     - Score: (aligned_signals / 8) * 100, with bonuses for rare confluences

  2. Fundamental Score
     - Extract EPS trend from earnings_quarterly
     - Check insider_transactions for net buying
     - Compare valuation metrics to sector medians from financials
     - Score: weighted aggregate of sub-scores

  3. Social Score
     - Parse sentiment_overall for bullish/bearish ratio
     - Check if sentiment is rising but below "euphoria" threshold
     - Score: alignment * magnitude * freshness

  4. Sector Score
     - Compare sector ETF performance vs SPY (5d, 20d)
     - Check if sector is in the "leading" list from regime analysis
     - Score: relative_strength * 100, capped at 100

  5. Macro Score
     - Is the setup type compatible with current regime?
     - Long momentum in Risk-On? Score = 95
     - Long momentum in Risk-Off? Score = 20 (auto-fail)
     - Score: compatibility * regime_confidence * 100

  6. AI Conviction
     - Synthesize all data points holistically
     - Check for red flags: upcoming earnings, FDA, FOMC
     - Estimate R:R from entry to S/R levels
     - Score: subjective assessment 0-100

  Composite = sum(weight_i * score_i) for i in dimensions
  Pass = composite >= 85 AND all individual scores >= threshold
9
23:16:00

AI Re-Ranking via LLMAnalysis

The top 20 candidates (by composite score) are passed to the LLMAnalysis tool for a second-opinion from DeepSeek:

MCP Tool Call
Tool: mcp__dailytickers__LLMAnalysis
Parameters: {
  "query": "Rank these 20 setups by conviction. For each, provide:
    1. Conviction level (high/medium/low)
    2. Primary risk factor
    3. Optimal entry strategy (limit at support vs market)
    4. Position sizing suggestion (% of portfolio)
    Setups: [detailed data for each candidate]"
}

DeepSeek's independent analysis serves as a cross-validation layer. If Claude scores a setup as 92/100 but DeepSeek flags a risk that Claude missed (e.g., "this company has a patent trial verdict next Tuesday"), the setup gets downgraded. Conversely, if both AIs agree on high conviction, the setup's A++ status is confirmed.

10
23:18:00

Price Validation (P0 Control)

Before finalizing the selection, a critical sanity check runs: for every selected ticker, Claude Code calls QueryData with types: quote to get the real-time spot price. If the calculated entry price differs by more than 10% from the current market price, the setup is rejected. This catches stale data issues, stock splits, and ticker symbol errors:

P0 Validation
for each selected_setup:
  spot_price = QueryData(symbols=[setup.ticker], types=["quote"]).price
  entry_price = setup.entry_zone_midpoint

  deviation = abs(spot_price - entry_price) / spot_price
  if deviation > 0.10:
    REJECT setup  # Entry price too far from reality
    log("P0 FAIL: {ticker} spot={spot_price} entry={entry_price} dev={deviation}")
11
23:20:00

Geographic Diversification Enforcement

The final 10 setups must meet geographic diversification requirements:

  • Minimum 5 US equities
  • Minimum 2 European equities or ETFs
  • Minimum 1 Asia-Pacific name
  • Minimum 2 thematic/sector ETFs

If the scoring naturally produces 10 US names, Claude Code replaces the lowest-scoring US names with the highest-scoring EU, APAC, and ETF candidates — even if their absolute scores are lower. This prevents home bias and ensures global coverage.

Additionally, in Risk-Off or Early Risk-Off regimes, at least 20% of setups (2 out of 10) must be defensive: short positions, inverse ETFs (SH, SQQQ), or safe havens (GLD, TLT).

12
23:22:00

Report Generation

Claude Code generates a full HTML report at scanner/YYYYMMDD/index.html using the project's CSS framework (report.css). The report includes:

  • Hero with regime badge and date
  • Dashboard with key metrics (regime, hit rate target, regime confidence)
  • 10 setup cards, each with: ticker, score breakdown radar chart (ECharts), entry zone, stop loss, TP1/TP2, R:R ratio, thesis summary, confirmation signals, invalidation signals, geographic badge
  • Retrospective reference ("Following the retrospective of DD/MM, we adjusted...")
  • Sources and disclaimer

The report is written directly to the filesystem via Claude Code's file writing capability.

13
23:24:00

Indexing and Git Operations

Three sequential commands execute:

shell
# Index the new report
node tools/add_card.js scanner/20260305/index.html

# Commit and push
git add scanner/20260305/ data/scanner.json data/search_data.js
git commit -m "feat: scanner 20260305 — Risk-On, 10 setups A+"
git push origin main

The add_card.js script parses the HTML report, extracts metadata (title, date, tags, tickers), creates a card object, injects it into data/scanner.json, and regenerates the global search index. The git push triggers a GitHub Actions deployment that publishes the report to GitHub Pages within 60 seconds.

14
23:25:00

Discord Alert Delivery

For the top 3 A++ setups, Claude Code sends rich Discord embeds:

Discord Embed Structure
{
  "embeds": [{
    "title": "A++ SETUP: NVDA — Momentum Continuation",
    "color": 1089337,  // #10a569 (green)
    "fields": [
      { "name": "Entry Zone", "value": "$875 - $882", "inline": true },
      { "name": "Stop Loss", "value": "$848 (-3.5%)", "inline": true },
      { "name": "TP1 / TP2", "value": "$920 / $965", "inline": true },
      { "name": "R:R", "value": "2.4 : 1", "inline": true },
      { "name": "Score", "value": "91/100 (A++)", "inline": true },
      { "name": "Regime", "value": "Risk-On (82%)", "inline": true },
      { "name": "Thesis", "value": "Pullback to rising 21 EMA with volume contraction. 5 of 8 technical signals aligned. Insider buying $4.2M in last 30 days. AI datacenter capex cycle intact." },
      { "name": "Confirmations", "value": "1. Hold above $870 on daily close\n2. Volume expansion on next green day\n3. SOX index holds 5,200\n4. No VIX spike above 18" },
      { "name": "Invalidations", "value": "1. Daily close below $848 (stop)\n2. Sector rotation out of XLK\n3. Macro regime shift to Risk-Off\n4. Earnings pre-announcement" }
    ],
    "footer": {
      "text": "Full report: articles.dailytickers.com/scanner/20260305/"
    }
  }]
}
15
23:26:00

Price Alert Creation

For each A++ setup, a persistent price alert is created via the Market Alerts MCP:

MCP Tool Call
Tool: mcp__market-alerts__create_alert
Parameters: {
  "symbol": "NVDA",
  "condition": "price_between",
  "value": [875, 882],
  "message": "NVDA entering A++ entry zone ($875-$882). Scanner score: 91/100.",
  "channel": "#scanner-alerts",
  "expires": "2026-03-12T23:59:59Z"  // 7 day expiry
}

The alert fires if/when the price enters the entry zone during market hours. This solves the timing problem: the scanner runs at 23:00, but the optimal entry might be during the next trading session when the price pulls back to the entry zone.

16
23:27:00

Completion and Cleanup

Claude Code exits. The tmux session closes. The Discord bot logs the completion status and duration. Total elapsed time: approximately 27 minutes. The complete pipeline log is saved at /tmp/scanner-YYYYMMDD.log for debugging if needed.

The next morning at 07:00, a separate pipeline runs the "Daily Briefing" which includes a section summarizing last night's scanner highlights.

Pipeline Timing Summary

~27 min
Total Pipeline Duration
50-80
MCP Tool Calls Per Run
~150
Candidates Evaluated
10 / 3
A+ / A++ Delivered

Project Setup

Let us get your environment set up. By the end of this section, you will have Claude Code installed, all three MCP servers configured, and you will run your first test scan. We will build the full pipeline in subsequent parts, but this foundation must be solid.

Prerequisites

You need the following installed before proceeding:

Step 1: Install Claude Code

shell
# Install Claude Code globally
npm install -g @anthropic-ai/claude-code

# Verify installation
claude --version
# Expected: claude-code 1.0.x

# Authenticate (interactive — follow browser prompts)
claude auth login

# Test basic functionality
claude -p "What is 2 + 2?"
# Expected: "4" (or a more verbose response ending with 4)

Claude Code stores its configuration in ~/.claude/. The key files are:

Step 2: Configure MCP Servers

MCP servers are configured in ~/.claude/claude_desktop_config.json. This file tells Claude Code which MCP servers to connect to and how to start them. Here is the full configuration for our 3-server setup:

~/.claude/claude_desktop_config.json
{
  "mcpServers": {
    "dailytickers": {
      "command": "node",
      "args": [
        "/path/to/dailytickers-mcp/dist/index.js"
      ],
      "env": {
        "MW_API_KEY": "your-dailytickers-api-key",
        "MW_BASE_URL": "https://api.dailytickers.com",
        "MW_CACHE_TTL": "60",
        "MW_MAX_CONCURRENT": "10",
        "MW_TIMEOUT": "30000"
      },
      "disabled": false
    },
    "market-alerts": {
      "command": "node",
      "args": [
        "/path/to/market-alerts-mcp/dist/index.js"
      ],
      "env": {
        "ALERTS_DB_PATH": "/path/to/alerts.db",
        "ALERTS_CHECK_INTERVAL": "60000",
        "DISCORD_WEBHOOK_URL": "https://discord.com/api/webhooks/xxx/yyy"
      },
      "disabled": false
    },
    "discord": {
      "command": "node",
      "args": [
        "/path/to/discord-mcp/dist/index.js"
      ],
      "env": {
        "DISCORD_TOKEN": "your-discord-bot-token",
        "DISCORD_DEFAULT_CHANNEL": "scanner-alerts",
        "DISCORD_GUILD_ID": "your-guild-id"
      },
      "disabled": false
    }
  }
}

Security Warning

The claude_desktop_config.json file contains API keys and tokens. Never commit this file to version control. Add it to your global .gitignore. Consider using a secrets manager or environment variable references instead of hardcoded values.

Step 3: Configure the DailyTickers MCP Server

The DailyTickers MCP server is the data backbone of the pipeline. It exposes 58 data types through a unified QueryData interface. Here is how to set it up:

shell
# Clone the MCP server
git clone https://github.com/dailytickers-xyz/dailytickers-mcp.git
cd dailytickers-mcp

# Install dependencies
npm install

# Build
npm run build

# Test the server locally (stdio mode)
echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | node dist/index.js

# Expected: JSON response listing all available tools
# - GetMarketOverview
# - QueryData
# - RunAutoScreener
# - RunScreener
# - GetInstruments
# - LLMAnalysis
# - CalculateOptionsGreeks
# - AnalyzeOptionsStrategy
# - ... (20+ tools total)

The server configuration is controlled via environment variables. Here are the key ones:

Variable Default Description
MW_API_KEY (required) API authentication key
MW_BASE_URL https://api.dailytickers.com Gateway API endpoint
MW_CACHE_TTL 60 Cache TTL in seconds (quotes)
MW_CACHE_TTL_FINANCIALS 86400 Cache TTL for financials (24h)
MW_MAX_CONCURRENT 10 Max concurrent API requests
MW_TIMEOUT 30000 Request timeout in milliseconds
MW_RETRY_COUNT 3 Number of retries on failure
MW_LOG_LEVEL info Logging verbosity (debug, info, warn, error)

Step 4: Set Up the Project Repository

Create the directory structure for your automated trading reports:

shell
# Create the project
mkdir -p automated-trading-reports
cd automated-trading-reports
git init

# Create the directory structure
mkdir -p scanner/{retrospective}
mkdir -p daily
mkdir -p weekly
mkdir -p analyses
mkdir -p data
mkdir -p assets
mkdir -p tools

# Create the CNAME for GitHub Pages
echo "your-domain.xyz" > CNAME

# Initialize the data files
echo "[]" > data/scanner.json
echo "[]" > data/daily.json
echo "[]" > data/weekly.json
echo "[]" > data/analyses.json
echo "var searchData = [];" > data/search_data.js
automated-trading-reports/ ├── scanner/ # Daily scanner reports │ ├── 20260305/ # One folder per scan date │ │ └── index.html # Full HTML report │ └── retrospective/ # Weekly performance reviews │ ├── 20260228/ │ │ └── index.html │ └── index.html # Redirect to latest ├── daily/ # Morning briefings ├── weekly/ # Weekly market reports ├── analyses/ # Individual ticker analyses ├── data/ # JSON indexes for the landing page │ ├── scanner.json │ ├── daily.json │ ├── weekly.json │ ├── analyses.json │ └── search_data.js ├── assets/ # Shared CSS and JS │ ├── report.css # Global stylesheet (3000+ lines) │ ├── core.js # Tag renderer + filters │ └── tag-renderer.js # Clickable tag system ├── tools/ # Automation scripts │ └── add_card.js # Auto-indexing tool ├── CLAUDE.md # System prompt (400+ lines) ├── CNAME # GitHub Pages domain ├── index.html # Landing page with tabs └── .gitignore

Step 5: Create the CLAUDE.md System Prompt

The CLAUDE.md file is the brain of the operation. It contains all the instructions that Claude Code follows during automated runs. Here is a minimal skeleton to get started — the full version we use in production is 400+ lines:

CLAUDE.md (starter template)
# CLAUDE.md - Automated Trading Pipeline

## Project Overview
Automated trading research pipeline using Claude Code + MCP.
Publishes scanner reports, daily briefings, and ticker analyses.

## MCP Gateway
Available tools:
- `mcp__dailytickers__GetMarketOverview` — Full market snapshot
- `mcp__dailytickers__QueryData` — 58 data types
- `mcp__dailytickers__RunAutoScreener` — Regime-aware screening
- `mcp__dailytickers__RunScreener` — Custom DSL screening
- `mcp__dailytickers__GetInstruments` — Deep symbol analysis
- `mcp__dailytickers__LLMAnalysis` — DeepSeek second opinion

## Scanner Command ("scan du jour")

### Step 1: Read Retrospectives
Read ALL files in `scanner/retrospective/*/index.html`.
Extract: hit rates, flop tickers, strategy adjustments.

### Step 2: Read Previous Scan
Read the most recent `scanner/YYYYMMDD/index.html`.
Extract the 10 tickers for anti-doublon filter (70% new minimum).

### Step 3: Regime Detection
Call `RunAutoScreener` to detect market regime.
Regimes: Risk-On, Early Risk-On, Neutral, Transition,
         Early Risk-Off, Risk-Off.

### Step 4: Multi-Strategy Screening
Run 3 DSL strategies:
1. Oversold: RSI(14) < 35 AND SMA(50) > SMA(200) AND Volume spike
2. Momentum: Close > SMA(20) > SMA(50) AND RSI 55-75 AND ADX > 25
3. Breakout: Close > BB_Upper AND Volume > 2x average

Additional screens: EU (VGK, SAP, ASML...), APAC (EWJ, FXI...),
ETFs (XLF, GLD, TLT, ARKK...).

### Step 5: Scoring (6 Layers)
For top 30 candidates, score across:
1. Technical confluence (>= 4 signals)
2. Fundamental quality (>= 80/100)
3. Social sentiment (aligned with direction)
4. Sector trend (outperforming SPY)
5. Macro regime (compatible)
6. AI conviction (>= 85%)

Composite >= 85 = A+. Top 3 with >= 90 = A++.

### Step 6: Output
- Create `scanner/YYYYMMDD/index.html` (> 40KB)
- Run `node tools/add_card.js scanner/YYYYMMDD/index.html`
- Git add, commit, push
- Send top 3 A++ to Discord

### Constraints
- Geographic diversity: min 5 US + 2 EU + 1 APAC + 2 ETF
- Risk-Off: min 20% defensive setups
- Anti-doublon: min 70% new tickers vs previous scan
- P0 control: reject if entry price > 10% from spot

The Power of CLAUDE.md

This file IS the trading strategy. When you want to add a new scoring dimension, change the geographic allocation, adjust the A++ threshold, or modify the output format, you edit this file. No code changes, no deployments, no compilation. Claude Code reads it fresh on every invocation. This is why AI-orchestrated systems are fundamentally different from traditional automation: the strategy lives in natural language, not in compiled code.

Step 6: First Test Run

With everything configured, let us run a minimal test to verify the pipeline works end-to-end:

shell
# Navigate to your project directory
cd /path/to/automated-trading-reports

# Run a simple market overview query
claude -p "Call GetMarketOverview and summarize the current market regime in 3 sentences."

# Expected output: Something like:
# "The current market regime is Risk-On with 78% confidence.
#  VIX is at 15.3 and declining, with market breadth at 65%
#  above the 200-day SMA. Leading sectors are Technology and
#  Consumer Discretionary."

If this works, your MCP Gateway is correctly configured. Now test a more complex query:

shell
# Test QueryData with multiple data types
claude -p "Query the following data for AAPL and NVDA: quote, trading_signals, support_resistance. \
For each ticker, tell me: current price, RSI(14), nearest support level, nearest resistance level, \
and whether you would consider it a buy, sell, or hold based purely on technicals."

If both tests pass, your data layer is operational. The next test is the full scanner — but we will build that properly in Parts 2-5 of this series.

Step 7: Configure the Discord Bot (Optional)

For automated scheduling, you need a Discord bot that can invoke Claude Code on a timer. Here is the minimal setup:

shell
# Clone the Discord bot
git clone https://github.com/dailytickers-xyz/claude-discord-bot.git
cd claude-discord-bot

# Install dependencies
npm install

# Configure
cp .env.example .env
# Edit .env with your Discord bot token and channel IDs
schedules.json
{
  "schedules": [
    {
      "id": 1,
      "name": "Scanner Quotidien",
      "cron": "0 23 * * 1-5",
      "command": "cd /path/to/automated-trading-reports && claude -p 'scan du jour'",
      "channel": "scanner-alerts",
      "enabled": true,
      "description": "Nightly scanner — weekdays at 23:00"
    },
    {
      "id": 2,
      "name": "Daily Briefing",
      "cron": "0 7 * * *",
      "command": "cd /path/to/automated-trading-reports && claude -p 'analyse daily'",
      "channel": "daily-briefing",
      "enabled": true,
      "description": "Morning briefing — every day at 07:00"
    },
    {
      "id": 3,
      "name": "Weekly Report",
      "cron": "0 18 * * 0",
      "command": "cd /path/to/automated-trading-reports && claude -p 'nouvelle analyse weekly'",
      "channel": "weekly-reports",
      "enabled": true,
      "description": "Weekly market report — Sundays at 18:00"
    },
    {
      "id": 4,
      "name": "Scanner Retrospective",
      "cron": "0 23 * * 5",
      "command": "cd /path/to/automated-trading-reports && claude -p 'rétrospective scanner'",
      "channel": "scanner-alerts",
      "enabled": true,
      "description": "Weekly scanner review — Fridays at 23:00"
    }
  ]
}
shell
# Start the Discord bot
npm start

# Or in a tmux session for persistence
tmux new-session -d -s discord-bot "cd /path/to/claude-discord-bot && npm start"

# Test: In Discord, type:
# > run #1
# This will manually trigger the Scanner task

Troubleshooting Common Setup Issues

Issue Symptom Fix
MCP server not found Error: Tool mcp__dailytickers__* not available Check claude_desktop_config.json path. Run node /path/to/dist/index.js manually to verify the server starts.
API key invalid 401 Unauthorized in server logs Verify MW_API_KEY in the config. Check the key has not expired.
CLAUDE.md not loaded Claude Code does not follow scanning instructions Ensure you are running claude -p from the project root where CLAUDE.md lives. Use pwd to verify.
Git push fails Permission denied (publickey) Set up SSH key: ssh-keygen -t ed25519 and add to GitHub. Or use gh auth login for HTTPS.
Discord bot offline Schedules do not fire Check tmux session: tmux attach -t discord-bot. Look for crash logs. Restart if needed.
Scanner report too small HTML file < 10KB Claude Code may have been truncated. Increase the max_tokens setting or split the generation into multiple write operations.
Rate limiting 429 Too Many Requests Reduce MW_MAX_CONCURRENT to 5. Increase MW_CACHE_TTL to reduce API calls.

Environment Verification Checklist

Run through this checklist before proceeding to Part 2:

shell
# 1. Claude Code installed and authenticated
claude --version          # Should show 1.0.x
claude -p "hello"         # Should respond

# 2. MCP servers configured
claude -p "List all available MCP tools that contain 'market'"
# Should list: GetMarketOverview, QueryData, RunScreener, etc.

# 3. Market data accessible
claude -p "Call GetMarketOverview and tell me the current VIX level"
# Should return a VIX value (e.g., "VIX is at 14.8")

# 4. Git configured
git status                # Should show clean working tree
git remote -v             # Should show your GitHub remote

# 5. GitHub Pages deployed
gh api repos/{owner}/{repo}/pages
# Should show: "status": "built"

# 6. Directory structure correct
ls scanner/ daily/ weekly/ analyses/ data/ assets/ tools/
# All directories should exist

# 7. CLAUDE.md present
wc -l CLAUDE.md
# Should show 100+ lines (ideally 400+)

If all 7 checks pass, your environment is ready. You have the foundation for a fully automated trading research pipeline.

Part 2 of 6
Real-Time Market Intelligence — The MCP Gateway Deep Dive
Automated Trading with Claude Code 1/6