Bläddra i källkod

1.增加查询今日保证金设置接口
2.任务 #382

zou.yingbin 4 år sedan
förälder
incheckning
c1bc6361c7
9 ändrade filer med 543 tillägg och 4 borttagningar
  1. 18 0
      controllers/tjmd/qryTjmd.go
  2. 116 0
      docs/docs.go
  3. 116 0
      docs/swagger.json
  4. 79 0
      docs/swagger.yaml
  5. 2 1
      models/ermcpAccMgr.go
  6. 44 0
      models/tjmd.go
  7. 153 3
      pb/mtp2.pb.go
  8. 14 0
      pb/mtp2.proto
  9. 1 0
      routers/router.go

+ 18 - 0
controllers/tjmd/qryTjmd.go

@@ -71,3 +71,21 @@ func QueryTjmdTransferApply(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataI(&m)
 }
+
+// QueryTjmdTodayAccountMargin
+// @Summary 查询今日账户保证金配置
+// @Produce json
+// @Security ApiKeyAuth
+// @Param marketid query string false "市场id"
+// @Param goodsid query string false "商品id"
+// @Param accountid query string false "资金账号"
+// @Success 200 {array} models.TjmdTodayAccountMargin
+// @Failure 500 {object} app.Response
+// @Router /Tjmd/QueryTjmdTodayAccountMargin [get]
+// @Tags 天津麦顿
+func QueryTjmdTodayAccountMargin(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.TjmdTodayAccountMargin{}
+	a.DoBindReq(&m)
+	a.DoGetDataI(&m)
+}

+ 116 - 0
docs/docs.go

@@ -10579,6 +10579,59 @@ var doc = `{
                 }
             }
         },
+        "/Tjmd/QueryTjmdTodayAccountMargin": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "天津麦顿"
+                ],
+                "summary": "查询今日账户保证金配置",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "市场id",
+                        "name": "marketid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "商品id",
+                        "name": "goodsid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "资金账号",
+                        "name": "accountid",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.TjmdTodayAccountMargin"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Tjmd/QueryTjmdTradeOrderDetail": {
             "get": {
                 "security": [
@@ -30433,6 +30486,28 @@ var doc = `{
                 }
             }
         },
