[2026-05-27] 포맷 후 복구 설치 스크립트 추가

This commit is contained in:
2026-05-27 16:53:52 +09:00
parent 04577c63f1
commit 29db1bfcab
135 changed files with 2909 additions and 251 deletions
+56
View File
@@ -0,0 +1,56 @@
$ErrorActionPreference = "Stop"
$Root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
Set-Location $Root
. "$Root\scripts\stockbot_env.ps1"
$Python = Resolve-StockBotPython -Project $Root
$LogDir = Join-Path $Root "logs"
New-Item -ItemType Directory -Force -Path $LogDir | Out-Null
$LogPath = Join-Path $LogDir "training.log"
function Write-Log {
param([string]$Message)
$Line = "[{0}] {1}" -f (Get-Date -Format "yyyy-MM-dd HH:mm:ss"), $Message
Add-Content -Path $LogPath -Value $Line -Encoding UTF8
Write-Host $Line
}
function Invoke-PythonStep {
param(
[string]$Name,
[string[]]$Args,
[bool]$Required = $true
)
Write-Log $Name
& $Python @Args *>> $LogPath
$Code = $LASTEXITCODE
if ($Code -ne 0) {
$Message = "$Name failed with exit code $Code"
if ($Required) {
throw $Message
}
Write-Log "warning: $Message"
}
}
Write-Log "training pipeline started"
$HolidayCheck = & $Python scripts\_is_trading_day.py 2>&1
if ($LASTEXITCODE -ne 0) {
Write-Log "market closed - skipped ($HolidayCheck)"
exit 0
}
Invoke-PythonStep -Name "collecting daily market features" -Args @("scripts\collect_daily_features.py") -Required $false
Invoke-PythonStep -Name "collecting KIS minute data" -Args @("scripts\collect_minute_data.py", "--top", "30", "--real-quotes") -Required $false
Invoke-PythonStep -Name "exporting bot training dataset" -Args @("scripts\export_training_dataset.py", "data\training_dataset.csv") -Required $true
Invoke-PythonStep -Name "building external training dataset" -Args @("scripts\build_external_training_dataset.py", "--out", "data\external_training_dataset.csv") -Required $true
Invoke-PythonStep -Name "training model" -Args @("scripts\train_ai_model.py") -Required $true
Write-Log "training pipeline finished"