-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschemas.py
37 lines (29 loc) · 907 Bytes
/
schemas.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from pydantic import BaseModel
from datetime import date
class StockDataBase(BaseModel):
symbol: str
date: date
open_price: float
close_price: float
high_price: float
low_price: float
volume: int
class Config:
orm_mode = True
class CreateStockData(StockDataBase):
pass # You can extend this class if you need to add more fields or methods
class StockDataResponse(StockDataBase):
id: int # Include the ID field for responses
class Config:
orm_mode = True
class PredictedStockData(BaseModel):
date: date # Assuming you will return a date
symbol:str
predicted_price: float
actual_price:float
class Config:
orm_mode = True # Enable ORM mode to work with SQLAlchemy models
from_attributes = True
# Schema for responses to clients
class PredictedStockDataResponse(PredictedStockData):
id: int