mirror of
https://github.com/jaxperro/winning-wallet-finder.git
synced 2026-07-27 15:57:47 +00:00
chain-balance gates in reconcile_exits + retry queue — ghosts dropped, sells clamped to chain (closes #7); tape ingest pings the daily channel at start + finish
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,14 +9,32 @@ import gzip
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import ssl
|
||||
import subprocess
|
||||
import time
|
||||
import urllib.request
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
DB = os.path.join(HERE, "..", "live", "rtds.duckdb")
|
||||
APP, SEG = "wwf-recorder", "/data/segments"
|
||||
|
||||
|
||||
def ping(msg):
|
||||
"""Best-effort Discord ping to the DAILY channel (user ask 2026-07-19:
|
||||
the nightly pull announces start + finish). Never fatal."""
|
||||
try:
|
||||
hook = json.load(open(os.path.join(HERE, "..", "config.json"))).get("daily_webhook")
|
||||
if not hook:
|
||||
return
|
||||
req = urllib.request.Request(hook, data=json.dumps({"content": msg}).encode(),
|
||||
headers={"Content-Type": "application/json",
|
||||
"User-Agent": "Mozilla/5.0"})
|
||||
urllib.request.urlopen(req, timeout=10,
|
||||
context=ssl._create_unverified_context()).read()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
# launchd runs daily.sh with a minimal PATH (no /opt/homebrew/bin) — the
|
||||
# 2026-07-18 run died on FileNotFoundError: 'flyctl'. Resolve it explicitly.
|
||||
FLYCTL = shutil.which("flyctl") or "/opt/homebrew/bin/flyctl"
|
||||
@@ -42,6 +60,7 @@ def main():
|
||||
have = {r[0] for r in con.execute("SELECT segment FROM ingested").fetchall()}
|
||||
segs = [s for s in box(f"ls {SEG}").split()
|
||||
if s.endswith(".gz") and s not in have]
|
||||
ping(f"📼 tape ingest started — {len(segs)} segment(s) queued")
|
||||
total = 0
|
||||
for s in sorted(segs):
|
||||
raw = box(f"base64 {SEG}/{s}")
|
||||
@@ -76,6 +95,8 @@ def main():
|
||||
print(f"[ingest] {s}: {len(rows)} trades + {len(aux)} aux")
|
||||
n = con.execute("SELECT count(*) FROM trades").fetchone()[0]
|
||||
print(f"[ingest] +{total} rows · rtds.duckdb now {n:,} trades")
|
||||
ping(f"📼 tape ingest done: +{total:,} rows across {len(segs)} segment(s) "
|
||||
f"· rtds.duckdb now {n:,} trades")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user