package models

import (
	"time"
)

type BotForexTrade struct {
	ClosingCost   string    `xorm:"comment('平仓手续费') DECIMAL(36,18)"`
	ClosingPrice  string    `xorm:"comment('平仓价') DECIMAL(36,18)"`
	ClosingTime   time.Time `xorm:"comment('平仓时间') DATETIME"`
	ContractId    string    `xorm:"not null comment('合约id') index(u_s_c) index(user_id) VARCHAR(100)"`
	CreateTime    time.Time `xorm:"not null comment('创建时间') DATETIME"`
	DealPrice     string    `xorm:"comment('成交价') DECIMAL(36,18)"`
	DealType      int       `xorm:"not null default 0 comment('委托方式:1限价,2市价') index(user_id) TINYINT(1)"`
	EarnestMoney  string    `xorm:"not null comment('保证金') DECIMAL(36,18)"`
	FaceValue     int64     `xorm:"comment('面值') BIGINT"`
	KeepDecimal   int       `xorm:"comment('小数点保留位数') INT"`
	LimitPrice    string    `xorm:"comment('限价') DECIMAL(36,18)"`
	MarketPrice   string    `xorm:"comment('市价') DECIMAL(36,18)"`
	OpenTime      time.Time `xorm:"comment('开仓时间') DATETIME"`
	OrderId       string    `xorm:"not null comment('订单ID') index(order_id) index(user_id) VARCHAR(60)"`
	OrderMoney    string    `xorm:"not null comment('订单金额') DECIMAL(36,18)"`
	OrderNumber   string    `xorm:"not null comment('委托数量') DECIMAL(36,18)"`
	OvernightCost string    `xorm:"comment('过夜手续费') DECIMAL(36,18)"`
	PryNum        int       `xorm:"comment('杠杆') INT"`
	SecondTime    int       `xorm:"comment('秒合约') INT"`
	ServiceCost   string    `xorm:"not null comment('持仓手续费') DECIMAL(36,18)"`
	State         int       `xorm:"not null default 0 comment('订单状态类型') index(order_id) index(u_s_c) index(user_id) INT"`
	Status        int       `xorm:"not null default 0 comment('订单状态:0-挂单(委托),1-持仓订单,2-已撤单,3-完成订单') index(order_id) index(u_s_c) index(user_id) TINYINT(1)"`
	StopLossPrice string    `xorm:"comment('止损价') DECIMAL(36,18)"`
	StopType      int       `xorm:"not null comment('止损止盈设置:0无设置,1止损止盈') TINYINT(1)"`
	StopWinPrice  string    `xorm:"comment('止赢价') DECIMAL(36,18)"`
	TotalMoney    string    `xorm:"not null comment('订单总金额(订单金额+手续费)') DECIMAL(36,18)"`
	TradeId       int       `xorm:"not null pk autoincr comment('自增长ID') INT"`
	TradeType     int       `xorm:"not null default 0 comment('交易类型:1买入,2卖出') index(user_id) TINYINT(1)"`
	UpdateTime    time.Time `xorm:"comment('更新时间') DATETIME"`
	UserId        int       `xorm:"not null comment('用户ID') index(u_s_c) index(user_id) INT"`
}