Created
January 21, 2014 06:38
-
-
Save fuzzy/8535370 to your computer and use it in GitHub Desktop.
models
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cryptolizzard.db.peewee import * | |
db = MySQLDatabase('cryptolizzard', user='clizzard', passwd='<pass>', host='192.168.0.2') | |
db.connect() | |
class BaseModel(Model): | |
class Meta: | |
database = db | |
# Operational models | |
class Menu(BaseModel): | |
link = CharField() | |
text = CharField() | |
# Metrics related models | |
class Currency(BaseModel): | |
symbol = CharField() | |
class Exchange(BaseModel): | |
name = CharField() | |
class ExchangeEntry(BaseModel): | |
currency = ForeignKeyField(Currency) | |
exchange = ForeignKeyField(Exchange) | |
datetime = IntegerField() | |
ask = FloatField() | |
bid = FloatField() | |
last = FloatField() | |
volume_btc = FloatField() | |
volume_total = FloatField() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment