from peewee import *

from models import db


class Mexc1(Model):
    id = IntegerField(primary_key=True)
    open = FloatField(null=True)
    high = FloatField(null=True)
    low = FloatField(null=True)
    close = FloatField(null=True)

    class Meta:
        database = db
        table_name = 'mexc_1'


class Mexc15(Model):
    id = IntegerField(primary_key=True)
    open = FloatField(null=True)
    high = FloatField(null=True)
    low = FloatField(null=True)
    close = FloatField(null=True)

    class Meta:
        database = db
        table_name = 'mexc_15'


class Mexc30(Model):
    id = IntegerField(primary_key=True)
    open = FloatField(null=True)
    high = FloatField(null=True)
    low = FloatField(null=True)
    close = FloatField(null=True)

    class Meta:
        database = db
        table_name = 'mexc_30'


class Mexc1Hour(Model):
    id = IntegerField(primary_key=True)
    open = FloatField(null=True)
    high = FloatField(null=True)
    low = FloatField(null=True)
    close = FloatField(null=True)

    class Meta:
        database = db
        table_name = 'mexc_1_hour'


# 连接到数据库
db.connect()
# 创建表（如果表不存在）
db.create_tables([Mexc1, Mexc15, Mexc30, Mexc1Hour])
