Place a Margin Order

To place a margin order, use the regular Place an Order endpoint with the margin_order_type parameter set to CROSS_MARGIN.

When borrowing funds to cover the order amount, interest will be applied to the borrowed amount based on the rates defined in Get Margin Available Currencies.

Prerequisites

Before placing margin orders, ensure the following conditions are met:

1. Margin Account Funding

Your margin account must be funded with the required collateral. To deposit funds into your margin account, use the Process Margin Funds Movement endpoint with the DEPOSIT movement type.

2. Check Book Availability

Margin orders can only be placed on books that support margin trading. To verify if a book allows margin trading, use the List Available Books endpoint and check the margin_enabled field. Only books with margin_enabled: true support margin orders.

3. Currency Configurations

To view the interest rates charged on borrowed amounts and the discount factors applied to collateral for each currency, use the Get Margin Available Currencies endpoint. This information helps you understand the borrowing costs and collateral requirements for margin trading.

4. Margin Level Requirements

Your margin account must maintain a healthy margin level to place orders. The margin level is calculated as the ratio of total assets to total liabilities (total assets / total liabilities).

Key Thresholds:

  • Safe Level: Orders can only be placed when your current margin level is above the safe threshold. This ensures you have sufficient collateral to cover potential risks.
  • Maintenance Level: If your margin level falls below the maintenance threshold, your account will be liquidated to protect against further losses.

You can monitor your current margin level and check these thresholds using the Get Margin Account Summary endpoint. The response includes:

  • margin_levels.current - Your current margin level
  • margin_levels.safe - The safe threshold (must be above this to place orders)
  • margin_levels.maintenance - The maintenance threshold (liquidation occurs if you fall below this)

Example: Complete Margin Trading Scenario

Initial Setup

You have $2,500 USD in your margin account and want to buy 0.1 BTC at $50,000 USD per BTC.

  • Total Order Cost: $5,000 USD
  • Your Balance: $2,500 USD
  • Amount to Borrow: $2,500 USD
  • Interest Rate (USD): 0.00008 per hour

Placing the Order

When you place the margin order, the system automatically borrows $2,500 USD to complete the purchase. You now hold:

  • Assets: 0.1 BTC (valued at $5,000 USD)
  • Liabilities: $2,500 USD borrowed
  • Margin Level: $5,000 / $2,500 = 2.0

Interest Accumulation

Interest is charged hourly on the borrowed amount:

  • Hourly Interest: $2,500 × 0.00008 = $0.20 USD
  • Daily Interest: $0.20 × 24 = $4.80 USD

Liquidation Risk

If the price of BTC drops, your margin level decreases:

Scenario 1 - Price drops to $40,000:

  • Assets: 0.1 BTC (now valued at $4,000 USD)
  • Liabilities: $2,500 USD (plus accrued interest)
  • New Margin Level: $4,000 / $2,500 = 1.6

Scenario 2 - Price drops to $33,000:

  • Assets: 0.1 BTC (now valued at $3,300 USD)
  • Liabilities: $2,500 USD (plus accrued interest)
  • New Margin Level: $3,300 / $2,500 = 1.32

If your margin level falls below the maintenance threshold (e.g., 1.1), your account enters liquidation:

  1. The system automatically sells your positions to repay borrowed funds
  2. Your account status changes to BLOCKED
  3. After liquidation completes, status returns to INACTIVE

To avoid liquidation, ensure your margin level stays above the maintenance threshold (e.g., 1.1) by either:

  • Depositing additional collateral
  • Closing positions to reduce liabilities
  • Monitoring price movements and market conditions

Related Endpoints