调整一些日志,基本上OK了
This commit is contained in:
+14
-5
@@ -14,6 +14,7 @@ class QmtV(XtQuantTraderCallback):
|
||||
def __init__(self) -> None:
|
||||
self.xttrader: XtQuantTrader
|
||||
self.inited: bool = False
|
||||
self.details = {}
|
||||
|
||||
def getTrader(self) -> XtQuantTrader:
|
||||
return self.xttrader
|
||||
@@ -78,13 +79,21 @@ class QmtV(XtQuantTraderCallback):
|
||||
strategy_name, # strategy_name
|
||||
orderRemark # remark # type: ignore
|
||||
)
|
||||
|
||||
def cacheStockDetail(self, stock_code:str):
|
||||
if stock_code in self.details:
|
||||
return self.details[stock_code]
|
||||
else:
|
||||
self.details[stock_code] = xtdata.get_instrument_detail(stock_code, False)
|
||||
return self.details[stock_code]
|
||||
|
||||
def getInstrumentName(self, stock_code:str):
|
||||
# print(f"getInstrumentName: 获取标的名称 {stock_code}")
|
||||
detail = xtdata.get_instrument_detail(stock_code, False)
|
||||
if detail is None:
|
||||
return None
|
||||
return detail['InstrumentName']
|
||||
return self.cacheStockDetail(stock_code)['InstrumentName']
|
||||
|
||||
def dailyUpStop(self, stock_code:str):
|
||||
return self.cacheStockDetail(stock_code)['UpStopPrice']
|
||||
def dailyDownStop(self, stock_code:str):
|
||||
return self.cacheStockDetail(stock_code)['DownStopPrice']
|
||||
|
||||
# def print_position_info(self):
|
||||
# positions:list[XtPosition] = self.xt_trader.query_stock_positions(self.account)
|
||||
|
||||
Reference in New Issue
Block a user