Close Positions
Overview
You can close open positions by asset or close all positions. When you close all open margin positions, BitGo will start an asynchronous process that buys and sells assets in an attempt to net them to zero.
Prerequisites
Close Positions
Endpoint: Close All Margin Positions
1 2 3 4 5 6 7 8 9 10
export BITGO_EXPRESS_HOST="<YOUR_LOCALHOST>" export ACCOUNT_ID="<YOUR_ACCOUNT_ID>" export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>" curl -X POST \ https://$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 }'