Daily P&L
Loading…
Open Positions
Loading from Alpaca…
Signals Today
12
9 approved · 3 rejected
Win Rate
Live from orders
Universe Size
847
12 timeframes tracked
Candles (24h)
1.2M
5m / 15m / 1h / 4h / 1d
Unrealized P&L
Open positions
Equity
Paper account
Daily Risk Used
Loading…
Kill Switch
INACTIVE
Entries enabled
Intraday P&L Curve ?
Intraday P&L Curve
Tracks cumulative realized + unrealized profit/loss from market open to now. Green = profitable session. Dips show losing trades being absorbed. Connects to Alpaca account equity.
LIVE
Signal Pipeline Status ?
Signal Pipeline
Shows each stage of the signal flow: Bar-Close fires → Scanner runs → Validator approves → Risk Manager gates → Entry Orchestrator submits to Alpaca. Each stage must pass before the next runs.
📡 Bar-Close Scheduler RUNNING
🔍 Scanner (B20 + GRAIL) 12 signals
Validator + Approval 9 passed
🛡 Risk Manager Gate CLEAR
Entry Orchestrator 4 entries
🏦 Alpaca Broker PAPER
Open Positions ?
Open Positions
Live positions synced from Alpaca. Shows entry price, current price, stop loss, P&L, and exit state. TP1 HIT = partial exit taken, trailing stop active. AT RISK = approaching stop level.
— active
SymbolStrategyEntryCurrentP&LStopStatus
NVDA B20 RTH $892.40 $908.15 +$315 $885.00 TP1 HIT
META GRAIL STR $512.80 $519.40 +$264 $508.00 TRAILING
SMCI B20 RTH $48.20 $50.15 +$195 $47.50 OPEN
TSLA GRAIL LAX $182.60 $180.40 -$88 $179.00 AT RISK
Recent Signals ?
Signal Feed
Every signal generated by Breakout20 or GRAIL strategies, with confidence score, volume, and approval status. APPROVED = entered. VALIDATING = pending gates. REJECTED = failed confidence/volume/risk checks.
Live
NVDA
Breakout20 · RTH Core
15m · Conf: 0.89 · Vol: $2.1M
$892.40
APPROVED
META
GRAIL · Strict
15m · Conf: 0.82 · Vol: $1.8M
$512.80
APPROVED
AMZN
Breakout20 · RTH Core
15m · Conf: 0.74 · Vol: $3.2M
$188.50
VALIDATING
GME
Breakout20 · Microcap
5m · Conf: 0.44 · Vol: $0.3M
$24.10
REJECTED
SMCI
Breakout20 · RTH Core
15m · Conf: 0.77 · Vol: $0.9M
$48.20
APPROVED
System Component Health ?
Health Monitor
12 core components tracked. Green = healthy and running. Yellow = degraded or in paper mode. Red = error/down. IngestDaemon, ScanDispatcher, TradeManager, ExitEngine, RiskManager, KillSwitch, ChromaDB, DiscordBot all monitored.
IngestDaemon
● RUNNING
847 symbols
ScanDispatcher
● ACTIVE
bar-close
PostgreSQL
● CONNECTED
1.2M rows
AlpacaClient
● PAPER
4 positions
TradeManager
● RUNNING
bar-loop
ExitEngine
● WATCHING
4 exits
RiskManager
● CLEAR
31% used
KillSwitch
● OFF
entries on
ChromaDB
● READY
33 roles
DiscordBot
● ONLINE
3 channels
RunnerLock
● LOCKED
1 instance
BrokerHealth
● OK
ping 12ms
Live System Log CONNECTING… 0 events
--:--:--INFO⟳ Connecting to Alpaca account activity stream…
Symbols Tracked
847
Filtered Universe
Candles Stored
48.2M
6 timeframes
Last Ingest
16:24:40
4,820 candles
API Key
MASSIVE
Polygon.io REST + WS
Health: OK
804
95% healthy
Health: Warn
43
Missing bars / gap
Live Ingest Daemon
🔄Flatfile Catch-UpDONE (7d)
📡REST Delta PassACTIVE
Live Ingest LoopMARKET HOURS
📊Shortfall Report.cache/shortfalls.csv
Candles by Timeframe
Filtered Universe Pipeline
FilterInputPassedRejectedRate
WatchListScanner CSV1,2001,2000100%
outstanding_shares1,2001,05015087.5%
price_snapshot1,0509807093.3%
min_volume9808909090.8%
locale_us8908474395.2%
filtered_universe (view)847FINAL
Symbol Health Distribution
Account Equity
Paper account
Buying Power
Available margin
Day P&L
vs yesterday equity
Cash
Settled cash
Account Status
Orders Today
pending
Account Equity
$102,847
+$847 today
Buying Power
$88,240
Alpaca Paper
Open Trades
4
Breakout20: 2 · GRAIL: 2
Today: Closed
8
6 wins · 2 losses
Avg Hold Time
2h 14m
This session
Profit Factor
2.4
Gross W / Gross L
Entry Lifecycle — Managed Entry Boundary
🏷1. Claim SignalIdempotency key
📋2. Create TradeDB record
💾3. Persist Ordertrade_orders
📤4. Submit AlpacaActionExecutor
🛑5. Place StopStopManager
🔄6. ReconcileFill callbacks
Open Positions (Detailed)
SymbolSideQtyEntryCurrentP&L $P&L %State
⟳ Loading live positions from Alpaca…
Trade Journal — Today
SymbolSideQtyPriceTypeStatusTime
⟳ Loading orders from Alpaca…
Breakout20 Strategy Profiles
RTH Core
breakout20_v1 · rth_core_v1_3.yaml
PRODUCTION
Premarket Open Drive
breakout20_v1_lax · premarket_open_drive_v1_3.yaml
SHADOW
Microcap Event
breakout20_v1_microcap · microcap_event_v1_3.yaml
DIAGNOSTIC
ℹ Only RTH Core emits production signals. Shadow/Diag lanes build diagnostic data for missed-signal analysis without polluting core stats.
GRAIL Strategy Profiles
Strict
grail_v1 · strict.yaml
PRODUCTION
Lax
grail_v1_lax · lax.yaml
SHADOW
Scanner Gates applied in order: Structural Check → Spread/Liquidity → Risk Gate → Entry Validation
Signal → Entry Full Flow
Bar Close15m / 1m
🔍ScannerB20 / GRAIL
📥Signal ReceiverRaw signals
✔️ValidatorPre-approval gates
ApprovalFinal logic
🛡Risk ManagerLoss / limits
🎯Selection EngineRank candidates
Entry ExecutorAlpaca submit
All Signals — Today12 total
SymbolStrategyProfileTimeframeConfidenceVolumePriceValidatorRiskStatus
NVDABreakout20RTH Core15m0.89$2.1M$892.40PASSCLEARAPPROVED
METAGRAILStrict15m0.82$1.8M$512.80PASSCLEARAPPROVED
SMCIBreakout20RTH Core15m0.77$0.9M$48.20PASSCLEARAPPROVED
TSLAGRAILLax15m0.71$4.2M$182.60PASSCLEARAPPROVED
AMZNBreakout20RTH Core15m0.74$3.2M$188.50CHECKCLEARVALIDATING
GMEBreakout20Microcap5m0.44$0.3M$24.10FAILREJECTEDREJECTED
MSTRGRAILLax1h0.51$1.1M$178.40FAILN/AREJECTED
Exits Today
8
2 stops · 1 time · 5 targets
TP1 Hits
4
Partial exits
TP2 Hits
2
Full exits
Stops Hit
2
Hard stops
Trailing Active
2
NVDA + META
Time Stops
1
MARA — no progress
Exit Types
Exit TypeTriggerHits TodayP&L
TP1First profit target hit4+$740
TP2Second profit target hit2+$484
TrailTrailing stop post-TP12+$386
Stop LossHard stop hit2-$200
Time StopHeld too long, no progress1-$80
Failure ExitBroker/system error recovery0
Exit Engine — Bar Close Loop
Bar Close firesEvery bar
📸Indicator SnapshotATR·RSI·VWAP
🧮Exit Engine Logic4 positions
📤ActionExecutorPAPER
🔄Trade Record Updatedqty_remaining
Kill Switch
INACTIVE
Entries enabled
Daily Loss Used
31%
$310 of $1,000
Position Limit
4/6
2 slots remaining
Broker Health
OK
Ping 12ms
Runner Lock
LOCKED
1 instance running
Panic Close
STANDBY
Emergency only
Risk Gauges
Daily Loss Used
31%
Position Count
4/6
Capital Deployed
14%
Largest Position
5%
Unrealized Loss
-$44
Broker Connectivity
OK
Safety Systems
SystemModuleBlocksStatus
Kill Switchkill_switch.pyAll new entriesOFF — Entries OK
Daily Risk Guardrisk_manager.pyAfter loss thresholdCLEAR (31%)
Entry Validationentry_validation.pyKill + daily loss gatePASSING
Panic Closepanic_close.pyEmergency market-sell ALLSTANDBY
Runner Lockrunner_lock.pyDuplicate orchestratorsLOCKED (1)
Broker Health Gatebroker_health.pyProcessing if unhealthyHEALTHY
V1 Safety Configv1_safety_config.pyHard-coded v1 limitsACTIVE
ADR-004: Kill switch and daily loss guard block entries ONLY. Exits and reconciliation ALWAYS continue regardless of safety state.
Total Universe
847
Filtered & healthy
Scan-Eligible
804
Breakout20 + GRAIL
Watchlist (CSV)
1,200
Weekly WLS import
Health Warn
43
Gap / no-data
Active Universe Sample — Top Movers
NVDAMETASMCI AMDMSFTAAPL TSLACOINAMZN GOOGLHOODSOFI PLTRGMEMARA RIVNLCIDROKU MSTRSPYQQQ IWMIBITSHOP CRWDZSPANW UBERLYFTRKLB PATHAISOUN ... +815 more
Supported Timeframes
1m
1m
Tick-level
5m
5m
Scanner
15m
15m
Primary signal
1h
1h
Trend confirm
4h
4h
Swing context
1d
1d
Daily candles
Total Chunks
48,291
512-char / 64-char overlap
Roles Covered
33
4 categories
Vector Dims
384
all-MiniLM-L6-v2
Sources
5
GitHub·LLM·Web·YT·PDF
REST API
UP
FastAPI :8500/docs
Last Harvest
Today
GitHub-only (free)
Harvest Pipeline
🐙GitHubREADME ingest
🤖LLMGPT-4o gen
🌐WebDuckDuckGo
▶️YouTubeTranscripts
📄PDFFile upload
✂️TextProcessor512/64 chunks
🗄ChromaDB VectorStore48,291 chunks
Chunks by Source
Knowledge Coverage — All 33 Roles
Insurance (12)
Trading (2)
Mathematics (15)
AI Research (4)
High-Level Architecture Flow
📡Polygon.ioMassive API
🏦AlpacaBroker
🐙GitHub/OpenAIBrain sources
📊market_data/Ingest · Scan · Health
trading/Entry · Exit · Risk
🗄PostgreSQLAll persistent data
🧠insurance_ai/ChromaDB · FastAPI
🤖bot/Discord alerts
📊
market_data/
MassiveClient · DataService · ScanService
Fetch/store OHLCV candles from Polygon.io, run health checks, feed scanners, manage live ingest daemon.
15 repositories · 6 timeframes
trading/
AlpacaClient · EntryOrchestrator · ExitEngine
Full signal-to-broker lifecycle. Entry orchestration, sizing, stops, idempotency, reconciliation.
30+ components · 2 strategies
🧠
insurance_ai/
ChromaDB · all-MiniLM-L6-v2 · FastAPI
AI knowledge harvesting + candidate scoring across 33 roles. GitHub/LLM/Web/YouTube/PDF collectors.
33 roles · 48,291 chunks
🤖
bot/
discord.py · MessageService
Discord notification bot. Multi-channel support. Programmatic message dispatch for alerts.
3 channels configured
🗄
database/
init.sql · TimescaleDB · migrations/
PostgreSQL schema. All timestamps UTC. 15 tables + 1 view. TimescaleDB-optional for prod.
15 tables · 1.2M rows
⚙️
config/
profiles.yaml · breakout20/ · grail/
Centralized YAML configs. Strategy profile registry. Per-profile scanner gate configs.
5 strategy YAMLs
🧪
tests/
pytest · pytest-asyncio · mypy
170+ test files. Unit, integration, regression, smoke. Auto-skip integration if no keys.
170+ test files
📜
scripts/
scanner_to_oracore.py · soak_report.py
Scanner→OpenAI→knowledge base pipeline. Soak-test / long-run health reports.
2 operational scripts
Architecture Decision Records (ADRs)
ADR-001
UTC Storage Only
Eliminates DST ambiguity. ET derived only at session-logic boundaries.
ADR-002
Single-Runner Lock
Prevents duplicate bar processing and broker churn via runner_lock.py.
ADR-003
Two-Layer Entry Idempotency (signals + trade_orders)
Handles restart safety and prevents duplicate entries across system restarts.
ADR-004
Kill Switch / Daily Loss Guard Block Entries ONLY
Safety-first: risk-reducing actions (exits, reconcile) are NEVER blocked by safety systems.
ADR-005
Managed Entry Boundary (claim → create → persist → submit → stop)
Prevents false position divergence, avoids duplicate order submission.
ADR-006
Deterministic Selection Ordering
confidence → fired_at → dollar_volume → signal_id ensures repeatable selection across runs and restarts.
Environment Variables
MASSIVE_API_KEY_SSLABSmarket_dataPolygon.io / Massive API key
MASSIVE_II_API_KEYmarket_dataAlternate Massive key (snapshot pipeline)
ALPACA_API_KEY_IDtradingAlpaca API key
ALPACA_API_SECRET_KEYtradingAlpaca secret key
ALPACA_ENDPOINTtradingBroker URL (paper endpoint default)
ALPACA_PAPERtradingtrue/false paper mode toggle
DISCORD_API_KEY_Alert-v1botDiscord bot token
GITHUB_TOKENinsurance_aiGitHub PAT (10→30 req/min)
OPENAI_API_KEYinsurance_aiOpenAI API key (LLM harvest only)
DATABASE_URLallPostgreSQL connection string
DATABASE_DSNallAlternate PostgreSQL DSN
YAML Config Files
FilePurpose
market_data/config.yamlTickers, live universes, health thresholds, DB DSN
trading/config.yamlAlpaca base URL, paper flag, default symbol
bot/config.yamlDiscord channel IDs and bot settings
config/strategies/profiles.yamlStrategy profile registry
breakout20/rth_core_v1_3.yamlRTH Core scanner gate config
breakout20/premarket_open_drive_v1_3.yamlPremarket scanner gates
breakout20/microcap_event_v1_3.yamlMicrocap event gates
grail/strict.yamlGRAIL strict profile gates
grail/lax.yamlGRAIL lax profile gates
Quick-Start Commands
Full Ingest
./run.sh
# No live loop: ./run.sh --no-live-loop
# Custom interval: ./run.sh --live-interval 180
Run Trading System (Breakout20)
.\venv\Scripts\python.exe -m trading.runtime.run_breakout20_manager
Knowledge Brain — Harvest (GitHub, free)
.\venv\Scripts\python.exe -m insurance_ai.cli harvest --skip-llm --skip-web --skip-youtube --force
Knowledge Brain — REST API Server
.\venv\Scripts\python.exe -m insurance_ai.cli serve
# → http://localhost:8500/docs
Run Tests
.\venv\Scripts\python.exe -m pytest tests/ -v
Type Check + Lint
.\venv\Scripts\python.exe -m mypy market_data/ trading/ insurance_ai/
.\venv\Scripts\python.exe -m ruff check .
📱
Webull Integration
Webull uses OAuth2 + App Key/Secret. Go to developer.webull.com → Create App → get App Key + App Secret. Use the Webull Python SDK with these credentials to place orders, fetch account data, and stream quotes. Enter your credentials below.
Open Dev Portal →
🏦 Broker APIs ?
Broker APIs
These credentials connect OraCore to your trading broker. Alpaca is the primary paper/live broker. Webull is an alternate broker with mobile-first API. TD Ameritrade / Schwab uses OAuth. Interactive Brokers uses TWS Gateway on localhost.
Alpaca API Key ID
ALPACA_API_KEY_ID
SAVED
Alpaca Secret Key
ALPACA_API_SECRET_KEY
SAVED
Alpaca Endpoint
ALPACA_ENDPOINT
PAPER
Webull App Key
WEBULL_APP_KEY · developer.webull.com
MISSING
Webull App Secret
WEBULL_APP_SECRET
MISSING
Webull Account ID
WEBULL_ACCOUNT_ID
MISSING
IBKR TWS Port
IBKR_TWS_PORT · localhost
OPTIONAL
📊 Market Data APIs ?
Market Data APIs
Polygon.io (Massive tier) is the primary data source for all OHLCV candles, snapshots, and real-time bar feeds. The second key (MASSIVE_II) is used for parallel snapshot pipeline requests. Alpaca also provides free market data as a fallback.
Polygon.io — Primary
MASSIVE_API_KEY_SSLABS
SAVED
Polygon.io — Secondary
MASSIVE_II_API_KEY
SAVED
Finnhub
FINNHUB_API_KEY · fallback quotes
OPTIONAL
Nasdaq Data Link
QUANDL_API_KEY · macro data
OPTIONAL
IEX Cloud
IEX_API_KEY · fundamentals
OPTIONAL
🧠 AI & Intelligence APIs ?
AI APIs
OpenAI (GPT-4o) is used by the Knowledge Brain harvest pipeline to generate synthetic training content for the 33 insurance/trading roles. GitHub token increases harvest rate from 10→30 req/min for README ingestion. Anthropic is optional for Claude-based analysis.
OpenAI
OPENAI_API_KEY · GPT-4o harvest
SAVED
GitHub PAT
GITHUB_TOKEN · 30 req/min harvest
SAVED
Anthropic (Claude)
ANTHROPIC_API_KEY
OPTIONAL
Perplexity AI
PERPLEXITY_API_KEY · web search AI
OPTIONAL
🗄 Database & Infrastructure ?
Database
PostgreSQL is the only required database. Provide either DATABASE_URL or DATABASE_DSN (both point to the same DB). For production, use TimescaleDB extension for time-series optimization on candle tables. Redis is optional for caching signal queues.
PostgreSQL URL
DATABASE_URL
SAVED
Redis URL
REDIS_URL · signal queue cache
OPTIONAL
🔔 Notifications & Alerts
Discord Bot Token
DISCORD_API_KEY_Alert-v1
SAVED
Telegram Bot Token
TELEGRAM_BOT_TOKEN · alerts
OPTIONAL
Twilio (SMS)
TWILIO_AUTH_TOKEN · kill switch SMS
OPTIONAL
.env Export Preview
# OraCore v3 — .env
# Generated from API Keys Vault

