add
This commit is contained in:
@@ -25,7 +25,6 @@ BEGIN
|
|||||||
) THEN
|
) THEN
|
||||||
CREATE TABLE cn_futures_trading_records (
|
CREATE TABLE cn_futures_trading_records (
|
||||||
id UUID DEFAULT gen_random_uuid() PRIMARY KEY, -- id
|
id UUID DEFAULT gen_random_uuid() PRIMARY KEY, -- id
|
||||||
event_type VARCHAR(40) NOT NULL, -- 事件名称
|
|
||||||
payload JSONB NOT NULL, -- 数据
|
payload JSONB NOT NULL, -- 数据
|
||||||
deleted BOOLEAN NOT NULL DEFAULT FALSE, -- 删除状态
|
deleted BOOLEAN NOT NULL DEFAULT FALSE, -- 删除状态
|
||||||
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 记录创建时间
|
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 记录创建时间
|
||||||
|
|||||||
@@ -14,12 +14,13 @@ import (
|
|||||||
|
|
||||||
/* ---------- 公共 Payload 结构体 ---------- */
|
/* ---------- 公共 Payload 结构体 ---------- */
|
||||||
type Payload struct {
|
type Payload struct {
|
||||||
|
Status int `json:"status" binding:"required,min=-1,max=1"` // 状态(-1:亏损,0:持仓中,1:盈利)
|
||||||
OpenYear int `json:"open_year" binding:"required,min=1900,max=2200"` // 开仓时间:年(1900-2200)
|
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)
|
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)
|
OpenDay int `json:"open_day" binding:"required,min=1,max=31"` // 开仓时间:日(1-31)
|
||||||
Symbol string `json:"symbol" binding:"required"` // 品种代码(如 RB、CU)
|
Symbol string `json:"symbol" binding:"required"` // 品种代码(如 RB、CU)
|
||||||
Contract string `json:"contract" binding:"required"` // 合约代码(如 2505)
|
Contract string `json:"contract" binding:"required"` // 合约代码(如 2505)
|
||||||
Direction string `json:"direction" binding:"required,oneof=long short"` // 交易方向:long 多头 / short 空头
|
Direction int `json:"direction" binding:"required,min=-1,max=1"` // 1 多头 / -1 空头
|
||||||
OpenPrice float64 `json:"open_price" binding:"required"` // 开仓价格(单位:元)
|
OpenPrice float64 `json:"open_price" binding:"required"` // 开仓价格(单位:元)
|
||||||
OpenFee float64 `json:"open_fee" binding:"required,min=0"` // 开仓手续费(≥0)
|
OpenFee float64 `json:"open_fee" binding:"required,min=0"` // 开仓手续费(≥0)
|
||||||
CloseYear int `json:"close_year" binding:"required,min=1900,max=2200"` // 平仓时间:年(1900-2200)
|
CloseYear int `json:"close_year" binding:"required,min=1900,max=2200"` // 平仓时间:年(1900-2200)
|
||||||
|
|||||||
Reference in New Issue
Block a user