示例#1
0
class Stock(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    ticker = db.Column(db.String(5))
    name = db.Column(db.String(80))
    price = db.Column(db.Float)
    datetime = db.Column(db.String(80))
    change = db.Column(db.Float)
    percentChange = db.Column(db.Float)
示例#2
0
class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    eid = db.Column(db.String)
    firstName = db.Column(db.String(80))
    lastName = db.Column(db.String(80))
    email = db.Column(db.String(80))
    attendance = db.Column(db.Integer)
    dues = db.Column(db.Integer)
    atLatestMeeting = db.Column(db.Boolean)
    rowOnSheet = db.Column(db.Integer)
    password_hash = db.Column(db.String)
    ret = db.Column(db.Float)
    score = db.Column(db.Float)
    active = db.Column(db.Boolean)
    analyst = db.Column(db.String)
    fund = db.Column(db.String)
    stocks = db.relationship('Tickers', secondary=ticker_identifier, backref='user')
    transactions = db.relationship('Transactions', backref='user')
    #required for Flask-Security
    roles =  db.relationship('Role', secondary=roles_users, backref=db.backref('users', lazy='dynamic'))

    @property
    def password(self):
        return self.password_hash

    @password.setter
    def password(self, password):
        self.password_hash = generate_password_hash(password)

    def check_password(self, password):
        # print("HERE IS THE PASSWORD: "******"<User '{}'>".format(self.email)
示例#3
0
class Transactions(db.Model, UserMixin):
    id = db.Column(db.Integer, Sequence('transactions_tid_seq', start=1001, increment = 1), primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
    ticker = db.Column(db.String(5))
    date = db.Column(db.String)
    end_price = db.Column(db.Integer)
    returns = db.Column(db.Integer)
示例#4
0
class Tickers(db.Model):
    id = db.Column(db.Integer, Sequence('tickers_tid_seq', start=1001, increment = 1), primary_key=True)
    # ticker = db.Column(db.String(5), unique=True)
    ticker = db.Column(db.String(5))
    startingPrice = db.Column(db.Float)
    short = db.Column(db.Boolean)
    #transactions = db.relationship('Transactions', backref='tickers')
    #user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    def __repr__(self):
        return "<Ticker '{}'>".format(self.ticker)
示例#5
0
class Member(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    eid = db.Column(db.String(8), unique=True)
    firstName = db.Column(db.String(80))
    lastName = db.Column(db.String(80))
    email = db.Column(db.String(80))
    attendance = db.Column(db.Integer)
    dues = db.Column(db.Integer)
    atLatestMeeting = db.Column(db.Boolean)
    rowOnSheet = db.Column(db.Integer)
    comments = db.Column(db.String(80))
    year = db.Column(db.String(80))

    @staticmethod
    def get_by_eid(eid):
        return Member.query.filter_by(eid=eid).first()

    @staticmethod
    def check_attendance(dues, attendance):
        if dues > 45:
            return True
        elif dues == 45:
            return attendance <= num_gms_semester
        elif dues == 0:
            return attendance <= num_gms_free
        return False
示例#6
0
class Vote(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    ticker = db.Column(db.String(5))
    email = db.Column(db.String(80))
    position = db.Column(db.String(80))
示例#7
0
class RecentVote(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    ticker = db.Column(db.String(5))
    close = db.Column(db.Boolean)
示例#8
0
class Role(db.Model, RoleMixin):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(80))
    description = db.Column(db.String(80))