System Architecture

Complete data flow, strategy logic, and AI integration for each instrument.

Pipeline Flow (Runs Every 15 Minutes)

1. ingest-candles
Fetches 1H OHLCV from Yahoo Finance for all 3 instruments
CRON 15m
candles table
2. compute-context
Calculates indicators (EMA, ATR, VWAP, Supertrend, RSI), detects session, range, structure levels
CRON 15m
indicator_snapshots + market_context_outputs
3. run-strategy
Evaluates all strategy conditions. Gold/Silver: 5 strategies. BTC: 3 crypto strategies
CRON 15m
aurum_strategy_outputs
4. run-decision
Picks strongest signal, applies confluence scoring (7 dimensions), determines final state
CRON 15m
final_decisions
5. ai-daily-briefing
GPT-4o analyzes ALL data + engine output. Makes independent trade recommendation with entry/SL/target/leverage
ON DEMAND
ai_briefings
DASHBOARD
AI Trade Card + Chart + Market Context + Pipeline Audit

AI Decision Architecture

PRIMARYAI (GPT-4o)

The AI is the primary decision maker. It receives ALL available data as context and makes its own independent analysis. It can agree or disagree with the engine. The AI determines:

• Direction: LONG / SHORT / NEUTRAL
• Confidence: 1-10 scale
• Entry, Stop Loss, Target levels
• Leverage recommendation: 1x-5x
• Risk analysis + energy narrative
Gold/Silver prompt: Receives DXY, VIX, macro regime, engine decision, indicators
BTC prompt: Receives funding rate, OI, fear/greed, leverage score, regime, engine decision
SECONDARYEngine (Strategy Pipeline)

The mechanical engine is secondary confirmation. It evaluates rule-based strategies and produces a signal that the AI can use as one of many inputs. When AI and engine agree, conviction is highest.

• Evaluates strategy conditions mechanically
• Applies confidence modifiers (regime, COT, divergence)
• 7-dimension confluence scoring
• R:R penalty for trades below 1.0
• Structure level anchoring for stops/targets
Shown in Market Context panel and Pipeline Audit on dashboard
Au

Gold XAUUSD

Precious metal — trades Mon-Fri, session-based (London/NY/Asia)

Data Inputs

Price Data
Yahoo Finance: GC=F (futures) 1H candles
120 bars rolling window
OHLCV + computed indicators
Technical Indicators
EMA 8 / EMA 20 crossover & gap
Supertrend direction & value
ATR(14) for volatility sizing
VWAP + distance percentage
RSI(14) for momentum
Volume regime (HIGH/NORMAL/LOW)
Range state & price position
Macro Data
FRED: Real yields (10Y - breakeven)
FRED: Fed funds rate, yield curve
FRED: M2 money supply, debt/GDP
DXY (dollar index) via Yahoo
VIX (volatility index) via Yahoo
CFTC: COT net speculative gold
GDX miner ETF volume + ratio
Central bank buying (260t/q est.)
Moon phase + backtested scores
Structure Levels
Previous day high / low
Previous week high / low
Round numbers ($10 intervals)
Used for stop/target anchoring
Cross-Signal Correlations
Gold/DXY correlation (20d + 60d)
Gold/Real Yield correlation
Gold/Miners divergence detection
Gold/Silver ratio analysis
Structural break detection
Driver ranking (what moves gold now)

Strategy Engine (5 Strategies)

Breakout ExpansionTREND

Price breaks range high/low with volume confirmation. Needs supertrend + trend alignment.

EMA CrossoverTREND

EMA8/21 gap signals direction. Trend must confirm. VWAP + volume boost confidence.

Supertrend FlipREVERSAL

Supertrend direction matches trend. Price must be near ST value (fresh flip, <3%).

Red Day AccumulationMEAN REVERT

Price below VWAP near range lows. Macro not hostile. Contrarian buy-the-dip.

NY Open Liquidity GrabSESSION

NY session only. Price at range extremes with volume spike. Grabs liquidity then reverses.

Confidence Modifiers (Applied to All Strategies)

