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

order

Place a single Hyperliquid-style order. Routes to the native submit_order.

Signature

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

Example

from dango.hyperliquid_compatibility.exchange import Exchange
from dango.utils.signing import Secp256k1Wallet
 
wallet = Secp256k1Wallet.from_mnemonic("...", subaccount_index=0)
exchange = Exchange(
    wallet,
    base_url="https://api-mainnet.dango.zone",
    account_address="0x...",
)
 
result = exchange.order(
    name="BTC",
    is_buy=True,
    sz=0.5,
    limit_px=65000.0,
    order_type={"limit": {"tif": "Gtc"}},
)

Parameters

namestr. Hyperliquid coin name (e.g. "BTC", "ETH"). Resolved to a Dango pair_id via info.name_to_pair.

is_buybool. True for a long, False for a short.

szfloat. Order size in base units of the coin.

limit_pxfloat. Limit price.

order_typeOrderType. Hyperliquid order-type dict, e.g. {"limit": {"tif": "Gtc"}} or {"trigger": {...}}.

reduce_onlybool, default False. Reduce-only flag.

cloidCloid | None, default None. Optional client order id (128-bit). Hashed to a 64-bit ClientOrderId via SHA-256. The cloid returned in the Dango response is the truncated value, not the original.

builder — Unused. Dango has no builder-fee marketplace; pass anything (ignored).

Returns

dict[str, Any] — Hyperliquid-shaped order response envelope.

Notes

See also