完善部分逻辑

This commit is contained in:
2025-11-24 16:30:53 +08:00
parent e5b1d80139
commit 3ee47e95cf
2 changed files with 39 additions and 16 deletions
+5 -3
View File
@@ -54,7 +54,6 @@ class QmtV(XtQuantTraderCallback):
def getStockPosition(self, stock_code: str):
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:
@@ -94,7 +93,10 @@ class QmtV(XtQuantTraderCallback):
return self.cacheStockDetail(stock_code)['InstrumentName']
def dailyUpStop(self, stock_code:str):
return self.cacheStockDetail(stock_code)['UpStopPrice']
cacheStock = self.cacheStockDetail(stock_code)
PrintLog(LogLevel.INFO, f'- [成功]获取股票详情: {stock_code} {cacheStock["InstrumentName"]} {cacheStock['UpStopPrice']}')
return cacheStock['UpStopPrice']
def dailyDownStop(self, stock_code:str):
return self.cacheStockDetail(stock_code)['DownStopPrice']
@@ -135,7 +137,7 @@ class QmtV(XtQuantTraderCallback):
if tmpMarketStatus and self.isMarketActive:
if tmpTime - self.lastMarketDataUpdateTimestamp > 10: # 上次更新市场状态已经超过10秒
self.isMarketActive = False
PrintLog(LogLevel.INFO, f'- [市场状态变更] 市场已 inactive') # 市场已 inactive
PrintLog(LogLevel.INFO, f'- [市场状态] {self.isMarketActive}') # 市场已 inactive
# ====== 市场回调方法 -- 以下方法由XtQuantTrader调用 ======