Regime Score
Weighted composite (-100 to +100)
LONG + regime > 40 → +12 confidence
LONG + regime < -20 → -15 confidence
SHORT + regime < -30 → +12 confidence
COT Positioning
CROWDED_LONG + SHORT → +10 (contrarian)
CROWDED_SHORT + LONG → +10 (squeeze)
CROWDED_LONG + LONG → -8 (risky)
Divergence
Structural break + LONG → +8
Any divergence active → +4
Gold defying yields = structural demand
Ag

Silver XAGUSD

Precious metal — trades Mon-Fri, higher volatility than gold, industrial demand component

Data Inputs

Price Data
Yahoo Finance: SI=F (futures) 1H candles
120 bars rolling window
OHLCV + computed indicators
Technical Indicators
Same as Gold: EMA 8/20, Supertrend, ATR(14)
VWAP, RSI(14), Volume regime
Range state & price position
Higher ATR fallback: price * 0.02 (vs gold 0.008)
Macro Data
Same FRED data as Gold
DXY + VIX (shared context)
CFTC: COT net speculative silver (separate)
SIL miner ETF volume + ratio
Silver/Gold ratio for relative value
Margin stress detection (silver-specific)

Strategy Engine

SHAREDSame 5 strategies as Gold

Silver uses the same strategy engine as Gold with silver-specific adjustments: higher ATR fallback (2% vs 0.8%), silver COT data instead of gold, SIL miners instead of GDX, and margin stress filter that blocks trades when silver margin requirements spike.

Bitcoin BTCUSD

Cryptocurrency — trades 24/7, leverage-driven, unique on-chain & derivatives data

Data Inputs

Price Data
Yahoo Finance: BTC-USD 1H candles
120 bars rolling window
24/7 — no staleness guard (always fresh)
Technical Indicators
EMA 8 / EMA 20 crossover & gap
Supertrend direction & value
ATR(14) — much higher than metals (~$128)
VWAP + distance percentage
RSI(14) for momentum
Volume regime & ratio
Crypto Leverage Data
Binance: Funding rate (8h)
Binance: Open Interest + 24h change %
Binance: Long/Short ratio
Binance: Taker buy/sell volume ratio
Alternative.me: Fear & Greed Index (0-100)
Yahoo: IBIT + FBTC ETF volumes
BTC Regime Classification
LEVERAGE_FLUSH — OI dropping fast, fear rising
ACCUMULATION — low fear, stable OI, neutral funding
EUPHORIA — high greed, extreme funding, OI spiking
CAPITULATION — extreme fear, massive OI decline
MACRO_BETA — normal conditions, follows risk assets
BTC Leverage Score
Composite score (-100 to +100)
Weights: funding rate, OI trend, fear/greed
Long/short ratio, taker flow direction
Positive = bullish setup, Negative = bearish
Used as confidence modifier in strategies

Strategy Engine (3 BTC-Specific Strategies)

Leverage Flush ReversalCONTRARIAN

Contrarian LONG after leverage wipeout. Requires: Fear/Greed < 30 or CAPITULATION regime, OI declining > -1%, funding < 0.03%. Extreme fear = +15 confidence bonus.

Funding Rate FadeMEAN REVERT

Fade crowded positioning. Extreme funding > 0.05% → SHORT (crowded longs). Funding < -0.02% → LONG (squeeze setup). L/S ratio + fear/greed confirm conviction.

BTC Momentum TrendTREND

Trend following with leverage confirmation. EMA crossover + trend alignment + leverage score. Fear dip-buy bonus, greed caution penalty. OI building confirms trend.

Additional Data Pipelines

ingest-macro-extended
FRED API, CFTC COT, Yahoo miners, moon phases, regime score
HOURLY :07
compute-relationships
Cross-signal correlations, divergence detection, structural breaks
HOURLY :12
ingest-btc-data
Binance derivatives, Fear & Greed, ETF volumes, regime classification
HOURLY :22
ai-daily-briefing
GPT-4o full analysis per instrument with trade setup. Triggered on-demand via Refresh button.
ON DEMAND