Vertex Docs
  • Getting Started
    • 📋Overview
    • 📜Table of Contents
    • 🚀Mission
    • ⚔️Vertex Edge
      • 1️⃣Vertex on Arbitrum
      • 2️⃣Blitz on Blast
        • Blitz Documentation
      • 3️⃣Vertex on Mantle
        • 🎆Trading Rewards
        • 📊Perpetual & Spot Market Specifications
        • 🖥️Open-Source Contracts
        • 🔌API
      • 4️⃣Vertex on Sei
        • 💰Trading Rewards
        • 📊Perpetual & Spot Market Specifications
        • 🖥️On-Chain Contracts
        • 🔌API
      • 5️⃣Vertex on Base
        • 💰Trading Rewards
        • 📊Perpetual & Spot Market Specifications
        • 💻Onchain Contracts
        • 🔌API
        • ✍️Create a Coinbase Smart Wallet
      • 6️⃣Vertex on Sonic
        • 💰Trading Rewards
        • 📊Perpetual & Spot Market Specifications
        • ⛓️On-Chain Contracts
        • 🔌API
      • 7️⃣Vertex on Abstract
        • 📊Market Specifications
        • ⛓️On-Chain Contracts
        • 🔌API
      • 8️⃣Bro.Trade on Berachain
        • ⛓️On-Chain Contracts
        • 🔌API
      • 9️⃣Vertex on Avalanche
        • 💰Trading Rewards
        • 📊Market Specifications
        • ⛓️On-Chain Contracts
        • 🔌API
  • Basics
    • 📽️Products
    • ⚡Technical Architecture
    • 🧵Universal Cross Margin
    • ✂️Isolated Margin
    • ℹ️Subaccounts & Health
    • ⏰Liquidations & Insurance Fund
    • 💵PnL Settlements
    • 📊Pricing (Oracles)
    • 💰Fees
    • 📈Funding Rates
    • 📅Market Specifications
    • ⚡One-Click Trading
    • 🔫Trigger Orders
    • 🗂️GMCI 30 & MEME Indices
    • 💰Trade & Earn
      • 🤝Maker Program
      • 🔁Cross-Chain VRTX Rewards
      • ❓Trading Rewards - FAQs
    • 🧑‍🤝‍🧑Referral Program
    • ⚒️Resources & Links
    • ❔FAQs
  • VRTX Token
    • 🎓VRTX Tokenomics
    • 📊Token Supply Distribution
  • More
    • 🌐Glossary
    • 🔬Contracts & Code Audits
    • 🦋Bug Bounties
    • 💽Data & Research
    • 🪟Maintenance Windows
    • 🏁Terms of Use
    • ✍️Statement of Risk
    • 🌍Restricted Territories
    • 📸Brand Assets
  • Tutorials
    • 🏁Quick Start
    • 🖱️One-Click Trading
    • ⚙️Trading Basics
    • ♾️Perpetuals
    • 🔮Spot
    • 🧑‍🤝‍🧑Multiple Accounts
    • 🔫TP/SL & Stop-Market
    • 💰Withdrawals
    • ⚡Fast Withdrawals
    • 🌉Cross-Chain Deposits
    • 🔄Lend, Borrow & Repay
    • ❤️Margin Health
    • 💧Pools
    • 💫VRTX Staking
    • ↔️Switching Chains
    • 🪙Trading Rewards
    • ✂️Shortcuts
  • Developer Resources
    • API
      • 🔌Endpoints
      • Gateway
        • Executes
          • Place Order
          • Place Isolated Order
          • Cancel Orders
          • Cancel Product Orders
          • Cancel And Place
          • Withdraw Collateral
          • Transfer Quote
          • Liquidate Subaccount
          • Mint LP
          • Burn LP
          • Link Signer
        • Queries
          • Status
          • Contracts
          • Nonces
          • Order
          • Orders
          • Subaccount Info
          • Isolated Positions
          • Market Liquidity
          • Symbols
          • All Products
          • Edge All Products
          • Market Prices
          • Max Order Size
          • Max Withdrawable
          • Max LP Mintable
          • Fee Rates
          • Health Groups
          • Linked Signer
          • Insurance
          • Min Deposit Rates
        • Signing
          • Examples
          • Q&A
      • Subscriptions
        • Authentication
        • Streams
        • Events
        • Rate limits
      • Archive (indexer)
        • Orders
        • Matches
        • Events
        • Summary
        • Candlesticks
        • Edge Candlesticks
        • Funding Rate
        • Interest & funding payments
        • Oracle Price
        • Perp Prices
        • Product Snapshots
        • Market Snapshots
        • Edge Market Snapshots
        • Maker Statistics
        • Merkle Proofs
        • Rewards
        • Referral Code
        • Liquidation Feed
        • Linked Signer Rate Limit
        • Subaccounts
        • Subaccount Snapshots
        • Signatures
        • USDC Price
      • Trigger
        • Executes
          • Place Order
          • Cancel Orders
          • Cancel Product Orders
        • Queries
          • List Trigger Orders
      • V2
        • Assets
        • Pairs
        • APR
        • Orderbook
        • Tickers
        • Contracts
        • Trades
        • VRTX Token
      • Rate limits
      • Errors
      • Symbols
      • Depositing
      • Withdrawing (on-chain)
      • Integrate via Smart Contracts
      • Definitions / Formulas
    • Vertex Typescript SDK
      • Getting Started
      • How To
        • Create a Vertex client
        • Useful Common Functions
        • Query Markets & Products
        • Deposit Funds
        • Withdraw Funds
        • Manage Orders
      • User Guide
        • Client
          • Market
            • Place Order
            • Cancel Orders
            • Cancel Product Orders
            • Mint LP
            • Burn LP
            • Get All Markets
            • Get Latest Market Price
            • Get Market Liquidity
            • Get Open Subaccount orders
            • Get Historical Orders
            • Get Max Order Size
            • Get Max Mint LP
            • Get Candlesticks
            • Get Funding Rate
            • Get Product Snapshots
          • Spot
            • Approve Allowance
            • Deposit
            • Withdraw
            • Get Max Withdrawable
            • Get Token Contract for Product
            • Get Token Wallet Balance
            • Get Token Allowance
          • Perp
            • Get prices
          • Subaccount
            • Link Signer
            • Get Subaccount Linked Signer with Rate limits
            • Get Subaccount Summary
            • Get Subaccount Fee Rates
            • Get Subaccount Token Rewards
        • Engine Client
          • Executes
          • Queries
        • Indexer Client
          • Base Queries
          • Paginated Queries
        • Websocket
          • Executes
          • Queries
          • Subscriptions
        • Utilities
          • Contracts
          • Utils
      • API Reference
    • Vertex Python SDK
    • Vertex Rust SDK
    • Contracts
    • API/SDK Terms of Use
