from sqlalchemy import Column, Integer, Float, String, DateTime, ForeignKey from sqlalchemy.orm import relationship from db import Base class Bid(Base): __tablename__ = "bids" id = Column(Integer, primary_key=True, index=True) timestamp = Column(DateTime, index=True, nullable=False) # Bid target time quantity = Column(Float, nullable=False) # MWh price = Column(Float, nullable=False) # $/MWh market = Column(String, nullable=False) # Market name: ISONE / MISO / NYISO for now status = Column(String, default="Submitted") # Submitted / Success / Fail pnl = Column(Float, nullable=True) # Profit/loss value, nullable initially user_id = Column(Integer, ForeignKey("users.id")) user = relationship("User", back_populates="bids")