View Source Hyperliquid.Api.Exchange.BatchModify (hyperliquid v0.2.2)

Modify multiple existing orders in a batch on Hyperliquid.

For modifying a single order, use Hyperliquid.Api.Exchange.Modify.

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders

Summary

Functions

Modify multiple orders in a batch.

Types

@type modify_opts() :: [{:vault_address, String.t()}]
@type modify_request() :: %{
  oid: non_neg_integer(),
  order: Hyperliquid.Api.Exchange.Order.order()
}
@type modify_response() :: %{
  status: String.t(),
  response: %{type: String.t(), data: %{statuses: list()}}
}

Functions

Link to this function

modify_batch(modifies, opts \\ [])

View Source
@spec modify_batch([modify_request()], modify_opts()) ::
  {:ok, modify_response()} | {:error, term()}

Modify multiple orders in a batch.

Parameters

  • modifies: List of modify requests [%{oid: 123, order: order}, ...]
  • opts: Optional parameters

Options

  • :private_key - Private key for signing (falls back to config)
  • :vault_address - Modify on behalf of a vault

Returns

  • {:ok, response} - Batch modify result
  • {:error, term()} - Error details

Examples

modifies = [
  %{oid: 12345, order: Order.limit(0, true, "51000.0", "0.1")},
  %{oid: 12346, order: Order.limit(0, true, "52000.0", "0.1")}
]
{:ok, result} = BatchModify.modify_batch(modifies)

Breaking Change (v0.2.0)

private_key was previously the first positional argument. It is now an option in the opts keyword list (:private_key).