| | |
| | | return |
| | | return self.__read_result(commands[2], timeout=10) |
| | | |
| | | def get_unfinish_orders(self, blocking=True): |
| | | """ |
| | | 获取委托列表 |
| | | :param blocking: |
| | | :return: |
| | | """ |
| | | commands = ("get_unfinish_orders", {}, self.__create_request_id("get_unfinish_orders")) |
| | | self.command_queue.put_nowait(commands) |
| | | if not blocking: |
| | | return |
| | | return self.__read_result(commands[2], timeout=10) |
| | | |
| | | def cancel_order(self, local_order_id, account_id, blocking=True): |
| | | """ |
| | | 撤单 |
| | | :param local_order_id: |
| | | :param account_id: |
| | | :param blocking: |
| | | :return: |
| | | """ |
| | | commands = ("cancel_order", {"local_order_id": local_order_id, "account_id": account_id}, |
| | | self.__create_request_id("cancel_order")) |
| | | self.command_queue.put_nowait(commands) |
| | | if not blocking: |
| | | return |
| | | return self.__read_result(commands[2], timeout=10) |
| | | |
| | | def get_symbol_names(self, symbols): |
| | | """ |
| | | 获取名称 |
| | | :param symbols: |
| | | :return: |
| | | """ |
| | | results = JueJinApi().get_gp_latest_info(symbols, "symbol,sec_name") |
| | | return {x["symbol"]: x["sec_name"] for x in results} |
| | | |
| | | def start_read_results(self): |
| | | while True: |
| | | try: |