first commit
This commit is contained in:
31
app/schemas/ohlcv.py
Normal file
31
app/schemas/ohlcv.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""OHLCV request/response schemas."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import datetime as _dt
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class OHLCVCreate(BaseModel):
|
||||
symbol: str = Field(..., description="Ticker symbol (e.g. AAPL)")
|
||||
date: _dt.date = Field(..., description="Trading date (YYYY-MM-DD)")
|
||||
open: float = Field(..., ge=0, description="Opening price")
|
||||
high: float = Field(..., ge=0, description="High price")
|
||||
low: float = Field(..., ge=0, description="Low price")
|
||||
close: float = Field(..., ge=0, description="Closing price")
|
||||
volume: int = Field(..., ge=0, description="Trading volume")
|
||||
|
||||
|
||||
class OHLCVResponse(BaseModel):
|
||||
id: int
|
||||
ticker_id: int
|
||||
date: _dt.date
|
||||
open: float
|
||||
high: float
|
||||
low: float
|
||||
close: float
|
||||
volume: int
|
||||
created_at: _dt.datetime
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
Reference in New Issue
Block a user