434d7cb357
根因三层(全案=audit/20261005_qmt_identity_env_plan.md): schtask 无 per-task env+机器级 env 未设→wrapper 被迫字面量;「部署身份」无单一权威源(env 名分裂三个);模拟号零安全压力致 32 文件 88 处 copy-paste 扩散。 - qmt_gate_common.load_identity 正典装载器(:14-59): env SANGUO_QMT_ACCOUNT/BIGQMT_ACCOUNT_ID(兼容别名)>json>RuntimeError fail-loud;SANGUO_IDENTITY_JSON 显式指路不存在=立即报错;查找=repo 相对>C:\sanguo_vnpy_v2\config\(生产副本回退位) - 灾备腿同源: relogin/qmt_bridge_probe/setclip 改 from qmt_gate_common import ACCOUNT - 桥腿镜像同链: xt_gateway._qmt_account/qmt_gateway_client._identity_default_account/is_price_source_vps/bridge_switch_ops(3 处 env 注入+1 处内嵌探针串)/check_xtquant——env 带默认的硬编码默认值全数退役 - xt_eod_wrapper.ps1 改 Get-Content identity json(保持 ASCII);码内 docstring 字面量→占位符(engine/runner/runner_live/live.yaml 注释/README) - .gitignore 白名单 !config/qmt_identity.json(全局 *.json 曾吞之,git check-ignore 实证) - tests/trader/test_qmt_identity.py 五钉: 装载链语义(env 双名覆盖/显式指路 fail)+单源一致性(identity≡live.yaml≡watch_accounts≡gate_common≡各腿镜像,休市表 CI 同步测先例)+码面字面量 grep-pin(生产码面零 66639661,只 config 三件套可含) - 监控 spec: §3.2 账号来源 bullet/§9.A-18 坑条/§12 行数+行号勘正(插入块致 bridge_ping/calendar_probe/relogin_running 引用行号推移);runbook: 非代码资产两行(副本回退路径+生产 wrapper 待改清单=10-08 窗口后 §五③) 生产 wrapper(C:\sanguo_bigqmt 库外)字面量收尾=10-08 复市验证窗口后非代码资产流程;VPS 班车同窗口(护 10-08 07:50 relogin 首班旧码纯净)。trader+api 620 绿。 Co-Authored-By: Claude Code <noreply@anthropic.com>
21 lines
1.4 KiB
PowerShell
21 lines
1.4 KiB
PowerShell
# xt_eod_wrapper.ps1 - sanguo-xt-daily schtask wrapper (21:00 xtdata ETF/fund EOD increment)
|
|
# (renamed from sanguo-xt-eod in the 2026-08-20 reorg; file name kept, 10-01 audit note)
|
|
# plan A: ETF/fund (baostock blind zone) -> dbbardata('d')
|
|
# 2026-09-10 data leg switch: xtquant via big-QMT redis bridge shim
|
|
# (xtquant_bridge PYTHONPATH -> in-process full market data). Replaces the dead
|
|
# miniQMT 58610 standalone service (IPythonApiServer stopped self-starting after
|
|
# the 09-09 accidental kill; root cause unresolved).
|
|
# NOTE: keep this file ASCII-only (PS 5.1 reads no-BOM files as ANSI/GBK).
|
|
$env:PYTHONPATH = 'C:\sanguo_bigqmt\xtquant_bridge;C:\sanguo_vnpy_v2;C:\sanguo_vnpy_v2\vnpy_v4.4.0;C:\sanguo_vnpy_v2\vnpy_qmt_v0.3.3'
|
|
# QMT account from single-source identity file (P2-18 root fix; no literal here)
|
|
$ident = Get-Content 'C:\sanguo_vnpy_v2\config\qmt_identity.json' -Raw | ConvertFrom-Json
|
|
$env:BIGQMT_ACCOUNT_ID = $ident.default_account
|
|
$env:BIGQMT_REDIS_PASSWORD = (Select-String -Path 'C:\redis\redis.conf' -Pattern '^requirepass\s+(\S+)' | ForEach-Object { $_.Matches[0].Groups[1].Value })
|
|
Set-Location C:\sanguo_vnpy_v2
|
|
$ts = Get-Date -Format 'yyyyMMdd_HHmmss'
|
|
$logDir = 'C:\sanguo_vnpy_v2\data\migration_logs'
|
|
if (-not (Test-Path $logDir)) { New-Item -ItemType Directory -Path $logDir -Force | Out-Null }
|
|
$log = Join-Path $logDir "xt_eod_$ts.txt"
|
|
C:\Python310\python.exe -X utf8 C:\sanguo_vnpy_v2\scripts\data_platform\xt_eod.py *>> $log
|
|
exit $LASTEXITCODE
|