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

Update leverage for a perpetual asset.

See: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint

Summary

Functions

Update leverage for a perpetual asset.

Functions

Link to this function

request(asset, leverage, is_cross, opts \\ [])

View Source

Update leverage for a perpetual asset.

Parameters

  • asset: Asset index
  • leverage: New leverage value
  • is_cross: true for cross margin, false for isolated
  • opts: Optional parameters

Options

  • :private_key - Private key for signing (falls back to config)
  • :vault_address - Update for a vault

Returns

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

Examples

{:ok, result} = UpdateLeverage.request(0, 10, true)

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