from __future__ import annotations

from pydantic import BaseModel, Field
from typing import Literal
from datetime import datetime


class KlineEvent(BaseModel):
    symbol: str
    timeframe: str
    open_time: datetime
    close_time: datetime
    open: float
    high: float
    low: float
    close: float
    volume: float = 0.0
    is_closed: bool = Field(default=True, description="True when candle closed")
    source: Literal["binance", "alpha_vantage", "oanda", "other"] = "other"


class OHLCVRequest(BaseModel):
    symbol: str
    timeframe: str
    start: datetime | None = None
    end: datetime | None = None