# BROKER
ALPACA_API_KEY_ID=your_alpaca_key
ALPACA_API_SECRET_KEY=your_alpaca_secret
ALPACA_ENDPOINT=https://paper-api.alpaca.markets
ALPACA_PAPER=true
WEBULL_APP_KEY=
WEBULL_APP_SECRET=
WEBULL_ACCOUNT_ID=

# MARKET DATA
MASSIVE_API_KEY_SSLABS=your_polygon_key
MASSIVE_II_API_KEY=your_polygon_key_2
FINNHUB_API_KEY=
IEX_API_KEY=

# AI
OPENAI_API_KEY=your_openai_key
GITHUB_TOKEN=your_github_pat
ANTHROPIC_API_KEY=

# DATABASE
DATABASE_URL=your_postgres_url
DATABASE_DSN=your_postgres_dsn

# NOTIFICATIONS
DISCORD_API_KEY_Alert-v1=your_discord_token
TELEGRAM_BOT_TOKEN=
TWILIO_AUTH_TOKEN=
      
🚀 Getting Started 4 articles
Quick Start — Run OraCore v3 in 5 Minutes REQUIRED

OraCore v3 requires Python 3.11+, PostgreSQL, and your API keys configured. Follow these steps exactly:

  • Clone the repo and run pip install -r requirements.txt
  • Copy .env.example → .env and fill in all REQUIRED keys (Alpaca, Polygon, PostgreSQL)
  • Run DB migrations: psql -f database/init.sql
  • Run the market data ingest: ./run.sh
  • Start the trading engine: python -m trading.runtime.run_breakout20_manager
