Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Exchange.modify_order (HL-compat)

Atomic cancel + replace, emulated as a single batched action.

Signature

def modify_order(
    self,
    oid: int | Cloid,
    name: str,
    is_buy: bool,
    sz: float,
    limit_px: float,
    order_type: OrderType,
    reduce_only: bool = False,
    cloid: Cloid | None = None,
) -> dict[str, Any]

Example

from dango.hyperliquid_compatibility.exchange import Exchange
 
ex = Exchange(wallet, base_url="...", account_address="0x...")
 
ex.modify_order(
    oid=12345,
    name="ETH",
    is_buy=True,
    sz=0.75,
    limit_px=1490.0,
    order_type={"limit": {"tif": "Gtc"}},
)

Parameters

oidint | Cloid. The order to cancel. int is the chain order id; Cloid triggers a Uint64-by-cloid cancel.

namestr. HL coin name.

is_buybool.

szfloat.

limit_pxfloat.

order_typeOrderType. Only {"limit": ...} is supported; {"trigger": ...} raises.

reduce_onlybool, optional. Default: False.

cloidCloid | None, optional. Client id for the new order (independent from the oid being cancelled).

Returns

dict[str, Any] — HL status envelope with response.type="batchModify".

Notes

  • Dango has no first-class modify message. The wrapper packs a CancelAction + SubmitAction into one batch_update_orders call so the cancel and the new submission settle in the same block.

See also