You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.4 KiB
63 lines
1.4 KiB
1 year ago
|
from datetime import datetime
|
||
|
|
||
4 years ago
|
from dotenv import load_dotenv
|
||
|
from peewee import *
|
||
1 year ago
|
from playhouse.sqliteq import SqliteQueueDatabase
|
||
4 years ago
|
|
||
|
|
||
|
load_dotenv('.env')
|
||
|
|
||
1 year ago
|
db = SqliteQueueDatabase('data/mm.db')
|
||
4 years ago
|
|
||
|
|
||
|
class Ticker(Model):
|
||
|
id = AutoField()
|
||
|
trade_pair = CharField()
|
||
|
initial_price = DoubleField()
|
||
|
current_price = DoubleField()
|
||
|
high_price = DoubleField()
|
||
|
low_price = DoubleField()
|
||
|
volume = DoubleField()
|
||
|
bid = DoubleField()
|
||
|
ask = DoubleField()
|
||
|
spread_btc = DoubleField()
|
||
|
spread_sats = IntegerField()
|
||
|
spread_perc = DoubleField()
|
||
1 year ago
|
date = DateTimeField(default=datetime.utcnow)
|
||
4 years ago
|
|
||
|
class Meta:
|
||
|
database = db
|
||
|
|
||
|
class Balance(Model):
|
||
|
total = DoubleField()
|
||
|
available = DoubleField()
|
||
|
currency = CharField()
|
||
1 year ago
|
date = DateTimeField(default=datetime.utcnow)
|
||
4 years ago
|
|
||
|
class Meta:
|
||
|
database = db
|
||
|
|
||
4 years ago
|
class Order(Model):
|
||
|
trade_pair = CharField()
|
||
|
trade_type = CharField()
|
||
|
buy = BooleanField()
|
||
|
quantity = DoubleField()
|
||
|
price = DoubleField()
|
||
3 years ago
|
uuid = TextField(null=True)
|
||
4 years ago
|
active = BooleanField(default=True)
|
||
|
cancelled = BooleanField(default=False)
|
||
1 year ago
|
date = DateTimeField(default=datetime.utcnow)
|
||
4 years ago
|
|
||
|
class Meta:
|
||
|
database = db
|
||
|
|
||
4 years ago
|
class Earning(Model):
|
||
|
trade_pair = CharField()
|
||
|
quantity = DoubleField()
|
||
1 year ago
|
date = DateTimeField(default=datetime.utcnow)
|
||
4 years ago
|
|
||
|
class Meta:
|
||
|
database = db
|
||
4 years ago
|
|
||
4 years ago
|
db.create_tables([Ticker, Balance, Order, Earning])
|