class Prices(db.Model): __tablename__ = "prices" id = db.Column(db.Integer, primary_key=True) symbol = db.Column(db.Text, index=True) price = db.Column(db.Float(precision=32)) timestamp = db.Column(db.Float(precision=32), index=True)
class Indexes(db.Model): __tablename__ = "indexes" id = db.Column(db.Integer, primary_key=True) symbol = db.Column(db.VARCHAR(255), db.ForeignKey("index_metadata.symbol")) value = db.Column(db.Float(precision=32)) timestamp = db.Column(db.Float(precision=32))
class Transactions(db.Model): __tablename__ = "order_status" id = db.Column(db.Integer, primary_key=True) order_id = db.Column(db.Integer, db.ForeignKey("orders.id"), nullable=True) timestamp = db.Column(db.Float(precision=32)) status = db.Column(db.Enum(OrderStatusTypes)) clear_price = db.Column(db.Float(precision=32), nullable=True)
class Winners(db.Model): __tablename__ = "winners" id = db.Column(db.Integer, primary_key=True) game_id = db.Column(db.Integer, db.ForeignKey('games.id')) winner_id = db.Column(db.Integer, db.ForeignKey("users.id")) benchmark = db.Column(db.Enum(Benchmarks)) score = db.Column(db.Float(precision=32)) start_time = db.Column(db.Float(precision=32)) end_time = db.Column(db.Float(precision=32)) payout = db.Column(db.Float(precision=32)) type = db.Column(db.Enum(PayoutType)) timestamp = db.Column(db.Float(precision=32))
class Games(db.Model): __tablename__ = "games" id = db.Column(db.Integer, primary_key=True) creator_id = db.Column(db.Integer, db.ForeignKey("users.id")) title = db.Column(db.Text) game_mode = db.Column(db.Enum(GameModes)) duration = db.Column(db.Integer) buy_in = db.Column(db.Float(precision=32)) benchmark = db.Column(db.Enum(Benchmarks)) side_bets_perc = db.Column(db.Float(precision=32)) side_bets_period = db.Column(db.Enum(SideBetPeriods)) invite_window = db.Column(db.Float(precision=32)) stakes = db.Column(db.Enum(GameStakes), nullable=True)
class GameBalances(db.Model): __tablename__ = "game_balances" id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey("users.id")) game_id = db.Column(db.Integer, db.ForeignKey("games.id")) order_status_id = db.Column(db.Integer, db.ForeignKey("order_status.id")) stock_split_id = db.Column(db.Integer, db.ForeignKey("stock_splits.id")) dividend_id = db.Column(db.Integer, db.ForeignKey("dividends.id")) timestamp = db.Column(db.Float(precision=32)) balance_type = db.Column(db.Enum(GameBalanceTypes)) balance = db.Column(db.Float(precision=32)) symbol = db.Column(db.Text) transaction_type = db.Column(db.Enum(GameBalanceTransactionTypes))
class Dividends(db.Model): __tablename__ = "dividends" id = db.Column(db.Integer, primary_key=True) symbol = db.Column(db.Text) company = db.Column(db.Text) amount = db.Column(db.Float(precision=32)) exec_date = db.Column(db.Integer)
class StockSplits(db.Model): __tablename__ = "stock_splits" id = db.Column(db.Integer, primary_key=True) symbol = db.Column(db.Text) numerator = db.Column(db.Integer) denominator = db.Column(db.Integer) exec_date = db.Column(db.Float(precision=32))
class GameStatus(db.Model): __tablename__ = "game_status" id = db.Column(db.Integer, primary_key=True) game_id = db.Column(db.Integer, db.ForeignKey('games.id')) status = db.Column(db.Enum(GameStatusTypes)) users = db.Column(db.JSON) timestamp = db.Column(db.Float(precision=32)) # When was the game opened
class IndexMetaData(db.Model): __tablename__ = "index_metadata" id = db.Column(db.Integer, primary_key=True) symbol = db.Column(db.VARCHAR(255)) start_date = db.Column(db.Float(precision=32)) avatar = db.Column(db.Text) name = db.Column(db.Text)
class GameInvites(db.Model): __tablename__ = "game_invites" id = db.Column(db.Integer, primary_key=True) game_id = db.Column(db.Integer, db.ForeignKey('games.id')) user_id = db.Column(db.Integer, db.ForeignKey("users.id")) status = db.Column(db.Enum(GameInviteStatusTypes)) timestamp = db.Column(db.Float(precision=32))
class Payments(db.Model): """This table handles real payments -- this isn't virtual currency, but an actual record of cash liabilities vis-a- vis the platform= """ __tablename__ = "payments" id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey("users.id")) profile_id = db.Column(db.Integer, db.ForeignKey("payment_profiles.id")) game_id = db.Column(db.Integer, db.ForeignKey('games.id'), nullable=True) winner_table_id = db.Column(db.Integer, db.ForeignKey("winners.id"), nullable=True) type = db.Column(db.Enum(PaymentTypes)) amount = db.Column(db.Float(precision=32)) currency = db.Column(db.Enum(CurrencyTypes)) direction = db.Column(db.Enum(PaymentDirection)) timestamp = db.Column(db.Float(precision=32))
class PaymentProfiles(db.Model): __tablename__ = "payment_profiles" id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey("users.id")) processor = db.Column(db.Enum(Processors), index=True) uuid = db.Column(db.VARCHAR(255), index=True) payer_email = db.Column(db.Text, nullable=True) timestamp = db.Column(db.Float(precision=32))
class StockBetsRating(db.Model): __tablename__ = "stockbets_rating" id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey("users.id"), nullable=True, index=True) index_symbol = db.Column(db.VARCHAR(255), db.ForeignKey("index_metadata.symbol"), nullable=True) game_id = db.Column(db.Integer, db.ForeignKey('games.id'), nullable=True) rating = db.Column(db.Float(precision=32)) basis = db.Column(db.Float(precision=32)) total_return = db.Column(db.Float(precision=32)) n_games = db.Column(db.Integer) update_type = db.Column(db.Enum(EventTypes)) timestamp = db.Column(db.Float(precision=32))
class ExternalInvites(db.Model): __tablename__ = "external_invites" id = db.Column(db.Integer, primary_key=True) requester_id = db.Column(db.Integer, db.ForeignKey("users.id")) invited_email = db.Column(db.Text) status = db.Column(db.Enum(ExternalInviteStatus)) timestamp = db.Column(db.Float(precision=32)) type = db.Column(db.Enum(ExternalInviteTypes)) game_id = db.Column(db.Integer, db.ForeignKey('games.id'), nullable=True)
class Orders(db.Model): __tablename__ = "orders" id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey("users.id")) game_id = db.Column(db.Integer, db.ForeignKey('games.id')) symbol = db.Column(db.Text) buy_or_sell = db.Column(db.Enum(BuyOrSell)) quantity = db.Column(db.Integer) price = db.Column(db.Float(precision=32)) order_type = db.Column(db.Enum(OrderTypes)) time_in_force = db.Column(db.Enum(TimeInForce))
class Users(db.Model): __tablename__ = "users" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.Text, index=True) email = db.Column(db.Text, index=True) profile_pic = db.Column(db.Text) username = db.Column(db.Text, index=True) created_at = db.Column(db.Float(precision=32)) provider = db.Column(db.Enum(OAuthProviders)) resource_uuid = db.Column(db.Text, index=True) password = db.Column(db.Text, nullable=True)
class Friends(db.Model): id = db.Column(db.Integer, primary_key=True) requester_id = db.Column(db.Integer, db.ForeignKey("users.id")) invited_id = db.Column(db.Integer, db.ForeignKey("users.id")) status = db.Column(db.Enum(FriendStatuses)) timestamp = db.Column(db.Float(precision=32))