pair-trade-screener

Warn

Audited by Runlayer on Feb 21, 2026

Risk Level: MEDIUM
Scan Summary
Max Score
78%
Files
6
Flagged
6
Chunks
16
Flagged Files (6)
README.mdHIGH
78.3%

Malicious tool definition detected

Tool: README.md [1/2] Description: # Pair Trade Screener Statistical arbitrage tool for identifying and analyzing pair trading opportunities using cointegration testing and mean-reversion analysis.

Tool: README.md [2/2] Description: 0.70 - P-value > 0.05 - Half-life > 90 days or undefined - No economic linkage ### Exit Conditions **Primary Exit:** - Z-score crosses 0 (spread reverts to mean) - Close both legs simultaneously **Stop Loss:** - |Z-score| > 3.0 (extreme divergence, possible structural break) - -5% loss on spread - Exit immediately **Time-Based:** - No mean reversion after 90 days (or 3× half-life) - Free capital for better opportunities ## Troubleshooting ### No pairs found **S

SKILL.mdHIGH
78.3%

Malicious tool definition detected

Tool: SKILL.md [1/3] Description: --- name: pair-trade-screener description: Statistical arbitrage tool for identifying and analyzing pair trading opportunities.

Tool: SKILL.md [2/3] Description: std dev over 90-day rolling window - Plot historical z-score distribution - Identify maximum historical z-score deviations - Check for structural breaks (spread regime change) ### Step 6: Generate Entry/Exit Recommendations **Objective:** Provide actionable trading signals with clear rules.

Tool: SKILL.md [3/3] Description: - **Structural Breaks**: Testing for regime changes - **Practical Examples**: Case studies with real pairs ## Integration with Other Skills **Sector Analyst Integration:** - Use Sector Analyst to identify sectors in rotation - Screen for pairs within outperforming sectors - Pairs in leading sectors may have stronger trends **Technical Analyst Integration:** - Confirm pair entry/exit with individual stock technicals - Check support/resistance levels before entry

references/cointegration_guide.mdHIGH
78.3%

Malicious tool definition detected

Tool: references/cointegration_guide.md [1/3] Description: # Cointegration Testing Guide ## Table of Contents 1.

Tool: references/cointegration_guide.md [2/3] Description: 0.05)") strength = "☆" # Step 7: Calculate half-life (if cointegrated) if p_value < 0.05: from statsmodels.tsa.ar_model import AutoReg model = AutoReg(spread, lags=1) result = model.fit() phi = result.params[1] half_life = -np.log(2) / np.log(phi) print(f" Half-Life: {half_life:.1f} days") if half_life < 30: print(" → Fast mean reversion (excellent)") elif half_life < 60: print(" → Moderate mean reversion (good)") else: print(" → Slow me

Tool: references/cointegration_guide.md [3/3]

references/methodology.mdHIGH
78.3%

Malicious tool definition detected

Tool: references/methodology.md [1/4] Description: # Statistical Arbitrage and Pair Trading Methodology ## Table of Contents 1.

Tool: references/methodology.md [2/4] Description: > critical value (10%) → Weak evidence **Alternative Cointegration Tests:** - **Engle-Granger Two-Step**: Similar to ADF - **Johansen Test**: Multi-variate cointegration (for >2 stocks) - **Phillips-Ouliaris Test**: More robust to structural breaks --- ## Statistical Tests ### Stationarity Tests **Augmented Dickey-Fuller (ADF):** - Most common stationarity test - Tests for unit root in time series - Null hypothesis: Series has unit root (non-sta

Tool: references/methodology.md [3/4] Description: - High volatility pair → Smaller position - Low volatility pair → Larger position ### Portfolio-Level Risk **Diversification:** - **Minimum**: 5 pairs (reduce idiosyncratic risk) - **Optimal**: 8-10 pairs (balance diversification and management) - **Maximum**: 15 pairs (diminishing returns, management complexity) **Correlation Across Pairs:** - Avoid multiple pairs with overlapping stocks (e.g., AAPL/MSFT and AAPL/GOOGL) - Limit exposure to sing

Tool: references/methodology.md [4/4] Description: noise **Recommendation:** - Retail traders: Stick to daily/weekly pair trading - Institutional: Intraday feasible with infrastructure --- ## Conclusion Pair trading is a powerful market-neutral strategy with strong statistical and economic foundations.

scripts/analyze_spread.pyHIGH
78.3%

Malicious tool definition detected

Tool: scripts/analyze_spread.py [1/2] Description: #!/usr/bin/env python3 """ Pair Trade Spread Analyzer Analyzes a specific pair's spread behavior and generates trading signals.

Tool: scripts/analyze_spread.py [2/2] Description: Short B long_a = portfolio_allocation / 2 short_b = long_a * beta_result['beta'] print(f" LONG {symbol_a}: ${long_a:,.0f} ({long_a / prices_a.iloc[-1]:.0f} shares @ ${prices_a.iloc[-1]:.2f})") print(f" SHORT {symbol_b}: ${short_b:,.0f} ({short_b / prices_b.iloc[-1]:.0f} shares @ ${prices_b.iloc[-1]:.2f})") print(f" Exit Conditions:") print(f" - Primary: Z-score crosses {exit_zscore} (mean reversion)") print(f" - Stop Loss: Z-score > ±3.0 (extrem

scripts/find_pairs.pyHIGH
78.3%

Malicious tool definition detected

Tool: scripts/find_pairs.py [1/2] Description: #!/usr/bin/env python3 """ Pair Trade Screener - Find Cointegrated Stock Pairs This script screens for statistically significant pair trading opportunities by: 1.

Tool: scripts/find_pairs.py [2/2] Description: or pairs_analyzed == total_pairs: print(f" [{pairs_analyzed}/{total_pairs}] pairs analyzed...", end='\r', flush=True) result = analyze_pair( symbol_a, symbol_b, price_data[symbol_a], price_data[symbol_b], min_correlation ) if result and result['is_cointegrated']: cointegrated_pairs.append(result) print(f" → Found {len(cointegrated_pairs)} cointegrated pairs") return cointegrated_pairs def rank_pairs(pairs): """Rank pairs by statistical strength""" p

Audit Metadata
Max File Score
78%
Classification
UNKNOWN_SERVER
Files Scanned
6
Files Flagged
6
Chunks Analyzed
16
Analyzed
Feb 21, 2026, 08:08 PM
Security Audit — runlayer — pair-trade-screener