+        "models.TjmdTodayAccountMargin": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "账号ID",
+                    "type": "integer"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "infoc": {
+                    "description": "配置参数",
+                    "type": "object",
+                    "$ref": "#/definitions/pb.GoodsMarginCfgStruct"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.TjmdTradeOrderDetail": {
             "type": "object",
             "properties": {
@@ -35771,6 +35846,47 @@ var doc = `{
                 }
             }
         },
+        "pb.GoodsMarginCfgStruct": {
+            "type": "object",
+            "properties": {
+                "CustomerTypeID": {
+                    "description": "投资者客户类型",
+                    "type": "integer"
+                },
+                "GoodsID": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "IsDefault": {
+                    "description": "是否默认标志位",
+                    "type": "integer"
+                },
+                "LockMarginValue": {
+                    "description": "锁仓保证金",
+                    "type": "number"
+                },
+                "MarginAlgorithm": {
+                    "description": "保证金计算方式",
+                    "type": "integer"
+                },
+                "MarketMarginValue": {
+                    "description": "即市保证金值",
+                    "type": "number"
+                },
+                "RealMarginAlgorithm": {
+                    "description": "实付保证金计算方式",
+                    "type": "integer"
+                },
+                "RealMarginValue": {
+                    "description": "实付比例",
+                    "type": "number"
+                },
+                "ReckonMarginValue": {
+                    "description": "结算保证金值",
+                    "type": "number"
+                }
+            }
+        },
         "quote.HistoryData": {
             "type": "object",
             "properties": {

+ 116 - 0
docs/swagger.json

@@ -10563,6 +10563,59 @@
                 }
             }
         },
+        "/Tjmd/QueryTjmdTodayAccountMargin": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "天津麦顿"
+                ],
+                "summary": "查询今日账户保证金配置",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "市场id",
+                        "name": "marketid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "商品id",
+                        "name": "goodsid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "资金账号",
+                        "name": "accountid",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.TjmdTodayAccountMargin"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Tjmd/QueryTjmdTradeOrderDetail": {
             "get": {
                 "security": [
@@ -30417,6 +30470,28 @@
                 }
             }
         },
+        "models.TjmdTodayAccountMargin": {
+            "type": "object",
+            "properties": {
+                "accountid": {
+                    "description": "账号ID",
+                    "type": "integer"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "infoc": {
+                    "description": "配置参数",
+                    "type": "object",
+                    "$ref": "#/definitions/pb.GoodsMarginCfgStruct"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.TjmdTradeOrderDetail": {
             "type": "object",
             "properties": {
@@ -35755,6 +35830,47 @@
                 }
             }
         },
+        "pb.GoodsMarginCfgStruct": {
+            "type": "object",
+            "properties": {
+                "CustomerTypeID": {
+                    "description": "投资者客户类型",
+                    "type": "integer"
+                },
+                "GoodsID": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "IsDefault": {
+                    "description": "是否默认标志位",
+                    "type": "integer"
+                },
+                "LockMarginValue": {
+                    "description": "锁仓保证金",
+                    "type": "number"
+                },
+                "MarginAlgorithm": {
+                    "description": "保证金计算方式",
+                    "type": "integer"
+                },
+                "MarketMarginValue": {
+                    "description": "即市保证金值",
+                    "type": "number"
+                },
+                "RealMarginAlgorithm": {
+                    "description": "实付保证金计算方式",
+                    "type": "integer"
+                },
+                "RealMarginValue": {
+                    "description": "实付比例",
+                    "type": "number"
+                },
+                "ReckonMarginValue": {
+                    "description": "结算保证金值",
+                    "type": "number"
+                }
+            }
+        },
         "quote.HistoryData": {
             "type": "object",
             "properties": {

+ 79 - 0
docs/swagger.yaml

@@ -12910,6 +12910,22 @@ definitions:
         description: 卖量(暂不做, 无值, 保留字段)
         type: number
     type: object
+  models.TjmdTodayAccountMargin:
+    properties:
+      accountid:
+        description: 账号ID
+        type: integer
+      goodsid:
+        description: 商品ID
+        type: integer
+      infoc:
+        $ref: '#/definitions/pb.GoodsMarginCfgStruct'
+        description: 配置参数
+        type: object
+      marketid:
+        description: 市场ID
+        type: integer
+    type: object
   models.TjmdTradeOrderDetail:
     properties:
       buyorsell:
@@ -16912,6 +16928,36 @@ definitions:
     required:
     - goodsid
     type: object
+  pb.GoodsMarginCfgStruct:
+    properties:
+      CustomerTypeID:
+        description: 投资者客户类型
+        type: integer
+      GoodsID:
+        description: 商品ID
+        type: integer
+      IsDefault:
+        description: 是否默认标志位
+        type: integer
+      LockMarginValue:
+        description: 锁仓保证金
+        type: number
+      MarginAlgorithm:
+        description: 保证金计算方式
+        type: integer
+      MarketMarginValue:
+        description: 即市保证金值
+        type: number
+      RealMarginAlgorithm:
+        description: 实付保证金计算方式
+        type: integer
+      RealMarginValue:
+        description: 实付比例
+        type: number
+      ReckonMarginValue:
+        description: 结算保证金值
+        type: number
+    type: object
   quote.HistoryData:
     properties:
       c:
@@ -24669,6 +24715,39 @@ paths:
       summary: 查询掉期报价列表
       tags:
       - 天津麦顿
+  /Tjmd/QueryTjmdTodayAccountMargin:
+    get:
+      parameters:
+      - description: 市场id
+        in: query
+        name: marketid
+        type: string
+      - description: 商品id
+        in: query
+        name: goodsid
+        type: string
+      - description: 资金账号
+        in: query
+        name: accountid
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.TjmdTodayAccountMargin'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询今日账户保证金配置
+      tags:
+      - 天津麦顿
   /Tjmd/QueryTjmdTradeOrderDetail:
     get:
       description: 用户类型必传, 投资者只能看到自营会员的单, 反之亦然

+ 2 - 1
models/ermcpAccMgr.go

@@ -357,7 +357,8 @@ func (r *ErmcpTaAccount) buildSql() string {
 		"  left join tradeconfigtmp k on c.traderatetmpid = k.tradeconfigtmpid" +
 		" where 1 = 1" +
 		"   and t.taaccounttype = 1"
-	sqlId.And("t.userid", r.USERID)
+	//sqlId.And("t.userid", r.USERID)
+	sqlId.JoinFormat(" and %v in(t.userid, t.relateduserid)", r.USERID)
 	return sqlId.String()
 }
 

+ 44 - 0
models/tjmd.go

@@ -9,7 +9,9 @@ package models
 
 import (
 	"fmt"
+	"github.com/golang/protobuf/proto"
 	"mtp2_if/db"
+	"mtp2_if/pb"
 	"mtp2_if/utils"
 )
 
@@ -210,3 +212,45 @@ func (r *TjmdTransferApply) GetDataEx() (interface{}, error) {
 	}
 	return sData, err
 }
+
+// TjmdTodayAccountMargin 账户保证金配置
+type TjmdTodayAccountMargin struct {
+	ACCOUNTID   int64                   `json:"accountid"  xorm:"'ACCOUNTID'" form:"accountid"` // 账号ID
+	GOODSID     int32                   `json:"goodsid"  xorm:"'GOODSID'" form:"goodsid"`       // 商品ID
+	INFOCONTENT string                  `json:"-"  xorm:"'INFOCONTENT'"`                        // 保证金信息(存储配置的Protobuffer串)
+	MARKETID    int32                   `json:"marketid"  xorm:"'MARKETID'" form:"marketid"`    // 市场ID
+	INFOC       pb.GoodsMarginCfgStruct `json:"infoc"`                                          // 配置参数
+}
+
+func (r *TjmdTodayAccountMargin) calc() {
+	if len(r.INFOCONTENT) > 0 {
+		proto.Unmarshal([]byte(r.INFOCONTENT), &r.INFOC)
+	}
+}
+
+func (r *TjmdTodayAccountMargin) buildSql() string {
+	var sqlId utils.SQLVal = `
+select *
+  from (select t.accountid,
+               t.goodsid,
+               t.infocontent,
+               t.marketid,
+               row_number() over(partition by t.goodsid, t.marketid order by t.accountid desc) cnt
+          from today_accountmargin t) a
+ where a.cnt = 1
+`
+	sqlId.AndEx("a.ACCOUNTID", r.ACCOUNTID, r.ACCOUNTID > 0)
+	sqlId.AndEx("a.GOODSID", r.GOODSID, r.GOODSID > 0)
+	sqlId.AndEx("a.MARKETID", r.MARKETID, r.MARKETID > 0)
+	return sqlId.String()
+}
+
+// GetDataEx 获取账户保证金配置
+func (r *TjmdTodayAccountMargin) GetDataEx() (interface{}, error) {
+	sData := make([]TjmdTodayAccountMargin, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}

+ 153 - 3
pb/mtp2.pb.go

@@ -909,6 +909,118 @@ func (x *ErmcpAreaExposure) GetUpdateTime() *Date {
 	return nil
 }
 
+// GoodsMarginCfgStruct 商品保证金配置
+type GoodsMarginCfgStruct struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	GoodsID             *uint32  `protobuf:"varint,1,opt,name=GoodsID" json:"GoodsID,omitempty"`                         // 商品ID
+	CustomerTypeID      *uint32  `protobuf:"varint,2,opt,name=CustomerTypeID" json:"CustomerTypeID,omitempty"`           // 投资者客户类型
+	MarginAlgorithm     *uint32  `protobuf:"varint,3,opt,name=MarginAlgorithm" json:"MarginAlgorithm,omitempty"`         // 保证金计算方式
+	MarketMarginValue   *float64 `protobuf:"fixed64,4,opt,name=MarketMarginValue" json:"MarketMarginValue,omitempty"`    // 即市保证金值
+	ReckonMarginValue   *float64 `protobuf:"fixed64,5,opt,name=ReckonMarginValue" json:"ReckonMarginValue,omitempty"`    // 结算保证金值
+	LockMarginValue     *float64 `protobuf:"fixed64,6,opt,name=LockMarginValue" json:"LockMarginValue,omitempty"`        // 锁仓保证金
+	RealMarginValue     *float64 `protobuf:"fixed64,7,opt,name=RealMarginValue" json:"RealMarginValue,omitempty"`        // 实付比例
+	RealMarginAlgorithm *uint32  `protobuf:"varint,8,opt,name=RealMarginAlgorithm" json:"RealMarginAlgorithm,omitempty"` // 实付保证金计算方式
+	IsDefault           *uint32  `protobuf:"varint,9,opt,name=IsDefault" json:"IsDefault,omitempty"`                     // 是否默认标志位
+}
+
+func (x *GoodsMarginCfgStruct) Reset() {
+	*x = GoodsMarginCfgStruct{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_mtp2_proto_msgTypes[6]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *GoodsMarginCfgStruct) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GoodsMarginCfgStruct) ProtoMessage() {}
+
+func (x *GoodsMarginCfgStruct) ProtoReflect() protoreflect.Message {
+	mi := &file_mtp2_proto_msgTypes[6]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use GoodsMarginCfgStruct.ProtoReflect.Descriptor instead.
+func (*GoodsMarginCfgStruct) Descriptor() ([]byte, []int) {
+	return file_mtp2_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *GoodsMarginCfgStruct) GetGoodsID() uint32 {
+	if x != nil && x.GoodsID != nil {
+		return *x.GoodsID
+	}
+	return 0
+}
+
+func (x *GoodsMarginCfgStruct) GetCustomerTypeID() uint32 {
+	if x != nil && x.CustomerTypeID != nil {
+		return *x.CustomerTypeID
+	}
+	return 0
+}
+
+func (x *GoodsMarginCfgStruct) GetMarginAlgorithm() uint32 {
+	if x != nil && x.MarginAlgorithm != nil {
+		return *x.MarginAlgorithm
+	}
+	return 0
+}
+
+func (x *GoodsMarginCfgStruct) GetMarketMarginValue() float64 {
+	if x != nil && x.MarketMarginValue != nil {
+		return *x.MarketMarginValue
+	}
+	return 0
+}
+
+func (x *GoodsMarginCfgStruct) GetReckonMarginValue() float64 {
+	if x != nil && x.ReckonMarginValue != nil {
+		return *x.ReckonMarginValue
+	}
+	return 0
+}
+
+func (x *GoodsMarginCfgStruct) GetLockMarginValue() float64 {
+	if x != nil && x.LockMarginValue != nil {
+		return *x.LockMarginValue
+	}
+	return 0
+}
+
+func (x *GoodsMarginCfgStruct) GetRealMarginValue() float64 {
+	if x != nil && x.RealMarginValue != nil {
+		return *x.RealMarginValue
+	}
+	return 0
+}
+
+func (x *GoodsMarginCfgStruct) GetRealMarginAlgorithm() uint32 {
+	if x != nil && x.RealMarginAlgorithm != nil {
+		return *x.RealMarginAlgorithm
+	}
+	return 0
+}
+
+func (x *GoodsMarginCfgStruct) GetIsDefault() uint32 {
+	if x != nil && x.IsDefault != nil {
+		return *x.IsDefault
+	}
+	return 0
+}
+
 var File_mtp2_proto protoreflect.FileDescriptor
 
 var file_mtp2_proto_rawDesc = []byte{
@@ -1098,7 +1210,32 @@ var file_mtp2_proto_rawDesc = []byte{
 	0x20, 0x01, 0x28, 0x01, 0x52, 0x0e, 0x4e, 0x65, 0x65, 0x64, 0x48, 0x65, 0x64, 0x67, 0x65, 0x52,
 	0x61, 0x74, 0x69, 0x6f, 0x12, 0x28, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69,
 	0x6d, 0x65, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x61,
-	0x74, 0x65, 0x52, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65,
+	0x74, 0x65, 0x52, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x82,
+	0x03, 0x0a, 0x14, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x43, 0x66,
+	0x67, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x47, 0x6f, 0x6f, 0x64, 0x73,
+	0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x49,
+	0x44, 0x12, 0x26, 0x0a, 0x0e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x54, 0x79, 0x70,
+	0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x43, 0x75, 0x73, 0x74, 0x6f,
+	0x6d, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x49, 0x44, 0x12, 0x28, 0x0a, 0x0f, 0x4d, 0x61, 0x72,
+	0x67, 0x69, 0x6e, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x03, 0x20, 0x01,
+	0x28, 0x0d, 0x52, 0x0f, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69,
+	0x74, 0x68, 0x6d, 0x12, 0x2c, 0x0a, 0x11, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x72,
+	0x67, 0x69, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x11,
+	0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x56, 0x61, 0x6c, 0x75,
+	0x65, 0x12, 0x2c, 0x0a, 0x11, 0x52, 0x65, 0x63, 0x6b, 0x6f, 0x6e, 0x4d, 0x61, 0x72, 0x67, 0x69,
+	0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x52, 0x11, 0x52, 0x65,
+	0x63, 0x6b, 0x6f, 0x6e, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12,
+	0x28, 0x0a, 0x0f, 0x4c, 0x6f, 0x63, 0x6b, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x56, 0x61, 0x6c,
+	0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0f, 0x4c, 0x6f, 0x63, 0x6b, 0x4d, 0x61,
+	0x72, 0x67, 0x69, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x52, 0x65, 0x61,
+	0x6c, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01,
+	0x28, 0x01, 0x52, 0x0f, 0x52, 0x65, 0x61, 0x6c, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x56, 0x61,
+	0x6c, 0x75, 0x65, 0x12, 0x30, 0x0a, 0x13, 0x52, 0x65, 0x61, 0x6c, 0x4d, 0x61, 0x72, 0x67, 0x69,
+	0x6e, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d,
+	0x52, 0x13, 0x52, 0x65, 0x61, 0x6c, 0x4d, 0x61, 0x72, 0x67, 0x69, 0x6e, 0x41, 0x6c, 0x67, 0x6f,
+	0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x49, 0x73, 0x44, 0x65, 0x66, 0x61, 0x75,
+	0x6c, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x49, 0x73, 0x44, 0x65, 0x66, 0x61,
+	0x75, 0x6c, 0x74,
 }
 
 var (
@@ -1113,7 +1250,7 @@ func file_mtp2_proto_rawDescGZIP() []byte {
 	return file_mtp2_proto_rawDescData
 }
 
-var file_mtp2_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
+var file_mtp2_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
 var file_mtp2_proto_goTypes = []interface{}{
 	(*TradeRule)(nil),              // 0: pb.TradeRule
 	(*TradeRuleInfoStruct)(nil),    // 1: pb.TradeRuleInfoStruct
@@ -1121,6 +1258,7 @@ var file_mtp2_proto_goTypes = []interface{}{
 	(*Erms2ArbitrageStrategy)(nil), // 3: pb.Erms2ArbitrageStrategy
 	(*ErmcpAreaSpot)(nil),          // 4: pb.ErmcpAreaSpot
 	(*ErmcpAreaExposure)(nil),      // 5: pb.ErmcpAreaExposure
+	(*GoodsMarginCfgStruct)(nil),   // 6: pb.GoodsMarginCfgStruct
 }
 var file_mtp2_proto_depIdxs = []int32{
 	0, // 0: pb.TradeRuleInfoStruct.TradeRules:type_name -> pb.TradeRule
@@ -1212,6 +1350,18 @@ func file_mtp2_proto_init() {
 				return nil
 			}
 		}
+		file_mtp2_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*GoodsMarginCfgStruct); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
 	}
 	type x struct{}
 	out := protoimpl.TypeBuilder{
@@ -1219,7 +1369,7 @@ func file_mtp2_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_mtp2_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   6,
+			NumMessages:   7,
 			NumExtensions: 0,
 			NumServices:   0,
 		},

+ 14 - 0
pb/mtp2.proto

@@ -111,4 +111,18 @@ message ErmcpAreaExposure
   optional double NeedHedgeExposoure = 20;    // 应套保敞口
   optional double NeedHedgeRatio = 21;    // 应套保比率
   optional Date UpdateTime = 22;    // 更新时间
+}
+
+// GoodsMarginCfgStruct 商品保证金配置
+message GoodsMarginCfgStruct
+{
+    optional uint32 GoodsID = 1;                  // 商品ID
+    optional uint32 CustomerTypeID = 2;           // 投资者客户类型
+    optional uint32 MarginAlgorithm = 3;          // 保证金计算方式
+    optional double MarketMarginValue = 4;        // 即市保证金值
+    optional double ReckonMarginValue = 5;        // 结算保证金值
+    optional double LockMarginValue = 6;          // 锁仓保证金
+    optional double RealMarginValue = 7;          // 实付比例
+    optional uint32 RealMarginAlgorithm = 8;      // 实付保证金计算方式
+    optional uint32 IsDefault = 9;                // 是否默认标志位
 }

+ 1 - 0
routers/router.go

@@ -566,6 +566,7 @@ func InitRouter() *gin.Engine {
 		tjmdR.GET("QueryQuoteGoodsList", tjmd.QueryQuoteGoodsList)
 		tjmdR.GET("QueryTjmdTradeOrderDetail", tjmd.QueryTjmdTradeOrderDetail)
 		tjmdR.GET("QueryTjmdTransferApply", tjmd.QueryTjmdTransferApply)
+		tjmdR.GET("QueryTjmdTodayAccountMargin", tjmd.QueryTjmdTodayAccountMargin)
 	}
 
 	return r