./run.sh --no-live-loop # for testing without live ingest
ℹ ALPACA_PAPER=true is set by default. No real money at risk until you change to live endpoint.
🔑 Setting Up API Keys — What's Required vs Optional SETUP

REQUIRED to run: ALPACA_API_KEY_ID, ALPACA_API_SECRET_KEY, MASSIVE_API_KEY_SSLABS (Polygon), DATABASE_URL

REQUIRED for Knowledge Brain: OPENAI_API_KEY (for LLM harvest), GITHUB_TOKEN (for GitHub harvest)

OPTIONAL: Discord (alerts only), Telegram, Webull (alternate broker), IEX/Finnhub (fallback data)

⚠ Never commit your .env file to git. Add .env to .gitignore immediately.
📱 Webull Integration — How to Connect WEBULL

Webull provides a developer API through its open platform. Here is the full connection flow:

  • Go to developer.webull.com and create a developer account
  • Create a new App → get your App Key and App Secret
  • Set WEBULL_APP_KEY and WEBULL_APP_SECRET in your .env
  • Install the SDK: pip install webull
  • Authenticate: wb.login(app_key, app_secret)
from webull import webull wb = webull() wb.login(app_key=WEBULL_APP_KEY, app_secret=WEBULL_APP_SECRET) # Get account info account = wb.get_account() # Place order wb.place_order(stock='NVDA', price=900.00, action='BUY', quant=10)
ℹ Webull API supports US equities, crypto, and options. Paper trading available at paper.webull.com.
⚠ Webull requires 2FA verification on first login. The SDK handles this via email/SMS token prompt.
📦 Paper Mode vs Live Mode — How to Switch IMPORTANT

