劃轉 (單帳號內)
創建單帳號下帳戶類型間的劃轉操作
提示
- 每個帳戶類型有其可接受的幣種限制, 詳情請參考可劃轉幣種接口.
HTTP 請求
POST /v5/asset/transfer/inter-transfer
請求參數
參數 | 是否必需 | 類型 | 說明 |
---|---|---|---|
transferId | true | string | UUID. 請自行手動生成UUID |
coin | true | string | 幣種 |
amount | true | string | 劃入數量 |
fromAccountType | true | string | 轉出賬戶類型 |
toAccountType | true | string | 轉入賬戶類型 |
響應參數
參數 | 類型 | 說明 |
---|---|---|
transferId | string | UUID |
status | string | 劃轉狀態 STATUS_UNKNOWN SUCCESS PENDING FAILED |
請求示例
- HTTP
- Python
- Node.js
POST v5/asset/transfer/inter-transfer HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-API-KEY: XXXXX
X-BAPI-TIMESTAMP: 1670986690556
X-BAPI-RECV-WINDOW: 50000
X-BAPI-SIGN: XXXXX
Content-Type: application/json
{
"transferId": "42c0cfb0-6bca-c242-bc76-4e6df6cbcb16",
"coin": "BTC",
"amount": "0.05",
"fromAccountType": "UNIFIED",
"toAccountType": "CONTRACT"
}
from pybit.unified_trading import HTTP
session = HTTP(
testnet=True,
api_key="XXXXX",
api_secret="XXXXX",
)
print(session.create_internal_transfer(
transferId="42c0cfb0-6bca-c242-bc76-4e6df6cbcb16",
coin="BTC",
amount="0.05",
fromAccountType="UNIFIED",
toAccountType="CONTRACT",
))
const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
key: 'apikey',
secret: 'apisecret',
});
client
.createInternalTransfer(
'42c0cfb0-6bca-c242-bc76-4e6df6cbcb16',
'BTC',
'0.05',
'UNIFIED',
'CONTRACT',
)
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
響應示例
{
"retCode": 0,
"retMsg": "success",
"result": {
"transferId": "42c0cfb0-6bca-c242-bc76-4e6df6cbab16",
"status": "SUCCESS"
},
"retExtInfo": {},
"time": 1670986962783
}