order_to_hyperliquid_request

Function order_to_hyperliquid_request 

Source
pub fn order_to_hyperliquid_request(
    order: &OrderAny,
) -> Result<HyperliquidExecPlaceOrderRequest>
Expand description

Converts a Nautilus order into a Hyperliquid order request.

§Supported Order Types

  • Market: Implemented as IOC limit order
  • Limit: Standard limit order with TIF (GTC/IOC/ALO)
  • StopMarket: Trigger order with market execution (protective stop)
  • StopLimit: Trigger order with limit price (protective stop)
  • MarketIfTouched: Trigger order with market execution (profit taking/entry)
  • LimitIfTouched: Trigger order with limit price (profit taking/entry)

§Conditional Order Patterns

Following patterns from OKX and Bybit adapters:

  • Stop orders (StopMarket/StopLimit) use tpsl: Sl
  • If Touched orders (MIT/LIT) use tpsl: Tp
  • Trigger price determines when order activates
  • Order side and trigger price relationship determines TP vs SL semantics

§Trigger Type Support

Hyperliquid currently uses last traded price for all triggers. Future enhancement: Add support for mark/index price triggers if Hyperliquid API supports it.