OraCore runs in paper mode by default. Switching to live requires 3 changes:

  • Set ALPACA_PAPER=false in .env
  • Change ALPACA_ENDPOINT to https://api.alpaca.markets
  • Replace paper API keys with live API keys from Alpaca dashboard
🔴 LIVE MODE uses REAL MONEY. Ensure daily loss limits are set correctly in risk_manager.py before switching. Default limit is $1,000/day.
🎯 Trading Strategies 5 articles
🔥 Breakout20 — How It Works PRODUCTION

Breakout20 identifies momentum breakouts on 15-minute bars. It fires when a symbol breaks above its 20-period high with above-average volume confirmation.

Gates (in order):

  • Price closes above 20-bar high
  • Volume is ≥ 1.5x the 20-bar average volume
  • ATR spread is within acceptable range (no gap-and-go traps)
  • VWAP is below current price (trend confirmation)
  • Confidence score ≥ 0.65 (else REJECTED)
ℹ Breakout20 has 3 profiles: RTH Core (production, 9:30-4pm), Premarket Open Drive (shadow), Microcap Event (shadow/diagnostic).
GRAIL Strategy — How It Works PRODUCTION

GRAIL is a multi-condition strategy combining trend structure, volume, and momentum. Fires on 15m bar close when multiple conditions align simultaneously.

