Docs

usdClassTransfer - Transfer Between Margin Modes

Transfer USD between perp and spot margin on Hyperliquid. Manage capital allocation across trading modes.

Transfer USD-class assets between perpetual and spot margin modes. This allows traders to reallocate capital between different trading modes.

Sample Data

JSON
{
  "signature": {
    "r": "0xb6fb726ec034a9a8d5125cc9031012a58ba10f39c380a80566b56363a2a7cabf",
    "s": "0x6d4bc0977c2a7cb99c5ae1a5a9fd54fd219598661c12a36e344f52b3bdb6bc6b",
    "v": 28
  },
  "action": {
    "type": "usdClassTransfer",
    "signatureChainId": "0x66eee",
    "hyperliquidChain": "Mainnet",
    "amount": "55.00000001000001",
    "toPerp": true,
    "nonce": 1768146939642
  },
  "nonce": 1768146939642
}

View this transaction on Hypurrscan

Field Reference

Action Fields

FieldTypeDescription
typestringAlways "usdClassTransfer"
signatureChainIdstringChain ID for EIP-712 signing
hyperliquidChainstringTarget chain: "Mainnet" or "Testnet"
amountstringAmount to transfer (human-readable USD)
toPerpbooleantrue to transfer to perp margin, false to spot margin
noncenumberTransaction nonce

Transfer Direction

toPerp ValueDirection
trueSpot margin → Perp margin
falsePerp margin → Spot margin

Use Cases

Capital Flow Analysis

Track how traders allocate between perp and spot:

Python
def process_usdClassTransfer_action(action):
    amount = action.get('amount')
    to_perp = action.get('toPerp')

    direction = 'spot → perp' if to_perp else 'perp → spot'
    print(f"Margin transfer: ${amount} ({direction})")

Market Mode Preference

Monitor aggregate flows to understand market preferences between spot and perp trading.

Arbitrage Detection

Large transfers may indicate arbitrage opportunities between markets.