Overview

Margin orders are similar to trade orders, except the assets for margin orders withdraw from your Margin Trade Account instead of your Go Account.

You can execute all trade order types as margin trades, including market, limit, stop, TWAP, and steady pace orders. See Place Trade Orders for details on each order type, including stop market and stop limit variants.

BitGo initiates a Net Open Position (NOP) check before trades execute. Trades that exceed your NOP limit don't execute. Additionally, BitGo runs margin calculations after trades successfully execute. If the trade causes your account to violate the margin limits, then you can't place further trades until your account returns to a healthy state, such as by posting more collateral.

Note: Trade orders made in testnet confirm but do not settle. Trade orders only settle in the production environment.

Prerequisites

Cookbook

Need just the steps? Expand the cookbook below to get started:

Place Margin OrderOpen Cookbook

Place Trade Order

Endpoint: Place Order

export BITGO_EXPRESS_HOST="<YOUR_LOCALHOST>"
export ACCOUNT_ID="<YOUR_ACCOUNT_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
curl -X POST \
    http://$BITGO_EXPRESS_HOST/api/prime/trading/v1/accounts/$ACCOUNT_ID/orders \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $ACCESS_TOKEN" \
    -d '{
           "clientOrderId": "myorder1",
           "type": "market",
           "product": "TBTC-TUSD*",
           "fundingType": "margin",
           "side": "buy",
           "quantity": "10000",
           "quantityCurrency": "TUSD*"
         }'

Step Result

{
  "id": "67fd640c-cb6c-4218-80ae-49e79ec15646",
  "accountId": "60e740e7898f7d00064d43769a73dc48",
  "clientOrderId": "myorderid1",
  "time": "2021-08-05T18:05:23.431Z",
  "creationDate": "2021-08-05T18:05:22.286Z",
  "scheduledDate": "2021-08-05T18:05:00.000Z",
  "lastFillDate": "2021-08-05T18:05:23.302Z",
  "completionDate": "2021-08-05T18:05:23.431Z",
  "settleDate": "2021-08-05T20:00:00.000Z",
  "fundingType": "margin",
  "type": "market",
  "status": "completed",
  "product": "TBTC-TUSD*",
  "side": "buy",
  "quantity": "1000",
  "quantityCurrency": "TUSD*",
  "filledQuantity": "0.02457152",
  "averagePrice": "40697.32"
}

Next

  1. Cover Short Positions
  2. Close All Positions

See Also