add
This commit is contained in:
@@ -14,25 +14,25 @@ import (
|
||||
|
||||
/* ---------- 公共 Payload 结构体 ---------- */
|
||||
type Payload struct {
|
||||
OpenYear int `json:"open_year" binding:"required,min=1900,max=2200"`
|
||||
OpenMonth int `json:"open_month" binding:"required,min=1,max=12"`
|
||||
OpenDay int `json:"open_day" binding:"required,min=1,max=31"`
|
||||
Symbol string `json:"symbol" binding:"required"`
|
||||
Contract string `json:"contract" binding:"required"`
|
||||
Direction string `json:"direction" binding:"required,oneof=long short"`
|
||||
OpenPrice float64 `json:"open_price" binding:"required"`
|
||||
OpenFee float64 `json:"open_fee" binding:"required,min=0"`
|
||||
CloseYear int `json:"close_year" binding:"required,min=1900,max=2200"`
|
||||
CloseMonth int `json:"close_month" binding:"required,min=1,max=12"`
|
||||
CloseDay int `json:"close_day" binding:"required,min=1,max=31"`
|
||||
ClosePrice float64 `json:"close_price" binding:"required"`
|
||||
CloseFee float64 `json:"close_fee" binding:"required,min=0"`
|
||||
PriceDiff float64 `json:"price_diff" binding:"required"`
|
||||
MinTick float64 `json:"min_tick" binding:"required"`
|
||||
TickPrice float64 `json:"tick_price" binding:"required"`
|
||||
DiffPnL float64 `json:"diff_pnl" binding:"required"`
|
||||
TotalFee float64 `json:"total_fee" binding:"required,min=0"`
|
||||
ClosePnL float64 `json:"close_pnl" binding:"required"`
|
||||
OpenYear int `json:"open_year" binding:"required,min=1900,max=2200"` // 开仓时间:年(1900-2200)
|
||||
OpenMonth int `json:"open_month" binding:"required,min=1,max=12"` // 开仓时间:月(1-12)
|
||||
OpenDay int `json:"open_day" binding:"required,min=1,max=31"` // 开仓时间:日(1-31)
|
||||
Symbol string `json:"symbol" binding:"required"` // 品种代码(如 RB、CU)
|
||||
Contract string `json:"contract" binding:"required"` // 合约代码(如 2505)
|
||||
Direction string `json:"direction" binding:"required,oneof=long short"` // 交易方向:long 多头 / short 空头
|
||||
OpenPrice float64 `json:"open_price" binding:"required"` // 开仓价格(单位:元)
|
||||
OpenFee float64 `json:"open_fee" binding:"required,min=0"` // 开仓手续费(≥0)
|
||||
CloseYear int `json:"close_year" binding:"required,min=1900,max=2200"` // 平仓时间:年(1900-2200)
|
||||
CloseMonth int `json:"close_month" binding:"required,min=1,max=12"` // 平仓时间:月(1-12)
|
||||
CloseDay int `json:"close_day" binding:"required,min=1,max=31"` // 平仓时间:日(1-31)
|
||||
ClosePrice float64 `json:"close_price" binding:"required"` // 平仓价格(单位:元)
|
||||
CloseFee float64 `json:"close_fee" binding:"required,min=0"` // 平仓手续费(≥0)
|
||||
PriceDiff float64 `json:"price_diff" binding:"required"` // 平仓差价 = ClosePrice - OpenPrice
|
||||
MinTick float64 `json:"min_tick" binding:"required"` // 品种最小跳点(如 1)
|
||||
TickPrice float64 `json:"tick_price" binding:"required"` // 每跳价格(如 10 元)
|
||||
DiffPnL float64 `json:"diff_pnl" binding:"required"` // 差价盈亏(已考虑方向与跳点)
|
||||
TotalFee float64 `json:"total_fee" binding:"required,min=0"` // 手续费合计 = OpenFee + CloseFee(≥0)
|
||||
ClosePnL float64 `json:"close_pnl" binding:"required"` // 平仓净盈亏 = DiffPnL - TotalFee
|
||||
}
|
||||
|
||||
/* ---------- 单条创建 ---------- */
|
||||
|
||||
Reference in New Issue
Block a user