Files
exchange_go/app/admin/models/line_pre_order.go

68 lines
4.4 KiB
Go
Raw Normal View History

2025-02-06 11:14:33 +08:00
package models
import (
"go-admin/common/models"
"time"
"github.com/shopspring/decimal"
)
type LinePreOrder struct {
models.Model
2025-03-31 15:37:29 +08:00
ExchangeType string `json:"exchangeType" gorm:"type:varchar(20);comment:交易所类型 (字典 exchange_type"`
StrategyTemplateType int `json:"strategyTemplateType" gorm:"type:tinyint;comment:策略类型 0-无 1-波段涨跌幅"`
Pid int `json:"pid" gorm:"type:int unsigned;omitempty;comment:pid"`
MainId int `json:"mainId" gorm:"type:int;comment:主单id"`
ApiId int `json:"apiId" gorm:"type:varchar(255);omitempty;comment:api用户"`
GroupId string `json:"groupId" gorm:"type:int unsigned;omitempty;comment:交易对组id"`
Symbol string `json:"symbol" gorm:"type:varchar(255);omitempty;comment:交易对"`
QuoteSymbol string `json:"quoteSymbol" gorm:"type:varchar(255);omitempty;comment:计较货币"`
SignPrice string `json:"signPrice" gorm:"type:decimal(18,8);omitempty;comment:对标价"`
SignPriceU decimal.Decimal `json:"signPriceU" gorm:"type:decimal(18,8);omitempty;comment:交易对对标U的行情价"`
SignPriceType string `json:"signPriceType" gorm:"type:enum('new','tall','low','mixture','entrust','add');omitempty;comment:对标价类型: new=最新价格;tall=24小时最高;low=24小时最低;mixture=标记价;entrust=委托实价;add=补仓"`
Rate string `json:"rate" gorm:"type:decimal(18,2);omitempty;comment:下单百分比"`
Price string `json:"price" gorm:"type:decimal(18,8);omitempty;comment:触发价格"`
Num string `json:"num" gorm:"type:decimal(18,8);omitempty;comment:购买数量"`
BuyPrice string `json:"buyPrice" gorm:"type:decimal(18,8);omitempty;comment:购买金额"`
SymbolType int `json:"symbolType" gorm:"type:int;comment:交易对类型:1=现货;2=合约"`
OrderCategory int `json:"orderCategory" gorm:"type:int;comment:订单类型: 1=主单 2=对冲单 3-加仓单"`
Site string `json:"site" gorm:"type:enum('BUY','SELL');omitempty;comment:购买方向:BUY=买;SELL=卖"`
OrderSn string `json:"orderSn" gorm:"type:varchar(255);omitempty;comment:订单号"`
OrderType int `json:"orderType" gorm:"type:int;omitempty;comment:订单类型:0=主单 1=止盈 2=止损 3=平仓 4=减仓"`
Desc string `json:"desc" gorm:"type:text;omitempty;comment:订单描述"`
Status int `json:"status" gorm:"type:int;omitempty;comment:是否被触发:0=待触发;1=已触发;2=下单失败;4=已取消;5=委托中;6=已成交;9=已平仓"`
CoverType int `json:"coverType" gorm:"type:int unsigned;omitempty;comment:对冲类型 1= 现货对合约 2=合约对合约 3 合约对现货"`
ExpireTime time.Time `json:"expireTime" gorm:"comment:过期时间"`
MainOrderType string `json:"mainOrderType" gorm:"type:enum;comment:第一笔(主单类型) 限价LIMIT市价(MARKET)"`
LossAmount decimal.Decimal `json:"lossAmount" gorm:"type:decimal(18,8);comment:亏损金额U"`
TriggerTime *time.Time `json:"triggerTime" gorm:"type:datetime;comment:触发时间"`
Child []LinePreOrder `json:"child" gorm:"-"`
ApiName string `json:"api_name" gorm:"->"`
ChildNum int64 `json:"child_num" gorm:"->"`
AddPositionStatus int `json:"add_position_status" gorm:"->"`
ReduceStatus int `json:"reduce_status" gorm:"->"`
Childs []LinePreOrder `json:"childs" gorm:"foreignKey:pid;references:id"`
ReduceOrderId int `json:"reduceOrderId" gorm:"type:bigint;comment:主减仓单id"`
// OrderReduceStrategy LineOrderReduceStrategy `json:"-" gorm:"foreignKey:order_id;references:id"`
2025-02-06 11:14:33 +08:00
// LinePreOrder 线上预埋单\
models.ModelTime
models.ControlBy
}
func (LinePreOrder) TableName() string {
return "line_pre_order"
}
func (e *LinePreOrder) Generate() models.ActiveRecord {
o := *e
return &o
}
func (e *LinePreOrder) GetId() interface{} {
return e.Id
}
type PositionSymbol struct {
Symbol string
}