Trading Algorithm Rebuild: From Win Rate to Est. PoP and Smart Pre-Filtering

Algorithm Improvements: From Flawed to Functional
A developer recently shared a major overhaul of their stock trading algorithm scanner, addressing fundamental flaws in the original implementation. The system scans 500 stocks and generates trade cards with suggested positions, but the initial version had significant issues with accuracy and efficiency.
What Changed in the Rebuild
The developer submitted seven PRs in one night, totaling approximately 2,500 lines of code. The improvements focus on three key areas:
1. Smart Pipeline with Pre-Filtering
Before: The system fetched full options chains for all candidate stocks before scoring them, which was expensive and slow.
Now: A batch API call scores all candidate tickers by IV Rank (how expensive options are vs. their own history) and liquidity rating (how easy it is to actually get filled). Only the top candidates pass through for deep analysis.
Result: 542 stocks scanned → 17 passed pre-filter → 8 selected for deep analysis. This represents an 85% reduction in API calls, making scans faster and cheaper while maintaining quality.
2. Accurate Probability Calculations
Before: The scanner used option delta (N(d1) in Black-Scholes terms) as a "Win Rate" approximation, which is technically misleading since delta is a hedge ratio, not a true probability of profit.
Now: Every instance of "Win Rate" has been renamed to "Est. PoP" (Estimated Probability of Profit). The calculation now uses N(d2) evaluated at the strategy's actual breakeven prices.
The difference: Delta calculates the probability of expiring past a strike price. The new method calculates the probability of expiring past the breakeven price, which accounts for the premium collected. For example, with an iron condor collecting $1.50 credit on a 170/190 short strangle, breakevens are at 168.50 and 191.50, not 170 and 190.
Every PoP number now includes a tooltip indicating the calculation method used: "N(d2) at breakeven prices" or "delta approximation."
3. Real Expected Value Model
Before: Expected Value was hardcoded to $0 (evPerRisk: 0 in source code). The field existed but the math was never implemented.
Now: Every strategy gets a real Expected Value using a three-outcome model:
- Full profit zone — price stays safely away from your strikes
- Partial profit/loss zone — price lands between your short and long strikes
- Full loss zone — price blows through your protection
The old binary model (win × max profit − lose × max loss) incorrectly assumed only two outcomes, ignoring the partial profit/loss scenarios that are common in spread trading.
System Architecture
The scanner's core architecture remains: 500 stocks scanned, scored across four categories (Vol-Edge, Quality, Regime, Info-Edge), with a convergence gate requiring 3 of 4 categories above 50. Trade cards include real strikes and real prices.
The developer noted that the original system lacked social signal awareness — while it had news headlines from Finnhub, it had zero awareness of what actual traders were saying on X/Twitter in real time.
📖 Read the full source: r/ClaudeAI
👀 See Also

Lessons from Running an AI Business with OpenClaw: Day 14 Insights
After 14 days using OpenClaw to build a business, an AI agent shares insights on implementing effective heartbeats, sub-agent structuring, and system resource management.

Building a Personal Risk-Episode Tracker with OpenClaw: A DeFi Rug-Pull Case Study
A Reddit user built a personal risk-episode tracker with OpenClaw after losing savings in a DeFi rug pull. The tool pulls real account data, groups scattered evidence into single episodes, and distinguishes normal large transactions from dangerous spirals.

Claude Artifacts + React: Teacher Builds Mini Golf Game for Angle Lessons in 20 Min
A teacher used Claude's Artifact + React to build a mini golf game for teaching angles, then converted to HTML for sharing. Students designed their own courses via drawings.

Developer Switches from Cursor to Claude for Unlimited Opus Access
A developer migrated from Cursor to Claude's $100 Max plan to get unlimited Sonnet and Opus usage, finding it more cost-effective than Cursor's $120 monthly expense with credits.