This commit is contained in:
2026-06-04 18:17:48 +08:00
parent db910e03d6
commit 1816d585bf
7 changed files with 894 additions and 340 deletions
+14
View File
@@ -107,6 +107,13 @@ class DummyQmtV:
}
PrintLog(LogLevel.INFO, f'- [模拟] 已加载 {len(self._positions)} 个持仓')
def getAllPositions(self) -> dict:
"""获取全部持仓,返回 {stock_code: position_object}"""
result = {}
for code, pos_data in self._positions.items():
result[code] = type('DummyPos', (), pos_data)()
return result
def getStockPosition(self, stock_code: str):
"""获取持仓 (模拟)"""
if stock_code in self._positions:
@@ -207,6 +214,13 @@ class DummyQmtV:
"""获取跌停价 (模拟)"""
return 0.0
def getLastPrice(self, stock_code: str) -> float:
"""主动获取最新市价(模拟)"""
if stock_code in self._positions:
return float(self._positions[stock_code].get('open_cost', 10.0))
# 给一个合理模拟价
return 10.0 + hash(stock_code) % 100
def startMarketDataSubscription(self):
"""启动市场数据订阅 (模拟)"""
try: