Skip to main content

Get Current Position Information

API Description

This interface allows users to query information on current open positions(filled orders) by specifying an instrument. Users can also retrieve details of specific positions by providing one or more Position IDs.

Note: This function is available via only RESTful API.

Precautions

  1. This interface allows users to query the current open positions information by specifying an instrument. If needed, users can also retrieve details of specific positions by providing one or more Position IDs.
  2. 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 Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface.

Request Method

GET

Endpoint

/v1/perpum/positions

Frequency Limit

The frequency limit for this interface is 10 requests/s per user ID and 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

ParameterMandatoryTypeDescription
instrumenttrueStringThe base currency of the instrument. (e.g., BTC or btc). This parameter is case-insensitive.
Note: For instruments that start with numbers (e.g., 1000PEPE), both uppercase and lowercase formats are valid.
openIdsfalseStringOne or more position IDs separated by comma (,).
Example: 'positionId1,positionId2,positionId3'
Note: The number of positions IDs cannot exceed 20.

Response Parameters

ParameterTypeDescription
idLongPosition ID
baseStringContract base currency, such as BTC
baseSizeBigDecimalContract face value
createdDateLongPosition creation timestamp
currentPieceBigDecimalCurrent number of contracts
directionStringTrade direction:long/short
feeBigDecimalFunding fee
fundingSettleBigDecimalSettled funding fee
indexPriceBigDecimalIndex price at trigger
instrumentStringBase currency of the instrument e.g., BTC or ETH.
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 the quote currency (e.g., USDT in BTC-USDT),
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),
1: Denominated in number of contracts,
2: Denominated in the base currency (e.g., BTC in BTC-USDT)
statusStringStatus: (open/close)
stopLossPriceStringStop loss price
stopLossRateStringStop loss rate
stopProfitPriceStringTake profit price
stopProfitRateStringTake profit rate
stopLossOrderPriceStringStop loss limit price
stopProfitOrderPriceStringTake profit limit price
stopProfitTypeStringThe type of perpetual contract plan order after triggering:
plan: limit order,
execute: market order.
stopLossTypeStringThe type of perpetual contract plan order after triggering:
plan: limit order,
execute: market order.
totalPieceBigDecimalTotal number of contracts
updatedDateStringLast update timestamp
userIdLongUser ID
autoDeleveragingScoreInteger(user can ignore it)
profitUnrealFloatCurrent unrealized profit or loss of the open position
liquidationPriceFloatLiquidation price
triggerTypeIntegerSpecifies type of order once "triggerPrice" is met:
0: Limit order
1 : Market order
triggerPriceBigDecimalTrigger price for perpetual contract plan order

Request Example

The following Python code shows how to get the current open position information for BTC.

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

params = {
"instrument": "BTC",
}

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

Note: For a complete Java code example, please refer to Introduction > 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': 'btc',
'baseSize': 0.001,
'closedPiece': 0,
'createdDate': 1740572391000,
'currentPiece': 1,
'direction': 'short',
'fee': '0.0529',
'fundingFee': '0',
'fundingSettle': 0,
'id': 2435521222631982507,
'indexPrice': 88230.6,
'instrument': 'BTC',
'leverage': 1,
'margin': 88.2305,
'openPrice': 88230.5,
'orderPrice': 0,
'originalType': 'execute',
'posType': 'execute',
'positionMargin': 88.2305,
'positionModel': 0,
'profitReal': 0,
'profitUnreal': 0.0086,
'quantity': 88.2305,
'quantityUnit': 0,
'source': 'api',
'status': 'open',
'totalPiece': 1,
'updatedDate': 1740572391000,
'userId': 1162061}],
'msg': ''}