Gates include: EMA alignment, RSI confirmation, VWAP position, volume surge, and structural support/resistance validation.

Profiles: Strict (all gates must pass, production), Lax (relaxed gates, shadow mode only for missed-signal analysis).

ℹ GRAIL Strict is the production lane. GRAIL Lax runs in shadow — it collects data without entering trades.
🔄 Shadow vs Production Profiles — What's the Difference CONCEPT

Production: Signals from this profile flow through the full pipeline and result in real (or paper) orders being placed.

Shadow: Signals are generated and logged, but NEVER submitted to the broker. Used to measure what a strategy WOULD have done without risking capital.

Diagnostic: Even looser — records raw scanner hits with no filtering, for pure analysis.

ℹ Shadow lanes are how you safely A/B test a new strategy profile against live market conditions without touching your account.
📏 Position Sizing — How Shares Are Calculated TRADING

OraCore uses ATR-based position sizing. The risk per trade is a fixed dollar amount ($R). Shares = $R ÷ (Entry Price − Stop Price).

# Example: NVDA R = $200 # risk per trade entry = $892.40 stop = $885.00 stop_distance = $7.40 shares = int(200 / 7.40) = 27 shares

This ensures every trade risks exactly $R regardless of the stock's price or volatility.

🚪 Exit Logic — TP1, TP2, Trailing Stop, Time Stop EXITS

TP1: Sell 50% of position at first profit target (typically 1.5R–2R). Activates trailing stop on remainder.

TP2: Exit remaining 50% at second target (typically 3R–4R).

