Spaces:
Running
Running
Upload pmct/digest.py with huggingface_hub
Browse files- pmct/digest.py +23 -5
pmct/digest.py
CHANGED
|
@@ -143,6 +143,17 @@ def fresh_moves(client, selected: pd.DataFrame, hours: int = 24,
|
|
| 143 |
return moves
|
| 144 |
|
| 145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
def render_markdown(selected: pd.DataFrame, moves: list[Move],
|
| 147 |
hours: int, top_moves: int = 12) -> str:
|
| 148 |
date = pd.Timestamp.now("UTC").strftime("%Y-%m-%d %H:%M UTC")
|
|
@@ -157,6 +168,11 @@ def render_markdown(selected: pd.DataFrame, moves: list[Move],
|
|
| 157 |
"",
|
| 158 |
"## Top moves right now",
|
| 159 |
"",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
]
|
| 161 |
if not moves:
|
| 162 |
lines.append("_No qualifying fresh moves in the window. Check back next run._")
|
|
@@ -164,20 +180,22 @@ def render_markdown(selected: pd.DataFrame, moves: list[Move],
|
|
| 164 |
lines.append("| Signal | Trader | Move | Price | Size | Conviction |")
|
| 165 |
lines.append("|---|---|---|---|---|---|")
|
| 166 |
for m in moves[:top_moves]:
|
| 167 |
-
bar = "β" * int(round(m.signal_quality * 5)) or "β"
|
| 168 |
-
short = f"`{m.wallet[:6]}β¦{m.wallet[-4:]}`"
|
| 169 |
title = (m.title[:46] + "β¦") if len(m.title) > 47 else m.title
|
| 170 |
lines.append(
|
| 171 |
-
f"| {
|
|
|
|
| 172 |
f"({m.outcome}) | {m.price:.2f} | ${m.usdc:,.0f} | {m.conviction:.0%} |"
|
| 173 |
)
|
| 174 |
lines += ["", "## The traders we're tracking", "",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
"| Trader | Score | Profit | Consistency | Repeatability | Topic |",
|
| 176 |
"|---|---|---|---|---|---|"]
|
| 177 |
for _, r in selected.iterrows():
|
| 178 |
-
short = f"`{r['wallet'][:6]}β¦{r['wallet'][-4:]}`"
|
| 179 |
lines.append(
|
| 180 |
-
f"| {
|
| 181 |
f"{float(r.get('monthly_profit_ratio',0)):.0%} | "
|
| 182 |
f"{float(r.get('repeatability',0)):.2f} | "
|
| 183 |
f"{r.get('dominant_topic','')} |"
|
|
|
|
| 143 |
return moves
|
| 144 |
|
| 145 |
|
| 146 |
+
def _wallet_md(w: str) -> str:
|
| 147 |
+
"""Short label, full address preserved as a verifiable Polymarket link."""
|
| 148 |
+
return f"[{w[:6]}β¦{w[-4:]}](https://polymarket.com/profile/{w})"
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
def _dots(sig: float) -> str:
|
| 152 |
+
"""Render a 0..1 signal as a 5-dot bar (β=strength, β=remainder)."""
|
| 153 |
+
n = max(0, min(5, int(round(sig * 5))))
|
| 154 |
+
return "β" * n + "β" * (5 - n)
|
| 155 |
+
|
| 156 |
+
|
| 157 |
def render_markdown(selected: pd.DataFrame, moves: list[Move],
|
| 158 |
hours: int, top_moves: int = 12) -> str:
|
| 159 |
date = pd.Timestamp.now("UTC").strftime("%Y-%m-%d %H:%M UTC")
|
|
|
|
| 168 |
"",
|
| 169 |
"## Top moves right now",
|
| 170 |
"",
|
| 171 |
+
"_Signal (0β1) = our quality score for a move: the trader's consistency "
|
| 172 |
+
"blended with how big this bet is for them (conviction) and how far the "
|
| 173 |
+
"price is from a coin-flip (edge). More β = stronger. Tap any address to "
|
| 174 |
+
"verify it on Polymarket._",
|
| 175 |
+
"",
|
| 176 |
]
|
| 177 |
if not moves:
|
| 178 |
lines.append("_No qualifying fresh moves in the window. Check back next run._")
|
|
|
|
| 180 |
lines.append("| Signal | Trader | Move | Price | Size | Conviction |")
|
| 181 |
lines.append("|---|---|---|---|---|---|")
|
| 182 |
for m in moves[:top_moves]:
|
|
|
|
|
|
|
| 183 |
title = (m.title[:46] + "β¦") if len(m.title) > 47 else m.title
|
| 184 |
lines.append(
|
| 185 |
+
f"| {_dots(m.signal_quality)} {m.signal_quality:.2f} "
|
| 186 |
+
f"| {_wallet_md(m.wallet)} | {title} "
|
| 187 |
f"({m.outcome}) | {m.price:.2f} | ${m.usdc:,.0f} | {m.conviction:.0%} |"
|
| 188 |
)
|
| 189 |
lines += ["", "## The traders we're tracking", "",
|
| 190 |
+
"_The mid-size, consistently-profitable wallets that passed our filter β "
|
| 191 |
+
"the ones we pull fresh moves from. Score blends consistency, "
|
| 192 |
+
"repeatability and copyability (not size). Tap to verify on Polymarket._",
|
| 193 |
+
"",
|
| 194 |
"| Trader | Score | Profit | Consistency | Repeatability | Topic |",
|
| 195 |
"|---|---|---|---|---|---|"]
|
| 196 |
for _, r in selected.iterrows():
|
|
|
|
| 197 |
lines.append(
|
| 198 |
+
f"| {_wallet_md(r['wallet'])} | {r['trader_score']:.2f} | ${_profit(r):,.0f} | "
|
| 199 |
f"{float(r.get('monthly_profit_ratio',0)):.0%} | "
|
| 200 |
f"{float(r.get('repeatability',0)):.2f} | "
|
| 201 |
f"{r.get('dominant_topic','')} |"
|