| name | f1-weekend-ops |
| description | Use when working on weekend operations, the queued-job worker, ops-calendar authority, per-GP CLI commands, model promotion gates, paper trading, or operator-assisted live trading for the F1 prediction-market stack. |
f1-weekend-ops
Use this skill for weekend operations: the queued-job worker, ops calendar, per-GP CLI
pipelines, promotion gates, paper trading, and operator-assisted live trading.
Start here
- Read
docs/workflows/operations.md and the Miami/paper-trading sections of README.md.
- Inspect the current source before changing behavior:
apps/worker/src/f1_polymarket_worker/job_queue.py — queued-job dispatcher.
apps/worker/src/f1_polymarket_worker/gp_registry.py — GP configs and required stages.
apps/worker/src/f1_polymarket_worker/ops_calendar.py — ops-calendar authority and overrides.
apps/worker/src/f1_polymarket_worker/live_trading.py — live signal board and ticket gates.
apps/worker/src/f1_polymarket_worker/cli.py — per-GP dynamic commands and promotion commands.
py/common/src/f1_polymarket_lab/common/settings.py — live-trading env flags.
Queued-job worker
- Jobs are enqueued as
ingestion_job_runs rows with status=queued (via enqueue_job or the
queue-job CLI command) and drained by make worker, which loops run_worker_once.
- The worker claims a row with
SELECT ... FOR UPDATE SKIP LOCKED, increments attempt_count,
runs the handler, and on failure re-queues with exponential backoff (10s → 300s cap) until
max_attempts, then marks it failed. Stale locks older than --stale-after-seconds
(default 7200) are recovered.
QUEUE_JOB_SPECS registers exactly 11 job types:
ingest-demo, sync-f1-calendar, sync-f1-markets, run-backtest, backfill-backtests,
run-paper-trade, run-weekend-cockpit, refresh-latest-session, refresh-driver-affinity,
capture-live-weekend, dq-run.
- Backtest, paper-trade, cockpit, refresh, and capture jobs set
default_max_attempts=1.
- Live ticket create/fill/cancel routes intentionally stay synchronous so the operator gets an
immediate write result before the next manual trading step.
Ops calendar authority and overrides
ops_calendar.py resolves the effective meeting (EffectiveOpsMeeting, override_active) that
weekend ops treats as authoritative, layering F1CalendarOverride rows on top of the synced
calendar.
- Manage overrides with
set-f1-calendar-override / clear-f1-calendar-override (CLI), which write
set_calendar_override / clear_calendar_override. Overrides carry effective round, dates,
meeting/country/location, ops slug, status, and source provenance.
Per-GP dynamic CLI naming
cli.py registers per-GP commands from the registry using the GP short_code:
build-<code>-snapshot — build the FP1-derived feature snapshot.
run-<code>-baseline — run baseline predictions against a snapshot.
report-<code>-quicktest — quicktest report for the GP.
run-<code>-paper-trade — one-shot pipeline: build snapshot → run baselines → paper trade.
<code> is the registry short_code with underscores rendered as dashes (e.g. china,
aus, japan-q-race, miami-sq-sprint); do not add session-stage suffixes such as fp1-
or sq-pole- that are not part of the registered short_code.
Promotion gates and model stages
- Promotion commands:
promote-model-run, promote-best-model-run,
promote-live-baseline-model-run, promote-best-live-baseline-run.
- Required promoted stages (from
gp_registry.py):
sq_pole_live_v1 — Sprint Qualifying pole live baseline.
sprint_winner_live_v1 — Sprint winner live baseline.
multitask_qr — Qualifying pole and Race winner live scoring.
- Weekend paper trading and live scoring hard-fail when no active promotion exists for the required
stage. Score a live snapshot with
score-multitask-snapshot --stage multitask_qr.
Operator-assisted live trading
- The live path is operator-assisted: create the ticket in the cockpit, place the order in the
Polymarket browser, then record the actual fill. Ticket create/fill/cancel are synchronous.
- Env flags (
settings.py, LIVE_TRADING_* / LIVE_QUOTE_*):
LIVE_TRADING_ENABLED (default false) — gate for creatable operator tickets; also the
emergency stop when set back to false.
LIVE_TRADING_READINESS_CONFIRMED (default false) — flip only after jurisdiction, account,
and rehearsal checks pass.
LIVE_QUOTE_MAX_AGE_SEC (default 90) — max accepted live-quote age.
- Live-ticket creation blocks when any of these hold: live tickets disabled or readiness off;
required promoted champion missing; incompatible snapshot/artifact version; no live quote; stale
or future-dated quote; spread wider than the configured max; size over the conservative cap;
min-edge/spread override looser than limits; daily loss budget consumed; target session outside
the live window; another open ticket already exists for the same market.
Validation
uv run ruff check .
uv run mypy apps py
uv run pytest