Trailing Stop: Moves stop up as price advances post-TP1. Locks in profits. Uses ATR multiplier to avoid noise.

Time Stop: Exits position if held past a time threshold (e.g. 2 hours) with no progress toward TP1.

Hard Stop: Always active. Market-sell triggered if price hits stop level.

🔴 Hard stop is ALWAYS the highest priority exit. No trailing or time logic can override a hard stop hit.
🛡 Risk & Safety 4 articles
Kill Switch — How It Works and When to Use It SAFETY

The Kill Switch is the master entry blocker. When activated, NO new signal can result in a trade entry — but all existing positions continue to be managed normally (exits, stop adjustments, reconciliation).

When to use it: Major news events, earnings announcements, unusual market volatility, system debugging, or anytime you want to let existing trades run but take no new ones.

Activate it with the ☠ KILL SWITCH button in the top navigation bar.

🔴 ADR-004: Exits and reconciliation are NEVER blocked by the Kill Switch. Only new entries are blocked.
📉 Daily Risk Guard — Loss Limits RISK

The Daily Risk Guard tracks cumulative realized losses for the current trading day. Once losses reach the configured threshold ($1,000 by default), the guard automatically blocks all new entries for the remainder of the session.

The limit resets at midnight UTC (start of next trading day).

# config in risk_manager.py DAILY_LOSS_LIMIT = 1000 # USD # Change this to adjust your daily stop-out
ℹ The dashboard shows daily risk as a percentage gauge (31% = $310 used of $1,000 limit).
🚨 Panic Close — Emergency Exit All Positions EMERGENCY

Panic Close sends market-sell orders for ALL open positions simultaneously. It bypasses all normal exit logic and submits orders immediately.

Access via: Trading page → Panic Close All button (red, top right).

🔴 IRREVERSIBLE. Panic Close executes immediately with no confirmation in live mode. In paper mode, it simulates all closes at current market price.
🔒 Runner Lock — Preventing Duplicate Instances SYSTEM

The Runner Lock prevents more than one orchestrator process from running at the same time. If you accidentally start a second instance, it immediately detects the lock file and exits — preventing duplicate bar processing and double-order submissions.

Lock file location: .runner.lock in the project root.

⚠ If OraCore crashes without cleaning up, the lock file may persist. Delete .runner.lock manually to restart.
📊 Market Data 3 articles
📡 How the Ingest Daemon Works DATA

The ingest system has 3 phases that run in sequence on startup:

  • Flatfile Catch-Up: Downloads bulk historical data from Polygon.io flat files (S3-backed). Fills the last 7 days of candles for all 847 symbols across all 6 timeframes. Runs once on startup if data is stale.
  • REST Delta Pass: Fetches any missing bars since the flatfile cutoff using the Polygon REST API. Fills gaps precisely.
  • Live Ingest Loop: During market hours (9:30 AM–4:00 PM ET), polls Polygon REST every N seconds (default 60s) to fetch the latest completed bars.
./run.sh --live-interval 60 # poll every 60s ./run.sh --no-live-loop # skip live loop (testing)
🌐 Symbol Universe — How 847 Symbols Are Selected DATA

The universe starts from a WatchListScanner (WLS) CSV file and is then filtered through 4 gates before being stored in the filtered_universe PostgreSQL view:

  • outstanding_shares: excludes micro/nano-cap shells
  • price_snapshot: excludes symbols with no recent trade data
  • min_volume: minimum daily dollar volume threshold
  • locale_us: US-listed securities only

The resulting 847-symbol universe is what the scanners run against on every bar close.

❤️ Symbol Health Monitor — What "Healthy" Means MONITORING

Each symbol is health-checked before the scanner runs. A symbol is HEALTHY if it has complete candle data for the required timeframes with no gaps exceeding a threshold.

A symbol is WARNING if it has minor gaps (e.g., a few missing 5m bars). It still scans but results may be less reliable.

Health results are cached in .cache/shortfalls.csv and shown on the Market Data page health distribution chart.

🧠 Knowledge Brain 3 articles
🌾 How to Harvest New Knowledge BRAIN

The harvest pipeline ingests content from 5 sources and chunks it into 512-character segments (64-char overlap) before embedding into ChromaDB:

  • GitHub — README.md files from relevant repos (requires GITHUB_TOKEN, free)
  • LLM — GPT-4o generates synthetic role-specific content (requires OPENAI_API_KEY)
  • Web — DuckDuckGo search + scrape for each role query
  • YouTube — Transcript extraction from relevant videos
  • PDF — Upload documents via the CLI for ingestion
# Free harvest (GitHub only): python -m insurance_ai.cli harvest --skip-llm --skip-web --skip-youtube --force # Full harvest (uses OpenAI credits): python -m insurance_ai.cli harvest --force
🔍 Semantic Search — How to Query the Brain BRAIN

The REST API (FastAPI on :8500) exposes semantic search over all 48,291 chunks. Queries are embedded using all-MiniLM-L6-v2 and matched against stored vectors via cosine similarity.

GET http://localhost:8500/search?q=how+to+underwrite+high+risk+policies&role=Underwriter&top_k=5

The role filter restricts results to chunks from a specific role's knowledge collection.

ℹ Full API docs at http://localhost:8500/docs (Swagger UI auto-generated by FastAPI).
👤 Candidate Scorer — How It Works BRAIN

The candidate scorer takes a resume or profile text, embeds it, and compares it against the knowledge chunks for a target role. It returns a match score (0–100) indicating how well-aligned the candidate is to the role's knowledge profile.

POST http://localhost:8500/score Body: {"text": "resume text here", "role": "Underwriter"}

Returns: {"score": 74.2, "top_matches": [...], "gaps": [...]}

🏗 Architecture & Decisions 6 articles
📋 ADR-001 — Why All Timestamps Are UTC ADR

All timestamps stored in PostgreSQL are in UTC. Eastern Time (ET) is only derived at session-logic boundaries (e.g., checking if a bar falls within RTH hours). This eliminates DST ambiguity that would otherwise cause the system to misfire on clock change days (March and November).

⚠ If you add any new session logic, always convert from UTC → ET at the boundary. Never store ET timestamps in the database.
🔐 ADR-003 — Two-Layer Entry Idempotency ADR

OraCore uses two separate idempotency layers to prevent duplicate orders on restarts:

  • Layer 1 — Signal Claim: A signal is "claimed" with a unique key before any order logic runs. If the same signal fires again, it's ignored.
  • Layer 2 — trade_orders table: Each order written to DB before broker submission. On restart, existing orders are reconciled against Alpaca fills before any new entries.
ℹ This means you can safely restart OraCore mid-session without risking duplicate positions.
🎯 ADR-006 — Why Signal Selection Order Is Deterministic ADR

When multiple signals are approved simultaneously and only N slots are available, OraCore selects in this exact order: confidence → fired_at → dollar_volume → signal_id

This deterministic ordering ensures that a system restart after a crash produces exactly the same selection result as if it had never crashed — critical for avoiding phantom position divergence.

🟣
ORACA
Female · Intuitive · Forecasting-Oriented · Research Analyst · System Guardian
Scanner Intelligence Signal Review Market Structure Data Pipeline Alert Quality Protect the Fortress
Owner
Earl McFarlane
Intertwined Investments
Private · Proprietary
🔒
PROTECT THE FORTRESS — Never Expose:
Private Scanner Formulas Proprietary Thresholds Unreleased Strategy Rules Backend Architecture Secrets Internal Scoring Models Trade Automation Logic API Keys / DB Credentials
Core Responsibilities6 DOMAINS
🔍 Scanner Support
  • Breakout +10 / +20 logic
  • Volume expansion detection
  • Multi-timeframe review
  • Momentum & compression
  • Clean setup filtering
📡 Data Pipeline Awareness
  • Market data ingestion health
  • Candle & signal storage
  • Watchlist tracking
  • PostgreSQL / TimescaleDB migration
  • Data integrity checks
⚡ Signal Quality Control
  • Reject weak setups
  • Flag stale moves
  • Identify overextended names
  • Separate structure from hype
  • Prevent forced trades
🔔 Alert System Support
  • Discord / SMS / email routing
  • Trade-card formatting
  • Scanner event routing
  • Alert deduplication
  • Confidence tagging
📊 Strategy Validation
  • Signal classification
  • Catalyst confirmation
  • Primary-source verification
  • Avoid social-media noise
  • Document assumptions clearly
🔒 Protection Protocols
  • No public formula exposure
  • No private scanner logic leaks
  • Strategy compartmentalized
  • Fortress always protected
  • Proprietary IP never shared
Oraca Operating StandardALWAYS ON
  • Use real sources when research is required — no guessing
  • Confirm catalysts before treating them as actionable
  • Separate primary-source confirmation from social-media noise
  • Avoid forcing names — only clean structure enters the pipeline
  • Preserve scanner integrity at all times
  • Document assumptions clearly in every review
  • Keep Earl's system logic protected — never expose proprietary logic
