# engine/market.py
from datetime import datetime, time as dtime
import pytz

def us_market_status():
    tz = pytz.timezone("America/New_York")
    now = datetime.now(tz)

    open_t = dtime(9, 30)
    close_t = dtime(16, 0)

    is_open = now.weekday() < 5 and open_t <= now.time() <= close_t

    return is_open, now
