| | |
| | | result = cls.__create_and_run_client(CLIENT_TYPE_TRADE_SELL, i) |
| | | cls.trade_client_dict[result[0]] = result[1] |
| | | |
| | | # @classmethod |
| | | # def process_command(cls, client_id, result_json): |
| | | # data = result_json["data"] |
| | | # content_type = data["type"] |
| | | # printlog("接收内容", data) |
| | | # request_id = result_json.get('request_id') |
| | | # if not socket_util.is_client_params_sign_right(result_json): |
| | | # printlog("签名错误") |
| | | # # 签名出错 |
| | | # SendResponseSkManager.send_error_response(_type, request_id, client_id, |
| | | # {"code": -1, "msg": "签名错误"}) |
| | | # return |
| | | # if content_type == API_TYPE_TRADE: |
| | | # # 交易 |
| | | # cls.action_callback.OnTrade(client_id, request_id, data) |
| | | # elif content_type == API_TYPE_SELL_RULE: |
| | | # cls.action_callback.OnSellRule(client_id, request_id, data) |
| | | # elif content_type == API_TYPE_REFRESH_TRADE_DATA: |
| | | # cls.action_callback.OnRefreshTradeData(client_id, request_id, data) |
| | | # elif content_type == API_TYPE_GET_CODE_POSITION_INFO: |
| | | # cls.action_callback.OnGetCodePositionInfo(client_id, request_id, data) |
| | | # elif content_type == API_TYPE_COMMON_REQUEST: |
| | | # cls.action_callback.OnCommonRequest(client_id, request_id, data) |
| | | |
| | | # 听取指令 |
| | | @classmethod |
| | | def __listen_command(cls, _type, client_id, sk): |