File size: 1,349 Bytes
d4c51f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/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()