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

Deep Research Reports with Hermes Agent and Qwen3.6-35b-a3b: A Practical Walkthrough
A social researcher shares their workflow using Hermes Agent and qwen3.6-35b-a3b Q6_K to produce 21-page policy reports autonomously, with full repo of prompts, skills, and intermediate artifacts.

OpenClaw Introduces One-Prompt Email Reporting for Seamless Operations
OpenClaw takes operational efficiency to the next level by enabling its agents to generate and send operational reports via a single prompt. This innovative feature simplifies workflow and enhances automation.

OpenClaw Bot Automates KMZ Data Extraction and Spreadsheet Merging
A user reports using OpenClaw bot to parse KMZ files, extract eight specific data points including mile markers, calculate decimal mile positions with high accuracy, and merge new data into existing spreadsheets without overwriting. The process took 5 minutes of processing time and 15% of a $100 max plan session budget.

Ambient AI Manager Using Claude Haiku for Context-Aware Notifications
A developer built an ambient AI system using Claude Haiku that delivers single-line contextual notifications based on Notion tasks, calendar, biometrics, and desk presence, displayed on a Raspberry Pi touchscreen bar.