示例#1
0
文件: huobipro.py 项目: macomfan/cei
 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()
示例#2
0
文件: huobipro.py 项目: macomfan/cei
 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()
示例#3
0
文件: test.py 项目: 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()
示例#4
0
文件: huobipro.py 项目: macomfan/cei
 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
示例#5
0
文件: huobipro.py 项目: macomfan/cei
 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
示例#6
0
文件: test.py 项目: 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
示例#7
0
文件: binance.py 项目: macomfan/cei
 def on_candlestick_event_trigger(msg):
     root_obj = JsonWrapper.parse_from_string(msg.get_string())
     json_checker = JsonChecker()
     json_checker.check_equal("e", "kline", root_obj)
     return json_checker.complete()
示例#8
0
文件: huobipro.py 项目: macomfan/cei
 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", "trade.clearing", root_obj)
     return json_checker.complete()
示例#9
0
文件: huobipro.py 项目: macomfan/cei
 def on_order_event_trigger(msg):
     root_obj = JsonWrapper.parse_from_string(msg.get_string())
     json_checker = JsonChecker()
     json_checker.check_equal("action", "push", root_obj)
     json_checker.value_include("ch", "order.", root_obj)
     return json_checker.complete()
示例#10
0
文件: huobipro.py 项目: macomfan/cei
 def on_ping_event_trigger(msg):
     root_obj = JsonWrapper.parse_from_string(msg.get_string())
     json_checker = JsonChecker()
     json_checker.check_equal("action", "ping", root_obj)
     return json_checker.complete()
示例#11
0
文件: test.py 项目: macomfan/cei
 def on_second1event_trigger(msg):
     root_obj = JsonWrapper.parse_from_string(msg.get_string())
     json_checker = JsonChecker()
     json_checker.check_equal("ch", "Second1", root_obj)
     return json_checker.complete()