copytrade.py moves out of archive/ + Fly health check (watchdog layer 1)

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 <noreply@anthropic.com>
This commit is contained in:
jaxperro
2026-07-08 17:34:36 -04:00
parent 63eda48aa7
commit 82f62124e7
6 changed files with 16 additions and 4 deletions
+1 -1
View File
@@ -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 |
+1
View File
@@ -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
+1
View File
@@ -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"
+1 -3
View File
@@ -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,
)
+12
View File
@@ -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"