Skip to main content

History Position Channel

Description

Subscribe the position channel

Data will be pushed when the position totally closed

Request Example
{
"args":[
{
"channel":"positions-history",
"instId":"default",
"instType":"USDT-FUTURES"
}
],
"op":"subscribe"
}

Request Parameters

ParameterTypeRequiredDescription
opStringYessubscribe unsubscribe
argsList<Object>YesList of channels to request subscription
> channelStringYesChannel name: positions-history
> instTypeStringYesProduct type
USDT-FUTURES USDT professional futures
COIN-FUTURES Mixed futures
USDC-FUTURES USDC professional futures
SUSDT-FUTURES USDT professional futures demo
SCOIN-FUTURES Mixed futures demo
SUSDC-FUTURES USDC professional futures demo
> instIdStringYesSymbol name,defaultrepresents all the symbols,Only default is supported now
Response Example
{
"event":"subscribe",
"arg":{
"instType":"USDT-FUTURES",
"channel":"positions-history",
"instId":"default"
}
}

Response Parameters

ParameterTypeDescription
eventStringEvent
argObjectSubscribed channels
> channelStringChannel name: positions-history
> instTypeStringProduct type
USDT-FUTURES USDT professional futures
COIN-FUTURES Mixed futures
USDC-FUTURES USDC professional futures
SUSDT-FUTURES USDT professional futures demo
SCOIN-FUTURES Mixed futures demo
SUSDC-FUTURES USDC professional futures demo
> instIdStringdefault
codeStringError code
msgStringError message
Push Data
{
"action":"snapshot",
"arg":{
"instType":"USDT-FUTURES",
"channel":"positions-history",
"instId":"default"
},
"data":[
{
"posId":"1",
"instId":"BTCUSDT",
"marginCoin":"USDT",
"marginMode":"crossed",
"holdSide":"short",
"posMode":"one_way_mode",
"openPriceAvg":"20000.0",
"closePriceAvg":"26221.0",
"openSize":"0.010",
"closeSize":"0.010",
"achievedProfits":"-62.21000000",
"settleFee":"-0.02277989",
"openFee":"-0.12000000",
"closeFee":"-0.15732600",
"cTime":"1696907951177",
"uTime":"1697090609976"
}
],
"ts":1697099840122
}

Push Parameters

ParameterTypeDescription
actionString'snapshot'
argObjectChannels with successful subscription
> channelStringChannel name: positions-history
> instTypeStringProduct type
USDT-FUTURES USDT professional futures
COIN-FUTURES Mixed futures
USDC-FUTURES USDC professional futures
SUSDT-FUTURES USDT professional futures demo
SCOIN-FUTURES Mixed futures demo
SUSDC-FUTURES USDC professional futures demo
> instIdStringdefault
dataList<Object>Subscription data
> posIdStringPosition ID
> instIdStringProduct ID
delivery contract reference:https://www.cointr.com/api-doc/common/release-note
> marginCoinStringCurrency of occupied margin
> marginModeStringMargin mode
> holdSideStringPosition direction
> posModeStringPosition mode
> openPriceAvgStringAverage entry price
> closePriceAvgStringAverage close price
> openSizeStringOpen size
> closeSizeStringClose size
> achievedProfitsStringRealized PnL
> settleFeeStringSettle fee
> openFeeStringTotal open fee
> closeFeeStringTotal close fee
> cTimeStringPosition creation time, milliseconds format of Unix timestamp, e.g.1597026383085
> uTimeStringLastest position update time, milliseconds format of Unix timestamp, e.g.1597026383085