删除部分无用代码,添加当前订单查询功能
This commit is contained in:
+2
-5
@@ -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]:
|
||||
|
||||
Reference in New Issue
Block a user