수정본
This commit is contained in:
37
backend/app/api/endpoints/debug.py
Normal file
37
backend/app/api/endpoints/debug.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from fastapi import APIRouter
|
||||
from app.core.config import settings
|
||||
from app.core.market_schedule import is_market_open
|
||||
from datetime import datetime
|
||||
import pytz
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/debug/autotrade-status")
|
||||
async def get_autotrade_status():
|
||||
"""자동매매 상태 진단"""
|
||||
KST = pytz.timezone('Asia/Seoul')
|
||||
now = datetime.now(KST)
|
||||
market_open = is_market_open()
|
||||
|
||||
return {
|
||||
"timestamp": now.isoformat(),
|
||||
"current_time_kst": now.strftime('%Y-%m-%d %H:%M:%S %A'),
|
||||
"weekday": now.weekday(),
|
||||
"current_minutes": now.hour * 60 + now.minute,
|
||||
"market_hours": "540-930 (09:00-15:30)",
|
||||
"market_open": market_open,
|
||||
"auto_trade_enabled": settings.AUTO_TRADE_ENABLED,
|
||||
"can_trade": market_open and settings.AUTO_TRADE_ENABLED,
|
||||
"settings": {
|
||||
"stop_loss_percent": settings.STOP_LOSS_PERCENT,
|
||||
"take_profit_percent": settings.TAKE_PROFIT_PERCENT,
|
||||
"max_daily_trades": settings.MAX_DAILY_TRADES,
|
||||
"trend_filter_enabled": settings.TREND_FILTER_ENABLED,
|
||||
},
|
||||
"api_configured": bool(settings.KOREA_INVESTMENT_APP_KEY),
|
||||
"diagnosis": {
|
||||
"market_status": "OPEN - 자동매매 가능" if market_open else "CLOSED - 장 마감",
|
||||
"config_status": "ENABLED" if settings.AUTO_TRADE_ENABLED else "DISABLED",
|
||||
"api_status": "CONFIGURED" if settings.KOREA_INVESTMENT_APP_KEY else "NOT CONFIGURED",
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user