From 82f62124e71d81c2c2243757d723dcd6e869abe7 Mon Sep 17 00:00:00 2001 From: jaxperro Date: Wed, 8 Jul 2026 17:34:36 -0400 Subject: [PATCH] copytrade.py moves out of archive/ + Fly health check (watchdog layer 1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The execution engine was load-bearing from archive/ — the one thing in there that wasn't retired. Now at repo root next to copybot.py; the two archived scripts that imported it as a sibling get a parent-path shim. fly.toml gains an http /health check so Fly restarts a dark machine (self-heal); the notify half is the GH Actions watchdog (next commit). Co-Authored-By: Claude Fable 5 --- README.md | 2 +- archive/backtest.py | 1 + archive/lp_paper.py | 1 + copybot.py | 4 +--- archive/copytrade.py => copytrade.py | 0 fly.toml | 12 ++++++++++++ 6 files changed, 16 insertions(+), 4 deletions(-) rename archive/copytrade.py => copytrade.py (100%) diff --git a/README.md b/README.md index 944680ca..1f322ec7 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ does). | `host/geocheck.py` | 3-probe geo-gate verdict (ipinfo → Polymarket's `/api/geoblock` → unauth CLOB order POST); runs at every boot, `GEOCHECK_ONLY=1` = probe-and-idle for testing a new host/region without a second book-writer | | `live/discord_daily.py` | the daily Discord digest (the only Discord output) | | `copybot.py` | the copy-trading bot: push/poll trigger → follow filter → execution engine (paper + live) | -| `archive/copytrade.py` | the execution engine the bot reuses: sizing, risk gates, price guard, paper/live executors | +| `copytrade.py` | the execution engine the bot reuses: sizing, risk gates, price guard, paper/live executors (moved out of archive/ 2026-07-08 — nothing load-bearing lives in archive) | | `host/start.sh` | 24/7 worker bootstrap for Fly/any VPS (geo-gate check, clones repo, resumes committed state) | | `LIVE_TEST.md` · `preflight_live.py` · `redeem.py` | real-money runbook, read-only credential preflight, on-chain redemption | | `insider.py` | the original detector: z-score, pre-resolution timing, fresh-wallet flags, funding-cluster rings | diff --git a/archive/backtest.py b/archive/backtest.py index b65ebcb3..c1d0874a 100644 --- a/archive/backtest.py +++ b/archive/backtest.py @@ -21,6 +21,7 @@ import time from collections import defaultdict import smart_money as sm +import sys, os; sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) # copytrade lives at the repo root since 2026-07-08 from copytrade import clob_price, DEFAULT_CONFIG, load_json LOOKBACK_DAYS = 21 # how far before the window we try to read, for seed diff --git a/archive/lp_paper.py b/archive/lp_paper.py index 2e0b7a06..4759cdd8 100644 --- a/archive/lp_paper.py +++ b/archive/lp_paper.py @@ -34,6 +34,7 @@ import time from concurrent.futures import ThreadPoolExecutor from lp_screener import get, reward_markets, daily_rate, hours_to_end, realized_vol_cents, CLOB +import sys, os; sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) # copytrade lives at the repo root since 2026-07-08 from copytrade import post_discord, load_json STATE_PATH = "lp_paper_state.json" diff --git a/copybot.py b/copybot.py index d1d3f758..efa7b7d7 100644 --- a/copybot.py +++ b/copybot.py @@ -50,9 +50,7 @@ import urllib.error import urllib.request from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer -# reuse the proven execution engine as a library (kept in archive/) -sys.path.insert(0, os.path.join(os.path.dirname(__file__), "archive")) -from copytrade import ( # noqa: E402 +from copytrade import ( # the execution engine (sizing, gates, executors) CopyTrader, PaperExecutor, LiveExecutor, DEFAULT_CONFIG, load_json, save_json, new_state, recent_trades, confirm_live, ) diff --git a/archive/copytrade.py b/copytrade.py similarity index 100% rename from archive/copytrade.py rename to copytrade.py diff --git a/fly.toml b/fly.toml index 4eb45419..4e98c665 100644 --- a/fly.toml +++ b/fly.toml @@ -23,3 +23,15 @@ primary_region = "arn" [[vm]] size = "shared-cpu-1x" memory = "512mb" + +# health check: Fly restarts the machine if /health stops answering — the +# self-heal half of the watchdog (the notify half is the GitHub Actions +# watchdog workflow -> Discord). grace covers the boot clone. +[checks] + [checks.health] + type = "http" + port = 8080 + path = "/health" + interval = "30s" + timeout = "5s" + grace_period = "60s"