live: expose per-wallet conv_thr in portfolio.json (for live current-bets)

Adds each followed wallet's cache p80 conviction threshold so the dashboard
can filter LIVE open positions the same way the server does.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
jaxperro
2026-06-23 15:16:13 -06:00
parent 87a956a059
commit 92fe276737
2 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -1 +1 @@
{"started":1782194400.0,"updated":1782248379.1922848,"bank":1000.0,"stake":50.0,"equity":1001.72,"liquid":800.0,"invested":201.72,"realized":0.0,"pnl":1.72,"unreal":1.72,"resolved_count":0,"wins":0,"losses":0,"open_count":4,"missed_count":0,"wallets":[{"name":"raid3r","wallet":"0xa1a77ea9382bb8c3610f3303b66e093f644aace4","bets":3,"invested":164.99,"realized":0.0},{"name":"0x6d1A94f4","wallet":"0x6d1a94f4bdd53114ec483925d025367db68697fb","bets":0,"invested":0.0,"realized":0.0},{"name":"Kruto2027","wallet":"0xe8ca3f758c93f44f3ec210542ab78afb7c0bcccb","bets":1,"invested":36.73,"realized":0.0},{"name":"LSB1","wallet":"0x41558102a796ba971c7567cad41c307e59f8fa41","bets":0,"invested":0.0,"realized":0.0}],"current":[{"title":"Will England win on 2026-06-23?","name":"raid3r","outcome":"Yes","stake":50.0,"val":51.15,"pnl":1.15,"end":"2026-06-23"},{"title":"England vs. Ghana: England O/U 6.5 Corners","name":"raid3r","outcome":"Over","stake":50.0,"val":60.85,"pnl":10.85,"end":"2026-06-23"},{"title":"England vs. Ghana: England O/U 5.5 Corners","name":"raid3r","outcome":"Over","stake":50.0,"val":52.99,"pnl":2.99,"end":"2026-06-23"},{"title":"Spread: Club ABB (-1.5)","name":"Kruto2027","outcome":"Bamin Real Potos\u00ed","stake":50.0,"val":36.73,"pnl":-13.27,"end":"2026-05-14"}],"resolved":[],"missed":[],"missed_pnl":0}
{"started":1782194400.0,"updated":1782249371.41886,"bank":1000.0,"stake":50.0,"equity":984.48,"liquid":800.0,"invested":184.48,"realized":0.0,"pnl":-15.52,"unreal":-15.52,"resolved_count":0,"wins":0,"losses":0,"open_count":4,"missed_count":0,"wallets":[{"name":"raid3r","wallet":"0xa1a77ea9382bb8c3610f3303b66e093f644aace4","bets":3,"invested":147.75,"realized":0.0,"conv_thr":33},{"name":"0x6d1A94f4","wallet":"0x6d1a94f4bdd53114ec483925d025367db68697fb","bets":0,"invested":0.0,"realized":0.0,"conv_thr":3},{"name":"Kruto2027","wallet":"0xe8ca3f758c93f44f3ec210542ab78afb7c0bcccb","bets":1,"invested":36.73,"realized":0.0,"conv_thr":123},{"name":"LSB1","wallet":"0x41558102a796ba971c7567cad41c307e59f8fa41","bets":0,"invested":0.0,"realized":0.0,"conv_thr":223}],"current":[{"title":"Will England win on 2026-06-23?","name":"raid3r","outcome":"Yes","stake":50.0,"val":49.62,"pnl":-0.38,"end":"2026-06-23"},{"title":"England vs. Ghana: England O/U 6.5 Corners","name":"raid3r","outcome":"Over","stake":50.0,"val":57.09,"pnl":7.09,"end":"2026-06-23"},{"title":"England vs. Ghana: England O/U 5.5 Corners","name":"raid3r","outcome":"Over","stake":50.0,"val":41.04,"pnl":-8.96,"end":"2026-06-23"},{"title":"Spread: Club ABB (-1.5)","name":"Kruto2027","outcome":"Bamin Real Potos\u00ed","stake":50.0,"val":36.73,"pnl":-13.27,"end":"2026-05-14"}],"resolved":[],"missed":[],"missed_pnl":0}
+8 -1
View File
@@ -165,6 +165,12 @@ def main():
# hypothetical P&L had we been able to afford it (held to resolution)
m["pnl"] = STAKE * ((1.0 / m["p"]) - 1) if m["won"] else -STAKE
wins = sum(1 for r in resolved if r.get("won"))
# per-wallet conviction threshold (cache p80) so the dashboard can filter LIVE open
# positions the same way; 1e12 = "no sized bets" (nothing qualifies)
conv_thr = {}
for w in WALLETS:
t = cache.conv_cutoff(b["size"] for b in cache.get_bets(w["wallet"]) if (b["size"] or 0) > 0)
conv_thr[w["wallet"]] = round(t) if t != float("inf") else 1e12
equity = cash + invested
out = {
"started": START, "updated": now,
@@ -175,7 +181,8 @@ def main():
"resolved_count": len(resolved), "wins": wins, "losses": len(resolved) - wins,
"open_count": len(current), "missed_count": len(missed),
"wallets": [{"name": v["name"], "wallet": v["wallet"], "bets": v["bets"],
"invested": round(v["invested"], 2), "realized": round(v["realized"], 2)}
"invested": round(v["invested"], 2), "realized": round(v["realized"], 2),
"conv_thr": conv_thr.get(v["wallet"], 1e12)}
for v in perW.values()],
"current": [{"title": c.get("title", ""), "name": c["name"], "outcome": c.get("outcome", ""),
"stake": STAKE, "val": round(c["val"], 2), "pnl": round(c["pnl"], 2),