Move Position
You can move positions between sub-master, master-sub, or sub-sub UIDs when necessary
tip
UTA2.0 inverse contract move position is supported now
info
- The endpoint can only be called by master UID api key
- UIDs must be the same master-sub account relationship
- The trades generated from move-position endpoint will not be displayed in the Recent Trade (Rest API & Websocket)
- There is no trading fee
fromUidandtoUidboth should be Unified trading accounts, and they need to be one-way mode when moving the positions- Please note that once executed, you will get execType=
MovePositionentry from Get Trade History, Get Closed Pnl, and stream from Execution.
HTTP Request
POST /v5/position/move-positions
Request Parameters
| Parameter | Required | Type | Comments |
|---|---|---|---|
| fromUid | true | string | From UID
|
| toUid | true | string | To UID
|
| list | true | array | Object. Up to 25 legs per request |
| > category | true | string | Product type |
| > symbol | true | string | Symbol name, like BTCUSDT, uppercase only |
| > price | true | string | Trade price
|
| > side | true | string | Trading side of fromUid
|
| > qty | true | string | Executed qty
|
Response Parameters
| Parameter | Type | Comments |
|---|---|---|
| retCode | integer | Result code. 0 means request is successfully accepted |
| retMsg | string | Result message |
| result | map | Object |
| > blockTradeId | string | Block trade ID |
| > status | string | Status. Processing, Rejected |
| > rejectParty | string |
|
Request Example
- HTTP
- Python
- Java
- Node.js
POST /v5/position/move-positions HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-SIGN: XXXXXX
X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx
X-BAPI-TIMESTAMP: 1697447928051
X-BAPI-RECV-WINDOW: 5000
Content-Type: application/json
{
"fromUid": "100307601",
"toUid": "592324",
"list": [
{
"category": "spot",
"symbol": "BTCUSDT",
"price": "100",
"side": "Sell",
"qty": "0.01"
}
]
}
import com.bybit.api.client.domain.*;
import com.bybit.api.client.domain.position.*;
import com.bybit.api.client.domain.position.request.*;
import com.bybit.api.client.service.BybitApiClientFactory;
var client = BybitApiClientFactory.newInstance().newAsyncPositionRestClient();
var movePositionsRequest = Arrays.asList(MovePositionDetailsRequest.builder().category(CategoryType.SPOT.getCategoryTypeId()).symbol("BTCUSDT").side(Side.SELL.getTransactionSide()).price("100").qty("0.01").build(),
MovePositionDetailsRequest.builder().category(CategoryType.SPOT.getCategoryTypeId()).symbol("ETHUSDT").side(Side.SELL.getTransactionSide()).price("100").qty("0.01").build());
var batchMovePositionsRequest = BatchMovePositionRequest.builder().fromUid("123456").toUid("456789").list(movePositionsRequest).build();
System.out.println(client.batchMovePositions(batchMovePositionsRequest));
Response Example
{
"retCode": 0,
"retMsg": "OK",
"result": {
"blockTradeId": "e9bb926c95f54cf1ba3e315a58b8597b",
"status": "Processing",
"rejectParty": ""
}
}