Exemple #1
0
    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_withdraw_quota(currency="btc")
LogInfo.output_list(list_obj)

list_obj = wallet_client.get_account_withdraw_quota(currency="usdt")
LogInfo.output_list(list_obj)