# engine/data.py
import yfinance as yf

def fetch_live_price(ticker):
    df = yf.download(
        ticker,
        period="1d",
        interval="1m",
        auto_adjust=True,
        progress=False,
    )

    if df.empty:
        raise RuntimeError(f"No live data for {ticker}")

    return float(df["Close"].iloc[-1])
