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()
from huobi.client.generic import GenericClient
"""
GET https://status.huobigroup.com/api/v2/summary.json
"""
generic_client = GenericClient()
system_status = generic_client.get_system_status()
print(system_status)