예제 #1
0
파일: test.py 프로젝트: 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
예제 #2
0
파일: huobipro.py 프로젝트: macomfan/cei
 def place_order(self, account_id, symbol, order_type, amount, price):
     request = RestfulRequest(self.__option)
     post_msg = JsonWrapper()
     post_msg.add_json_string("account-Id", account_id)
     post_msg.add_json_string("symbol", symbol)
     post_msg.add_json_string("orderType", order_type)
     post_msg.add_json_string("amount", amount)
     post_msg.add_json_string("price", price)
     request.set_target("/v1/order/orders/place")
     request.set_method(RestfulRequest.Method.POST)
     request.set_post_body(post_msg.to_json_string())
     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
예제 #3
0
파일: test.py 프로젝트: macomfan/cei
 def post_inputs(self, this, price, number, status):
     request = RestfulRequest(self.__option)
     post_msg = JsonWrapper()
     post_msg.add_json_string("Name", this)
     post_msg.add_json_number("Price", price)
     post_msg.add_json_number("Number", number)
     post_msg.add_json_boolean("Status_1", status)
     request.set_target("/restful/post/echo")
     request.set_method(RestfulRequest.Method.POST)
     request.set_post_body(post_msg.to_json_string())
     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_1")
     return simple_info_var