Skip to content

RFQ and combos: Polymarket US, Kalshi, Polymarket, SX Bet (experimental line) - #37

Merged
YukiC0804 merged 1 commit into
codex/order-lifecycle-storagefrom
sp/rfq-combo
Oct 21, 2026
Merged

YukiC0804 merged 1 commit into
codex/order-lifecycle-storagefrom
sp/rfq-combo

Conversation

@YukiC0804

@YukiC0804 YukiC0804 commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Adds request-for-quote and combo trading to the experimental line, on the outcome + action order model the terminal uses. It targets codex/order-lifecycle-storage, never main.

The plan, venue research and per-phase results are in docs/rfq-combo.md.

Venues

Venue Taker Quoter Combos
Polymarket US ✅ ✅ ✅
Kalshi ✅ ✅ ✅ multivariate collections
Polymarket ✅ ✅ ✅ RFQ-only, Exchange v3 signing
SX Bet — (no API to request a parlay) ✅ parlays ✅

Limitless Packs (needs partner access), Smarkets, Betfair, Opinion, Hyperliquid and predict.fun are out of scope. The doc gives the reasons.

What's in it

  • Models:
    • Rfq, RfqQuote, Combo/ComboLeg, AcceptQuote, MakerQuote, plus status enums.
    • Sizing by contracts or by amount (synpath/trading/money.py).
    • Capability keys rfq_taker, rfq_quoter and combos.
  • One typed interface on TradingExchange. Accept side mappings:
    • Kalshi: accepted_side names the maker's bid. Buy YES sends no at 1 − no_bid. This was checked on the Kalshi demo exchange: an accept with no filled as buy YES, 5 @ 0.45.
    • Polymarket US: acceptedSide is the requester's own side.
    • Polymarket: Exchange v3 orders. These are matched byte for byte against EIP-712 vectors built without Synpath code, including the Deposit Wallet's ERC-7739 wrap. CLOB V2 signing is unchanged.
    • SX Bet: quotes are signed orders on the parlay market, expiring before the parlay ends. Void-leg settlement is handled conservatively.
  • Engine (engine.rfq):
    • Accept and confirm pass the risk rules (rfq_taker, rfq_quoter, worst_price). The intent is journaled before the venue call.
    • Crash recovery reads the quote back; nothing is sent twice.
    • Fills land in positions. A combo is its own instrument.
    • A side mismatch from the venue raises an alert.
    • Halt cancels open RFQs and quotes under the cancel policy.
    • Incoming RFQs are pushed to quoting callbacks on venues that stream them (Polymarket, SX Bet): about 0.3 ms to the callback in tests.
    • Polymarket RFQs are re-seeded from the journal after a restart.
  • serve:
    • /trading/rfqs, /trading/quotes, /trading/combos and /trading/combos/collections.
    • Accept and confirm return 202 at once, or 200 when wait=true and the quote is final.
    • Risk refusals are 409, with the rule.
    • rfq.*, quote.* and combo.saved events on /ws/events.
    • Polymarket US RFQ endpoints are paced at 1 request/s.

Tests

  • All offline: mocked HTTP and sockets, plus a paper venue with fake makers.
  • Full suite: 3160 passed, 199 skipped (PostgreSQL variants: no test DSN set).

Not verified (phase P10, live, announced to Yuki before each run)

  • Kalshi quoter collateral: a demo quote was refused with insufficient_balance.
  • Size fields on target-cost RFQs.
  • Combo quota behaviour.
  • Polymarket US error bodies and last-look lapse status.
  • Polymarket v3 acceptance window and fees.
  • SX Bet parlay timing and void settlement.

Each venue's checklist is in the doc.

Request-for-quote and combo trading for the terminal, on the experimental
order model (outcome + action). Plan and venue research: docs/rfq-combo.md.

- Models: Rfq, RfqQuote, Combo/ComboLeg, AcceptQuote, MakerQuote, status
  enums, sizing by contracts or by amount (synpath/trading/money.py), and
  capability keys rfq_taker, rfq_quoter and combos on every adapter.
- One typed interface on TradingExchange, implemented by:
  - Polymarket US: taker, quoter, combos.
  - Kalshi: taker, quoter, multivariate combos; accepted_side names the
    maker's bid, so buying YES sends "no" (checked on the demo exchange).
  - Polymarket: taker, quoter, combos, with Exchange v3 order signing
    (matched against independently built EIP-712 vectors, incl. the
    Deposit Wallet ERC-7739 wrap).
  - SX Bet: the parlay quoter side.
- Engine (engine.rfq): accepts and confirms go through risk and are
  journaled before the venue call; crash recovery reads the quote back;
  fills land in positions; a combo is its own instrument; a side mismatch
  alerts; halt cancels open RFQs and quotes. Incoming RFQs are pushed to
  quoting callbacks where the venue streams them.
- serve: /trading/rfqs, /trading/quotes, /trading/combos and quote events
  on /ws/events. Accept and confirm return 202 at once, 200 when waited.

Offline tests only; live runs are phase P10.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@YukiC0804
YukiC0804 merged commit c4a9b82 into codex/order-lifecycle-storage Oct 21, 2026
5 checks passed
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