docs + audit sweep 2026-07-23: fill-model lesson, five-test day, archive pass

FINDINGS: 'The fill model is the next scorer' section (A2 chain grade
-$7.54/fill x1344 confirms the surge kill; oracle harness chain grade
vetoes the ledger-positive tiers; virtual-book +26% variance footnote;
the five tandem tests and the makers-on-the-wall through-line).
HANDOFF: snapshot -> 07-23 (7-wallet rev 5, dark flags, Friday agenda
incl #20/#21). READMEs: /test consolidation row, measurement-harness
research row, study statuses + new script inventory.
Archive: value/ (closed 07-19) + its test, ETHERSCAN_MIGRATION.md,
order_probe v1 -> archive/; replay_out/ gitignored; links repaired.
Tests: all 7 active scripts pass post-move.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jaxperro
2026-07-23 13:55:25 -04:00
parent 2d3c5dbfa8
commit 222a750bd7
19 changed files with 214 additions and 21 deletions
-58
View File
@@ -1,58 +0,0 @@
#!/usr/bin/env python3
"""Controlled end-to-end order probe (Phase-4 in miniature): place ONE tiny
marketable FAK buy on a liquid market via the exact executor the bot uses,
report the fill, then immediately sell it back. Proves sign -> create ->
post -> fill -> parse without waiting for an organic signal — after two
crash-restarts proved this path had never once executed to completion.
Cost: the spread + fees on ~$2. Run on the live box (env creds)."""
import json, math, os, ssl, sys, urllib.request
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
_SSL = ssl._create_unverified_context()
def get(u):
req = urllib.request.Request(u, headers={"User-Agent": "Mozilla/5.0"})
return json.load(urllib.request.urlopen(req, timeout=15, context=_SSL))
# pick the highest-volume active market with a sane two-sided book
gm = get("https://gamma-api.polymarket.com/markets?active=true&closed=false"
"&limit=25&order=volume24hr&ascending=false")
tok = ask = bid = None
for m in gm:
try:
if m.get("negRisk") or m.get("negRiskAugmented"):
continue # plain binary first — negRisk needs its own
# order options (suspected cause of the 400)
t0 = json.loads(m["clobTokenIds"])[0]
book = get(f"https://clob.polymarket.com/book?token_id={t0}")
bids, asks = book.get("bids") or [], book.get("asks") or []
bb = max((float(x["price"]) for x in bids), default=None)
ba = min((float(x["price"]) for x in asks), default=None)
if bb and ba and 0.10 <= ba <= 0.90 and (ba - bb) <= 0.02:
tok, ask, bid = t0, ba, bb
print(f"market: {m.get('question','?')[:60]}")
print(f"book: bid {bb} / ask {ba}")
break
except Exception:
continue
if not tok:
sys.exit("no suitable liquid market found")
cfg = {"live": {"private_key": os.environ["LIVE_PRIVATE_KEY"].strip(),
"funder_address": os.environ["LIVE_FUNDER_ADDRESS"].strip(),
"signature_type": int(os.environ.get("LIVE_SIGNATURE_TYPE") or 1),
"order_type": "FAK"}}
from copybot import LedgerLiveExecutor
ex = LedgerLiveExecutor(cfg)
shares = math.ceil(5 / ask * 100) / 100 # 5-share exchange minimum, ~$1-4.50
print(f"\nBUY probe: {shares} shares @ ~{ask} (≈ ${shares*ask:.2f}) FAK…")
r = ex.buy(tok, shares, ask, {})
print("result:", json.dumps({k: str(v)[:200] for k, v in r.items()}, indent=1))
if r["ok"] and r["filled_shares"] > 0:
print(f"\nSELL back: {r['filled_shares']} @ ~{bid} FAK…")
r2 = ex.sell(tok, r["filled_shares"], bid, {})
print("result:", json.dumps({k: str(v)[:200] for k, v in r2.items()}, indent=1))
print("\nround trip complete — placement path PROVEN")
else:
print("\nbuy did not fill — path exercised without crash; inspect resp above")