Browse Source

增加业务管理-基差贸易查询接口

zhou.yingan 5 năm trước cách đây
mục cha
commit
c12ee85360
9 tập tin đã thay đổi với 1167 bổ sung57 xóa
  1. 1 1
      config/config.xml
  2. 118 0
      docs/docs.go
  3. 118 0
      docs/swagger.json
  4. 82 0
      docs/swagger.yaml
  5. 183 44
      models/erms2.go
  6. 75 0
      models/erms3.go
  7. 536 11
      pb/mtp2.pb.go
  8. 52 1
      pb/mtp2.proto
  9. 2 0
      routers/router.go

+ 1 - 1
config/config.xml

@@ -16,7 +16,7 @@
         <DbAddress value="192.168.31.117"/>
         <DbName    value="orcl"/>
         <DbPort    value="1521"/>
-        <DbUser    value="mtp2_test82"/>
+        <DbUser    value="mtp2_test104"/>
         <DbPwd     value="muchinfo"/>
     </DbSetting>
 

+ 118 - 0
docs/docs.go

@@ -871,6 +871,55 @@ var doc = `{
                 }
             }
         },
+        "/Erms3/QueryBusinessInfo": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "风险管理v3"
+                ],
+                "summary": "查询业务表单数据",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "资金账号ID列表,用逗号分隔",
+                        "name": "accountids",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "状态,0为未结束 1为已结束",
+                        "name": "status",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/erms3.QueryBusinessInfoRsp"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Erms3/QueryPendingAuditContract": {
             "get": {
                 "security": [
@@ -5141,6 +5190,75 @@ var doc = `{
                 }
             }
         },
+        "erms3.QueryBusinessInfoRsp": {
+            "type": "object",
+            "properties": {
+                "businessid": {
+                    "description": "业务ID.",
+                    "type": "integer"
+                },
+                "buyamount": {
+                    "description": "采购额.",
+                    "type": "number"
+                },
+                "buyqty": {
+                    "description": "采购量.",
+                    "type": "string"
+                },
+                "futurepl": {
+                    "description": "期货盈亏.",
+                    "type": "number"
+                },
+                "futureqty": {
+                    "description": "期货敞口.",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品名称/商品代码.",
+                    "type": "string"
+                },
+                "hedgingqty": {
+                    "description": "套保量.",
+                    "type": "string"
+                },
+                "sellamount": {
+                    "description": "销售额.",
+                    "type": "number"
+                },
+                "sellqty": {
+                    "description": "销售量.",
+                    "type": "string"
+                },
+                "spotmarketvalue": {
+                    "description": "现货市值.",
+                    "type": "number"
+                },
+                "spotpl": {
+                    "description": "浮动权益.",
+                    "type": "number"
+                },
+                "spotqty": {
+                    "description": "现货量.",
+                    "type": "string"
+                },
+                "statu": {
+                    "description": "状态,0-未结束 1-已结束.",
+                    "type": "integer"
+                },
+                "totalpl": {
+                    "description": "总盈亏.",
+                    "type": "number"
+                },
+                "totalqty": {
+                    "description": "总敞口.",
+                    "type": "string"
+                },
+                "type": {
+                    "description": "业务类型,1-期现套利,2-仓单回购,3-现货贸易.",
+                    "type": "integer"
+                }
+            }
+        },
         "erms3.QuerySpotContractAppleFormRsp": {
             "type": "object",
             "properties": {

+ 118 - 0
docs/swagger.json

@@ -855,6 +855,55 @@
                 }
             }
         },
+        "/Erms3/QueryBusinessInfo": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "风险管理v3"
+                ],
+                "summary": "查询业务表单数据",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "资金账号ID列表,用逗号分隔",
+                        "name": "accountids",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "状态,0为未结束 1为已结束",
+                        "name": "status",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/erms3.QueryBusinessInfoRsp"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Erms3/QueryPendingAuditContract": {
             "get": {
                 "security": [
@@ -5125,6 +5174,75 @@
                 }
             }
         },
