删除部分无用代码,添加当前订单查询功能

This commit is contained in:
2025-11-19 16:28:04 +08:00
parent 64bdddde79
commit 1618cad5a0
3 changed files with 16 additions and 174 deletions
+2 -5
View File
@@ -54,17 +54,14 @@ class QmtV(XtQuantTraderCallback):
def getStockPosition(self, stock_code: str):
volume = 0
print(f'获取股票持仓: {stock_code}, {self.xttrader.connected}, {self.account.account_id if self.account else None}') # pyright: ignore[reportAttributeAccessIssue]
positions = self.xttrader.query_stock_positions(self.account)
if positions:
for temp in positions:
pos:XtPosition = temp
if pos.stock_code == stock_code:
volume = pos.volume
break
return volume
return pos
return None
def queryPendingOrder(self, stock_code:str, tag: str) -> list[XtOrder]: