ee27313644
xtdata逐只下载(非批量download_history_data2,后者5201只触发xtquant死锁), 先5m后15m(15m依赖5m),看get bars判成败(ret=None正常非失败)。 download_15m_xtdata.py + relaunch_15m_wrapper.ps1(auto-restart兜底segfault)。 import_vnpy_minute_fast.py灌库(INSERT OR REPLACE,interval存5m/15m,8028万行)。 _run_daily.ps1加5m/15m增量段(每天16:30)。validate_import.py校验。 全市场5201只,5m 6020万/15m 2007万bar,2025-07-17~2026-07-17。
41 lines
1.4 KiB
PowerShell
41 lines
1.4 KiB
PowerShell
$ErrorActionPreference = 'Continue'
|
|
$ProgressPreference = 'SilentlyContinue'
|
|
$maxRetries = 15
|
|
$script = 'C:\sanguo_vnpy_v2\scripts\data_platform\download_15m_xtdata.py'
|
|
$resultFile = 'C:\sanguo_vnpy_v2\data\minute_15\_result.json'
|
|
$logFile = 'C:\sanguo_vnpy_v2\data\minute_15_download.log'
|
|
$errFile = 'C:\sanguo_vnpy_v2\data\minute_15_download.err.log'
|
|
$wrapperLog = 'C:\sanguo_vnpy_v2\data\minute_15_wrapper.log'
|
|
|
|
function Log-W($m) {
|
|
$line = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') $m"
|
|
Add-Content -Path $wrapperLog -Value $line -Encoding UTF8
|
|
}
|
|
|
|
Log-W "WRAPPER START maxRetries=$maxRetries"
|
|
for ($i = 1; $i -le $maxRetries; $i++) {
|
|
Log-W "ATTEMPT $i/$maxRetries starting python"
|
|
if (Test-Path $errFile) { Clear-Content $errFile -EA SilentlyContinue }
|
|
try {
|
|
$p = Start-Process -FilePath 'C:\Python310\python.exe' `
|
|
-ArgumentList '-X utf8', $script `
|
|
-WindowStyle Hidden `
|
|
-RedirectStandardOutput $logFile `
|
|
-RedirectStandardError $errFile `
|
|
-Wait -PassThru
|
|
$ec = if ($null -ne $p.ExitCode) { $p.ExitCode } else { -999 }
|
|
} catch {
|
|
$ec = -998
|
|
Log-W "Start-Process exception: $_"
|
|
}
|
|
Log-W "ATTEMPT $i exited code=$ec"
|
|
|
|
if (Test-Path $resultFile) {
|
|
Log-W "_result.json EXISTS - DONE"
|
|
break
|
|
}
|
|
Log-W "no result yet, sleeping 8s before retry..."
|
|
Start-Sleep -Seconds 8
|
|
}
|
|
Log-W "WRAPPER EXIT"
|