Close Margin Positions

Close open margin positions by asset or close all positions at once. See the Guide.

  1. Close all open margin positions or close positions by asset. When you close all open margin positions, BitGo starts an asynchronous process that buys and sells assets in an attempt to net them to zero.

    To close positions by asset instead of all positions, replace "all": true with "currencies": ["<ASSET_ID>"] in the request body.

    Prerequisites: Access token must have the trade_trade scope. You must have the Trade role on your enterprise.

    API Reference

// 1. Close Positions
export BITGO_EXPRESS_HOST="<YOUR_LOCAL_HOST>"
export ACCOUNT_ID="<YOUR_ACCOUNT_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
curl -X POST \
  http://$BITGO_EXPRESS/api/prime/trading/v1/accounts/$ACCOUNT_ID/margin/positions/close \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
        "all": true
      }'