From 6ddcf993036fbfec57f29f3f789d25c34377a0cf Mon Sep 17 00:00:00 2001 From: vipg Date: Fri, 19 Dec 2025 17:33:17 +0800 Subject: [PATCH] add --- .../src/crud/create.go | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/services/cn_futures_trading_records/src/crud/create.go b/services/cn_futures_trading_records/src/crud/create.go index f528078..1450097 100644 --- a/services/cn_futures_trading_records/src/crud/create.go +++ b/services/cn_futures_trading_records/src/crud/create.go @@ -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 } /* ---------- 单条创建 ---------- */