This commit is contained in:
2026-09-05 20:39:58 +08:00
parent 1fc3e119d3
commit af55324e2a
4 changed files with 110 additions and 80 deletions

View File

@@ -42,9 +42,9 @@ class OrderBook:
self.mutex = Lock()
@staticmethod
def new_order_id() -> str:
def new_order_id(side:str) -> str:
"""生成 ``trend-xxxxxxxx`` 格式的本地订单号。"""
return f"trend-{secrets.token_hex(12)}"
return f"trend-{side}-{secrets.token_hex(10)}"
def busy(self, code: str, side: str) -> bool:
"""判断证券是否存在仍在处理中的同方向委托。"""