Example #1
0
 def get_market_depth(self, symbol, depth, merge_type):
     request = RestfulRequest(self.__option)
     request.set_target("/market/depth")
     request.set_method(RestfulRequest.Method.GET)
     request.add_query_string("symbol", symbol)
     request.add_query_string("depth", str(depth))
     request.add_query_string("type", merge_type)
     response = RestfulConnection.query(request)
     root_obj = JsonWrapper.parse_from_string(response.get_string())
     depth_var = Depth()
     depth_var.status = root_obj.get_string("status")
     depth_var.ts = root_obj.get_int("ts")
     depth_var.ch = root_obj.get_string("ch")
     obj = root_obj.get_object("tick")
     obj0 = obj.get_array("bids")
     for item in obj0.array():
         quote_var = Quote()
         quote_var.price = item.get_decimal("[0]")
         quote_var.amount = item.get_decimal("[1]")
         if depth_var.bids is None:
             depth_var.bids = list()
         depth_var.bids.append(quote_var)
     obj1 = obj.get_array("asks")
     for item2 in obj1.array():
         quote_var3 = Quote()
         quote_var3.price = item2.get_decimal("[0]")
         quote_var3.amount = item2.get_decimal("[1]")
         if depth_var.asks is None:
             depth_var.asks = list()
         depth_var.asks.append(quote_var3)
     return depth_var
Example #2
0
 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
Example #3
0
 def get_last_trade(self, symbol):
     request = RestfulRequest(self.__option)
     request.set_target("/market/trade")
     request.set_method(RestfulRequest.Method.GET)
     request.add_query_string("symbol", symbol)
     response = RestfulConnection.query(request)
     root_obj = JsonWrapper.parse_from_string(response.get_string())
     last_trade_var = LastTrade()
     last_trade_var.status = root_obj.get_string("status")
     last_trade_var.ts = root_obj.get_int("ts")
     last_trade_var.ch = root_obj.get_string("ch")
     obj = root_obj.get_object("tick")
     last_trade_var.ts_in_tick = obj.get_int("ts")
     last_trade_var.id_in_tick = obj.get_int("id")
     obj0 = obj.get_array("data")
     for item in obj0.array():
         trade_var = Trade()
         trade_var.amount = item.get_decimal("amount")
         trade_var.price = item.get_decimal("price")
         trade_var.ts = item.get_int("ts")
         trade_var.id = item.get_int("id")
         trade_var.direction = item.get_string("direction")
         trade_var.trade_id = item.get_int("trade-id")
         if last_trade_var.data is None:
             last_trade_var.data = list()
         last_trade_var.data.append(trade_var)
     return last_trade_var
Example #4
0
File: test.py Project: macomfan/cei
 def on_echo_event_trigger(msg):
     root_obj = JsonWrapper.parse_from_string(msg.get_string())
     json_checker = JsonChecker()
     json_checker.check_equal("op", "echo", root_obj)
     obj = root_obj.get_object_or_none("param")
     json_checker.check_equal("Name", name, obj)
     return json_checker.complete()
Example #5
0
 def get_candlestick(self, symbol, period, size):
     request = RestfulRequest(self.__option)
     request.set_target("/market/history/kline")
     request.set_method(RestfulRequest.Method.GET)
     request.add_query_string("symbol", symbol)
     request.add_query_string("period", period)
     request.add_query_string("size", str(size))
     response = RestfulConnection.query(request)
     root_obj = JsonWrapper.parse_from_string(response.get_string())
     candlestick_var = Candlestick()
     candlestick_var.status = root_obj.get_string("status")
     obj = root_obj.get_array("data")
     for item in obj.array():
         candlestick_data_var = CandlestickData()
         candlestick_data_var.id = item.get_int("id")
         candlestick_data_var.amount = item.get_decimal("amount")
         candlestick_data_var.count = item.get_int("count")
         candlestick_data_var.open = item.get_decimal("open")
         candlestick_data_var.close = item.get_decimal("close")
         candlestick_data_var.low = item.get_decimal("low")
         candlestick_data_var.high = item.get_decimal("high")
         candlestick_data_var.vol = item.get_decimal("vol")
         if candlestick_var.data is None:
             candlestick_var.data = list()
         candlestick_var.data.append(candlestick_data_var)
     return candlestick_var
Example #6
0
 def on_ping_event_event(connection, msg):
     root_obj = JsonWrapper.parse_from_string(msg.get_string())
     ts = Timestamp()
     obj = root_obj.get_object("data")
     ts.timestamp = obj.get_int("ts")
     json_result = JsonWrapper()
     json_result.add_json_string("op", "pong")
     json_result.add_json_number("ts", ts.timestamp)
     connection.send(json_result.to_json_string())
Example #7
0
 def on_depth_event_trigger(msg):
     root_obj = JsonWrapper.parse_from_string(msg.get_string())
     json_checker = JsonChecker()
     json_checker.check_equal(
         "ch",
         CEIUtils.string_replace("market.{0}.depth.{1}", symbol,
                                 type_u), root_obj)
     return json_checker.complete()
Example #8
0
File: test.py Project: macomfan/cei
 def on_second1event_event(connection, msg):
     root_obj = JsonWrapper.parse_from_string(msg.get_string())
     simple_info_var = SimpleInfo()
     simple_info_var.name = root_obj.get_string("Name")
     simple_info_var.number = root_obj.get_int("Number")
     simple_info_var.price = root_obj.get_decimal("Price")
     simple_info_var.status = root_obj.get_bool("Status")
     on_second1(simple_info_var)
Example #9
0
 def on_candlestick_event_trigger(msg):
     root_obj = JsonWrapper.parse_from_string(msg.get_string())
     json_checker = JsonChecker()
     json_checker.check_equal(
         "rep",
         CEIUtils.string_replace("market.{0}.kline.{1}", symbol,
                                 period), root_obj)
     return json_checker.complete()
Example #10
0
    def subscript_order(self, symbol, on_sub):
        on_sub_event = WebSocketEvent(False)

        def on_sub_event_trigger(msg):
            root_obj = JsonWrapper.parse_from_string(msg.get_string())
            json_checker = JsonChecker()
            json_checker.check_equal("action", "sub", root_obj)
            json_checker.value_include("ch", "orders", root_obj)
            return json_checker.complete()

        on_sub_event.set_trigger(on_sub_event_trigger)

        def on_sub_event_event(connection, msg):
            root_obj = JsonWrapper.parse_from_string(msg.get_string())
            code_var = Code()
            code_var.code = root_obj.get_int("code")
            on_sub(code_var)

        on_sub_event.set_event(on_sub_event_event)
        self.__connection.register_event(on_sub_event)
        json = JsonWrapper()
        json.add_json_string("action", "sub")
        json.add_json_string("ch",
                             CEIUtils.string_replace("orders#{0}", symbol))
        self.__connection.send(json.to_json_string())
Example #11
0
 def get_timestamp(self):
     request = RestfulRequest(self.__option)
     request.set_target("/api/v3/time")
     request.set_method(RestfulRequest.Method.GET)
     response = RestfulConnection.query(request)
     root_obj = JsonWrapper.parse_from_string(response.get_string())
     timestamp_var = Timestamp()
     timestamp_var.server_time = root_obj.get_int("serverTime")
     return timestamp_var
Example #12
0
 def get_currencies(self):
     request = RestfulRequest(self.__option)
     request.set_target("/v1/common/currencys")
     request.set_method(RestfulRequest.Method.GET)
     response = RestfulConnection.query(request)
     root_obj = JsonWrapper.parse_from_string(response.get_string())
     currencies_var = Currencies()
     currencies_var.status = root_obj.get_string("status")
     currencies_var.data = root_obj.get_string_array("data")
     return currencies_var
Example #13
0
 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
Example #14
0
File: test.py Project: macomfan/cei
 def get_simple_info(self):
     request = RestfulRequest(self.__option)
     request.set_target("/restful/get/simpleInfo")
     request.set_method(RestfulRequest.Method.GET)
     response = RestfulConnection.query(request)
     root_obj = JsonWrapper.parse_from_string(response.get_string())
     simple_info_var = SimpleInfo()
     simple_info_var.name = root_obj.get_string("Name")
     simple_info_var.number = root_obj.get_int("Number")
     simple_info_var.price = root_obj.get_decimal("Price")
     simple_info_var.status = root_obj.get_bool("Status")
     return simple_info_var
Example #15
0
 def cancel_order(self, order_id):
     request = RestfulRequest(self.__option)
     request.set_target(
         CEIUtils.string_replace("/v1/order/orders/{0}/submitcancel",
                                 str(order_id)))
     request.set_method(RestfulRequest.Method.POST)
     Procedures.restful_auth(request, self.__option)
     response = RestfulConnection.query(request)
     root_obj = JsonWrapper.parse_from_string(response.get_string())
     order_idvar = OrderID()
     order_idvar.status = root_obj.get_string("status")
     order_idvar.data = root_obj.get_int("data")
     return order_idvar
Example #16
0
 def on_candlestick_event_event(connection, msg):
     root_obj = JsonWrapper.parse_from_string(msg.get_string())
     candlestick_data_var = CandlestickData()
     obj = root_obj.get_object("tick")
     candlestick_data_var.id = obj.get_int("id")
     candlestick_data_var.amount = obj.get_decimal("amount")
     candlestick_data_var.count = obj.get_int("count")
     candlestick_data_var.open = obj.get_decimal("open")
     candlestick_data_var.close = obj.get_decimal("close")
     candlestick_data_var.low = obj.get_decimal("low")
     candlestick_data_var.high = obj.get_decimal("high")
     candlestick_data_var.vol = obj.get_decimal("vol")
     on_candlestick(candlestick_data_var)
Example #17
0
File: test.py Project: macomfan/cei
 def inputs_by_get(self, name, number, price, status):
     request = RestfulRequest(self.__option)
     request.set_target("/restful/get/inputsByGet")
     request.set_method(RestfulRequest.Method.GET)
     request.add_query_string("Name", name)
     request.add_query_string("Number", str(number))
     request.add_query_string("Price", str(price))
     request.add_query_string("Status", str(status))
     response = RestfulConnection.query(request)
     root_obj = JsonWrapper.parse_from_string(response.get_string())
     simple_info_var = SimpleInfo()
     simple_info_var.name = root_obj.get_string("Name")
     simple_info_var.number = root_obj.get_int("Number")
     simple_info_var.price = root_obj.get_decimal("Price")
     simple_info_var.status = root_obj.get_bool("Status")
     return simple_info_var
Example #18
0
 def get_accounts(self):
     request = RestfulRequest(self.__option)
     request.set_target("/v1/account/accounts")
     request.set_method(RestfulRequest.Method.GET)
     Procedures.restful_auth(request, self.__option)
     response = RestfulConnection.query(request)
     root_obj = JsonWrapper.parse_from_string(response.get_string())
     account_var = Account()
     account_var.status = root_obj.get_string("status")
     account_data_var = AccountData()
     obj = root_obj.get_object("data")
     account_data_var.id = obj.get_int("id")
     account_data_var.state = obj.get_string("state")
     account_data_var.type = obj.get_string("type")
     account_data_var.subtype = obj.get_string("subtype")
     return account_var
Example #19
0
File: test.py Project: macomfan/cei
 def get_info_list(self):
     request = RestfulRequest(self.__option)
     request.set_target("/restful/get/infoList")
     request.set_method(RestfulRequest.Method.GET)
     response = RestfulConnection.query(request)
     root_obj = JsonWrapper.parse_from_string(response.get_string())
     info_list_var = InfoList()
     info_list_var.name = root_obj.get_string("Name")
     obj = root_obj.get_array("Values")
     for item in obj.array():
         info_entity_var = InfoEntity()
         info_entity_var.name = item.get_string("Name")
         info_entity_var.info_value = item.get_string("InfoValue")
         if info_list_var.values is None:
             info_list_var.values = list()
         info_list_var.values.append(info_entity_var)
     return info_list_var
Example #20
0
File: test.py Project: macomfan/cei
 def get_price_list(self):
     request = RestfulRequest(self.__option)
     request.set_target("/restful/get/priceList")
     request.set_method(RestfulRequest.Method.GET)
     response = RestfulConnection.query(request)
     root_obj = JsonWrapper.parse_from_string(response.get_string())
     price_list_var = PriceList()
     price_list_var.name = root_obj.get_string("Name")
     obj = root_obj.get_array("Prices")
     for item in obj.array():
         price_entity_var = PriceEntity()
         price_entity_var.price = item.get_decimal("[0]")
         price_entity_var.volume = item.get_decimal("[1]")
         if price_list_var.prices is None:
             price_list_var.prices = list()
         price_list_var.prices.append(price_entity_var)
     return price_list_var
Example #21
0
 def on_candlestick_event_event(connection, msg):
     root_obj = JsonWrapper.parse_from_string(msg.get_string())
     candlestick_var = Candlestick()
     obj = root_obj.get_array("data")
     for item in obj.array():
         candlestick_data_var = CandlestickData()
         candlestick_data_var.id = item.get_int("id")
         candlestick_data_var.amount = item.get_decimal("amount")
         candlestick_data_var.count = item.get_int("count")
         candlestick_data_var.open = item.get_decimal("open")
         candlestick_data_var.close = item.get_decimal("close")
         candlestick_data_var.low = item.get_decimal("low")
         candlestick_data_var.high = item.get_decimal("high")
         candlestick_data_var.vol = item.get_decimal("vol")
         if candlestick_var.data is None:
             candlestick_var.data = list()
         candlestick_var.data.append(candlestick_data_var)
     on_candlestick(candlestick_var)
Example #22
0
    def request_depth(self, symbol, type_u, on_depth):
        on_depth_event = WebSocketEvent(True)

        def on_depth_event_trigger(msg):
            root_obj = JsonWrapper.parse_from_string(msg.get_string())
            json_checker = JsonChecker()
            json_checker.check_equal(
                "ch",
                CEIUtils.string_replace("market.{0}.depth.{1}", symbol,
                                        type_u), root_obj)
            return json_checker.complete()

        on_depth_event.set_trigger(on_depth_event_trigger)

        def on_depth_event_event(connection, msg):
            root_obj = JsonWrapper.parse_from_string(msg.get_string())
            depth_var = Depth()
            depth_var.ch = root_obj.get_string("ch")
            obj = root_obj.get_object("tick")
            obj0 = obj.get_array("bids")
            for item in obj0.array():
                quote_var = Quote()
                quote_var.price = item.get_decimal("[0]")
                quote_var.amount = item.get_decimal("[1]")
                if depth_var.bids is None:
                    depth_var.bids = list()
                depth_var.bids.append(quote_var)
            obj1 = obj.get_array("asks")
            for item2 in obj1.array():
                quote_var3 = Quote()
                quote_var3.price = item2.get_decimal("[0]")
                quote_var3.amount = item2.get_decimal("[1]")
                if depth_var.asks is None:
                    depth_var.asks = list()
                depth_var.asks.append(quote_var3)
            on_depth(depth_var)

        on_depth_event.set_event(on_depth_event_event)
        self.__connection.register_event(on_depth_event)
        ts = CEIUtils.get_now("Unix_ms")
        json = JsonWrapper()
        json.add_json_string(
            "sub",
            CEIUtils.string_replace("market.{0}.depth.{1}", symbol, type_u))
        json.add_json_string("id", ts)
        self.__connection.send(json.to_json_string())
Example #23
0
File: test.py Project: macomfan/cei
 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
Example #24
0
 def get_candlestick_data(self, symbol, interval, start_time, end_time,
                          limit):
     request = RestfulRequest(self.__option)
     request.set_target("/api/v3/klines")
     request.set_method(RestfulRequest.Method.GET)
     request.add_query_string("symbol", symbol)
     request.add_query_string("interval", interval)
     request.add_query_string("startTime", str(start_time))
     request.add_query_string("endTime", str(end_time))
     request.add_query_string("limit", str(limit))
     response = RestfulConnection.query(request)
     root_obj = JsonWrapper.parse_from_string(response.get_string())
     candlestick_data_list_var = CandlestickDataList()
     for item in root_obj.array():
         candlestick_data_var = CandlestickData()
         candlestick_data_var.open = item.get_decimal("\\[0]")
         candlestick_data_var.high = item.get_decimal("\\[1]")
         if candlestick_data_list_var.data is None:
             candlestick_data_list_var.data = list()
         candlestick_data_list_var.data.append(candlestick_data_var)
     return candlestick_data_list_var
Example #25
0
File: test.py Project: macomfan/cei
 def authentication(self, name, number):
     request = RestfulRequest(self.__option)
     post_msg = JsonWrapper()
     post_msg.add_json_number("Number", number)
     request.set_target("/restful/post/authentication")
     request.set_method(RestfulRequest.Method.POST)
     request.add_query_string("Name", name)
     request.set_post_body(post_msg.to_json_string())
     Procedures.restful_auth(request, self.__option)
     response = RestfulConnection.query(request)
     root_obj = JsonWrapper.parse_from_string(response.get_string())
     simple_info_var = SimpleInfo()
     simple_info_var.name = root_obj.get_string("Name")
     simple_info_var.number = root_obj.get_int("Number")
     simple_info_var.price = root_obj.get_decimal("Price")
     return simple_info_var
Example #26
0
    def request_candlestick(self, symbol, period, on_candlestick):
        on_candlestick_event = WebSocketEvent(False)

        def on_candlestick_event_trigger(msg):
            root_obj = JsonWrapper.parse_from_string(msg.get_string())
            json_checker = JsonChecker()
            json_checker.check_equal(
                "rep",
                CEIUtils.string_replace("market.{0}.kline.{1}", symbol,
                                        period), root_obj)
            return json_checker.complete()

        on_candlestick_event.set_trigger(on_candlestick_event_trigger)

        def on_candlestick_event_event(connection, msg):
            root_obj = JsonWrapper.parse_from_string(msg.get_string())
            candlestick_var = Candlestick()
            obj = root_obj.get_array("data")
            for item in obj.array():
                candlestick_data_var = CandlestickData()
                candlestick_data_var.id = item.get_int("id")
                candlestick_data_var.amount = item.get_decimal("amount")
                candlestick_data_var.count = item.get_int("count")
                candlestick_data_var.open = item.get_decimal("open")
                candlestick_data_var.close = item.get_decimal("close")
                candlestick_data_var.low = item.get_decimal("low")
                candlestick_data_var.high = item.get_decimal("high")
                candlestick_data_var.vol = item.get_decimal("vol")
                if candlestick_var.data is None:
                    candlestick_var.data = list()
                candlestick_var.data.append(candlestick_data_var)
            on_candlestick(candlestick_var)

        on_candlestick_event.set_event(on_candlestick_event_event)
        self.__connection.register_event(on_candlestick_event)
        ts = CEIUtils.get_now("Unix_ms")
        json = JsonWrapper()
        json.add_json_string(
            "req",
            CEIUtils.string_replace("market.{0}.kline.{1}", symbol, period))
        json.add_json_string("id", ts)
        self.__connection.send(json.to_json_string())
Example #27
0
 def get_trade(self, symbol, limit):
     request = RestfulRequest(self.__option)
     request.set_target("/api/v3/trades")
     request.set_method(RestfulRequest.Method.GET)
     request.add_query_string("symbol", symbol)
     request.add_query_string("limit", str(limit))
     response = RestfulConnection.query(request)
     root_obj = JsonWrapper.parse_from_string(response.get_string())
     trade_list_var = TradeList()
     for item in root_obj.array():
         trade_var = Trade()
         trade_var.id = item.get_int("id")
         trade_var.price = item.get_decimal("price")
         trade_var.qty = item.get_decimal("qty")
         trade_var.quote_qty = item.get_decimal("quoteQty")
         trade_var.time = item.get_int("time")
         trade_var.is_buyer_maker = item.get_bool("isBuyerMaker")
         trade_var.is_best_match = item.get_bool("isBestMatch")
         if trade_list_var.data is None:
             trade_list_var.data = list()
         trade_list_var.data.append(trade_var)
     return trade_list_var
Example #28
0
 def on_depth_event_event(connection, msg):
     root_obj = JsonWrapper.parse_from_string(msg.get_string())
     depth_var = Depth()
     depth_var.ch = root_obj.get_string("ch")
     obj = root_obj.get_object("tick")
     obj0 = obj.get_array("bids")
     for item in obj0.array():
         quote_var = Quote()
         quote_var.price = item.get_decimal("[0]")
         quote_var.amount = item.get_decimal("[1]")
         if depth_var.bids is None:
             depth_var.bids = list()
         depth_var.bids.append(quote_var)
     obj1 = obj.get_array("asks")
     for item2 in obj1.array():
         quote_var3 = Quote()
         quote_var3.price = item2.get_decimal("[0]")
         quote_var3.amount = item2.get_decimal("[1]")
         if depth_var.asks is None:
             depth_var.asks = list()
         depth_var.asks.append(quote_var3)
     on_depth(depth_var)
Example #29
0
 def get_best_quote(self, symbol):
     request = RestfulRequest(self.__option)
     request.set_target("/market/depth")
     request.set_method(RestfulRequest.Method.GET)
     request.add_query_string("symbol", symbol)
     request.add_query_string("depth", "5")
     request.add_query_string("type", "step0")
     response = RestfulConnection.query(request)
     root_obj = JsonWrapper.parse_from_string(response.get_string())
     best_quote_var = BestQuote()
     best_quote_var.status = root_obj.get_string("status")
     best_quote_var.ts = root_obj.get_int("ts")
     obj = root_obj.get_object("tick")
     obj0 = obj.get_object("bids")
     obj1 = obj0.get_object("[0]")
     best_quote_var.best_bid_price = obj1.get_decimal("[0]")
     best_quote_var.best_bid_amount = obj1.get_decimal("[1]")
     obj2 = obj.get_object("asks")
     obj3 = obj2.get_object("[0]")
     best_quote_var.best_ask_price = obj3.get_decimal("[0]")
     best_quote_var.best_ask_amount = obj3.get_decimal("[1]")
     best_quote_var.ch = root_obj.get_string("ch")
     return best_quote_var
Example #30
0
 def get_exchange_info(self):
     request = RestfulRequest(self.__option)
     request.set_target("/api/v3/exchangeInfo")
     request.set_method(RestfulRequest.Method.GET)
     response = RestfulConnection.query(request)
     root_obj = JsonWrapper.parse_from_string(response.get_string())
     exchange_info_var = ExchangeInfo()
     exchange_info_var.timezone = root_obj.get_string("timezone")
     exchange_info_var.server_time = root_obj.get_int("serverTime")
     obj = root_obj.get_array("rateLimits")
     for item in obj.array():
         rate_limits_var = RateLimits()
         rate_limits_var.rate_limit_type = item.get_string("rateLimitType")
         rate_limits_var.interval = item.get_string("interval")
         rate_limits_var.interval_num = item.get_int("intervalNum")
         rate_limits_var.limit = item.get_int("limit")
         if exchange_info_var.rate_limits is None:
             exchange_info_var.rate_limits = list()
         exchange_info_var.rate_limits.append(rate_limits_var)
     obj0 = root_obj.get_array("symbols")
     for item1 in obj0.array():
         symbol_var = Symbol()
         symbol_var.symbol = item1.get_string("symbol")
         symbol_var.status = item1.get_string("status")
         symbol_var.base_asset = item1.get_string("baseAsset")
         symbol_var.base_asset_precision = item1.get_int(
             "baseAssetPrecision")
         symbol_var.quote_asset = item1.get_string("quoteAsset")
         symbol_var.quote_precision = item1.get_int("quotePrecision")
         symbol_var.order_types = item1.get_string_array("orderTypes")
         symbol_var.iceberg_allowed = item1.get_bool("icebergAllowed")
         symbol_var.oco_allowed = item1.get_bool("ocoAllowed")
         if exchange_info_var.symbols is None:
             exchange_info_var.symbols = list()
         exchange_info_var.symbols.append(symbol_var)
     return exchange_info_var