def test_wallet(self): wallet_client = WalletClient(api_key=g_api_key, secret_key=g_secret_key, performance_test=True) # case get_account_deposit_address tc = TimeCost( function_name=wallet_client.get_account_deposit_address.__name__) result, tc.server_req_cost, tc.server_api_cost = wallet_client.get_account_deposit_address( currency="usdt") tc.run_status = RunStatus.SUCCESS if result and len( result) else RunStatus.FAILED tc.add_record() # case get_account_withdraw_quota tc = TimeCost( function_name=wallet_client.get_account_withdraw_quota.__name__) result, tc.server_req_cost, tc.server_api_cost = wallet_client.get_account_withdraw_quota( currency="usdt") tc.run_status = RunStatus.SUCCESS if result and len( result) else RunStatus.FAILED tc.add_record() # case get_sub_user_deposit_address tc = TimeCost( function_name=wallet_client.get_sub_user_deposit_address.__name__) result, tc.server_req_cost, tc.server_api_cost = wallet_client.get_sub_user_deposit_address( sub_uid=g_sub_uid, currency="btc") tc.run_status = RunStatus.SUCCESS if result and len( result) else RunStatus.FAILED tc.add_record() # case get_sub_user_deposit_history tc = TimeCost( function_name=wallet_client.get_sub_user_deposit_history.__name__) result, tc.server_req_cost, tc.server_api_cost = wallet_client.get_sub_user_deposit_history( sub_uid=g_sub_uid) tc.run_status = RunStatus.SUCCESS if result else RunStatus.FAILED tc.add_record() # case get_deposit_withdraw tc = TimeCost( function_name=wallet_client.get_deposit_withdraw.__name__) result, tc.server_req_cost, tc.server_api_cost = wallet_client.get_deposit_withdraw( op_type=DepositWithdraw.DEPOSIT, currency=None, from_id=1, size=10, direct=QueryDirection.PREV) tc.run_status = RunStatus.SUCCESS if result and len( result) else RunStatus.FAILED tc.add_record() # case post_create_withdraw tc = TimeCost( function_name=wallet_client.post_create_withdraw.__name__) record_id, tc.server_req_cost, tc.server_api_cost = wallet_client.post_create_withdraw( address=withdraw_address, amount=2, currency="usdt", fee=0, chain="trc20usdt", address_tag=None) tc.run_status = RunStatus.SUCCESS if record_id and record_id > 0 else RunStatus.FAILED tc.add_record() # case post_cancel_withdraw tc = TimeCost( function_name=wallet_client.post_cancel_withdraw.__name__) record_id, tc.server_req_cost, tc.server_api_cost = wallet_client.post_cancel_withdraw( withdraw_id=record_id) tc.run_status = RunStatus.SUCCESS if record_id and record_id > 0 else RunStatus.FAILED tc.add_record()
from huobi.client.wallet import WalletClient from huobi.constant import * from huobi.utils import * wallet_client = WalletClient(api_key=g_api_key, secret_key=g_secret_key) list_obj = wallet_client.get_account_deposit_address(currency="usdt") LogInfo.output_list(list_obj)
from huobi.client.wallet import WalletClient from huobi.constant import * from huobi.utils import * # case 1: TRX withdraw and cancel wallet_client = WalletClient(api_key=g_api_key, secret_key=g_secret_key) withdraw_id = wallet_client.post_create_withdraw(address="xxxxxx", amount=40, currency="trx", fee=1, chain=None, address_tag=None) LogInfo.output("Create Withdraw ID {id}".format(id=withdraw_id)) withdraw_id_ret = wallet_client.post_cancel_withdraw(withdraw_id=withdraw_id) LogInfo.output("Cancel Withdraw Id {id} {response_id}".format( id=withdraw_id, response_id=withdraw_id_ret)) # case 2: USDT withdraw and cancel wallet_client = WalletClient(api_key=g_api_key, secret_key=g_secret_key) withdraw_id = wallet_client.post_create_withdraw(address="xxxxxx", amount=2, currency="usdt", fee=0, chain="trc20usdt", address_tag=None) withdraw_id_ret = wallet_client.post_cancel_withdraw(withdraw_id=withdraw_id) LogInfo.output("Cancel Withdraw {withdraw_id}, {response_id}".format( withdraw_id=withdraw_id, response_id=withdraw_id_ret))
from huobi.client.wallet import WalletClient from huobi.constant import * from huobi.utils import * wallet_client = WalletClient(api_key=g_api_key, secret_key=g_secret_key) list_obj = wallet_client.get_deposit_withdraw(op_type=DepositWithdraw.DEPOSIT, currency=None, from_id=1, size=10, direct=QueryDirection.PREV) LogInfo.output_list(list_obj) list_obj = wallet_client.get_deposit_withdraw(op_type=DepositWithdraw.WITHDRAW, currency=None, from_id=1, size=10, direct=QueryDirection.NEXT) LogInfo.output_list(list_obj)
from huobi.client.wallet import WalletClient from huobi.constant import * from huobi.utils import * wallet_client = WalletClient(api_key=g_api_key, secret_key=g_secret_key) list_obj = wallet_client.get_account_withdraw_quota(currency="btc") LogInfo.output_list(list_obj) list_obj = wallet_client.get_account_withdraw_quota(currency="usdt") LogInfo.output_list(list_obj)
from huobi.client.wallet import WalletClient from huobi.constant import * from huobi.utils import LogInfo wallet_client = WalletClient(api_key=g_api_key, secret_key=g_secret_key) list_obj = wallet_client.get_sub_user_deposit_address(sub_uid=g_sub_uid, currency="btc") LogInfo.output_list(list_obj)
from huobi.client.wallet import WalletClient from huobi.constant import * wallet_client = WalletClient(api_key=g_api_key, secret_key=g_secret_key) deposit_history = wallet_client.get_sub_user_deposit_history(sub_uid=g_sub_uid) deposit_history.print_object()