Commit Graph

7 Commits

Author SHA1 Message Date
Codex
ebf7f17132 malkhut: fee+slippage execution threshold 2026-07-18 17:44:20 +02:00
Codex
041c879e82 malkhut: all exchange order types in DSL + action_menu
ActionType → OrderType mapping (common-sensical):
  QUOTE/REQUOTE/CHASE: LIMIT (passive, post_only)
  CROSS_SPREAD (high urgency): MARKET (immediate fill)
  CROSS_SPREAD (medium urgency): LIMIT + IOC (partial fill)
  STOP_LOSS: STOP_MARKET (trigger → market exit)
  TAKE_PROFIT: TRIGGER_MARKET (trigger → market exit)
  TRAILING_STOP: TRAILING_STOP (trailing stop exit)
  EXIT/FLAT_ALL: STOP_MARKET
  EMERGENCY_EXIT: MARKET (immediate)

All order types exercised: LIMIT, MARKET, STOP_MARKET, TRIGGER_MARKET, TRAILING_STOP
2026-07-18 12:25:41 +02:00
Codex
8322550fbc malkhut: REQUOTE as proper CANCEL_REPLACE primitive + action_menu metadata
REQUOTE is now distinct from QUOTE:
  QUOTE: PLACE new order (no existing to cancel)
  REQUOTE: CANCEL_REPLACE existing + place new (immediate)
  CHASE: PLACE with short TTL (auto-cancel retry)
  CANCEL: Remove existing order

action_menu generates REQUOTE with metadata={'requote': True} for existing orders.
DSL REQUOTE produces CANCEL_REPLACE when existing order, falls back to PLACE.

All 800+ tests pass.
2026-07-17 23:17:22 +02:00
Codex
8857daedfa malkhut: urgency-driven maker/taker + calibrated slippage + chase + docs 2026-07-17 10:16:55 +02:00
Codex
d24d9bc6bd malkhut(wire): OrderType as three orthogonal dimensions — Fable's corrections
CRITICAL REFACTOR based on Fable's review (S9 roadmap item):

Before: flat enum conflating order types with TIF/instructions
  OrderType had MARKET, LIMIT, IOC, FOK, POST_ONLY, REDUCE_ONLY, etc.

After: three orthogonal dimensions (FIX-aligned):
  1. OrderType (Tag 40): what the order IS
     LIMIT, MARKET, STOP_MARKET, STOP_LIMIT, TRIGGER_MARKET, TRIGGER_LIMIT,
     TRAILING_STOP, OCO, TP_SL
  2. TimeInForce (Tag 59): how long it LIVES
     GTC, IOC, FOK, GTD
  3. Instructions (Tag 18): behavioral modifiers
     POST_ONLY, REDUCE_ONLY, HIDDEN, ICEBERG

Key corrections:
- POST_ONLY is an instruction on a LIMIT order, not a standalone type
- IOC/FOK are TimeInForce values, not order types
- BingX trailing_stop -> native TRAILING_STOP_MARKET (not TRIGGER_MARKET)
- FulfilmentAction.time_in_force: new field, default GTC

Exchange mappings restructured:
  EXCHANGE_ORDER_TYPE_MAP: OrderType -> exchange native 'type' param
  EXCHANGE_TIF_MAP: TimeInForce -> exchange native 'timeInForce' param
  EXCHANGE_INSTRUCTION_MAP: Instruction -> exchange encoding

21 files changed. 380+ tests pass. Backward compatible.
2026-07-14 14:46:44 +02:00
Codex
3324933613 malkhut(wire): OrderType unified — 5-layer taxonomy, backward compatible
state.py OrderType replaced with 5-layer taxonomy (FIX/CCXT aligned):
  Layer 1: MARKET, LIMIT (FIX Tag 40)
  Layer 2: GTC, IOC, FOK, GTD (FIX Tag 59)
  Layer 3: STOP_MARKET, STOP_LIMIT, TRIGGER_MARKET, TRIGGER_LIMIT, TRAILING_STOP
  Layer 4: POST_ONLY, REDUCE_ONLY, HIDDEN, ICEBERG (FIX Tag 18)
  Layer 5: OCO, TP_SL (exchange-specific)

action_menu.py: REDUCE_ONLY_MARKET → MARKET (reduce_only field handles it)

All 1126 tests pass. Fully wired and backward compatible.
2026-07-14 13:04:54 +02:00
Codex
4ffc8a601f malkhut(T3): planner + adversarial counterparties
Planner: Decoupled UCB/UCT simultaneous-move MCTS (sm_mcts.py),
compact action space (action_menu.py), planner alternatives (alternatives.py).
Counterparties: 4+ adversarial agent ecology — ToxicTaker, LatencyArb,
MarketMaker, NoiseTrader + extended: LiquidationFlow, WhaleOrder,
MomentumFollower, SpoofDetector, QueueChaser.
2026-07-11 10:26:01 +02:00