Exemplo n.º 1
0
class User(db.Model):

   __tablename__ = 't_user'

   id = db.Column(db.Integer, primary_key = True, autoincrement = True)
   username = db.Column(db.String(64), nullable = False, unique=True)
   password = db.Column(db.String(64), nullable = False)
   email = db.Column(db.String(64), nullable = False, unique=True)
   role = db.Column(db.String(20), nullable = False, default = 'user')

   def __repr__(self):
       return '<%s: (%r, %s)>' % (self.__class__.__name__, self.username, self.role)
Exemplo n.º 2
0
class Asset(db.Model):
    __tablename__ = 't_asset'
    __table_args__ = (db.UniqueConstraint('dt', 'portfolio', 'code', name='idx_dt_portfolio_code_unique'),)
                      #db.Index('idx', 'user_id', 'insert_time'),)

    id = db.Column(db.Integer, primary_key = True, autoincrement = True)
    dt = db.Column(db.Date, index = True)
    portfolio = db.Column(db.String(50))
    code = db.Column(db.String(50))
    sec_type = db.Column(db.String(50))
    quantity = db.Column(db.DECIMAL(15, 4))
    amount = db.Column(db.DECIMAL(15, 4))

    def __repr__(self):
        return '<%s: %s, %s, %s, %f>' % (self.__class__.__name__, self.dt, self.portfolio, self.code, self.amount)
Exemplo n.º 3
0
class Transaction(db.Model):
    __tablename__ = 't_transaction'

    id = db.Column(db.Integer, primary_key = True, autoincrement = True)
    dt = db.Column(db.Date, index = True)
    code = db.Column(db.String(50))
    operation = db.Column(db.String(50))
    portfolio = db.Column(db.String(50))
    sec_type = db.Column(db.String(50))
    quantity = db.Column(db.DECIMAL(15, 4))
    price = db.Column(db.DECIMAL(15, 4))
    tax = db.Column(db.DECIMAL(15, 4))
    other_charges = db.Column(db.DECIMAL(15, 4))
    amount = db.Column(db.DECIMAL(15, 4))

    def __repr__(self):
        return '<%s: %d, %s, %s>' % (self.__class__.__name__, self.id, self.dt, self.code)
Exemplo n.º 4
0
class Hist_price(db.Model):
    __tablename__ = 't_hist_price'
    __table_args__ = (db.UniqueConstraint('dt', 'code', name='idx_dt_code_unique'),)
                      #db.Index('idx', 'user_id', 'insert_time'),)

    id = db.Column(db.Integer, primary_key = True, autoincrement = True)
    dt = db.Column(db.Date, index = True)
    code = db.Column(db.String(50))
    price = db.Column(db.DECIMAL(15, 4))

    def __repr__(self):
        return '<%s: %s, %s, %s>' % (self.__class__.__name__, self.dt, self.code, self.price)