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