Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.02 KB | None | 0 0
  1. from sqlalchemy.ext.declarative import declarative_base
  2. from sqlalchemy import Column, Integer, String, Float, DateTime
  3.  
  4. Base = declarative_base()
  5.  
  6. class ExchangePair(Base):
  7.     __tablename__ = 'exchange_pairs'
  8.     id = Column(Integer, primary_key=True)
  9.     target_currency_id = Column(String)
  10.     base_currency_id = Column(String)
  11.     last = Column(Float)
  12.     volume = Column(Float)
  13.     exchange_id = Column(String)
  14.     date = Column(DateTime)
  15.     time = Column(Integer)
  16.  
  17.     def __repr__(self):
  18.         return "<ExchangePair(target='{}', base='{}', last='{}', exchange='{}')>".format(
  19.             self.target_currency_id, self.base_currency_id, self.last, self.volume)
  20.  
  21. class Currency(Base):
  22.     __tablename__ = 'currencies'
  23.     id = Column(Integer, primary_key=True)
  24.     currency_id = Column(String)
  25.     price = Column(Float)
  26.     time = Column(Integer)
  27.  
  28.     def __repr__(self):
  29.         return "<Currency(currency_id='{}', time='{}', price='{}')>".format(
  30.             self.currency_id, self.time, self.price)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement