Fix CTP exchange routing for non-SHFE contracts and duplicate trade closes.
Resolve CZCE/DCE symbols to the correct exchange for orders, dedupe stop-loss closes and trade logs, and rely on CTP sync for authoritative records. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+6
-2
@@ -32,8 +32,12 @@ def ths_to_vnpy_symbol(ths_code: str) -> Tuple[str, str]:
|
||||
"""
|
||||
code = (ths_code or "").strip()
|
||||
codes = ths_to_codes(code)
|
||||
ex = (codes.get("ex") if codes else None) or "SHFE"
|
||||
ex = _EX_MAP.get(ex, "SHFE")
|
||||
ex = (codes.get("ex") if codes else None)
|
||||
if not ex and codes:
|
||||
mc = (codes.get("market_code") or "")
|
||||
if "." in mc:
|
||||
ex = mc.rsplit(".", 1)[-1]
|
||||
ex = _EX_MAP.get(ex or "SHFE", "SHFE")
|
||||
m = re.match(r"^([A-Za-z]+)(\d+)$", code)
|
||||
if not m:
|
||||
return code, ex
|
||||
|
||||
Reference in New Issue
Block a user