View Source Hyperliquid.Api.Exchange.CancelByCloid (hyperliquid v0.2.2)
Cancel orders on Hyperliquid by client order ID.
See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint
Summary
Types
@type cancel_opts() :: [{:vault_address, String.t()}]
@type cancel_request() :: %{asset: non_neg_integer(), cloid: String.t()}
Functions
@spec cancel(non_neg_integer(), String.t(), cancel_opts()) :: {:ok, cancel_response()} | {:error, term()}
Cancel a single order by client order ID.
Parameters
private_key: Private key for signing (hex string)asset: Asset indexcloid: Client order ID to cancelopts: Optional parameters
Options
:vault_address- Cancel on behalf of a vault
Returns
{:ok, response}- Cancel result{:error, term()}- Error details
Examples
{:ok, result} = CancelByCloid.cancel(private_key, 0, "my-order-1")
@spec cancel_batch([cancel_request()], cancel_opts()) :: {:ok, cancel_response()} | {:error, term()}
Cancel multiple orders by client order ID.
Parameters
private_key: Private key for signing (hex string)cancels: List of cancel requests[%{asset: 0, cloid: "id"}, ...]opts: Optional parameters
Options
:vault_address- Cancel on behalf of a vault
Returns
{:ok, response}- Batch cancel result{:error, term()}- Error details
Examples
cancels = [
%{asset: 0, cloid: "my-order-1"},
%{asset: 0, cloid: "my-order-2"}
]
{:ok, result} = CancelByCloid.cancel_batch(private_key, cancels)