You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Address review: real ERROR back-compat, summary contract, dead code
Three review fixes on top of the post-only rejection tracker:
1. **Default ERROR level now byte-identical to the legacy line**
(review item 1, should-fix). Previously the tracker emitted the
richer ``[reject:post_only_match] coin — …`` line at every level
including the default ERROR, so log scrapers / templated alerts
keying off the historical ``Order rejected: …`` prefix would no
longer match. ``OrderRejectionTracker.record`` now branches: at
``ERROR`` (default) it emits the legacy line verbatim, only
downgraded levels get the categorised format. Counter aggregation
is unchanged so ``[reject-summary]`` still works at any level.
2. **``log_summary_if_due`` return value matches its docstring**
(review item 3, nit). The docstring promised "True iff a summary
was emitted" but the function returned True whenever the interval
elapsed, even on idle intervals with nothing to log. ``_emit_summary``
now returns a bool indicating whether anything was actually logged
and ``log_summary_if_due`` propagates it. The strategy main loop
discards the value, but tests / external observers can rely on it.
3. **Drop dead ``return None if any_emitted else None``** (review item
2, nit). The conditional collapsed to ``None`` either way; replaced
with the meaningful ``return any_emitted`` from item 2.
Tests updated:
- ``test_default_log_level_emits_legacy_line_at_error`` (renamed) —
now asserts the legacy line at ERROR and explicitly that the
categorised format is absent at default level.
- ``test_unknown_log_level_string_falls_back_to_error`` — same
legacy-line shape after fallback.
- ``test_summary_skipped_when_no_events`` — pins the new
``True iff emitted`` contract; also asserts the cursor still
advances to prevent the next call re-firing on every loop.
- New integration test ``TestSingleRejectionWithTrackerAtDefaultError``
pins back-compat at the order_manager → tracker boundary.
README updated to drop the stale claim about ``[reject-summary]``
being the only new line and to describe the actual two-mode behaviour
(legacy line at ERROR, categorised line at downgraded levels).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -363,7 +363,7 @@ The `market_making` strategy uses **progressive close pricing**: as a position a
363
363
364
364
**Adverse selection logging** (`--enable-adverse-selection-log`): Measures mid-price movement 5s/30s/60s after each fill, logging per-coin summaries every 300s. Observation only — no trading impact.
365
365
366
-
**Order rejection log aggregation** (`--rejection-log-level`, `--rejection-summary-interval`): Routine post-only rejections (`Post only order would have immediately matched`) are an expected retry signal under maker-only quoting, but they were historically logged at ERROR — drowning out genuine errors as MM size grows. The strategy now classifies each rejection by API error text and routes routine matches through a small aggregator that logs a single `[reject-summary]` INFO line every `--rejection-summary-interval` seconds (default 300, set to 0 to disable). The default per-rejection log level stays `error`to preserve historical behaviour; flip `--rejection-log-level warning` (or `info`) once the summary line is trusted. Unknown rejection text always falls through to ERROR so format changes / new reject reasons stay visible.
366
+
**Order rejection log aggregation** (`--rejection-log-level`, `--rejection-summary-interval`): Routine post-only rejections (`Post only order would have immediately matched`) are an expected retry signal under maker-only quoting, but they were historically logged at ERROR — drowning out genuine errors as MM size grows. The strategy now classifies each rejection by API error text and adds a single `[reject-summary]` INFO line every `--rejection-summary-interval` seconds (default 300, set to 0 to disable). The default per-rejection log level stays `error`and emits the same byte-identical `Order rejected: …` line as before, so existing log scrapers and ERROR-rate alerts keep working. Flipping `--rejection-log-level warning` (or `info`) opts into a richer `[reject:tag] coin — …` categorised format at the chosen level; unknown rejection text always falls through to ERROR with the legacy line so format changes / new reject reasons stay visible.
367
367
368
368
**Dynamic offset** (`--dynamic-offset`): Auto-adjusts per-coin BBO offset based on adverse selection severity from the tracker. Coins with higher adverse selection get wider offsets; favorable coins get tighter offsets. Requires `--enable-ws` and `--enable-adverse-selection-log`. Manual `--coin-offset-overrides` serve as the baseline; dynamic adjustment adds/subtracts from it.
0 commit comments