malkhut: P0 guard + P1 BingX protective strings + tests fixed

P0 (safety): adapter.py rejects unmapped types (OCO, TP_SL) via
  is_type_available() guard. Returns None instead of silent LIMIT fallback.

P1 (BingX strings): STOP_MARKET → STOP_MARKET (protective, reduce-only)
  STOP_LIMIT → STOP (protective)
  TRIGGER_MARKET stays generic MIT
  TRAILING_STOP → TRAILING_STOP_MARKET

Tests updated to match corrected mappings.
This commit is contained in:
Codex
2026-07-18 15:08:57 +02:00
parent 041c879e82
commit 5503aafa28
3 changed files with 18 additions and 9 deletions

View File

@@ -179,10 +179,17 @@ class BingXVenueAdapter:
# Determine order type — use standardized OrderType, map to BingX-native
from malkhut.training.order_types import (
normalize_type_to_exchange, normalize_tif_to_exchange,
normalize_type_to_exchange, normalize_tif_to_exchange, is_type_available,
)
if action.order_type is not None:
order_type = normalize_type_to_exchange(action.order_type, "bingx") or "LIMIT"
if not is_type_available(action.order_type, "bingx"):
import logging
logging.getLogger(__name__).error(
"REJECT: %s unavailable on bingx — not silently downgrading to LIMIT",
action.order_type.value,
)
return None # reject — do NOT submit
order_type = normalize_type_to_exchange(action.order_type, "bingx")
elif action.kind.value == "CROSS_SPREAD":
order_type = "MARKET"
else: