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

Add or remove margin from an isolated position.

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

Summary

Functions

Add or remove margin from an isolated position.

Functions

Link to this function

request(asset, is_buy, ntli, opts \\ [])

View Source

Add or remove margin from an isolated position.

Parameters

  • private_key: Private key for signing (hex string)
  • asset: Asset index
  • is_buy: true for long position, false for short
  • ntli: Amount to add (positive) or remove (negative)
  • opts: Optional parameters

Options

  • :vault_address - Update for a vault

Returns

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

Examples

# Add margin
{:ok, result} = UpdateIsolatedMargin.request(private_key, 0, true, 100)

# Remove margin
{:ok, result} = UpdateIsolatedMargin.request(private_key, 0, true, -50)