Skip to main content
POST
Python (SDK)

Authorizations

x-api-key
string
header
required

Your Compass API Key. Get your key here.

Body

application/json

Request to set leverage on a perpetual trading asset.

Omit leverage (or pass null) to target the asset's maximum leverage.

owner
string
required

User's EOA address

asset
string
required

Asset ticker (e.g. 'AAPL', 'CL')

leverage
integer | null

Target leverage as a whole-number multiplier. Omit (or pass null) to use the asset's maximum leverage. Must be between 1 and the asset's max leverage, which is available from the /opportunities endpoint.

Required range: x >= 1

Response

Successful Response

Returned by the set_leverage endpoint.

If the asset is already at the requested leverage, typed_data/action/nonce are null. If not, they contain the EIP-712 payload the user must sign.

leverage_ok
boolean
required

True if leverage already matches the requested value, false if an update is needed

typed_data
Typed Data · object | null

EIP-712 typed data for wallet signing, or null if no change is needed

action
Action · object | null

Raw Hyperliquid action (passed back to the execute endpoint), or null

nonce
integer | null

Timestamp-based nonce, or null if no action needed