#!/usr/bin/env python3 """Step 3 — filter to the copy-worthy shortlist. python scripts/03_screen.py Reads data/wallets.csv Writes data/shortlist.csv (ranked survivors of both gates) """ import sys from pathlib import Path import pandas as pd sys.path.insert(0, str(Path(__file__).resolve().parents[1])) from pmct.screen import screen from pmct.util import load_config, cache_path def main(): cfg = load_config() df = pd.read_csv(cache_path(cfg, "wallets.csv")) print(f"Screening {len(df)} wallets against both gates...") short = screen(df, cfg["screen"]) out = cache_path(cfg, "shortlist.csv") short.to_csv(out, index=False) if short.empty: print("No wallets cleared both gates. Loosen thresholds in config.yaml " "(screen:) or widen discovery.") return cols = ["wallet", "score", "profit_final", "on_leaderboard", "roi", "win_rate", "monthly_profit_ratio", "max_drawdown_pct", "repeatability", "rebate_share", "dominant_topic", "n_resolved_markets", "active_days"] cols = [c for c in cols if c in short.columns] print(f"\nTop {len(short)} copy candidates -> {out}\n") with pd.option_context("display.max_columns", None, "display.width", 200): print(short[cols].to_string(index=False)) if __name__ == "__main__": main()