Files
sanguo_vnpy_v2/scripts/qmt_relogin/qmt_xmldiff.py
T

43 lines
1.7 KiB
Python

# -*- coding: utf-8 -*-
"""Read-only round 3: startupAutorun / modbootstart values across daily baselines."""
import os
import re
d = open(r"C:\sanguo_bigqmt\qmt_install_dir.txt", encoding="utf-8").read().strip()
root = os.path.dirname(d)
def esc(s):
return s.encode("unicode_escape").decode("ascii")
files = {
"now": os.path.join(root, "config", "indexUserConfig.xml"),
"snap_before": r"C:\sanguo_bigqmt\indexUserConfig_before.xml",
"d0907": os.path.join(root, "config", "Temp", "indexUserConfig.xml_20260907"),
"d0908": os.path.join(root, "config", "Temp", "indexUserConfig.xml_20260908"),
"d0909": os.path.join(root, "config", "Temp", "indexUserConfig.xml_20260909"),
}
for tag, p in files.items():
t = open(p, encoding="utf-8", errors="replace").read()
sa = re.findall(r'startupAutorun="([^"]*)"', t)
# instance element presence: count id attrs near FromulaExpandData
fe = t.count("FromulaExpandData")
# find modbootstart-ish global in same file too
mb = re.findall(r'modbootstart="([^"]*)"', t)
# restarttimelist
rt = re.findall(r'restarttimelist="([^"]*)"', t)
print("%-11s size=%d startupAutorun=%s FromulaExpandData=%d modbootstart=%s restarttimelist=%s"
% (tag, len(t.encode('utf-8')), sa, fe, mb, [esc(x) for x in rt]))
# Config.xml (user) modbootstart + restart time attrs
p2 = os.path.join(root, "userdata", "users", "66639661", "Config.xml")
t2 = open(p2, encoding="utf-8", errors="replace").read()
for kw in ["modbootstart", "restarttime", "restarttimelist", "TradeSetting"]:
for m in re.finditer(re.escape(kw), t2):
a = max(0, m.start() - 80)
b = min(len(t2), m.end() + 250)
print("CFG", esc(t2[a:b]).replace("\\n", " ")[:400])
print("---")
print("DONE3")