pythonCopy codeimport requestsimport hashlibimport hmacimport time
API_KEY = 'your_api_key'API_SECRET = 'your_api_secret'BASE_URL = '():
return int(time.time() * 1000)def sign_message(query_string):
return hmac.new(API_SECRET.encode('utf-8'), query_string.encode('utf-8'), hashlib.sha256).
hexdigest()def deposit_usdt(amount):
endpoint = '/sapi/v1/capital/deposit/hisrec'
url = BASE_URL + endpoint
params = {
'coin': 'USDT',
'status': 6,
'startTime': get_timestamp() - (24 * 60 * 60 * 1000),
'endTime': get_timestamp(),
'recvWindow': 5000,
'timestamp': get_timestamp()
}
query_string = '&'.join([f'{key}={params[key]}' for key in params])
signature = sign_message(query_string)
headers = {
'X-MBX-APIKEY': API_KEY
}
response = requests.get(url, headers=headers, params={**params, 'signature': signature})
print(response.json())def withdraw_usdt(amount):
endpoint = '/sapi/v1/capital/withdraw/apply'
url = BASE_URL + endpoint
params = {
'coin': 'USDT',
'withdrawOrderId': 'your_withdraw_order_id',
'network': 'OMNI',
'address': 'your_usdt_address',
'amount': amount,
'recvWindow': 5000,
'timestamp': get_timestamp()
}