#!/usr/bin/env python3
"""3단계: 실거래 (monitor_rules + 빗썸 주문). LIVE_TRADING_ENABLED=1 필수."""
import argparse
import runpy
from pathlib import Path

runpy.run_path(str(Path(__file__).resolve().parent / "_bootstrap.py"))

from config import LIVE_TRADING_ENABLED, MONITOR_LOOP_SLEEP_SEC
from deepcoin.ops.live_trader import LiveTrader

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="WLD 실거래 (06)")
    parser.add_argument("--once", action="store_true", help="1회만 실행")
    args = parser.parse_args()
    trader = LiveTrader()
    if not LIVE_TRADING_ENABLED:
        print("주의: LIVE_TRADING_ENABLED=0 — 주문 없이 dry_run 로그만")
    if args.once:
        trader.run_once()
    else:
        trader.run_loop(MONITOR_LOOP_SLEEP_SEC)
