提現
警告
- 確保您已經將提現地址加入到地址簿
- 僅支持母帳號的API key
API頻率: 1次/秒
HTTP 請求
POST /private/v1/asset/withdraw/create
請求參數
參數 | 是否必需 | 類型 | 說明 |
---|---|---|---|
coin | true | string | 幣種 |
chain | true | string | 鏈名 |
address | true | string | 錢包地址 |
tag | false | string | 標籤
|
amount | true | string | 提現金額 |
requestId | true | string | 自定義ID, 全局唯一, 用於冪等校驗 |
響應參數
參數 | 類型 | 說明 |
---|---|---|
withdraw_id | string | 提現Id |
請求示例
import time
import hmac
import hashlib
import uuid
import requests
import json
def create_transfer_request(apiKey, secret, body):
url = 'https://openapi-testnet.zoomex.com/private/v1/asset/withdraw/create'
timestamp = int(time.time() * 1000)
recv_window = 1000000
body['api_key'] = apiKey
body['timestamp'] = timestamp
body['recv_window'] = recv_window
ordered_params = '&'.join([f"{key}={body[key]}" for key in sorted(body.keys())])
signature = hmac.new(secret.encode('utf-8'), ordered_params.encode('utf-8'), hashlib.sha256).hexdigest()
body['sign'] = signature
headers = {
'X-BAPI-API-KEY': apiKey,
'X-BAPI-SIGN': signature,
'X-BAPI-TIMESTAMP': str(timestamp),
'X-BAPI-RECV-WINDOW': str(recv_window),
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers, data=json.dumps(body))
print("响应状态:", response.status_code)
print("响应信息:", response.json())
print("响应时间:", response.elapsed.total_seconds())
apiKey = 'your key'
secret = 'your secret'
transferId = uuid.uuid4().hex
body = {
"coin":"USDT",
"chain": "your chain",
"address": "your address",
"amount":"1",
"sub_user_id":"162119745",
"requestId":transferId,
}
create_transfer_request(apiKey, secret, body)
響應示例
{
"retCode": 0,
"retMsg": "success",
"result": {
"withdraw_id": "10195"
},
"retExtInfo": null,
"time": 1672196571239
}