bbcb935bf3
- scripts/_is_trading_day.py 신규: 한국 공휴일+대체공휴일 판단 (exit 0=거래일, 1=휴장) * holidays.SouthKorea() 기반, 제헌절(7/17) 오탐 제외 처리 - run_morning/midday/evening/bot.ps1: 스크립트 상단에 공휴일 체크 추가 * 휴장일이면 로그 기록 후 즉시 종료 (Claude/봇 미실행) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
32 lines
1.2 KiB
PowerShell
32 lines
1.2 KiB
PowerShell
# 매매 봇 시작 스크립트
|
|
# 작업 스케줄러에서 07:55에 실행 (평일)
|
|
|
|
$OutputEncoding = [System.Text.Encoding]::UTF8
|
|
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
$env:PYTHONIOENCODING = "utf-8"
|
|
|
|
$PROJECT = Split-Path -Parent $PSScriptRoot
|
|
$LOG = "$PROJECT\logs\bot_start.log"
|
|
$CLAUDE = "C:\Users\whdwo\AppData\Roaming\npm\claude.cmd"
|
|
$PYTHON = "C:\Users\whdwo\.pyenv\pyenv-win\versions\3.11.9\python.exe"
|
|
$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] /start-bot 실행`n", $utf8)
|
|
|
|
& $CLAUDE -p "/start-bot" --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] /start-bot 완료`n", $utf8)
|