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

Modify a single existing order on Hyperliquid.

For modifying multiple orders in a batch, use Hyperliquid.Api.Exchange.BatchModify.

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

Summary

Functions

Modify a single order.

Types

@type modify_opts() :: [{:vault_address, String.t()}]
@type modify_response() :: %{status: String.t(), response: map()}

Functions

Link to this function

modify(oid, order, opts \\ [])

View Source
@spec modify(
  non_neg_integer() | String.t(),
  Hyperliquid.Api.Exchange.Order.order(),
  modify_opts()
) ::
  {:ok, modify_response()} | {:error, term()}

Modify a single order.

Parameters

  • oid: Order ID to modify (integer or hex string for Client Order ID)
  • order: New order parameters (built with Order.limit_order/4 or Order.trigger_order/5)
  • 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} - Modify result
  • {:error, term()} - Error details

Examples

# Modify order with new price
alias Hyperliquid.Api.Exchange.{Modify, Order}

new_order = Order.limit_order("BTC", true, "51000.0", "0.1")
{:ok, result} = Modify.modify(12345, new_order)

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).