package models

import (
	"go-admin/common/models"

	"github.com/shopspring/decimal"
)

type LineReversePosition struct {
	models.Model

	ApiId              int             `json:"apiId" gorm:"type:bigint;comment:api_id"`
	TotalAmount        decimal.Decimal `json:"totalAmount" gorm:"type:decimal(18,8);comment:总仓位"`
	Amount             decimal.Decimal `json:"amount" gorm:"type:decimal(18,8);comment:仓位"`
	ReverseApiId       int             `json:"reverseApiId" gorm:"type:bigint;comment:反单api_id"`
	TotalReverseAmount decimal.Decimal `json:"totalReverseAmount" gorm:"type:decimal(18,8);comment:总反单仓位"`
	ReverseAmount      decimal.Decimal `json:"reverseAmount" gorm:"type:decimal(18,8);comment:反单仓位"`
	Side               string          `json:"side" gorm:"type:varchar(10);comment:买卖方向 BUY SELL"`
	PositionSide       string          `json:"positionSide" gorm:"type:varchar(10);comment:持仓方向 LONG SHORT"`
	Symbol             string          `json:"symbol" gorm:"type:varchar(20);comment:交易对"`
	Status             int             `json:"status" gorm:"type:tinyint;comment:仓位状态 1-已开仓 2-已平仓"`
	ReverseStatus      int             `json:"reverseStatus" gorm:"type:tinyint;comment:反单仓位状态 1-已开仓 2-已平仓"`

	models.ModelTime
	models.ControlBy
}

func (LineReversePosition) TableName() string {
	return "line_reverse_position"
}

func (e *LineReversePosition) Generate() models.ActiveRecord {
	o := *e
	return &o
}

func (e *LineReversePosition) GetId() interface{} {
	return e.Id
}
