跳至主要内容

修改持倉設置

信息

API key 需要「理財」權限

備註

duration = Fixed 的持倉支持設置自動複投。您可以從 GET /v5/earn/product?category=OnChain 的響應參數中獲取 duration 的值。

HTTP 請求

POST/v5/earn/position/modify

請求參數

參數是否必需類型說明
categorytruestring產品類別,固定傳 OnChain
productIdtrueinteger產品 ID,從 GET /v5/earn/product 獲取
positionIdtrueinteger持倉 ID,從 GET /v5/earn/position 獲取
autoReinvesttrueinteger自動續期開關。0:關閉,1:開啟

響應參數

參數類型說明
retCodeinteger返回碼,0 表示成功
retMsgstring返回信息,成功時為 ""

請求示例

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
}

響應示例

{
"retCode": 0,
"retMsg": "",
"result": {},
"retExtInfo": {},
"time": 1773732693032
}