Skip to content

145: Restore maker strategy as layer ​

Identity ​

  • Status: restoration design (open)
  • Spawned from: F6 of ADR-024 pivot, 2026-05-13
  • Original module: crates/pm-bot/src/domain/strategies/maker.rs (~2329 LOC at archive)
  • Recovery: git show 619f7f0:crates/pm-bot/src/domain/strategies/maker.rs
  • Target taxonomy: directional MakerPostOnly profile (per ADR-018 §directional)
  • Original ADRs: none specific; legacy concept
  • Type: restoration

Context ​

Maker strategy posts passive bids at mid-band with post_only flag, accumulating inventory if filled. Was active production before ADR-024 pivot. Per F4 soft archive

  • F4.5 physical archive, removed from active code. Restoration must use ADR-025 extension API (ScannerHooks + ReadCtx) without modifying core engine.

Data model needs (from polymarket-data-model.md) ​

  • Market.tokens[0..2].best_bid/best_ask — orderbook entry pricing
  • Market.tick_size (0.01 / 0.001 split, 25% markets on 0.001)
  • Market.accepting_orders, Market.active, Market.closed — gating
  • Market.end_date / Market.game_start_time — deadline computation

Restoration scope ​

  • New module: crates/pm-bot/src/domain/strategies/maker.rs (layer crate or in-tree)
  • Implement ScannerHooks trait + Strategy trait per ADR-025
  • rtds_filter_set via ReadCtx<'_> (no direct OrderManager / MarketCache access)
  • Decision emission via existing Decision enum variants (PostOrder, CancelOrder)
  • No new Effect / pm-sdk additions required (binary markets, no neg-risk-specific ops)
  • Strategy config knob set: maker.mid_band_bps, maker.requote_threshold_bps, maker.size_per_market_usdc, etc. (cf. original MakerConfig)
  • Add StrategyType::Maker variant back + dispatcher branch
  • Config schema: new crates/pm-bot/src/config/strategy/maker.rs (recover from 619f7f0)

Prerequisites ​

  • ADR-025 ReadCtx pattern (existing, F5.1 landed).
  • No new Decision variants required (uses existing PostOrder / CancelOrder).
  • No pm-sdk additions required.
  • Liveness/integration tests required per feedback_silent_feature_broken: ScannerHooks contract test extension + wiremock Gamma + simulated CLOB book.

Out of scope ​

  • Не модифицировать core engine за пределами ScannerHooks impls.
  • Не вводить новые traits в core layer (extension goes в layer module).
  • Не trash strategy isolation invariant (memory feedback_strategy_isolation).

Acceptance criteria ​

  • ScannerHooks implementation green per F4 contract test pattern (extend strategy_extension_contract.rs)
  • Integration test on wiremock-backed Gamma fixture + simulated CLOB book
  • VERIFIED markers per feedback_silent_feature_broken (liveness boundary signal)
  • ADR amendment if behaviour differs from original (e.g., per-rule semantics evolved)

Dependencies ​

  • None major. First restoration candidate (least entanglement).

LOC estimate ​

  • New strategy: ~1500-2000 LOC (slimmer than original 2329 LOC due to ReadCtx abstraction)
  • New strategy config: ~150 LOC
  • Tests: ~300-500 LOC
  • Total: ~2000-2700 LOC

References ​

  • ADR-024 (directional-first), ADR-025 (extension points)
  • 619f7f0 (archive reference)
  • docs/architecture/strategy-extension-points.md §8.1 (restoration sketch — maker)
  • .tmp/audit-reports/D-strategy-consumption.md (consumption matrix)