def get_symbol(self): request = RestfulRequest(self.__option) request.set_target("/v1/common/symbols") request.set_method(RestfulRequest.Method.GET) response = RestfulConnection.query(request) root_obj = JsonWrapper.parse_from_string(response.get_string()) json_checker = JsonChecker() json_checker.check_not_equal("stauts", "ok", root_obj) json_checker.report_error() symbols_var = Symbols() symbols_var.status = root_obj.get_string("status") obj = root_obj.get_array("data") for item in obj.array(): symbols_data_var = SymbolsData() symbols_data_var.base_currency = item.get_string("base-currency") symbols_data_var.quote_currency = item.get_string("quote-currency") symbols_data_var.price_precision = item.get_int("price-precision") symbols_data_var.amount_precision = item.get_int( "amount-precision") symbols_data_var.symbol_partition = item.get_string( "symbol-partition") symbols_data_var.symbol = item.get_string("symbol") symbols_data_var.state = item.get_string("state") symbols_data_var.value_precision = item.get_int("value-precision") symbols_data_var.min_order_amt = item.get_decimal("min-order-amt") symbols_data_var.max_order_amt = item.get_decimal("max-order-amt") symbols_data_var.min_order_value = item.get_decimal( "min-order-value") symbols_data_var.leverage_ratio = item.get_int("leverage-ratio") if symbols_var.data is None: symbols_var.data = list() symbols_var.data.append(symbols_data_var) return symbols_var
def get_timestamp(self): request = RestfulRequest(self.__option) request.set_target("/v1/common/timestamp") request.set_method(RestfulRequest.Method.GET) response = RestfulConnection.query(request) root_obj = JsonWrapper.parse_from_string(response.get_string()) json_checker = JsonChecker() json_checker.check_not_equal("stauts", "ok", root_obj) json_checker.report_error() timestamp_var = Timestamp() timestamp_var.timestamp = root_obj.get_int("data") return timestamp_var
def get_model_info(self): request = RestfulRequest(self.__option) request.set_target("/restful/get/modelInfo") request.set_method(RestfulRequest.Method.GET) response = RestfulConnection.query(request) root_obj = JsonWrapper.parse_from_string(response.get_string()) json_checker = JsonChecker() json_checker.check_equal("aaa", "aa", root_obj) json_checker.report_error() model_info_var = ModelInfo() model_info_var.name = root_obj.get_string("Name") obj = root_obj.get_object("DataL1") obj0 = obj.get_object("DataL2") model_value_var = ModelValue() obj1 = obj0.get_object("Value") model_value_var.name = obj1.get_string("Name") model_value_var.value = obj1.get_int("Value") model_info_var.value = model_value_var return model_info_var