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.account import AccountClient from huobi.client.generic import CandlestickInterval, GenericClient from huobi.client.market import LogInfo, MarketClient from huobi.client.trade import TradeClient generic_client = GenericClient() list_symbol = generic_client.get_exchange_symbols() list_currency = generic_client.get_reference_currencies() print(list_symbol[0]) print(list_currency[0].print_object()) a = c access_key = " " secret_key = " " # Create generic client instance and get the timestamp generic_client = GenericClient() timestamp = generic_client.get_exchange_timestamp() print(timestamp) # Create the market client instance and get the latest btcusdt‘s candlestick market_client = MarketClient() list_obj = market_client.get_candlestick("btcusdt", CandlestickInterval.MIN5, 10) LogInfo.output_list(list_obj) # // Create an AccountClient instance with APIKey account_client = AccountClient(api_key=access_key, secret_key=secret_key) # // Create a TradeClient instance with API Key and customized host trade_client = TradeClient(api_key=access_key,
from huobi.client.generic import GenericClient from huobi.utils import * generic_client = GenericClient() list_obj = generic_client.get_reference_currencies() LogInfo.output_list(list_obj) list_obj = generic_client.get_reference_currencies(currency="usdt") LogInfo.output_list(list_obj)