Powered by GitBook
On this page
  • Rate limits
  • Request
  • Request Parameters
  • Signing
  • Response
Export as PDF
  1. Developer Resources
  2. API
  3. Gateway
  4. Executes

Liquidate Subaccount

Submits a transaction to liquidate a subaccount's balance for a specified liquidation amount.

PreviousTransfer QuoteNextMint LP

Last updated 9 months ago

Rate limits

  • 30 liquidations/min or 5 liquidations every 10 seconds per wallet. (weight=20)

See more details in .

Request

Connect

WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]

Message


{
  "liquidate_subaccount": {
    "tx": {
      "sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43746573743000000000000000",
      "liquidatee": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43746573743000000000000000",
      "productId": 1,
      "isEncodedSpread": false,
      "amount": "1000000000000000000",
      "nonce": "1"
    },
    "signature": "0x"
  }
}

POST [GATEWAY_REST_ENDPOINT]/execute

Body


{
  "liquidate_subaccount": {
    "tx": {
      "sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43746573743000000000000000",
      "liquidatee": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43746573743000000000000000",
      "mode": 0,
      "healthGroup": 1,
      "amount": "1000000000000000000",
      "nonce": "1"
    },
    "signature": "0x"
  }
}

Request Parameters

Parameter
Type
Required
Description

tx

object

Yes

tx.sender

string

Yes

Hex string representing the subaccount's 32 bytes (address + subaccount name) of the tx sender.

tx.liquidatee

string

Yes

Hex string representing the subaccount's 32 bytes (address + subaccount name) of the subaccount being liquidated.

tx.productId

number

Yes

Perp Liquidation:

  • A valid perp product Id.

Spot Liquidation:

  • A valid spot product Id.

Spread Liquidation:

tx.isEncodedSpread

bool

Yes

When set to true, the productId is expected to encode a perp and spot product Ids as follows: (perp_id << 16) | spot_id

tx.amount

string

Yes

The amount to liquidate multiplied by 1e18, sent as a string.

tx.nonce

string

Yes

signature

string

Yes

Signing

The solidity typed data struct that needs to be signed is:

struct LiquidateSubaccount {
    bytes32 sender;
    bytes32 liquidatee;
    uint32 productId;
    bool isEncodedSpread;
    int128 amount;
    uint64 nonce;
}

sender: a bytes32 sent as a hex string; includes the address and the subaccount identifier.

liquidatee: a bytes32 sent as a hex string; includes the address and the subaccount identifier.

productId: The product to liquidate as well as the liquidation mode.

  • Perp liquidation ⇒ A valid perp product id is provided and isEncodedSpread is set to false.

  • Spot liquidation ⇒ A valid spot product id is provided and isEncodedSpread is set to false

  • Spread Liquidation => If there are perp and spot positions in different directions, liquidate both at the same time. Must be set to a 32 bits integer where the lower 16 bits represent the spot product and the higher 16 bits represent the perp product. isEncodedSpread must be set to true.

Computing productId for Spread Liquidation

btc_spot = 1
btc_perp = 2

spread_product_id = (btc_perp << 16) | btc_spot

isEncodedSpread: indicates whether productId encodes both a spot and a perp product Id for spread liquidation.

amount: the amount to liquidate multiplied by 1e18, sent as a string. Can be positive or negative, depending on if the user’s balance is positive or negative.

Note: for signing you should always use the data type specified in the solidity struct which might be different from the type sent in the request e.g: nonce should be an uint64 for Signing but should be sent as a string in the final payload.

Response

Success

{
  "status": "success",
  "signature": {signature},
  "request_type": "execute_liquidate_subaccount"
}

Failure

{
  "status": "failure",
  "signature": {signature},
  "error": "{error_msg}",
  "error_code": {error_code},
  "request_type": "execute_liquidate_subaccount"
}

Liquidate subaccount transaction object. See section for details on the transaction fields.

An encoded perp / spot product Ids, where the lower 16 bits represent the spot product and the higher 16 bits represent the perp product. isEncodedSpread must be set to true for spread liquidation. See section for more details.

This is an incrementing nonce, can be obtained using the query.

Signed transaction. See section for more details.

See more details and examples in our page.

nonce: the tx_nonce. This is an incrementing nonce, can be obtained using the query.

API Rate limits
signing
Nonces
Nonces
Signing
Signing
Signing