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

Running a Multi-Agent Startup Team on OpenClaw: Setup and Patterns
The noHuman Team built a web UI that deploys multi-agent OpenClaw setups with pre-built team templates, isolating each agent in its own virtual computer with a browser. They use a simple HTTP relay for agent communication and maintain role boundaries for focused work.

Using OpenClaw on Raspberry Pi as an AI hardware lab for device management
A developer runs OpenClaw on a dedicated Raspberry Pi to manage hardware devices through Discord, handling firmware flashing, troubleshooting, and system operations via subagents with guardrails like backups and rollback paths.

OpenClaw user shifts from complex agent setups to practical automation, saves 8-10 hours weekly
A developer running OpenClaw for a month abandoned elaborate multi-agent systems and focused on automating website management through GitHub. The setup now produces 30 posts in 4 weeks, reducing weekly work from 8-10 hours to about 20 minutes daily for review.

Karis CLI Architecture: Using Claude for Planning, Not Execution
Karis CLI uses a three-layer architecture where Claude handles planning and reasoning while pure code executes tasks reliably, creating a stable agent setup that separates LLM capabilities from execution.