Skip to main content

Get All Current Positions

API Description​

This interface allows users to query all current open positions(filled orders).

Note: Current positions data is available via both Resful and Websocket APIs. This page describes the RESTful API. For information on the Websocket API, please click here

Precautions​

  1. This interface closely resembles "closing postions at market price" endpoint. Users should carefully distinguish similar URLs and ensure the correct request method is used to avoid unintended actions.

Authentication​

This is a private interface and requires authentication. For details on using the RESTful API, refer to Common > Authentication & Code Snippet > Futures > RESTful Private Interface.

Request Method​

GET

Endpoint​

v1/perpum/positions/all

Frequency Limit​

The frequency limit for this interface is 30 requests/second per user ID and 100000 requests/2s per IP. In addition to this per-interface limit, a global rate limit is also enforced.

For detailed information on Global rate limits and API Rate Limiting Policy, please refer to the "Frequency Limit" section at click here

Request Parameters​

This interface does not require any request parameter.

Response Parameters​

ParameterTypeDescription
idLongPosition ID
baseStringContract base currency, such as BTC
baseSizeBigDecimalContract face value
createdDateLongPosition creation timestamp
currentPieceBigDecimalCurrent number of contracts
closedPieceIntegerNumber of closed contracts.
directionStringTrade direction:long/short
feeBigDecimalFunding fee
fundingSettleBigDecimalSettled funding fee
indexPriceBigDecimalIndex price at trigger
instrumentStringInstrument identifier, e.g., BTC (USDT contracts) or BTC_USDC (USDC contracts).
leverageBigDecimalPosition leverage
marginBigDecimalMargin used by position
orderPriceBigDecimalOrder execution price
openPriceBigDecimalPosition opening price
originalTypeStringOriginal order type
posTypeStringPosition type upon order execution:plan/planTrigger/execute
positionMarginBigDecimalPosition margin
positionModelIntegerposition Margin mode:
0: Isolated margin,
1: Cross margin.
quantityStringSpecifies order size based on quantityUnit:
If quantityUnit=0, the quantity is measured in the quote currency (e.g., USDT in BTC-USDT / USDC in BTC-USDC),
If quantityUnit=1, the quantity is measured in number of contracts,
If quantityUnit=2, the quantity is measured in the base currency (e.g., BTC in BTC-USDT)
quantityUnitBigDecimalSpecifies the unit for order size:
0: Denominated in the quote currency (e.g., USDT in BTC-USDT / USDC in BTC-USDC),
1: Denominated in number of contracts,
2: Denominated in the base currency (e.g., BTC in BTC-USDT)
statusStringStatus: (open/close)
totalPieceBigDecimalTotal number of contracts
updatedDateStringLast update timestamp
userIdLongUser ID
autoDeleveragingScoreInteger(user can ignore it)
triggerTypeIntegerSpecifies type of order once "triggerPrice" is met:
0: Limit order.
1 : Market order
profitUnrealFloatCurrent unrealized profit or loss of the open position
liquidationPriceFloatLiquidation price
triggerPriceBigDecimalTrigger price for perpetual contract plan order

Request Example​

The following Python code shows how to get all the current open positions information.

Note: For a complete code example, please refer to Common > Authentication & Code Snippet > Futures > RESTful Private Interface.

params = {}
api_url = "/v1/perpum/positions/all"
method = "GET"
response_code, response_data = FuturesRestfulPrivate(params, api_url, method, sec_key, api_key) # function FuturesRestfulPrivate() is defined in section (Common > Authentication & Code Snippet > Futures > RESTful Private Interface)

Note: For a complete Java code example, please refer to Common > Authentication & Code Snippet > Futures > RESTful Private Interface.

Response Example​

The following is an example response returned by the above Python request:

{'code': 0,
'data': [{'autoDeleveragingScore': 1,
'base': 'sand',
'baseSize': 10.0,
'closedPiece': 0,
'createdDate': 1751972973000,
'currentPiece': 1,
'direction': 'long',
'fee': '0.0014',
'fundingFee': '0',
'fundingSettle': 0,
'id': 2435521222635399738,
'indexPrice': 0.24477,
'instrument': 'SAND',
'leverage': 2,
'liquidationPrice': 0.123594777082913,
'margin': 1.2223,
'openPrice': 0.24477,
'orderPrice': 2147483647,
'originalType': 'execute',
'posType': 'execute',
'positionMargin': 1.22385,
'positionModel': 0,
'positionVersion': 0,
'profitReal': 0,
'profitUnreal': 0.0001,
'quantity': 1.22385,
'quantityUnit': 1,
'source': 'web',
'status': 'open',
'totalPiece': 1,
'updatedDate': 1751972973000,
'userId': 1162061},
{'autoDeleveragingScore': 1,
'base': 'btc',
'baseSize': 0.001,
'closedPiece': 0,
'createdDate': 1751973010000,
'currentPiece': 1,
'direction': 'short',
'fee': '0.0652',
'fundingFee': '0',
'fundingSettle': 0,
'id': 2435521222635399758,
'indexPrice': 108828,
'instrument': 'BTC',
'leverage': 2,
'liquidationPrice': 162591.22485053807,
'margin': 54.3486,
'openPrice': 108827.9,
'orderPrice': 0,
'originalType': 'execute',
'posType': 'execute',
'positionMargin': 54.41395,
'positionModel': 0,
'positionVersion': 0,
'profitReal': 0,
'profitUnreal': -0.0002,
'quantity': 54.41395,
'quantityUnit': 1,
'source': 'web',
'status': 'open',
'totalPiece': 1,
'updatedDate': 1751973010000,
'userId': 1162061}],
'msg': ''}