fix: restore positions on restart and fix notify env loading

- restore_positions(): read Upbit balances on startup to prevent
  double-buying after restart
- notify.py: read TOKEN/CHAT_ID inside _send() to avoid empty values
  when module is imported before load_dotenv()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
joungmin
2026-02-28 10:36:17 +09:00
parent a799fbebbd
commit a287e48522
3 changed files with 41 additions and 5 deletions

View File

@@ -17,10 +17,14 @@ logging.basicConfig(
)
from core.monitor import run_monitor
from core.trader import restore_positions
from daemon.runner import run_scanner
def main() -> None:
# 재시작 시 기존 잔고 복원 (이중 매수 방지)
restore_positions()
# 트레일링 스탑 감시 스레드 (10초 주기)
monitor_thread = threading.Thread(
target=run_monitor, args=(10,), daemon=True, name="monitor"