Exemplo n.º 1
0
    def test_generic(self):
        generic_client = GenericClient(api_key=g_api_key,
                                       secret_key=g_secret_key,
                                       performance_test=True)
        # case get_exchange_symbol_list
        tc = TimeCost(
            function_name=generic_client.get_exchange_timestamp.__name__)
        result, tc.server_req_cost, tc.server_api_cost = generic_client.get_exchange_timestamp(
        )
        tc.run_status = RunStatus.SUCCESS if result and result > 0 else RunStatus.FAILED
        tc.add_record()

        # case get_exchange_currencies
        tc = TimeCost(
            function_name=generic_client.get_exchange_currencies.__name__)
        result, tc.server_req_cost, tc.server_api_cost = generic_client.get_exchange_currencies(
        )
        tc.run_status = RunStatus.SUCCESS if result and len(
            result) else RunStatus.FAILED
        tc.add_record()

        # case get_exchange_symbols
        tc = TimeCost(
            function_name=generic_client.get_exchange_symbols.__name__)
        result, tc.server_req_cost, tc.server_api_cost = generic_client.get_exchange_symbols(
        )
        tc.run_status = RunStatus.SUCCESS if result and len(
            result) else RunStatus.FAILED
        tc.add_record()

        # case get_reference_currencies
        tc = TimeCost(
            function_name=generic_client.get_reference_currencies.__name__)
        result, tc.server_req_cost, tc.server_api_cost = generic_client.get_reference_currencies(
        )
        tc.run_status = RunStatus.SUCCESS if result and len(
            result) else RunStatus.FAILED
        tc.add_record()

        # case get_system_status
        tc = TimeCost(function_name=generic_client.get_system_status.__name__)
        result, tc.server_req_cost, tc.server_api_cost = generic_client.get_system_status(
        )
        tc.run_status = RunStatus.SUCCESS if result and result.get(
            "page") and result.get("components") else RunStatus.FAILED
        tc.add_record()
Exemplo n.º 2
0
from huobi.client.generic import GenericClient
from huobi.utils import *

generic_client = GenericClient()
list_obj = generic_client.get_exchange_currencies()
LogInfo.output("---- Supported currency ----")
for currency in list_obj:
    LogInfo.output(currency)