+        "erms3.QueryBusinessInfoRsp": {
+            "type": "object",
+            "properties": {
+                "businessid": {
+                    "description": "业务ID.",
+                    "type": "integer"
+                },
+                "buyamount": {
+                    "description": "采购额.",
+                    "type": "number"
+                },
+                "buyqty": {
+                    "description": "采购量.",
+                    "type": "string"
+                },
+                "futurepl": {
+                    "description": "期货盈亏.",
+                    "type": "number"
+                },
+                "futureqty": {
+                    "description": "期货敞口.",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品名称/商品代码.",
+                    "type": "string"
+                },
+                "hedgingqty": {
+                    "description": "套保量.",
+                    "type": "string"
+                },
+                "sellamount": {
+                    "description": "销售额.",
+                    "type": "number"
+                },
+                "sellqty": {
+                    "description": "销售量.",
+                    "type": "string"
+                },
+                "spotmarketvalue": {
+                    "description": "现货市值.",
+                    "type": "number"
+                },
+                "spotpl": {
+                    "description": "浮动权益.",
+                    "type": "number"
+                },
+                "spotqty": {
+                    "description": "现货量.",
+                    "type": "string"
+                },
+                "statu": {
+                    "description": "状态,0-未结束 1-已结束.",
+                    "type": "integer"
+                },
+                "totalpl": {
+                    "description": "总盈亏.",
+                    "type": "number"
+                },
+                "totalqty": {
+                    "description": "总敞口.",
+                    "type": "string"
+                },
+                "type": {
+                    "description": "业务类型,1-期现套利,2-仓单回购,3-现货贸易.",
+                    "type": "integer"
+                }
+            }
+        },
         "erms3.QuerySpotContractAppleFormRsp": {
             "type": "object",
             "properties": {

+ 82 - 0
docs/swagger.yaml

@@ -1566,6 +1566,57 @@ definitions:
     - matchcustomername
     - spotcontractid
     type: object
+  erms3.QueryBusinessInfoRsp:
+    properties:
+      businessid:
+        description: 业务ID.
+        type: integer
+      buyamount:
+        description: 采购额.
+        type: number
+      buyqty:
+        description: 采购量.
+        type: string
+      futurepl:
+        description: 期货盈亏.
+        type: number
+      futureqty:
+        description: 期货敞口.
+        type: string
+      goodsid:
+        description: 商品名称/商品代码.
+        type: string
+      hedgingqty:
+        description: 套保量.
+        type: string
+      sellamount:
+        description: 销售额.
+        type: number
+      sellqty:
+        description: 销售量.
+        type: string
+      spotmarketvalue:
+        description: 现货市值.
+        type: number
+      spotpl:
+        description: 浮动权益.
+        type: number
+      spotqty:
+        description: 现货量.
+        type: string
+      statu:
+        description: 状态,0-未结束 1-已结束.
+        type: integer
+      totalpl:
+        description: 总盈亏.
+        type: number
+      totalqty:
+        description: 总敞口.
+        type: string
+      type:
+        description: 业务类型,1-期现套利,2-仓单回购,3-现货贸易.
+        type: integer
+    type: object
   erms3.QuerySpotContractAppleFormRsp:
     properties:
       goodses:
@@ -5073,6 +5124,37 @@ paths:
       summary: 新增客户申请
       tags:
       - 风险管理v3
+  /Erms3/QueryBusinessInfo:
+    get:
+      parameters:
+      - description: 资金账号ID列表,用逗号分隔
+        in: query
+        name: accountids
+        required: true
+        type: string
+      - description: 状态,0为未结束 1为已结束
+        in: query
+        name: status
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/erms3.QueryBusinessInfoRsp'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询业务表单数据
+      tags:
+      - 风险管理v3
   /Erms3/QueryPendingAuditContract:
     get:
       parameters:

+ 183 - 44
models/erms2.go

@@ -1,7 +1,10 @@
 // Package models 211.2风险管理系统2020_期现套利
 package models
 
-import "time"
+import (
+	"mtp2_if/db"
+	"time"
+)
 
 // Hedgeinnertradedetail 对冲内部成交单表 - 导历史
 type Hedgeinnertradedetail struct {
@@ -82,52 +85,131 @@ func (Erms2astradedetails) TableName() string {
 	return "ERMS2_ASTRADEDETAILS"
 }
 
-// Erms2arbitragestrategy 期现套利策略表 - 导历史
-type Erms2arbitragestrategy struct {
-	Asapplyid          int64     `json:"asapplyid"  xorm:"'ASAPPLYID'" binding:"required"` // 策略申请ID(702+Unix秒时间戳(10位)+xxxxxx)
-	Asno               string    `json:"asno"  xorm:"'ASNO'"`                              // 策略编号
-	Biztype            int64     `json:"biztype"  xorm:"'BIZTYPE'"`                        // 业务类型 - 1:正向套利 -1:反向套利
-	Userid             int64     `json:"userid"  xorm:"'USERID'"`                          // 所属机构
-	Deliverygoodsid    int64     `json:"deliverygoodsid"  xorm:"'DELIVERYGOODSID'"`        // 现货品种ID
-	Goodsgroupid       int64     `json:"goodsgroupid"  xorm:"'GOODSGROUPID'"`              // 期货品种ID
-	Spotquota          float64   `json:"spotquota"  xorm:"'SPOTQUOTA'"`                    // 现货额度
-	Futurequote        float64   `json:"futurequote"  xorm:"'FUTUREQUOTE'"`                // 期货额度
-	Applybasis         float64   `json:"applybasis"  xorm:"'APPLYBASIS'"`                  // 申请基差
-	Strategystatus     int64     `json:"strategystatus"  xorm:"'STRATEGYSTATUS'"`          // 策略状态 - 0:未结束 1:已结束
-	Remark             string    `json:"remark"  xorm:"'REMARK'"`                          // 备注
-	Marketid           int64     `json:"marketid"  xorm:"'MARKETID'"`                      // 市场ID
-	Tradedate          string    `json:"tradedate"  xorm:"'TRADEDATE'"`                    // 交易日(yyyyMMdd)
-	Closetradedate     string    `json:"closetradedate"  xorm:"'CLOSETRADEDATE'"`          // 完结交易日(yyyyMMdd)
-	Usedquota          float64   `json:"usedquota"  xorm:"'USEDQUOTA'"`                    // 已占用资金
-	Futureqty          float64   `json:"futureqty"  xorm:"'FUTUREQTY'"`                    // 期货持仓数量
-	Futureavgprice     float64   `json:"futureavgprice"  xorm:"'FUTUREAVGPRICE'"`          // 期货建仓均价
-	Futurepl           float64   `json:"futurepl"  xorm:"'FUTUREPL'"`                      // 期货总盈亏[结算更新]
-	Pricedspotqty      float64   `json:"pricedspotqty"  xorm:"'PRICEDSPOTQTY'"`            // 已定价现货数量
-	Pricedspotqtynotax float64   `json:"pricedspotqtynotax"  xorm:"'PRICEDSPOTQTYNOTAX'"`  // 已定价现货不含税数量
-	Spotavgprice       float64   `json:"spotavgprice"  xorm:"'SPOTAVGPRICE'"`              // 现货均价
-	Spotpl             float64   `json:"spotpl"  xorm:"'SPOTPL'"`                          // 现货总盈亏[结算更新]
-	Netexposure        float64   `json:"netexposure"  xorm:"'NETEXPOSURE'"`                // 单笔业务头寸净敞口 = 期货持仓数量 + 已定价现货不含税数量
-	Netexposurerate    float64   `json:"netexposurerate"  xorm:"'NETEXPOSURERATE'"`        // 净敞口比例 - 0:未结束 =  (NetExposure/PriceSpotQtyNoTax) ; 已结束为0
-	Totalpl            float64   `json:"totalpl"  xorm:"'TOTALPL'"`                        // 业务合计损益 = FuturePL + SpotPL [结算更新]
-	Openbasis          float64   `json:"openbasis"  xorm:"'OPENBASIS'"`                    // 建仓基差
-	Curbasis           float64   `json:"curbasis"  xorm:"'CURBASIS'"`                      // 当前基差[结算更新]
-	Basischangepl      float64   `json:"basischangepl"  xorm:"'BASISCHANGEPL'"`            // 基差变动损益[结算更新]
-	Netexposurepl      float64   `json:"netexposurepl"  xorm:"'NETEXPOSUREPL'"`            // 净敞口损益 = TotalPL - BasisChangePL[结算更新]
-	Spotusedquota      float64   `json:"spotusedquota"  xorm:"'SPOTUSEDQUOTA'"`            // 现货占用资金
-	Futureopenqty      float64   `json:"futureopenqty"  xorm:"'FUTUREOPENQTY'"`            // 期货开仓数量
-	Futureopenamount   float64   `json:"futureopenamount"  xorm:"'FUTUREOPENAMOUNT'"`      // 期货开仓金额
-	Futurecloseqty     float64   `json:"futurecloseqty"  xorm:"'FUTURECLOSEQTY'"`          // 期货平仓数量
-	Futurecloseamount  float64   `json:"futurecloseamount"  xorm:"'FUTURECLOSEAMOUNT'"`    // 期货平仓金额
-	Spotbuyamount      float64   `json:"spotbuyamount"  xorm:"'SPOTBUYAMOUNT'"`            // 现货采购金额
-	Spotbuyqty         float64   `json:"spotbuyqty"  xorm:"'SPOTBUYQTY'"`                  // 现货采购数量
-	Spotsellamount     float64   `json:"spotsellamount"  xorm:"'SPOTSELLAMOUNT'"`          // 现货销售金额
-	Spotsellqty        float64   `json:"spotsellqty"  xorm:"'SPOTSELLQTY'"`                // 现货销售数量
-	Updatetime         time.Time `json:"updatetime"  xorm:"'UPDATETIME'"`                  // 更新时间
-	Asname             string    `json:"asname"  xorm:"'ASNAME'"`                          // 策略名称
+// Erms2Wrrcontract 仓单回购业务表
+type Erms2Wrrcontract struct {
+	Wrrcontractid         int64     `json:"wrrcontractid" xorm:"WRRCONTRACTID"`                 // 回购业务ID(343&#43;Unix秒时间戳(10位)&#43;xxxxxx)
+	Wrrcontractno         string    `json:"wrrcontractno" xorm:"WRRCONTRACTNO"`                 // 回购业务编号
+	Wrrcontractname       string    `json:"wrrcontractname" xorm:"WRRCONTRACTNAME"`             // 回购名称
+	Areauserid            int64     `json:"areauserid" xorm:"AREAUSERID"`                       // 所属机构
+	Deliverygoodsid       int64     `json:"deliverygoodsid" xorm:"DELIVERYGOODSID"`             // 现货品种ID
+	Wrstandardid          int64     `json:"wrstandardid" xorm:"WRSTANDARDID"`                   // 仓单标准ID
+	Wrfactortypeid        int64     `json:"wrfactortypeid" xorm:"WRFACTORTYPEID"`               // 仓单要素类型ID
+	Accountid             int64     `json:"accountid" xorm:"ACCOUNTID"`                         // 现货账户
+	Contractqtychar       string    `json:"contractqtychar" xorm:"CONTRACTQTYCHAR"`             // 合同数量(显示)
+	Contractqty           float64   `json:"contractqty" xorm:"CONTRACTQTY"`                     // 合同数量
+	Contractprice         float64   `json:"contractprice" xorm:"CONTRACTPRICE"`                 // 合同价格
+	Contractamount        float64   `json:"contractamount" xorm:"CONTRACTAMOUNT"`               // 合同金额
+	Interestratemode      int32     `json:"interestratemode" xorm:"INTERESTRATEMODE"`           // 利率方式 - 1:年利率 2:日利率
+	Interestrate          float64   `json:"interestrate" xorm:"INTERESTRATE"`                   // 利率
+	Interestmindays       int64     `json:"interestmindays" xorm:"INTERESTMINDAYS"`             // 最小计息天数
+	Contractinterest      float64   `json:"contractinterest" xorm:"CONTRACTINTEREST"`           // 合同利息
+	Orimargin             float64   `json:"orimargin" xorm:"ORIMARGIN"`                         // 初始保证金
+	Marginrate            float64   `json:"marginrate" xorm:"MARGINRATE"`                       // 保证金率
+	Begindate             time.Time `json:"begindate" xorm:"BEGINDATE"`                         // 开始日期
+	Enddate               time.Time `json:"enddate" xorm:"ENDDATE"`                             // 结束日期
+	Warningline           float64   `json:"warningline" xorm:"WARNINGLINE"`                     // 预警线
+	Closeline             float64   `json:"closeline" xorm:"CLOSELINE"`                         // 强平线
+	Customeruserid        int64     `json:"customeruserid" xorm:"CUSTOMERUSERID"`               // 回购客户ID
+	Customeraccountid     int64     `json:"customeraccountid" xorm:"CUSTOMERACCOUNTID"`         // 客户资金账户ID
+	Curqty                float64   `json:"curqty" xorm:"CURQTY"`                               // 当前数量
+	Curamount             float64   `json:"curamount" xorm:"CURAMOUNT"`                         // 当前金额
+	Curinterest           float64   `json:"curinterest" xorm:"CURINTEREST"`                     // 当前利息
+	Curmargin             float64   `json:"curmargin" xorm:"CURMARGIN"`                         // 当前保证金
+	Addedmargin           float64   `json:"addedmargin" xorm:"ADDEDMARGIN"`                     // 已追加保证金
+	Curenddate            time.Time `json:"curenddate" xorm:"CURENDDATE"`                       // 最新结束日期(默认为结束日期)
+	Remark                string    `json:"remark" xorm:"REMARK"`                               // 备注
+	Marketid              int64     `json:"marketid" xorm:"MARKETID"`                           // 市场ID
+	Tradedate             string    `json:"tradedate" xorm:"TRADEDATE"`                         // 交易日(yyyyMMdd)
+	Updatetime            time.Time `json:"updatetime" xorm:"UPDATETIME"`                       // 更新时间
+	Relatedspotcontractid int64     `json:"relatedspotcontractid" xorm:"RELATEDSPOTCONTRACTID"` // 关联销售合同ID
+	Handlestatus          int32     `json:"handlestatus" xorm:"HANDLESTATUS"`                   // 处理状态
+	Contractstatus        int32     `json:"contractstatus" xorm:"CONTRACTSTATUS"`               // 合同状态 -  0:未结束 1:已结束
+	Closetradedate        string    `json:"closetradedate" xorm:"CLOSETRADEDATE"`               // 完结交易日(yyyyMMdd)
+}
+
+// TableName is ERMS2_WRRCONTRACT
+func (Erms2Wrrcontract) TableName() string {
+	return "ERMS2_WRRCONTRACT"
+}
+
+// Erms2Spottradebiz 现货贸易业务表
+type Erms2Spottradebiz struct {
+	Spottradeid        int64   `json:"spottradeid" xorm:"SPOTTRADEID"`               // 业务ID(341&#43;Unix秒时间戳(10位)&#43;xxxxxx)
+	Spottradeno        string  `json:"spottradeno" xorm:"SPOTTRADENO"`               // 业务编号
+	Spottradename      string  `json:"spottradename" xorm:"SPOTTRADENAME"`           // 业务名称
+	Areauserid         int64   `json:"areauserid" xorm:"AREAUSERID"`                 // 所属机构
+	Deliverygoodsid    int64   `json:"deliverygoodsid" xorm:"DELIVERYGOODSID"`       // 现货品种ID
+	Wrstandardid       int64   `json:"wrstandardid" xorm:"WRSTANDARDID"`             // 仓单标准ID
+	Goodsgroupid       int64   `json:"goodsgroupid" xorm:"GOODSGROUPID"`             // 期货品种
+	Spotaccountid      int64   `json:"spotaccountid" xorm:"SPOTACCOUNTID"`           // 现货资金账户
+	Futureaccountid    int64   `json:"futureaccountid" xorm:"FUTUREACCOUNTID"`       // 期货资金账户
+	Remark             string  `json:"remark" xorm:"REMARK"`                         // 备注
+	Marketid           int64   `json:"marketid" xorm:"MARKETID"`                     // 市场ID
+	Tradedate          string  `json:"tradedate" xorm:"TRADEDATE"`                   // 交易日(yyyyMMdd)
+	Buyqty             float64 `json:"buyqty" xorm:"BUYQTY"`                         // 采购总量
+	Buyamount          float64 `json:"buyamount" xorm:"BUYAMOUNT"`                   // 采购总金额
+	Buydeliveryqty     float64 `json:"buydeliveryqty" xorm:"BUYDELIVERYQTY"`         // 采购已交收数量
+	Buydeliveryamount  float64 `json:"buydeliveryamount" xorm:"BUYDELIVERYAMOUNT"`   // 采购已交收金额
+	Sellqty            float64 `json:"sellqty" xorm:"SELLQTY"`                       // 销售总量
+	Sellamount         float64 `json:"sellamount" xorm:"SELLAMOUNT"`                 // 销售总金额
+	Selldeliveryqty    float64 `json:"selldeliveryqty" xorm:"SELLDELIVERYQTY"`       // 销售已交收数量
+	Selldeliveryamount float64 `json:"selldeliveryamount" xorm:"SELLDELIVERYAMOUNT"` // 销售已交收金额
+	Futurelot          float64 `json:"futurelot" xorm:"FUTURELOT"`                   // 期货手数
+	Closestatus        int32   `json:"closestatus" xorm:"CLOSESTATUS"`               // 完结状态 - 0:未完结 1:已完结
+	Closetradedate     string  `json:"closetradedate" xorm:"CLOSETRADEDATE"`         // 完结交易日(yyyyMMdd)
+}
+
+// TableName is ERMS2_SPOTTRADEBIZ
+func (Erms2Spottradebiz) TableName() string {
+	return "ERMS2_SPOTTRADEBIZ"
+}
+
+// Erms2Arbitragestrategy 期现套利业务表
+type Erms2Arbitragestrategy struct {
+	Asapplyid          int64     `json:"asapplyid" xorm:"ASAPPLYID"`                   // 策略申请ID(342&#43;Unix秒时间戳(10位)&#43;xxxxxx)
+	Asno               string    `json:"asno" xorm:"ASNO"`                             // 策略编号
+	Asname             string    `json:"asname" xorm:"ASNAME"`                         // 策略名称
+	Biztype            int32     `json:"biztype" xorm:"BIZTYPE"`                       // 业务类型 - 1:正向套利 -1:反向套利
+	Userid             int64     `json:"userid" xorm:"USERID"`                         // 所属机构
+	Deliverygoodsid    int64     `json:"deliverygoodsid" xorm:"DELIVERYGOODSID"`       // 现货品种ID
+	Goodsgroupid       int64     `json:"goodsgroupid" xorm:"GOODSGROUPID"`             // 期货品种ID
+	Spotquota          float64   `json:"spotquota" xorm:"SPOTQUOTA"`                   // 现货额度
+	Futurequote        float64   `json:"futurequote" xorm:"FUTUREQUOTE"`               // 期货额度
+	Applybasis         float64   `json:"applybasis" xorm:"APPLYBASIS"`                 // 申请基差
+	Strategystatus     int32     `json:"strategystatus" xorm:"STRATEGYSTATUS"`         // 策略状态 - 0:未结束 1:已结束
+	Remark             string    `json:"remark" xorm:"REMARK"`                         // 备注
+	Marketid           int64     `json:"marketid" xorm:"MARKETID"`                     // 市场ID
+	Tradedate          string    `json:"tradedate" xorm:"TRADEDATE"`                   // 交易日(yyyyMMdd)
+	Closetradedate     string    `json:"closetradedate" xorm:"CLOSETRADEDATE"`         // 完结交易日(yyyyMMdd)
+	Usedquota          float64   `json:"usedquota" xorm:"USEDQUOTA"`                   // 期货已占用资金[结算更新]
+	Futureqty          float64   `json:"futureqty" xorm:"FUTUREQTY"`                   // 期货持仓数量
+	Futureavgprice     float64   `json:"futureavgprice" xorm:"FUTUREAVGPRICE"`         // 期货建仓均价
+	Futurepl           float64   `json:"futurepl" xorm:"FUTUREPL"`                     // 期货总盈亏[结算更新]
+	Pricedspotqty      float64   `json:"pricedspotqty" xorm:"PRICEDSPOTQTY"`           // 已定价现货数量
+	Pricedspotqtynotax float64   `json:"pricedspotqtynotax" xorm:"PRICEDSPOTQTYNOTAX"` // 已定价现货不含税数量
+	Spotavgprice       float64   `json:"spotavgprice" xorm:"SPOTAVGPRICE"`             // 现货均价
+	Spotpl             float64   `json:"spotpl" xorm:"SPOTPL"`                         // 现货总盈亏[结算更新]
+	Netexposure        float64   `json:"netexposure" xorm:"NETEXPOSURE"`               // 单笔业务头寸净敞口 = 期货持仓数量 &#43; 已定价现货不含税数量
+	Netexposurerate    float64   `json:"netexposurerate" xorm:"NETEXPOSURERATE"`       // 净敞口比例 - 0:未结束 =  (NetExposure/PriceSpotQtyNoTax) ; 已结束为0
+	Totalpl            float64   `json:"totalpl" xorm:"TOTALPL"`                       // 业务合计损益 = FuturePL &#43; SpotPL [结算更新]
+	Openbasis          float64   `json:"openbasis" xorm:"OPENBASIS"`                   // 建仓基差
+	Curbasis           float64   `json:"curbasis" xorm:"CURBASIS"`                     // 当前基差[结算更新]
+	Basischangepl      float64   `json:"basischangepl" xorm:"BASISCHANGEPL"`           // 基差变动损益[结算更新]
+	Netexposurepl      float64   `json:"netexposurepl" xorm:"NETEXPOSUREPL"`           // 净敞口损益 = TotalPL - BasisChangePL[结算更新]
+	Spotusedquota      float64   `json:"spotusedquota" xorm:"SPOTUSEDQUOTA"`           // 现货占用资金
+	Futureopenqty      float64   `json:"futureopenqty" xorm:"FUTUREOPENQTY"`           // 期货开仓数量
+	Futureopenamount   float64   `json:"futureopenamount" xorm:"FUTUREOPENAMOUNT"`     // 期货开仓金额
+	Futurecloseqty     float64   `json:"futurecloseqty" xorm:"FUTURECLOSEQTY"`         // 期货平仓数量
+	Futurecloseamount  float64   `json:"futurecloseamount" xorm:"FUTURECLOSEAMOUNT"`   // 期货平仓金额
+	Spotbuyamount      float64   `json:"spotbuyamount" xorm:"SPOTBUYAMOUNT"`           // 现货采购金额
+	Spotbuyqty         float64   `json:"spotbuyqty" xorm:"SPOTBUYQTY"`                 // 现货采购数量
+	Spotsellamount     float64   `json:"spotsellamount" xorm:"SPOTSELLAMOUNT"`         // 现货销售金额
+	Spotsellqty        float64   `json:"spotsellqty" xorm:"SPOTSELLQTY"`               // 现货销售数量
+	Updatetime         time.Time `json:"updatetime" xorm:"UPDATETIME"`                 // 更新时间
 }
 
 // TableName is ERMS2_ARBITRAGESTRATEGY
-func (Erms2arbitragestrategy) TableName() string {
+func (Erms2Arbitragestrategy) TableName() string {
 	return "ERMS2_ARBITRAGESTRATEGY"
 }
 
@@ -219,3 +301,60 @@ type Erms2asspotdetail struct {
 func (Erms2asspotdetail) TableName() string {
 	return "ERMS2_ASSPOTDETAIL"
 }
+
+// QueryASAccountInfoByAccountID 根据资金账号ID查询.
+func QueryASAccountInfoByAccountID(accountids []int64) ([]Erms2asaccount, error) {
+	engine := db.GetEngine()
+	data := make([]Erms2asaccount, 0)
+	err := engine.In("ACCOUNTID", accountids).Find(&data)
+
+	return data, err
+}
+
+// QueryASApplyIDSByAccountID 根据资金账号ID查询业务ID集合.
+func QueryASApplyIDSByAccountID(accountids []int64) ([]int64, error) {
+	data, err := QueryASAccountInfoByAccountID(accountids)
+	if err != nil {
+		return nil, err
+	}
+
+	distinctID := make(map[int64]struct{})
+	applyids := make([]int64, 0, len(data))
+	for i := range data {
+		if _, ok := distinctID[data[i].Asapplyid]; ok {
+			continue
+		}
+
+		applyids = append(applyids, data[i].Asapplyid)
+		distinctID[data[i].Asapplyid] = struct{}{}
+	}
+
+	return applyids, nil
+}
+
+// QueryArbitragestrategy 根据业务ID和状态查询.
+func QueryArbitragestrategy(applyid []int64, status int32) ([]Erms2Arbitragestrategy, error) {
+	engine := db.GetEngine()
+	data := make([]Erms2Arbitragestrategy, 0)
+	err := engine.In("ASAPPLYID", applyid).Where("STRATEGYSTATUS = ?", status).Find(&data)
+
+	return data, err
+}
+
+// QueryWRRContract 根据资金账号ID和状态查询.
+func QueryWRRContract(accountids []int64, status int32) ([]Erms2Wrrcontract, error) {
+	engine := db.GetEngine()
+	data := make([]Erms2Wrrcontract, 0)
+	err := engine.In("ACCOUNTID", accountids).Where("CONTRACTSTATUS = ?", status).Find(&data)
+
+	return data, err
+}
+
+// QuerySpotTradeBiz 根据现货资金账号ID和状态查询现货贸易业务.
+func QuerySpotTradeBiz(accountids []int64, status int32) ([]Erms2Spottradebiz, error) {
+	engine := db.GetEngine()
+	data := make([]Erms2Spottradebiz, 0)
+	err := engine.In("SPOTACCOUNTID", accountids).Where("CLOSESTATUS = ?", status).Find(&data)
+
+	return data, err
+}

+ 75 - 0
models/erms3.go

@@ -101,6 +101,40 @@ func (Erms3SpotContractApply) TableName() string {
 	return "ERMS3_SPOTCONTRACTAPPLY"
 }
 
+// Erms3Biztradedetail 业务关联单据明细表
+type Erms3Biztradedetail struct {
+	Biztradedetailid     int64     `json:"biztradedetailid" xorm:"BIZTRADEDETAILID"`         // 业务关联单据明细ID(352&#43;Unix秒时间戳(10位)&#43;xxxxxx)
+	Tradedetailid        int64     `json:"tradedetailid" xorm:"TRADEDETAILID"`               // 单据明细ID
+	Relatedbiztype       int32     `json:"relatedbiztype" xorm:"RELATEDBIZTYPE"`             // 关联业务类型 - 1:期现套利 2:仓单回购 3:现货贸易
+	Relatedbizid         int64     `json:"relatedbizid" xorm:"RELATEDBIZID"`                 // 关联业务ID
+	Marketid             int64     `json:"marketid" xorm:"MARKETID"`                         // 业务市场ID
+	Spotdetailid         int64     `json:"spotdetailid" xorm:"SPOTDETAILID"`                 // 标的明细ID
+	Spotcontractid       int64     `json:"spotcontractid" xorm:"SPOTCONTRACTID"`             // 现货合同ID
+	Contracttype         int32     `json:"contracttype" xorm:"CONTRACTTYPE"`                 // 现货合同类型 - 1:采购 -1:销售
+	Bizaccountid         int64     `json:"bizaccountid" xorm:"BIZACCOUNTID"`                 // 业务现货资金账户
+	Contractaccountid    int64     `json:"contractaccountid" xorm:"CONTRACTACCOUNTID"`       // 现货合同资金账户
+	Tradedate            string    `json:"tradedate" xorm:"TRADEDATE"`                       // 交易日(yyyyMMdd)
+	Relatedqty           float64   `json:"relatedqty" xorm:"RELATEDQTY"`                     // 关联数量
+	Relatedamount        float64   `json:"relatedamount" xorm:"RELATEDAMOUNT"`               // 关联金额
+	Cancelledqty         float64   `json:"cancelledqty" xorm:"CANCELLEDQTY"`                 // 撤销量
+	Cancelledamount      float64   `json:"cancelledamount" xorm:"CANCELLEDAMOUNT"`           // 撤销金额
+	Deliveryqty          float64   `json:"deliveryqty" xorm:"DELIVERYQTY"`                   // 交收数量(业务)
+	Deliveryamount       float64   `json:"deliveryamount" xorm:"DELIVERYAMOUNT"`             // 交收金额(业务) - 按比例计算
+	Deliveryovershortqty float64   `json:"deliveryovershortqty" xorm:"DELIVERYOVERSHORTQTY"` // 交收溢短数量(业务)
+	Deliveryactualamount float64   `json:"deliveryactualamount" xorm:"DELIVERYACTUALAMOUNT"` // 交收实际金额(业务)
+	Deliveryotheramount  float64   `json:"deliveryotheramount" xorm:"DELIVERYOTHERAMOUNT"`   // 交收其它费用(业务)
+	Closestatus          int32     `json:"closestatus" xorm:"CLOSESTATUS"`                   // 完结状态 - 0:未完结 1:已完结
+	Closetradedate       string    `json:"closetradedate" xorm:"CLOSETRADEDATE"`             // 完结交易日(yyyyMMdd)
+	Updatetime           time.Time `json:"updatetime" xorm:"UPDATETIME"`                     // 更新时间
+	Handlestatus         int32     `json:"handlestatus" xorm:"HANDLESTATUS"`                 // 处理状态
+
+}
+
+// TableName is ERMS3_BIZTRADEDETAIL
+func (m *Erms3Biztradedetail) TableName() string {
+	return "ERMS3_BIZTRADEDETAIL"
+}
+
 // AddSpotContractApply 插入现货合同记录
 func AddSpotContractApply(spotContractApply Erms3SpotContractApply) error {
 	engine := db.GetEngine()
@@ -180,3 +214,44 @@ to_char(ERMS3_BIZTRADEDETAIL.RELATEDBIZID) RELATEDBIZID, ENUMDICITEM.ENUMDICNAME
 	err := s.Find(&datas)
 	return datas, err
 }
+
+// QueryBizTradeDetailByBizID 根据关联业务ID查询.
+func QueryBizTradeDetailByBizID(relatedbizid []int64) ([]Erms3Biztradedetail, error) {
+	data := make([]Erms3Biztradedetail, 0)
+	engine := db.GetEngine()
+	err := engine.In("RELATEDBIZID", relatedbizid).Find(&data)
+	return data, err
+}
+
+// Erms3BizTradeInfo 汇总数据.
+type Erms3BizTradeInfo struct {
+	Relatedbizid int64     // 关联业务ID
+	Buyqty       float64   // 采购量.
+	Buyamount    float64   // 采购额.
+	Sellqty      float64   // 销售量.
+	Sellamount   float64   // 销售额.
+}
+
+// QueryBizTradeInfo 根据关联业务ID查询汇总信息.
+func QueryBizTradeInfo(relatedbizid []int64) (map[int64]Erms3BizTradeInfo, error) {
+	data, err := QueryBizTradeDetailByBizID(relatedbizid)
+	if err != nil {
+		return nil, err
+	}
+
+	infos := make(map[int64]Erms3BizTradeInfo)
+	for i := range data {
+		info := infos[data[i].Relatedbizid]
+		if 1 == data[i].Contracttype {
+			info.Buyqty += data[i].Relatedqty - data[i].Cancelledqty
+			info.Buyamount += data[i].Relatedamount - data[i].Cancelledamount
+		} else if -1 == data[i].Contracttype {
+			info.Sellqty += data[i].Relatedqty - data[i].Cancelledqty
+			info.Sellamount += data[i].Relatedamount - data[i].Cancelledamount
+		}
+
+		infos[data[i].Relatedbizid] = info
+	}
+
+	return infos, nil
+}

+ 536 - 11
pb/mtp2.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
 // 	protoc-gen-go v1.25.0
-// 	protoc        v3.14.0
+// 	protoc        v3.11.4
 // source: mtp2.proto
 
 package pb
@@ -145,6 +145,415 @@ func (x *TradeRuleInfoStruct) GetTradeRules() []*TradeRule {
 	return nil
 }
 
+// 日期类型定义
+type Date struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	DateStr *string `protobuf:"bytes,1,opt,name=DateStr" json:"DateStr,omitempty"` // 日期时间
+}
+
+func (x *Date) Reset() {
+	*x = Date{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_mtp2_proto_msgTypes[2]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *Date) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Date) ProtoMessage() {}
+
+func (x *Date) ProtoReflect() protoreflect.Message {
+	mi := &file_mtp2_proto_msgTypes[2]
+	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 Date.ProtoReflect.Descriptor instead.
+func (*Date) Descriptor() ([]byte, []int) {
+	return file_mtp2_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *Date) GetDateStr() string {
+	if x != nil && x.DateStr != nil {
+		return *x.DateStr
+	}
+	return ""
+}
+
+// ERMS2_ARBITRAGESTRATEGY 期现套利策略表
+type Erms2ArbitrageStrategy struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	//mkey: 1
+	ASApplyId          *uint64  `protobuf:"varint,1,opt,name=ASApplyId" json:"ASApplyId,omitempty"`                     // 策略申请ID(702+Unix秒时间戳(10位)+xxxxxx)
+	ASNo               *string  `protobuf:"bytes,2,opt,name=ASNo" json:"ASNo,omitempty"`                                // 策略编号
+	BizType            *uint32  `protobuf:"varint,3,opt,name=BizType" json:"BizType,omitempty"`                         // 业务类型 - 1:正向套利 -1:反向套利
+	UserId             *uint32  `protobuf:"varint,4,opt,name=UserId" json:"UserId,omitempty"`                           // 所属机构
+	DeliveryGoodsId    *uint32  `protobuf:"varint,5,opt,name=DeliveryGoodsId" json:"DeliveryGoodsId,omitempty"`         // 现货品种ID
+	GoodsGroupId       *uint32  `protobuf:"varint,6,opt,name=GoodsGroupId" json:"GoodsGroupId,omitempty"`               // 期货品种ID
+	SpotQuota          *float64 `protobuf:"fixed64,7,opt,name=SpotQuota" json:"SpotQuota,omitempty"`                    // 现货额度
+	FutureQuote        *float64 `protobuf:"fixed64,8,opt,name=FutureQuote" json:"FutureQuote,omitempty"`                // 期货额度
+	ApplyBasis         *float64 `protobuf:"fixed64,9,opt,name=ApplyBasis" json:"ApplyBasis,omitempty"`                  // 申请基差
+	StrategyStatus     *uint32  `protobuf:"varint,10,opt,name=StrategyStatus" json:"StrategyStatus,omitempty"`          // 策略状态 - 0:未结束 1:已结束
+	Remark             *string  `protobuf:"bytes,11,opt,name=Remark" json:"Remark,omitempty"`                           // 备注
+	MarketId           *uint32  `protobuf:"varint,12,opt,name=MarketId" json:"MarketId,omitempty"`                      // 市场ID
+	TradeDate          *string  `protobuf:"bytes,13,opt,name=TradeDate" json:"TradeDate,omitempty"`                     // 交易日(yyyyMMdd)
+	CloseTradeDate     *string  `protobuf:"bytes,14,opt,name=CloseTradeDate" json:"CloseTradeDate,omitempty"`           // 完结交易日(yyyyMMdd)
+	UsedQuota          *float64 `protobuf:"fixed64,15,opt,name=UsedQuota" json:"UsedQuota,omitempty"`                   // 已占用资金
+	FutureQty          *float64 `protobuf:"fixed64,16,opt,name=FutureQty" json:"FutureQty,omitempty"`                   // 期货持仓数量
+	FutureAvgPrice     *float64 `protobuf:"fixed64,17,opt,name=FutureAvgPrice" json:"FutureAvgPrice,omitempty"`         // 期货建仓均价
+	FuturePL           *float64 `protobuf:"fixed64,18,opt,name=FuturePL" json:"FuturePL,omitempty"`                     // 期货总盈亏[结算更新]
+	PricedSpotQty      *float64 `protobuf:"fixed64,19,opt,name=PricedSpotQty" json:"PricedSpotQty,omitempty"`           // 已定价现货数量
+	PricedSpotQtyNoTax *float64 `protobuf:"fixed64,20,opt,name=PricedSpotQtyNoTax" json:"PricedSpotQtyNoTax,omitempty"` // 已定价现货不含税数量
+	SpotavgPrice       *float64 `protobuf:"fixed64,21,opt,name=SpotavgPrice" json:"SpotavgPrice,omitempty"`             // 现货均价
+	SpotPL             *float64 `protobuf:"fixed64,22,opt,name=SpotPL" json:"SpotPL,omitempty"`                         // 现货总盈亏[结算更新]
+	NetExposure        *float64 `protobuf:"fixed64,23,opt,name=NetExposure" json:"NetExposure,omitempty"`               // 单笔业务头寸净敞口 = 期货持仓数量 + 已定价现货不含税数量
+	NetExposureRate    *float64 `protobuf:"fixed64,24,opt,name=NetExposureRate" json:"NetExposureRate,omitempty"`       // 净敞口比例 - 0:未结束 =  (NetExposure/PriceSpotQtyNoTax) ; 已结束为0
+	TotalPL            *float64 `protobuf:"fixed64,25,opt,name=TotalPL" json:"TotalPL,omitempty"`                       // 业务合计损益 = FuturePL + SpotPL [结算更新]
+	OpenBasis          *float64 `protobuf:"fixed64,26,opt,name=OpenBasis" json:"OpenBasis,omitempty"`                   // 建仓基差
+	CurBasis           *float64 `protobuf:"fixed64,27,opt,name=CurBasis" json:"CurBasis,omitempty"`                     // 当前基差[结算更新]
+	BasisChangePL      *float64 `protobuf:"fixed64,28,opt,name=BasisChangePL" json:"BasisChangePL,omitempty"`           // 基差变动损益[结算更新]
+	NetExposurePL      *float64 `protobuf:"fixed64,29,opt,name=NetExposurePL" json:"NetExposurePL,omitempty"`           // 净敞口损益 = TotalPL - BasisChangePL[结算更新]
+	SpotUsedQuota      *float64 `protobuf:"fixed64,30,opt,name=SpotUsedQuota" json:"SpotUsedQuota,omitempty"`           // 现货占用资金
+	FutureOpenQty      *float64 `protobuf:"fixed64,31,opt,name=FutureOpenQty" json:"FutureOpenQty,omitempty"`           // 期货开仓数量
+	FutureOpenAmount   *float64 `protobuf:"fixed64,32,opt,name=FutureOpenAmount" json:"FutureOpenAmount,omitempty"`     // 期货开仓金额
+	FutureCloseQty     *float64 `protobuf:"fixed64,33,opt,name=FutureCloseQty" json:"FutureCloseQty,omitempty"`         // 期货平仓数量
+	FutureCloseAmount  *float64 `protobuf:"fixed64,34,opt,name=FutureCloseAmount" json:"FutureCloseAmount,omitempty"`   // 期货平仓金额
+	SpotBuyAmount      *float64 `protobuf:"fixed64,35,opt,name=SpotBuyAmount" json:"SpotBuyAmount,omitempty"`           // 现货采购金额
+	SpotBuyQty         *float64 `protobuf:"fixed64,36,opt,name=SpotBuyQty" json:"SpotBuyQty,omitempty"`                 // 现货采购数量
+	SpotSellAmount     *float64 `protobuf:"fixed64,37,opt,name=SpotSellAmount" json:"SpotSellAmount,omitempty"`         // 现货销售金额
+	SpotSellQty        *float64 `protobuf:"fixed64,38,opt,name=SpotSellQty" json:"SpotSellQty,omitempty"`               // 现货销售数量
+	UpDatetime         *Date    `protobuf:"bytes,39,opt,name=UpDatetime" json:"UpDatetime,omitempty"`                   // 更新时间
+	ASName             *string  `protobuf:"bytes,40,opt,name=ASName" json:"ASName,omitempty"`                           // 策略名称
+}
+
+func (x *Erms2ArbitrageStrategy) Reset() {
+	*x = Erms2ArbitrageStrategy{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_mtp2_proto_msgTypes[3]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *Erms2ArbitrageStrategy) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Erms2ArbitrageStrategy) ProtoMessage() {}
+
+func (x *Erms2ArbitrageStrategy) ProtoReflect() protoreflect.Message {
+	mi := &file_mtp2_proto_msgTypes[3]
+	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 Erms2ArbitrageStrategy.ProtoReflect.Descriptor instead.
+func (*Erms2ArbitrageStrategy) Descriptor() ([]byte, []int) {
+	return file_mtp2_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *Erms2ArbitrageStrategy) GetASApplyId() uint64 {
+	if x != nil && x.ASApplyId != nil {
+		return *x.ASApplyId
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetASNo() string {
+	if x != nil && x.ASNo != nil {
+		return *x.ASNo
+	}
+	return ""
+}
+
+func (x *Erms2ArbitrageStrategy) GetBizType() uint32 {
+	if x != nil && x.BizType != nil {
+		return *x.BizType
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetUserId() uint32 {
+	if x != nil && x.UserId != nil {
+		return *x.UserId
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetDeliveryGoodsId() uint32 {
+	if x != nil && x.DeliveryGoodsId != nil {
+		return *x.DeliveryGoodsId
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetGoodsGroupId() uint32 {
+	if x != nil && x.GoodsGroupId != nil {
+		return *x.GoodsGroupId
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetSpotQuota() float64 {
+	if x != nil && x.SpotQuota != nil {
+		return *x.SpotQuota
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetFutureQuote() float64 {
+	if x != nil && x.FutureQuote != nil {
+		return *x.FutureQuote
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetApplyBasis() float64 {
+	if x != nil && x.ApplyBasis != nil {
+		return *x.ApplyBasis
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetStrategyStatus() uint32 {
+	if x != nil && x.StrategyStatus != nil {
+		return *x.StrategyStatus
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetRemark() string {
+	if x != nil && x.Remark != nil {
+		return *x.Remark
+	}
+	return ""
+}
+
+func (x *Erms2ArbitrageStrategy) GetMarketId() uint32 {
+	if x != nil && x.MarketId != nil {
+		return *x.MarketId
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetTradeDate() string {
+	if x != nil && x.TradeDate != nil {
+		return *x.TradeDate
+	}
+	return ""
+}
+
+func (x *Erms2ArbitrageStrategy) GetCloseTradeDate() string {
+	if x != nil && x.CloseTradeDate != nil {
+		return *x.CloseTradeDate
+	}
+	return ""
+}
+
+func (x *Erms2ArbitrageStrategy) GetUsedQuota() float64 {
+	if x != nil && x.UsedQuota != nil {
+		return *x.UsedQuota
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetFutureQty() float64 {
+	if x != nil && x.FutureQty != nil {
+		return *x.FutureQty
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetFutureAvgPrice() float64 {
+	if x != nil && x.FutureAvgPrice != nil {
+		return *x.FutureAvgPrice
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetFuturePL() float64 {
+	if x != nil && x.FuturePL != nil {
+		return *x.FuturePL
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetPricedSpotQty() float64 {
+	if x != nil && x.PricedSpotQty != nil {
+		return *x.PricedSpotQty
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetPricedSpotQtyNoTax() float64 {
+	if x != nil && x.PricedSpotQtyNoTax != nil {
+		return *x.PricedSpotQtyNoTax
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetSpotavgPrice() float64 {
+	if x != nil && x.SpotavgPrice != nil {
+		return *x.SpotavgPrice
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetSpotPL() float64 {
+	if x != nil && x.SpotPL != nil {
+		return *x.SpotPL
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetNetExposure() float64 {
+	if x != nil && x.NetExposure != nil {
+		return *x.NetExposure
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetNetExposureRate() float64 {
+	if x != nil && x.NetExposureRate != nil {
+		return *x.NetExposureRate
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetTotalPL() float64 {
+	if x != nil && x.TotalPL != nil {
+		return *x.TotalPL
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetOpenBasis() float64 {
+	if x != nil && x.OpenBasis != nil {
+		return *x.OpenBasis
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetCurBasis() float64 {
+	if x != nil && x.CurBasis != nil {
+		return *x.CurBasis
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetBasisChangePL() float64 {
+	if x != nil && x.BasisChangePL != nil {
+		return *x.BasisChangePL
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetNetExposurePL() float64 {
+	if x != nil && x.NetExposurePL != nil {
+		return *x.NetExposurePL
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetSpotUsedQuota() float64 {
+	if x != nil && x.SpotUsedQuota != nil {
+		return *x.SpotUsedQuota
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetFutureOpenQty() float64 {
+	if x != nil && x.FutureOpenQty != nil {
+		return *x.FutureOpenQty
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetFutureOpenAmount() float64 {
+	if x != nil && x.FutureOpenAmount != nil {
+		return *x.FutureOpenAmount
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetFutureCloseQty() float64 {
+	if x != nil && x.FutureCloseQty != nil {
+		return *x.FutureCloseQty
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetFutureCloseAmount() float64 {
+	if x != nil && x.FutureCloseAmount != nil {
+		return *x.FutureCloseAmount
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetSpotBuyAmount() float64 {
+	if x != nil && x.SpotBuyAmount != nil {
+		return *x.SpotBuyAmount
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetSpotBuyQty() float64 {
+	if x != nil && x.SpotBuyQty != nil {
+		return *x.SpotBuyQty
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetSpotSellAmount() float64 {
+	if x != nil && x.SpotSellAmount != nil {
+		return *x.SpotSellAmount
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetSpotSellQty() float64 {
+	if x != nil && x.SpotSellQty != nil {
+		return *x.SpotSellQty
+	}
+	return 0
+}
+
+func (x *Erms2ArbitrageStrategy) GetUpDatetime() *Date {
+	if x != nil {
+		return x.UpDatetime
+	}
+	return nil
+}
+
+func (x *Erms2ArbitrageStrategy) GetASName() string {
+	if x != nil && x.ASName != nil {
+		return *x.ASName
+	}
+	return ""
+}
+
 var File_mtp2_proto protoreflect.FileDescriptor
 
 var file_mtp2_proto_rawDesc = []byte{
@@ -161,7 +570,96 @@ var file_mtp2_proto_rawDesc = []byte{
 	0x64, 0x73, 0x49, 0x44, 0x12, 0x2d, 0x0a, 0x0a, 0x54, 0x72, 0x61, 0x64, 0x65, 0x52, 0x75, 0x6c,
 	0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x72,
 	0x61, 0x64, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x0a, 0x54, 0x72, 0x61, 0x64, 0x65, 0x52, 0x75,
-	0x6c, 0x65, 0x73,
+	0x6c, 0x65, 0x73, 0x22, 0x20, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x44,
+	0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x44, 0x61,
+	0x74, 0x65, 0x53, 0x74, 0x72, 0x22, 0xea, 0x0a, 0x0a, 0x16, 0x45, 0x72, 0x6d, 0x73, 0x32, 0x41,
+	0x72, 0x62, 0x69, 0x74, 0x72, 0x61, 0x67, 0x65, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79,
+	0x12, 0x1c, 0x0a, 0x09, 0x41, 0x53, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20,
+	0x01, 0x28, 0x04, 0x52, 0x09, 0x41, 0x53, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x64, 0x12, 0x12,
+	0x0a, 0x04, 0x41, 0x53, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x41, 0x53,
+	0x4e, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x42, 0x69, 0x7a, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20,
+	0x01, 0x28, 0x0d, 0x52, 0x07, 0x42, 0x69, 0x7a, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06,
+	0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x55, 0x73,
+	0x65, 0x72, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79,
+	0x47, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x44,
+	0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x12, 0x22,
+	0x0a, 0x0c, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x18, 0x06,
+	0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x47, 0x72, 0x6f, 0x75, 0x70,
+	0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x70, 0x6f, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x18,
+	0x07, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x53, 0x70, 0x6f, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x61,
+	0x12, 0x20, 0x0a, 0x0b, 0x46, 0x75, 0x74, 0x75, 0x72, 0x65, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x18,
+	0x08, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x46, 0x75, 0x74, 0x75, 0x72, 0x65, 0x51, 0x75, 0x6f,
+	0x74, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x42, 0x61, 0x73, 0x69, 0x73,
+	0x18, 0x09, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x42, 0x61, 0x73,
+	0x69, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x53, 0x74, 0x72, 0x61, 0x74, 0x65, 0x67, 0x79, 0x53, 0x74,
+	0x61, 0x74, 0x75, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x53, 0x74, 0x72, 0x61,
+	0x74, 0x65, 0x67, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65,
+	0x6d, 0x61, 0x72, 0x6b, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x52, 0x65, 0x6d, 0x61,
+	0x72, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x49, 0x64, 0x18, 0x0c,
+	0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x49, 0x64, 0x12, 0x1c,
+	0x0a, 0x09, 0x54, 0x72, 0x61, 0x64, 0x65, 0x44, 0x61, 0x74, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28,
+	0x09, 0x52, 0x09, 0x54, 0x72, 0x61, 0x64, 0x65, 0x44, 0x61, 0x74, 0x65, 0x12, 0x26, 0x0a, 0x0e,
+	0x43, 0x6c, 0x6f, 0x73, 0x65, 0x54, 0x72, 0x61, 0x64, 0x65, 0x44, 0x61, 0x74, 0x65, 0x18, 0x0e,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x54, 0x72, 0x61, 0x64, 0x65,
+	0x44, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x55, 0x73, 0x65, 0x64, 0x51, 0x75, 0x6f, 0x74,
+	0x61, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x55, 0x73, 0x65, 0x64, 0x51, 0x75, 0x6f,
+	0x74, 0x61, 0x12, 0x1c, 0x0a, 0x09, 0x46, 0x75, 0x74, 0x75, 0x72, 0x65, 0x51, 0x74, 0x79, 0x18,
+	0x10, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x46, 0x75, 0x74, 0x75, 0x72, 0x65, 0x51, 0x74, 0x79,
+	0x12, 0x26, 0x0a, 0x0e, 0x46, 0x75, 0x74, 0x75, 0x72, 0x65, 0x41, 0x76, 0x67, 0x50, 0x72, 0x69,
+	0x63, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0e, 0x46, 0x75, 0x74, 0x75, 0x72, 0x65,
+	0x41, 0x76, 0x67, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x46, 0x75, 0x74, 0x75,
+	0x72, 0x65, 0x50, 0x4c, 0x18, 0x12, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x46, 0x75, 0x74, 0x75,
+	0x72, 0x65, 0x50, 0x4c, 0x12, 0x24, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x63, 0x65, 0x64, 0x53, 0x70,
+	0x6f, 0x74, 0x51, 0x74, 0x79, 0x18, 0x13, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0d, 0x50, 0x72, 0x69,
+	0x63, 0x65, 0x64, 0x53, 0x70, 0x6f, 0x74, 0x51, 0x74, 0x79, 0x12, 0x2e, 0x0a, 0x12, 0x50, 0x72,
+	0x69, 0x63, 0x65, 0x64, 0x53, 0x70, 0x6f, 0x74, 0x51, 0x74, 0x79, 0x4e, 0x6f, 0x54, 0x61, 0x78,
+	0x18, 0x14, 0x20, 0x01, 0x28, 0x01, 0x52, 0x12, 0x50, 0x72, 0x69, 0x63, 0x65, 0x64, 0x53, 0x70,
+	0x6f, 0x74, 0x51, 0x74, 0x79, 0x4e, 0x6f, 0x54, 0x61, 0x78, 0x12, 0x22, 0x0a, 0x0c, 0x53, 0x70,
+	0x6f, 0x74, 0x61, 0x76, 0x67, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x15, 0x20, 0x01, 0x28, 0x01,
+	0x52, 0x0c, 0x53, 0x70, 0x6f, 0x74, 0x61, 0x76, 0x67, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x16,
+	0x0a, 0x06, 0x53, 0x70, 0x6f, 0x74, 0x50, 0x4c, 0x18, 0x16, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06,
+	0x53, 0x70, 0x6f, 0x74, 0x50, 0x4c, 0x12, 0x20, 0x0a, 0x0b, 0x4e, 0x65, 0x74, 0x45, 0x78, 0x70,
+	0x6f, 0x73, 0x75, 0x72, 0x65, 0x18, 0x17, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x4e, 0x65, 0x74,
+	0x45, 0x78, 0x70, 0x6f, 0x73, 0x75, 0x72, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x4e, 0x65, 0x74, 0x45,
+	0x78, 0x70, 0x6f, 0x73, 0x75, 0x72, 0x65, 0x52, 0x61, 0x74, 0x65, 0x18, 0x18, 0x20, 0x01, 0x28,
+	0x01, 0x52, 0x0f, 0x4e, 0x65, 0x74, 0x45, 0x78, 0x70, 0x6f, 0x73, 0x75, 0x72, 0x65, 0x52, 0x61,
+	0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x4c, 0x18, 0x19, 0x20,
+	0x01, 0x28, 0x01, 0x52, 0x07, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x4c, 0x12, 0x1c, 0x0a, 0x09,
+	0x4f, 0x70, 0x65, 0x6e, 0x42, 0x61, 0x73, 0x69, 0x73, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x01, 0x52,
+	0x09, 0x4f, 0x70, 0x65, 0x6e, 0x42, 0x61, 0x73, 0x69, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x75,
+	0x72, 0x42, 0x61, 0x73, 0x69, 0x73, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x43, 0x75,
+	0x72, 0x42, 0x61, 0x73, 0x69, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x42, 0x61, 0x73, 0x69, 0x73, 0x43,
+	0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x4c, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0d, 0x42,
+	0x61, 0x73, 0x69, 0x73, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x4c, 0x12, 0x24, 0x0a, 0x0d,
+	0x4e, 0x65, 0x74, 0x45, 0x78, 0x70, 0x6f, 0x73, 0x75, 0x72, 0x65, 0x50, 0x4c, 0x18, 0x1d, 0x20,
+	0x01, 0x28, 0x01, 0x52, 0x0d, 0x4e, 0x65, 0x74, 0x45, 0x78, 0x70, 0x6f, 0x73, 0x75, 0x72, 0x65,
+	0x50, 0x4c, 0x12, 0x24, 0x0a, 0x0d, 0x53, 0x70, 0x6f, 0x74, 0x55, 0x73, 0x65, 0x64, 0x51, 0x75,
+	0x6f, 0x74, 0x61, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0d, 0x53, 0x70, 0x6f, 0x74, 0x55,
+	0x73, 0x65, 0x64, 0x51, 0x75, 0x6f, 0x74, 0x61, 0x12, 0x24, 0x0a, 0x0d, 0x46, 0x75, 0x74, 0x75,
+	0x72, 0x65, 0x4f, 0x70, 0x65, 0x6e, 0x51, 0x74, 0x79, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x01, 0x52,
+	0x0d, 0x46, 0x75, 0x74, 0x75, 0x72, 0x65, 0x4f, 0x70, 0x65, 0x6e, 0x51, 0x74, 0x79, 0x12, 0x2a,
+	0x0a, 0x10, 0x46, 0x75, 0x74, 0x75, 0x72, 0x65, 0x4f, 0x70, 0x65, 0x6e, 0x41, 0x6d, 0x6f, 0x75,
+	0x6e, 0x74, 0x18, 0x20, 0x20, 0x01, 0x28, 0x01, 0x52, 0x10, 0x46, 0x75, 0x74, 0x75, 0x72, 0x65,
+	0x4f, 0x70, 0x65, 0x6e, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x26, 0x0a, 0x0e, 0x46, 0x75,
+	0x74, 0x75, 0x72, 0x65, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x51, 0x74, 0x79, 0x18, 0x21, 0x20, 0x01,
+	0x28, 0x01, 0x52, 0x0e, 0x46, 0x75, 0x74, 0x75, 0x72, 0x65, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x51,
+	0x74, 0x79, 0x12, 0x2c, 0x0a, 0x11, 0x46, 0x75, 0x74, 0x75, 0x72, 0x65, 0x43, 0x6c, 0x6f, 0x73,
+	0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x22, 0x20, 0x01, 0x28, 0x01, 0x52, 0x11, 0x46,
+	0x75, 0x74, 0x75, 0x72, 0x65, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74,
+	0x12, 0x24, 0x0a, 0x0d, 0x53, 0x70, 0x6f, 0x74, 0x42, 0x75, 0x79, 0x41, 0x6d, 0x6f, 0x75, 0x6e,
+	0x74, 0x18, 0x23, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0d, 0x53, 0x70, 0x6f, 0x74, 0x42, 0x75, 0x79,
+	0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x70, 0x6f, 0x74, 0x42, 0x75,
+	0x79, 0x51, 0x74, 0x79, 0x18, 0x24, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x53, 0x70, 0x6f, 0x74,
+	0x42, 0x75, 0x79, 0x51, 0x74, 0x79, 0x12, 0x26, 0x0a, 0x0e, 0x53, 0x70, 0x6f, 0x74, 0x53, 0x65,
+	0x6c, 0x6c, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x25, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0e,
+	0x53, 0x70, 0x6f, 0x74, 0x53, 0x65, 0x6c, 0x6c, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x20,
+	0x0a, 0x0b, 0x53, 0x70, 0x6f, 0x74, 0x53, 0x65, 0x6c, 0x6c, 0x51, 0x74, 0x79, 0x18, 0x26, 0x20,
+	0x01, 0x28, 0x01, 0x52, 0x0b, 0x53, 0x70, 0x6f, 0x74, 0x53, 0x65, 0x6c, 0x6c, 0x51, 0x74, 0x79,
+	0x12, 0x28, 0x0a, 0x0a, 0x55, 0x70, 0x44, 0x61, 0x74, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x27,
+	0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x61, 0x74, 0x65, 0x52, 0x0a,
+	0x55, 0x70, 0x44, 0x61, 0x74, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x53,
+	0x4e, 0x61, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x41, 0x53, 0x4e, 0x61,
+	0x6d, 0x65,
 }
 
 var (
@@ -176,18 +674,21 @@ func file_mtp2_proto_rawDescGZIP() []byte {
 	return file_mtp2_proto_rawDescData
 }
 
-var file_mtp2_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
+var file_mtp2_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
 var file_mtp2_proto_goTypes = []interface{}{
-	(*TradeRule)(nil),           // 0: pb.TradeRule
-	(*TradeRuleInfoStruct)(nil), // 1: pb.TradeRuleInfoStruct
+	(*TradeRule)(nil),              // 0: pb.TradeRule
+	(*TradeRuleInfoStruct)(nil),    // 1: pb.TradeRuleInfoStruct
+	(*Date)(nil),                   // 2: pb.Date
+	(*Erms2ArbitrageStrategy)(nil), // 3: pb.Erms2ArbitrageStrategy
 }
 var file_mtp2_proto_depIdxs = []int32{
 	0, // 0: pb.TradeRuleInfoStruct.TradeRules:type_name -> pb.TradeRule
-	1, // [1:1] is the sub-list for method output_type
-	1, // [1:1] is the sub-list for method input_type
-	1, // [1:1] is the sub-list for extension type_name
-	1, // [1:1] is the sub-list for extension extendee
-	0, // [0:1] is the sub-list for field type_name
+	2, // 1: pb.Erms2ArbitrageStrategy.UpDatetime:type_name -> pb.Date
+	2, // [2:2] is the sub-list for method output_type
+	2, // [2:2] is the sub-list for method input_type
+	2, // [2:2] is the sub-list for extension type_name
+	2, // [2:2] is the sub-list for extension extendee
+	0, // [0:2] is the sub-list for field type_name
 }
 
 func init() { file_mtp2_proto_init() }
@@ -220,6 +721,30 @@ func file_mtp2_proto_init() {
 				return nil
 			}
 		}
+		file_mtp2_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*Date); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_mtp2_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*Erms2ArbitrageStrategy); 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{
@@ -227,7 +752,7 @@ func file_mtp2_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_mtp2_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   2,
+			NumMessages:   4,
 			NumExtensions: 0,
 			NumServices:   0,
 		},

+ 52 - 1
pb/mtp2.proto

@@ -13,4 +13,55 @@ message TradeRuleInfoStruct{
     optional uint64 AccountID = 1;                // 资金账号
     optional uint32 GoodsID = 2;                  // 商品id 
     repeated TradeRule TradeRules = 3;            // 交易规则
-}
+}
+
+// 日期类型定义
+message Date {
+  optional string DateStr = 1; // 日期时间
+}
+
+// ERMS2_ARBITRAGESTRATEGY 期现套利策略表
+message Erms2ArbitrageStrategy
+{
+  //mkey: 1
+  optional uint64 ASApplyId = 1;    // 策略申请ID(702+Unix秒时间戳(10位)+xxxxxx)
+  optional string ASNo = 2;    // 策略编号
+  optional uint32 BizType = 3;    // 业务类型 - 1:正向套利 -1:反向套利
+  optional uint32 UserId = 4;    // 所属机构
+  optional uint32 DeliveryGoodsId = 5;    // 现货品种ID
+  optional uint32 GoodsGroupId = 6;    // 期货品种ID
+  optional double SpotQuota = 7;    // 现货额度
+  optional double FutureQuote = 8;    // 期货额度
+  optional double ApplyBasis = 9;    // 申请基差
+  optional uint32 StrategyStatus = 10;    // 策略状态 - 0:未结束 1:已结束
+  optional string Remark = 11;    // 备注
+  optional uint32 MarketId = 12;    // 市场ID
+  optional string TradeDate = 13;    // 交易日(yyyyMMdd)
+  optional string CloseTradeDate = 14;    // 完结交易日(yyyyMMdd)
+  optional double UsedQuota = 15;    // 已占用资金
+  optional double FutureQty = 16;    // 期货持仓数量
+  optional double FutureAvgPrice = 17;    // 期货建仓均价
+  optional double FuturePL = 18;    // 期货总盈亏[结算更新]
+  optional double PricedSpotQty = 19;    // 已定价现货数量
+  optional double PricedSpotQtyNoTax = 20;    // 已定价现货不含税数量
+  optional double SpotavgPrice = 21;    // 现货均价
+  optional double SpotPL = 22;    // 现货总盈亏[结算更新]
+  optional double NetExposure = 23;    // 单笔业务头寸净敞口 = 期货持仓数量 + 已定价现货不含税数量
+  optional double NetExposureRate = 24;    // 净敞口比例 - 0:未结束 =  (NetExposure/PriceSpotQtyNoTax) ; 已结束为0
+  optional double TotalPL = 25;    // 业务合计损益 = FuturePL + SpotPL [结算更新]
+  optional double OpenBasis = 26;    // 建仓基差
+  optional double CurBasis = 27;    // 当前基差[结算更新]
+  optional double BasisChangePL = 28;    // 基差变动损益[结算更新]
+  optional double NetExposurePL = 29;    // 净敞口损益 = TotalPL - BasisChangePL[结算更新]
+  optional double SpotUsedQuota = 30;    // 现货占用资金
+  optional double FutureOpenQty = 31;    // 期货开仓数量
+  optional double FutureOpenAmount = 32;    // 期货开仓金额
+  optional double FutureCloseQty = 33;    // 期货平仓数量
+  optional double FutureCloseAmount = 34;    // 期货平仓金额
+  optional double SpotBuyAmount = 35;    // 现货采购金额
+  optional double SpotBuyQty = 36;    // 现货采购数量
+  optional double SpotSellAmount = 37;    // 现货销售金额
+  optional double SpotSellQty = 38;    // 现货销售数量
+  optional Date UpDatetime = 39;    // 更新时间
+  optional string ASName = 40;    // 策略名称
+}

+ 2 - 0
routers/router.go

@@ -188,6 +188,8 @@ func InitRouter() *gin.Engine {
 		erms3R.POST("/AddUserInfoApply", erms3.AddUserInfoApply)
 		// 客户申请信息查询
 		erms3R.GET("/QueryUserInfoApplies", erms3.QueryUserInfoApplies)
+		// 业务信息查询
+		erms3R.GET("/QueryBusinessInfo", erms3.QueryBusinessInfo)
 	}
 	// ************************ 定制【尚志大宗】 ************************
 	szdzR := apiR.Group("SZDZ")