aboutsummaryrefslogtreecommitdiff
path: root/server/models/market.py
blob: 0127141c62965916e2d48045020895605edd0169 (plain)
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
from datetime import datetime
from pydantic import BaseModel
from sqlalchemy import Column, Integer, String, Float, DateTime
from db import Base


class MarketData(BaseModel):
    timestamp: datetime
    lmp: float
    energy: float
    congestion: float
    loss: float


class MarketDataDB(Base):
    __tablename__ = "market_data"

    id = Column(Integer, primary_key=True, index=True)
    timestamp = Column(DateTime, index=True)
    lmp = Column(Float)
    energy = Column(Float)
    congestion = Column(Float)
    loss = Column(Float)
    market = Column(String, index=True)  # eg. "ISONE"
    type = Column(String, index=True)  # "REALTIME" or "DAYAHEAD"