創建萬能劃轉
支持子子帳戶間劃轉或母子帳號間劃轉。
提示
- 支持使用母帳戶或者子帳號api key請求
- 若要使用子帳號api key, 需要有"母子帳戶劃轉"(SubMemberTransferList)權限
- 當使用子帳號api key劃轉時, 僅能劃轉到母帳號下
- 如果您遇到錯誤碼是
131228
並且錯誤信息是your balance is not enough
, 請前往查詢賬戶單個幣種余額接口確認安全限額. - 不支持同一個uid之間的劃轉.
- 資金賬戶轉出目前僅支持加密貨幣轉賬,不支持法定貨幣劃轉.
HTTP 請求
POST /v5/asset/transfer/universal-transfer
請求參數
參數 | 是否必需 | 類型 | 說明 |
---|---|---|---|
transferId | true | string | UUID. 請求手動生成UUID |
coin | true | string | 幣種 |
amount | true | string | 劃轉金額 |
fromMemberId | true | integer | 轉出UID |
toMemberId | true | integer | 轉入UID |
fromAccountType | true | string | 轉出帳戶類型 |
toAccountType | true | string | 轉入帳戶類型 |
響應參數
參數 | 類型 | 說明 |
---|---|---|
transferId | string | UUID |
status | string | 劃轉狀態 STATUS_UNKNOWN SUCCESS PENDING FAILED |
請求示例
- HTTP
- Python
- Node.js
POST /v5/asset/transfer/universal-transfer HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-API-KEY: XXXXX
X-BAPI-TIMESTAMP: 1672189449697
X-BAPI-RECV-WINDOW: 5000
X-BAPI-SIGN: XXXXX
Content-Type: application/json
{
"transferId": "be7a2462-1138-4e27-80b1-62653f24925e",
"coin": "ETH",
"amount": "0.5",
"fromMemberId": 592334,
"toMemberId": 691355,
"fromAccountType": "CONTRACT",
"toAccountType": "UNIFIED"
}
from pybit.unified_trading import HTTP
session = HTTP(
testnet=True,
api_key="XXXXX",
api_secret="XXXXX",
)
print(session.create_universal_transfer(
transferId="be7a2462-1138-4e27-80b1-62653f24925e",
coin="ETH",
amount="0.5",
fromMemberId=592334,
toMemberId=691355,
fromAccountType="CONTRACT",
toAccountType="UNIFIED",
))
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
key: 'apikey',
secret: 'apisecret',
});
client
.createUniversalTransfer({
transferId: 'be7a2462-1138-4e27-80b1-62653f24925e',
coin: 'ETH',
amount: '0.5',
fromMemberId: 592334,
toMemberId: 691355,
fromAccountType: 'CONTRACT',
toAccountType: 'UNIFIED',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
響應示例
{
"retCode": 0,
"retMsg": "success",
"result": {
"transferId": "be7a2462-1138-4e27-80b1-62653f24925e",
"status": "SUCCESS"
},
"retExtInfo": {},
"time": 1672189450195
}