Modify Position
info
API key needs "Earn" permission
note
Only positions with duration = Fixed support setting auto-reinvestment. You can get the duration value from the response of GET /v5/earn/product?category=OnChain.
HTTP Request
POST/v5/earn/position/modifyRequest Parameters
| Parameter | Required | Type | Comments |
|---|---|---|---|
| category | true | string | Product category. Fixed value: OnChain |
| productId | true | integer | Product ID. Obtained from GET /v5/earn/product |
| positionId | true | integer | Position ID. Obtained from GET /v5/earn/position |
| autoReinvest | true | integer | Auto-reinvestment switch. 0: Off, 1: On |
Response Parameters
| Parameter | Type | Comments |
|---|---|---|
| retCode | integer | Return code. 0 means success |
| retMsg | string | Return message. Empty string "" on success |
Request Example
- HTTP
- Python
- Node.js
POST /v5/earn/position/modify HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-SIGN: XXXXXX
X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx
X-BAPI-TIMESTAMP: 1773732693000
X-BAPI-RECV-WINDOW: 5000
Content-Type: application/json
{
"category": "OnChain",
"productId": 8,
"positionId": 326,
"autoReinvest": 1
}
Response Example
{
"retCode": 0,
"retMsg": "",
"result": {},
"retExtInfo": {},
"time": 1773732693032
}