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
Claude Code vs Codex: 6-Project Practical Experiment Breakdown
A practical experiment comparing Claude Code and Codex across 6 projects—web, backend, and free challenge—with cross-reviews, self-audits, and scoring.

Claude AI Creates Interactive Art Gallery When Given Creative Freedom
A developer gave Claude AI permission to 'burn some tokens playing' without boundaries, resulting in eight interactive generative art pieces exploring mathematical patterns and AI experience. The collection includes works about token-by-token text generation and probabilistic existence.

OpenClaw Agent Development Forces Clarity in Decision-Making
A Reddit user reports that building an OpenClaw agent made them define their memory structure, articulate decision-making processes, and notice delegation patterns, leading to personal productivity gains from self-reflection.

OpenClaw-powered IT dashboard creates tickets from chat conversations
A developer built a single HTML file IT helpdesk dashboard with an AI agent that auto-creates tickets from chat conversations. The system uses OpenClaw for the backend and localStorage for data storage in the prototype.