From e0b77a03d87eb9bafd08e35492f918b5b8b0fbb5 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 28 六月 2024 15:34:18 +0800 Subject: [PATCH] '持仓矫正' --- local_api/__init__.py | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/local_api/__init__.py b/local_api/__init__.py index 764c378..cf7f236 100644 --- a/local_api/__init__.py +++ b/local_api/__init__.py @@ -127,6 +127,13 @@ return return self.__read_result(commands[2], timeout=10) + def position_by_symbol(self, symbol, blocking=True): + commands = ("get_position_by_symbol", {"symbol": symbol}, self.__create_request_id("get_position_by_symbol")) + self.command_queue.put_nowait(commands) + if not blocking: + return + return self.__read_result(commands[2], timeout=10) + def get_unfinish_orders(self, blocking=True): """ 鑾峰彇濮旀墭鍒楄〃 @@ -163,6 +170,14 @@ results = JueJinApi().get_gp_latest_info(symbols, "symbol,sec_name") return {x["symbol"]: x["sec_name"] for x in results} + def get_execution_reports(self, blocking=True): + commands = ("get_execution_reports", {}, + 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 start_read_results(self): while True: try: -- Gitblit v1.8.0