LinJennyLin commited on
Commit
573e473
Β·
verified Β·
1 Parent(s): 1e79652

Upload pmct/digest.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. pmct/digest.py +22 -9
pmct/digest.py CHANGED
@@ -148,10 +148,20 @@ def _wallet_md(w: str) -> str:
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],
@@ -168,21 +178,24 @@ def render_markdown(selected: pd.DataFrame, moves: list[Move],
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._")
179
  else:
 
 
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
  )
 
148
  return f"[{w[:6]}…{w[-4:]}](https://polymarket.com/profile/{w})"
149
 
150
 
151
+ def _rank_dots(vals: list[float]) -> list[str]:
152
+ """Relative 1–5 dot rank WITHIN the shown batch, so the bars actually spread
153
+ instead of clustering (raw signals bunch around 0.5–0.7). Weakest shown move
154
+ gets ●○○○○, strongest ●●●●●, the rest spaced by percentile rank."""
155
+ n = len(vals)
156
+ if n == 0:
157
+ return []
158
+ order = sorted(range(n), key=lambda i: vals[i])
159
+ dots = [""] * n
160
+ for pos, i in enumerate(order):
161
+ pct = pos / (n - 1) if n > 1 else 1.0
162
+ k = 1 + int(round(pct * 4)) # 1..5
163
+ dots[i] = "●" * k + "β—‹" * (5 - k)
164
+ return dots
165
 
166
 
167
  def render_markdown(selected: pd.DataFrame, moves: list[Move],
 
178
  "",
179
  "## Top moves right now",
180
  "",
181
+ "_Signal = our quality score for a move: the trader's consistency blended "
182
+ "with how big this bet is for them (conviction) and how far the price is "
183
+ "from a coin-flip (edge). Dots are a **relative rank among today's moves** β€” "
184
+ "●●●●● = strongest signal in this list, ●○○○○ = weakest. Tap any address to "
185
  "verify it on Polymarket._",
186
  "",
187
  ]
188
  if not moves:
189
  lines.append("_No qualifying fresh moves in the window. Check back next run._")
190
  else:
191
+ shown = moves[:top_moves]
192
+ dot_bars = _rank_dots([m.signal_quality for m in shown])
193
  lines.append("| Signal | Trader | Move | Price | Size | Conviction |")
194
  lines.append("|---|---|---|---|---|---|")
195
+ for m, bar in zip(shown, dot_bars):
196
  title = (m.title[:46] + "…") if len(m.title) > 47 else m.title
197
  lines.append(
198
+ f"| {bar} {m.signal_quality:.2f} "
199
  f"| {_wallet_md(m.wallet)} | {title} "
200
  f"({m.outcome}) | {m.price:.2f} | ${m.usdc:,.0f} | {m.conviction:.0%} |"
201
  )