Files
Stock-trading-programming/scripts/run_evening.ps1
T

35 lines
1.3 KiB
PowerShell
Raw Normal View History

# claude_evening 실행 스크립트
# 작업 스케줄러에서 15:30에 실행 (평일)
chcp 65001 | Out-Null # 콘솔 코드페이지 UTF-8 (외부 프로세스 출력 디코딩)
$OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$env:PYTHONUTF8 = "1"
$env:PYTHONIOENCODING = "utf-8"
$PROJECT = Split-Path -Parent $PSScriptRoot
$LOG = "$PROJECT\logs\evening.log"
. "$PROJECT\scripts\stockbot_env.ps1"
$CLAUDE = Resolve-StockBotClaude
$PYTHON = Resolve-StockBotPython -Project $PROJECT
$utf8 = New-Object System.Text.UTF8Encoding $false
Set-Location $PROJECT
# 공휴일 체크 — 휴장일이면 스킵
$holiday_result = & $PYTHON "scripts\_is_trading_day.py" 2>&1
if ($LASTEXITCODE -ne 0) {
$ts = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
[System.IO.File]::AppendAllText($LOG, "[$ts] 휴장일 — 스킵 ($holiday_result)`n", $utf8)
exit
}
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
[System.IO.File]::AppendAllText($LOG, "[$timestamp] claude_evening 시작`n", $utf8)
& $CLAUDE -p "/evening" --dangerously-skip-permissions 2>&1 |
ForEach-Object { [System.IO.File]::AppendAllText($LOG, "$_`n", $utf8) }
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
[System.IO.File]::AppendAllText($LOG, "[$timestamp] claude_evening 완료`n", $utf8)