Example #1
0
from app.model.user import User, g_user_transaction_level
from app.model.sell_order import SellOrder, g_sell_order_status
from app.model.buy_order import BuyOrder, g_buy_order_status
from app.model.match_order import MatchOrder, MatchOrderTask, g_match_order_task_status
from app.model.confirm_order import ConfirmOrder, g_confirm_order_status
from app.model.payment import Payment
from app.model.currency import CryptoCurrency
from app.model.setting import Setting
from app.model.currency import Currency
from app.model.assets import Assets, g_assets_record_type
from app.type.typedef_const import TypedefConst

g_order_status = TypedefConst()

g_order_status.PENDING = 1  # 挂单中
g_order_status.MATCH = 2  # 匹配中
g_order_status.PAID = 4  # 已付款
g_order_status.CONFIRMED = 8  # 已确认
g_order_status.CANCELLED = 16  # 已取消
g_order_status.DELETE = 32  # 删除

g_order_side = TypedefConst()

g_order_side.BUY = 1  # 买单
g_order_side.SELL = 2  # 卖单


class Order(AutoIncrementBase):
    match_order_id = db.Column(db.Integer, db.ForeignKey('match_order.id'), nullable=True)  # 匹配订单

    user_id = db.Column(db.String(36), db.ForeignKey('user.id'), nullable=False)  # 用户
Example #2
0
import logging
import time
import json
import decimal
from app.model import AutoIncrementBase, db, generate_timestamp_id
from app.model.user import User, g_user_transaction_level
from app.model.payment import Payment
from app.model.setting import Setting
from app.model.currency import Currency
from app.model.assets import Assets, g_assets_record_type
from app.type.typedef_const import TypedefConst

g_order_old_status = TypedefConst()

g_order_old_status.PENDING = 1  # 挂单中
g_order_old_status.MATCH = 2  # 匹配中
g_order_old_status.PAID = 4  # 已付款
g_order_old_status.CONFIRMED = 8  # 已确认
g_order_old_status.CANCELLED = 16  # 已取消


class OrderOld(AutoIncrementBase):
    user_id = db.Column(db.String(36),
                        db.ForeignKey('user.id'),
                        nullable=False)  # 卖方用户
    match_user_id = db.Column(db.String(36), db.ForeignKey('user.id'))  # 买方用户
    # side = db.Column(db.SmallInteger, nullable=False)  # 1 买单  2 卖单
    number = db.Column(db.String(16),
                       default=generate_timestamp_id,
                       unique=True,
                       nullable=False)