Build a Stock Scanner — Part 6 of 6

Production Scanner — Going Live

From prototype to daily runner. Build a production-grade scanner pipeline with scheduling, data feeds, alerting, monitoring, retrospective analysis, and the continuous improvement loop that separates hobbyists from professionals.

Production Pipeline Alert Systems Improvement Loop Performance Tracking
Build a Stock Scanner6/6
ArchitectureSchedulingData PipelineAlertingMonitoringRetrospectivesImprovementQuiz
System Architecture

The Production Scanner Architecture

You've built the scanner logic (filters, scoring, regime detection) and validated it with backtesting. Now it's time to wrap it in a production-grade pipeline that runs reliably every day without manual intervention. Here's the complete architecture.

5
Pipeline Stages
23:00
Daily Run Time
~15 min
Execution Time
99.5%
Target Uptime

The 5-Stage Pipeline

1 Data Ingestion

Pull market data from your data provider(s). This includes end-of-day prices, volume, fundamentals, insider transactions, options flow, and sentiment data. The ingestion layer handles API rate limits, retries, and data validation.

2 Regime Detection

Before running any scanner logic, determine the current market regime. This sets the parameters for everything that follows — which strategies to deploy, position sizing multipliers, and exposure limits.

Output: Regime label (Risk-On, Transition, Risk-Off, Crisis) + confidence level (High/Medium/Low).

3 Filter & Score

Apply the DSL filters (Part 2) to define the candidate universe, then score all candidates (Part 3) using the composite scoring engine. Apply boosts and penalties. This is the core scanner logic.

Output: Ranked list of all scored candidates with grades.

4 Selection & Validation

Select the top N candidates based on grade threshold and diversification rules. Validate each pick: check spot price vs calculated entry (must be within 10%), verify volume is still sufficient, and cross-check for any breaking news that might invalidate the thesis.

Output: Final shortlist of 5-10 A+ picks with entry, stop, and target levels.

5 Output & Alert

Generate the scan report (HTML or PDF), send alerts to configured channels (Discord, email, Telegram), and log all results for retrospective analysis. Archive the full scoring data for audit trail.

Output: Published scan report + notifications + historical log entry.

Fail-Safe Design

Production systems fail. APIs go down, data feeds have gaps, your server reboots. Design your pipeline with fail-safe defaults:

The golden rule: when in doubt, do nothing. No trade is always better than a bad trade based on faulty data.

Scheduling & Automation

Daily Scheduling

Your scanner needs to run at the same time every day, reliably, without manual intervention. The timing matters — you want results ready for the next trading day's open.

Optimal Run Schedule

Time (ET)TaskDurationNotes
20:00EOD data finalized—Most providers finalize by 8 PM ET
22:00Data ingestion begins5-10 minPull all required data sources
22:10Regime detection + scanning3-5 minFull pipeline execution
22:15Validation + report generation2-3 minSpot price check, HTML report build
22:20Alerts sent1 minDiscord/email/Telegram notifications
06:30Pre-market review15 minManual review of scanner output + overnight news
09:30Market open — execute—Place orders based on reviewed picks

Why Run at Night?

Running at night (after market close) has three advantages: (1) EOD data is complete and finalized — no partial candles or delayed feeds. (2) You have the entire overnight period to review results and prepare orders before market open. (3) Intraday scanning generates excessive noise — daily timeframe signals are more reliable for swing trading setups.

Some scanners also run a pre-market refresh at 7 AM ET to check for overnight news that might invalidate setups (earnings miss, geopolitical event, pre-market gap). This is a quick validation pass, not a full re-scan.

Automation Options

MethodComplexityReliabilityCostBest For
Cron job (Linux/Mac)LowHigh (local)FreePersonal scanner on your machine
Task Scheduler (Windows)LowMediumFreeWindows users
Cloud function (AWS Lambda)MediumVery high$1-5/monthReliable, serverless deployment
Docker + cron on VPSMediumHigh$5-20/monthFull control, portable environment
Bot (Discord/Telegram)HighVery high$5-10/monthTeam use, interactive commands
GitHub ActionsLowHighFree (2000 min/mo)Open-source scanners, CI/CD native

For most individual traders, a cron job on a local machine or a cloud function is sufficient. If you need team access or want interactive queries ("run scanner with custom filters"), a Discord/Telegram bot adds significant value. This is the approach DailyTickers uses — a Discord bot that triggers the scanner via scheduled commands, with the flexibility to run ad-hoc scans on demand.

Data Pipeline

Building a Reliable Data Pipeline

Your scanner is only as good as its data. A missing data point, a stale quote, or a bad fundamental value can produce a pick that looks great on paper but is based on fiction. The data pipeline is the foundation of production reliability.

Data Sources by Type

Data TypeFree OptionsPaid OptionsUpdate Frequency
EOD PricesYahoo Finance, Alpha VantagePolygon, IEX Cloud, TiingoDaily (after 8 PM ET)
Intraday PricesAlpha Vantage (limited)Polygon, Alpaca1-min to 15-min bars
FundamentalsSEC EDGAR, Financial Modeling PrepSharadar, BloombergQuarterly (within days of filing)
Insider TransactionsSEC EDGAR (Form 4)OpenInsider, Quiver QuantWithin 2 business days of trade
Options FlowLimited free optionsUnusual Whales, FlowAlgoReal-time during market hours
SentimentStockTwits APISentifi, MarketPsychReal-time
Market RegimeFRED (VIX, yield curve)Most providers include thisDaily

Data Quality Checks

Every data ingestion run should pass through quality checks before the scanner processes it. These are your data circuit breakers:

Data Quality Rule
If quality_score < 95% → Abort scan and alert operator

The Backup Data Source

