Skip to content

MarketData Adapter: runtime startup/shutdown + health/metrics + tests + CI#199

Open
VirilePeak wants to merge 103 commits intoPolymarket:mainfrom
VirilePeak:feat/market-data-adapter-tests-health
Open

MarketData Adapter: runtime startup/shutdown + health/metrics + tests + CI#199
VirilePeak wants to merge 103 commits intoPolymarket:mainfrom
VirilePeak:feat/market-data-adapter-tests-health

Conversation

@VirilePeak
Copy link

@VirilePeak VirilePeak commented Feb 11, 2026

Entry/Risk Gate ist jetzt ├óÔé¼┼ôun-umgehbar├óÔé¼^] (Chokepoint + low-level enforcement) Kill-Switch Cooldown ist persistent (├â┬╝berlebt Restart via RISK_STATE_PATH) Details: - src/order_executor.py::place_entry_order_with_gate() als zentraler Chokepoint - ^Ggents/polymarket/polymarket.py::execute_order(... gate_checked=...) wirft, wenn ENTRY_GATE_ENFORCE_POLY=True und Gate nicht gepr├â┬╝ft wurde Neue Settings: - MAX_ENTRY_SPREAD, HARD_REJECT_SPREAD, ENTRY_REQUIRE_FRESH_BOOK, ENTRY_GATE_ENFORCE_POLY - Kill-switch: KILL_SWITCH_* + RISK_STATE_PATH Persistence: - Default data/risk_state.json, atomarer Schreibvorgang (temp + rename), auto-clear nach Ablauf Tests hinzugef├â┬╝gt: - ests/order_executor/test_executor_gate.py - ests/risk/test_entry_gate.py - ests/risk/test_kill_switch_persistence.py Risk/Notes: - Default ENTRY_GATE_ENFORCE_POLY=True kann in Notf├â┬ñllen deaktiviert werden (nicht empfohlen) - Gate kann initial viele Eintr├â┬ñge blocken, wenn M├â┬ñrkte untradable (erwartetes Verhalten) \n\n### Addendum: trade performance reporting CLI\n- Adds ools/research/trade_report.py CLI to aggregate trade artifacts (JSON/JSONL/CSV) and report ALL vs ONLY_REAL (non-smoke/test/paper), confidence breakdown, rolling windows, exit reasons and blocked reasons (best-effort).\n- Wrapper script: scripts/trade_report.py\n- Includes pytest fixtures + unit test: ests/research/test_trade_report.py\n- Example: python -m tools.research.trade_report --roots --out-md report.md --out-json report.json --last-n 50 --since-hours 24 --print-blocked\n\nCI note: ensure CI runs pytest -q so the new test runs automatically.\n\n### BTC Up/Down timeframe (15m / 5m)\nDefault: 15 minutes.\n\nEnable 5-minute markets via env:\n- BTC_UPDOWN_TIMEFRAME_MINUTES=5\n- optional safety toggle: BTC_UPDOWN_ENABLE_5M=1\n\nTiming guards (defaults in src/config/settings.py):\n- BTC_UPDOWN_ENTRY_DEADLINE_SECONDS\n- BTC_UPDOWN_MIN_TIME_TO_END_SECONDS\n- BTC_UPDOWN_AUTO_CLOSE_BUFFER_SECONDS\n\nExample:\nexport BTC_UPDOWN_TIMEFRAME_MINUTES=5\nexport BTC_UPDOWN_ENABLE_5M=1

VirilePeak and others added 30 commits February 8, 2026 17:10
Co-authored-by: Cursor <cursoragent@cursor.com>
…-automatic)

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…secrets)

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
… file to prevent duplicate webhook processing after restart

Co-authored-by: Cursor <cursoragent@cursor.com>
…enen Wert zu überschreiben — verhindert Verlust benutzerdefinierter PYTHONPATH-Einträge beim Start.

Co-authored-by: Cursor <cursoragent@cursor.com>
…rice drop detection logic, and refactor market token fetching to use httpx directly
…on branch

Co-authored-by: Cursor <cursoragent@cursor.com>
YAML value for 'commit-message' contained a colon causing a nested mapping parse error; changed to block scalar.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…n PR)

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
… test

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…irmation store, exit safety; tests and scripts

Co-authored-by: Cursor <cursoragent@cursor.com>
…n confirmation key

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…ptance; remove duplicate confirmation block

Co-authored-by: Cursor <cursoragent@cursor.com>
…irmed)

Co-authored-by: Cursor <cursoragent@cursor.com>
VirilePeak and others added 5 commits February 13, 2026 13:51
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
… (fallback to opened_at)

Co-authored-by: Cursor <cursoragent@cursor.com>
…irement)

Co-authored-by: Cursor <cursoragent@cursor.com>
@VirilePeak
Copy link
Author

Main points: entry gate is now enforced via chokepoint + low-level guard; kill-switch cooldown is persistent via RISK_STATE_PATH; CI green; tests added.\n\nPlease focus review on: order_executor gate wiring, execute_order enforcement flag, kill-switch persistence/atomic write.\n\nAddendum: trade reporting CLI added (tools/research/trade_report.py + scripts/trade_report.py) to aggregate artifacts and report ALL vs ONLY_REAL, confidence breakdown, rolling windows, exit reasons and blocked reasons (best-effort). Tests included.

VirilePeak and others added 24 commits February 14, 2026 13:01
…tEntryEngine; tests

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…r; queue subscribes when disconnected (avoid AttributeError)

Co-authored-by: Cursor <cursoragent@cursor.com>
…etry; add tests

Co-authored-by: Cursor <cursoragent@cursor.com>
…); fix(ws): telemetry counters + flush subscribe op; add tests

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…ug endpoints

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…se method for batches

Co-authored-by: Cursor <cursoragent@cursor.com>
…logging per connection

Co-authored-by: Cursor <cursoragent@cursor.com>
…bid_ask events and message counters

Co-authored-by: Cursor <cursoragent@cursor.com>
…face import errors in health route

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
… endpoint returns samples; tests

Co-authored-by: Cursor <cursoragent@cursor.com>
…rough, admin endpoint returns samples; tests

Co-authored-by: Cursor <cursoragent@cursor.com>
…oats/timestamps; expose samples; tests

Co-authored-by: Cursor <cursoragent@cursor.com>
…ters A/B and telemetry; settings defaults; bucketing tests

Co-authored-by: Cursor <cursoragent@cursor.com>
…nto engine; settings + telemetry + tests

Co-authored-by: Cursor <cursoragent@cursor.com>
…quote; fast-exit integration; tests

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant