Overview

When you sell assets purchased using margin funds, you have an open short position. If you are close to your Net Open Position limit, you may want to cover some of your short positions to avoid a margin call. You can cover a short position by buying more assets in an attempt to reduce the amount owed. You can cover short positions by asset or cover all your short positions.

Prerequisites

Cookbook

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

Cover Short PositionsOpen Cookbook

Cover Positions

Endpoint: Cover Short Positions

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/margin/positions/cover \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
        "all": true
      }'

Step Result

{
  "balances": [
    {
      "currency": "BTC",
      "quantity": 2,
      "balanceValue": {
        "quantity": "1000000",
        "currency": "USD"
      }
    }
  ]
}

See Also