4 Commits

Author SHA1 Message Date
jaxperro 57cdbde395 audit fixes: pin-mirror to backtest, unpinned-floor warning, watch_sharps diff, class_pct guard
From the automated-writer clobber audit (3-agent workflow):
- sync_floors now ACTUALLY mirrors floor_pin into backtest.json (the comment
  claimed it; the code never did — so a paper pin diverged from the backtest's
  dynamic p80, defeating calibration). Kruto 80 now consistent across all 3.
- sync_floors warns loudly when about to revert an UNPINNED floor that looks
  hand-edited (>5 and >15%) — floor_pin is the only protected key, so a direct
  edit used to vanish silently at 08:00.
- validate_timing logs the sharps add/drop delta and documents watch_sharps.json
  as generated-only (format kept a plain list — dashboard/discord read it so).
- daily.sh warns if copybot.paper.json vs backtest.json class_pct desync.

Audit verdict otherwise CLEAN: sync_floors is the only pipeline step that
mutates a manual-knob file, and it round-trips the whole JSON touching only
floor — all other knobs (caps, guard, depth_gate, follow set, band) survive.
config.live.example.json is untouched by every automated writer (safe by
neglect). No second floor_pin-class bug exists.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 17:11:17 -04:00
jaxperro 5ac5396c7a floor_pin: manual floors survive the daily p80 sync (Kruto stays 80)
The 08:00 daily sync_floors.py unconditionally overwrote every paper-book
floor with the trusted p80 — silently reverting Kruto 80→125.61 the morning
after the deliberate lowering, so the paper book stopped matching the live
book (which reads a different config) and the 'catch more Kruto flow'
experiment ran on real money only. sync_floors now honors a per-wallet
floor_pin; Kruto pinned to 80 in paper + backtest (live already 80 via
per_wallet_min_usd). All three books gate Kruto at 80 again.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 13:10:11 -04:00
jaxperro 972b32e8f0 CRITICAL: fix their_prev crash that silently killed all new opens since 07-05
_handle_their_buy referenced their_prev in the fresh-OPEN branch but only
assigned it in the is_add branch — every new position crashed with
UnboundLocalError the moment the their-bet ceiling landed 2026-07-06. The
webhook/heartbeat try/except swallowed it as 'handler error', so the bot
logged FOLLOW then silently placed NOTHING (last real fill 07-05 23:17;
live Fly logs show FOLLOW ArbTrader ... -> heartbeat error: their_prev).
This is the primary cause of 'live bot missing bets'. Fix: hoist their_prev
above the if/else so both branches see the signal's prior position.

Also (the user's two asks):
- copybot on_wallet_activity: a QUALIFYING bet we were too slow to catch
  (webhook missed / bot down / fast market resolved before we polled) is now
  recorded as a missed bet 'too slow to follow (Nm late)' instead of silently
  dropped; below-floor dust stays console-only. Filter runs before the stale
  gate so we know if it would have qualified.
- sync_floors.py rewritten: PIN each paper-bot wallet's floor to the trusted
  cache p80 (identical to the backtest's conv_thr), written to
  copybot.paper.json, wired into daily.sh + committed. Kills the boot-time
  data-api floor drift (fortuneking $1,498 boot vs $892 backtest) that made
  the live bot filter out bets the backtest kept.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 11:33:36 -04:00
jaxperro 2946ac9170 copybot: 24/7 paper copy-trade test + live dashboard feed
Push-or-poll copy bot (FollowFilter conviction gate + copytrade engine),
cash-gated $1k book, resolution settling, lag/slippage logging, FOK live
orders, on-chain redeem. Runs free 24/7 via GitHub Actions (--poll-once
cron) and publishes live/copybot_live.json for the trading dashboard.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 12:41:56 -06:00