copybot: per-niche FAK re-quote waits from measured crater-refill times

The flat 10s retry was calibrated to nothing; the tape now says craters
refill at very different speeds (research requote_timing, 775k crater
prints): crypto 94% within 4s, esports 83% within 10s, sports only 70% at
10s but 76% by 25s, geo/politics tails run minutes (price guard is the
protection there, not the retry). Waits move to FAK_RETRY_NICHE_DEFAULT
{crypto 4, esports 10, sports/geo/politics/other 25}, classified by the
validated research niche patterns (esports before sports so 'LoL: A vs B'
doesn't fall through on ' vs '). cfg fak_retry_niche_s overrides per key;
fak_retry_s stays the fallback (tennis: no measurement yet) and 0 still
disables the feature. Paper-parity: same map both bots. test t8 covers the
map, first-match classing, fallback, and config override.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jaxperro
2026-07-20 17:45:31 -04:00
parent 83d1d8397a
commit 377192c4bf
4 changed files with 75 additions and 7 deletions
+18
View File
@@ -159,6 +159,7 @@ def t7():
bot.here = ""
bot.check_book = lambda: None # network-touching, not under test
copybot.book_depth = lambda t: None # _record_lag's book snapshot
bot.fak_retry_niche = {} # force the scalar fallback
bot.fak_retry_s = 0.05
eng.on_fak_reject = bot.fak_requote_retry
their_buy(eng) # reject -> schedules the retry
@@ -173,6 +174,23 @@ def t7():
assert not eng.state.get("missed"), eng.state["missed"]
@case("per-niche retry waits: measured map, first-match classing, fallback")
def t8():
eng = mkengine("fak")
bot = copybot.Copybot(eng.cfg, eng, filt=None)
assert bot._fak_wait("Ethereum above 1,900 on July 20, 12PM ET?") == 4.0
assert bot._fak_wait("LoL: G2 Esports vs LYON - Game 2 Winner") == 10.0
assert bot._fak_wait("Will Argentina win the 2026 FIFA World Cup?") == 25.0
assert bot._fak_wait("Israel x Iran ceasefire continues through July 20?") == 25.0
assert bot._fak_wait("Completely unclassifiable market") == 25.0 # other
assert bot._fak_wait("Wimbledon: Alcaraz set winner") == bot.fak_retry_s # tennis: no measurement -> fallback
eng.cfg["fak_retry_niche_s"] = {"crypto": 2}
bot2 = copybot.Copybot(eng.cfg, eng, filt=None)
assert bot2._fak_wait("Bitcoin above 63,400 on July 17, 3PM ET?") == 2.0
print()
print("FAILURES:", fails or "none")
sys.exit(1 if fails else 0)