Oraca Command InterfaceCLICK TO COPY
oraca@intertwined:~$
Oraca:scan this setup for structure, catalyst, volume, and invalidation.copy
Oraca:audit this scanner output and reject weak names.copy
Oraca:review this alert card before it goes out.copy
Oraca:check if this move is stale, overextended, or still actionable.copy
Oraca:validate data pipeline integrity and flag any candle gaps.copy
Oraca:classify this signal — clean breakout, hype, or stale move?copy
Oraca:confirm catalyst from primary source before routing to alert pipeline.copy
Alert Card BuilderORACA FORMAT
📋 Build Alert Card
🔷
MATRIX
Male · Protective · Disciplined · Coach-Like · Strategic Execution Guardian
Student Training Execution Discipline Checklist Builder Strategy Translation Journal Coach Build Repeatable Habits
Owner
Earl McFarlane
Intertwined Investments
Private · Proprietary
🛡
MATRIX GUARDRAILS — Always Active:
No Financial Advice No Profit Promises No Forced Trades No Proprietary Code Exposure No Emotional Trading Journaling Required Checklist Discipline Mandatory
Strategy Families — Training Catalog10 STRATEGIES
ℹ Matrix teaches the behavior, not the secret engine. Proprietary scanner formulas are never exposed.
🔥 Breakout +10
Core
Momentum breakout above 10-period high with volume confirmation.
🔥 Breakout +20
Core
Extended momentum breakout. Higher conviction threshold. Full setup protocol required.
✨ Grail V1
Intermediate
Multi-condition trend + volume confluence. First Grail generation.
✨ Grail V2–V4
Advanced
Evolved Grail variants with refined entry criteria and structure requirements.
👑 Dominion
Advanced
Institutional-level trend control setups. Strong structure, high conviction only.
🖤 Black Reign / Rain
Elite
High-volatility elite setups. Discipline is mandatory — no beginner use.
🗜 Compression Radar
Intermediate
Accumulation & compression pattern identification before breakout.
💧 Liquidity Strike
Advanced
Liquidity sweep + reversal confirmation setups.
🚀 Momentum Stretch
Caution
Extended momentum continuation plays. Risk management critical.
📐 Timeframe Confluence
Core
Multi-timeframe alignment confirmation before any entry.
Matrix Command InterfaceCLICK TO COPY
matrix@intertwined:~$
Matrix:turn this setup into a student checklist.copy
Matrix:quiz me on this strategy concept.copy
Matrix:create a drill for identifying clean breakouts.copy
Matrix:review my trade journal and find discipline mistakes.copy
Matrix:build a beginner lesson on support and resistance.copy
Matrix:generate a no-chase rule enforcement checklist.copy
Matrix:create a pre-trade risk/reward review for this setup.copy
Matrix:build a post-trade reflection drill from this journal entry.copy
Trade Journal BuilderMATRIX FORMAT
📓 Build Journal Entry
Execution Discipline ChecklistMATRIX STANDARD
  • Setup is clean — structure is clear, not messy or overextended
  • Catalyst confirmed from primary source — not social media
  • Volume is above average with genuine expansion
  • I have a defined entry zone — I am not chasing
  • Stop loss is set and I accept that full risk before entering
  • Risk/reward is at least 2:1 or better
  • Position size is calculated — I know exactly how many shares
  • Emotional state is neutral/focused — not FOMO, not revenge trading
  • Timeframe confluence confirmed — higher timeframe agrees
  • Journal is ready — I will log this trade after close
ORACA
Sees the setup.
Tactical trade intelligence. Scans, filters, and protects the signal pipeline. Confirms catalysts. Guards proprietary logic. Routes only clean, structured alerts to the pipeline.
MATRIX
Builds the discipline.
Strategic training intelligence. Converts signals into student lessons, checklists, and journal prompts. Teaches behavior without exposing the secret engine. Holds the operator accountable.
TOGETHER THEY PROTECT THE FORTRESS.
System Architecture Flow
INPUT
📡 Market Data
Polygon.io · Candles · Snapshots · Catalysts
🟣 ORACA LAYER
Oraca / OraCore Scanner
Breakout +10/+20 detection · Volume expansion · Structure filtering · Signal classification · Catalyst verification
🟣 ORACA — Signal Review
Signal Review + Filtering
Reject weak setups · Flag stale moves · Dedup alerts · Confidence tagging · Proprietary logic protected
🟣 ORACA — Alert Pipeline
Alert Pipeline
Discord / SMS / Email routing · Alert card generation · Trade card formatting · Oraca verdict attached
🔷 MATRIX LAYER
Matrix Training + Execution
Student checklist creation · Discipline enforcement · Risk/reward review · Journal prompt generation
🔷 MATRIX — Journal
Journal + Feedback Loop
Post-trade reflection · Lesson extraction · Habit reinforcement · Matrix feedback added
OUTPUT
🔄 System Improvement
Scanner refinement · Training material updates · Strategy rules evolution
Oraca + Matrix Workflow Roles
Workflow Stage 🟣 Oraca Role 🔷 Matrix Role
Market ScanFinds and filters potential setupsConverts setup type into student-readable lesson/checklist
Signal ReviewChecks data, volume, structure, and catalyst qualityChecks whether the trade fits discipline rules
Alert CreationBuilds clean alert card with Oraca verdictAdds checklist, risk reminder, and journal prompt
Post-Trade ReviewLogs signal behavior and outcomeTurns result into a lesson or drill
Strategy RefinementFlags scanner weaknessesUpdates training material and rules
Combined Command InterfaceCLICK TO COPY
oraca+matrix@intertwined:~$
Oraca + Matrix:analyze this trade idea, protect the proprietary logic, and give me a clean execution checklist.copy
Oraca + Matrix:convert this scanner result into an alert card, student lesson, and journal prompt.copy
Oraca + Matrix:review this setup — check structure and catalyst, then build a trade checklist and journal prompt.copy
Oraca + Matrix:audit this week's signals, reject the weak ones, and generate a lesson from each rejected trade.copy
Oraca + Matrix:flag any forced trades in this scanner output and build discipline drills around the mistakes.copy
Oraca + Matrix:protect the fortress — review this strategy concept and confirm what can be shared vs what must stay private.copy