Always have a secondary data source configured. If your primary provider goes down (it happens more often than you'd expect), the pipeline should automatically fall back to the secondary source rather than skipping the scan entirely. Log the fallback event for investigation the next day. The key metrics to verify on fallback: price accuracy (<0.5% divergence from primary) and universe coverage (>95% of symbols available).

Alert Systems

Multi-Channel Alert System

Your scanner produces results. Now they need to reach you — and possibly your team or subscribers — through the right channels at the right time. The key principle is tiered urgency: not every alert deserves to wake you up at midnight.

Channel Comparison

ChannelLatencyRich ContentTeam SupportSetup Effort
Discord< 1sEmbeds, charts, reactionsExcellent (channels, roles)Medium (bot + webhook)
Telegram< 1sGood (Markdown, images)Good (groups, channels)Low (bot token + API)
Email1-30sExcellent (full HTML)LimitedLow (SMTP or API)
SMS< 5sNone (text only)NoneMedium (Twilio)
Web DashboardReal-timeFull (interactive charts)ExcellentHigh (web app)

Alert Tiers

TierChannelsExamplesFrequency
CriticalSMS + DiscordScanner failure, data quality issue, regime → Crisis~2/month
HighDiscord + EmailNew scan results, A+ picks, regime changeDaily (scan nights)
MediumDiscord onlyB+ picks, price approaching entry/stop levels2-3x/week
LowDashboard onlyWatchlist updates, performance stats, market commentaryContinuous

Discord Integration Architecture

Discord is the most popular choice for trading communities and automated scanners because it supports rich embeds, file attachments (for scan reports), role-based access, and real-time interaction. Here's what a well-structured Discord scanner setup looks like:

ChannelPurposeUpdate Frequency
#scanner-dailyDaily scan results — top 10 picks with entry/stop/targetOnce/day at 10:20 PM ET
#regime-alertsRegime changes and confidence level updatesOn regime change only
#trade-alertsEntry/stop triggers for active picks during market hoursReal-time during market
#retrospectiveWeekly performance review and scoring adjustmentsOnce/week (Friday)
#scanner-logsSystem health, errors, debugging, data quality reportsContinuous
Monitoring & Debugging

Keeping Your Scanner Healthy

A production scanner is a living system. It can degrade silently — data quality drops, a signal stops working, market structure changes. Without monitoring, you won't notice until your P&L tells you, and by then the damage is done.

Key Health Metrics

MetricNormal RangeWarningCritical
Data completeness> 99%95-99%< 95% (abort scan)
Execution time< 10 min10-20 min> 20 min (likely hanging)
Candidates scored2,000-3,000< 1,500 (data gap?)< 500 (feed down)
A+ picks generated2-6 per scan0-1 or 10+ (calibration issue)Always 0 or always 10+
Rolling 30-day hit rate55-70%45-55% (strategy degrading)< 45% (broken — kill switch)
Avg score driftStable (mean ~62)Mean shifting 5+ pointsScores clustering at extremes

When to Pull the Kill Switch

Stop the scanner and investigate if any of these occur:

Pulling the kill switch is not failure — it's prudent risk management. Better to pause for a week of debugging than to bleed capital into a broken system.

Debugging Common Issues

SymptomLikely CauseDiagnostic StepFix
All picks hitting stopsRegime mismatchCheck regime classifier accuracyRecalibrate regime thresholds
Same 5 stocks every scanFilters too narrowLog candidate count at each filterWiden filters or add signal types
Score inflation (many A+)Correlated signalsCheck signal independence matrixRemove correlated signals
No picks foundOverly restrictive or data gapRun each filter independentlyCheck data, relax weakest filter
Good picks, poor executionEntry timing or slippageCompare entry price vs signal priceAdd limit orders or intraday logic
Decreasing hit rate over timeMarket structure shiftCompare recent vs historical regimeRe-run walk-forward backtest
Retrospective Analysis

The Weekly Retrospective

The retrospective is the most important process in running a production scanner. It closes the feedback loop: the scanner generates picks, the market delivers outcomes, and you analyze the delta. Without retrospectives, your scanner is static — it will inevitably degrade as markets evolve.

Retrospective Structure (45 minutes weekly)

SectionContentsTime
1. Results DashboardHit rate, avg P&L, best/worst picks, profit factor for the week5 min
2. Pick-by-Pick ReviewFor each pick: entry, current price, TP1 hit?, stop hit?, still open15 min
3. Strategy AnalysisHit rate by strategy type (momentum, value, breakout, short)5 min
4. Regime AccuracyWas the regime classifier correct? Did strategy allocation match?5 min
5. Lessons & AdjustmentsWhat worked, what didn't, parameter changes for next week10 min
6. Forward LookRegime outlook, earnings calendar, macro events, adjusted strategy5 min

The 5 Rules of Retrospectives

  1. Never skip it. Even when you're winning — especially when you're winning. Winning streaks breed complacency, and the retro catches brewing problems before they explode.
  2. Be brutally honest. Don't rationalize losers ("it would have worked if not for that tweet"). The market is always right. Your job is to understand why, not to argue.
  3. Track cumulative patterns. A single losing trade is noise. The same strategy losing 4 weeks in a row is a signal that demands action.
  4. Don't over-adjust. If last week's retro says "tighten stops," don't widen them this week because one tight stop was premature. Wait for 3+ data points before making parameter changes.
  5. Document everything. Every retro goes into a permanent log. In 6 months, you'll look back and understand exactly when and why your scanner evolved.

Cumulative Performance Tracking

Beyond weekly retros, track cumulative performance metrics that reveal the scanner's health over longer horizons:

Continuous Improvement

The Improvement Flywheel

A production scanner is never "done." Markets evolve, correlations shift, new data sources become available, and your own trading style matures. The improvement flywheel ensures your scanner keeps pace with these changes.

The Flywheel
Scan → Trade → Retrospective → Adjust → Backtest → Deploy → Repeat

A/B Testing Scanner Variants

When you want to test a change (new signal, different weight, adjusted threshold), don't just apply it globally. Run two variants in parallel and compare results over 30+ trading days.

ElementVariant A (Control)Variant B (Test)
DescriptionCurrent production scannerProduction + new insider buying signal
Duration30 trading days minimum30 trading days minimum
Capital allocation80% of normal20% of normal (or paper trade)
TrackingHit rate, PF, Sharpe, MDDSame metrics, tracked separately
Decision ruleBaseline performancePromote if improvement > 10%

The 10% Improvement Threshold

Don't deploy a variant just because it's marginally better. Require a meaningful improvement (at least 10% better on key metrics) before promoting it to production. Small improvements may be noise — statistical fluctuations that don't represent genuine edge. Additionally, the variant must perform well across all walk-forward windows in a re-backtest, not just the recent 30-day test period.

Be especially cautious about adding complexity. A variant with 2 extra signals that improves hit rate by 3% but makes the scanner harder to maintain and debug is probably not worth deploying. Simplicity has compounding value in production systems — every additional dependency is a potential point of failure.

Scaling Considerations

As your scanner matures and proves its edge, you may want to scale along several dimensions. The critical rule: scale one dimension at a time with a 30-day validation period between changes.

DimensionStarterIntermediateAdvanced
UniverseUS large-cap (500)US all-cap + Europe (3,000)Global + crypto (10,000+)
Strategies1 (momentum only)3 (momentum + value + breakout)5+ with regime-based rotation
Run frequencyDaily (EOD)Daily + pre-market refreshIntraday (every 4 hours)
TeamSolo trader2-3 person groupFull trading desk
OutputEmail alertDiscord bot + dashboardFull web app + API + published reports
RetrospectiveMonthly (manual)Weekly (semi-automated)Daily (fully automated with exception alerts)

If you scale multiple dimensions simultaneously and performance degrades, you won't know which change caused the problem. One dimension at a time, with validation between each step, gives you a clear audit trail and easy rollback path.

Knowledge Check

Test Your Understanding

Quiz 1: Your data feed fails at 10 PM. What should the scanner do?
Answer: Abort the scan and alert the operator. Never run the scanner on stale or missing data. The fail-safe principle is "when in doubt, do nothing." Send a critical alert (SMS + Discord) so you can investigate. Try the backup data source if configured. If backup also fails, skip tonight's scan entirely. No scan is always better than a scan based on yesterday's data labeled as today's.
Quiz 2: Why run the scanner at night instead of during market hours?
Answer: Three reasons: (1) Data completeness — EOD bars are finalized after market close, eliminating partial candles and delayed feeds. (2) Review time — Running at night gives you the overnight period to review results, check overnight news, and prepare orders for market open. (3) Signal quality — Daily timeframe signals (RSI, MACD, volume) are far more reliable than intraday signals, which generate excessive noise and false positives for swing trading.
Quiz 3: Your scanner's rolling 30-day hit rate dropped from 62% to 48%. What do you do?
Answer: This crosses the warning-to-critical threshold. Systematic response: (1) Check the regime classifier — did the market change regimes without detection? (2) Audit data quality — are there feed issues degrading signal accuracy? (3) Review recent losers — look for patterns (same sector, same strategy type, same signal failing). (4) Pull the kill switch if you can't identify the root cause within 1-2 days. (5) Re-run walk-forward backtest with the most recent 6 months to check if the scanner's edge has structurally decayed. Never keep trading a broken system while you investigate.
Quiz 4: What are the 5 rules of a good retrospective?
Answer: (1) Never skip it — even when winning, especially when winning. (2) Be brutally honest — don't rationalize losers or attribute losses to bad luck. (3) Track cumulative patterns — one bad trade is noise; four weeks of the same strategy failing is a signal. (4) Don't over-adjust — wait for 3+ data points before changing parameters. Knee-jerk reactions introduce instability. (5) Document everything — every retro goes into a permanent log for long-term pattern analysis and institutional memory.
Quiz 5: You have a new insider buying signal that improved backtest results by 8%. Should you deploy it?
Answer: Not yet. An 8% improvement is below the 10% threshold for promoting a variant to production. Steps: (1) Run it as Variant B in a 30-day A/B test with 20% capital allocation (or paper trade). (2) Verify the improvement holds across all walk-forward windows, not just the recent period. (3) Assess operational complexity — does the new signal add a data dependency that could break the pipeline? Only promote if the improvement is sustained, statistically significant, and operationally manageable. A simple scanner that works reliably beats a complex scanner that breaks unpredictably.
Quiz 6: What's the danger of scaling multiple dimensions simultaneously?
Answer: Each scaling step (larger universe, more strategies, higher frequency, more team members) introduces new failure modes. If you expand the universe AND add new strategies AND increase frequency simultaneously, and performance degrades, you won't know which change caused the problem. This makes debugging nearly impossible and rollback ambiguous. Scale one dimension at a time with a 30-day validation period between changes. If something breaks, you know exactly what caused it and can surgically roll back that specific change.
Key Takeaways

Part 6 — Key Takeaways

Series Complete — You Built a Scanner

You now have the complete blueprint for a professional-grade stock scanner. The rest is execution. Start simple (Parts 1-2), add scoring (Part 3), integrate regime detection (Part 4), validate with backtesting (Part 5), and deploy to production (Part 6). Iterate weekly with retrospectives. Good trading.

Back to the Beginning
Part 1: Scanner Philosophy — What Makes a Great Scanner
Build a Stock Scanner6/6