Kaynağa Gözat

增加“委托单查询请求(合约市场)”接口

Simon Zhou 5 yıl önce
ebeveyn
işleme
09df78f701
5 değiştirilmiş dosya ile 761 ekleme ve 2 silme
  1. 115 2
      controllers/order/order.go
  2. 236 0
      docs/docs.go
  3. 236 0
      docs/swagger.json
  4. 172 0
      docs/swagger.yaml
  5. 2 0
      routers/router.go

+ 115 - 2
controllers/order/order.go

@@ -9,17 +9,18 @@ import (
 	"mtp2_if/logger"
 	"mtp2_if/models"
 	"net/http"
+	"time"
 
 	"github.com/gin-gonic/gin"
 )
 
-// QueryTradePositionReq 持仓汇总查询请求参数
+// QueryTradePositionReq 持仓汇总查询请求参数(合约市场)
 type QueryTradePositionReq struct {
 	AccountID string `form:"accountID" binding:"required"`
 	TradeMode string `form:"tradeMode"`
 }
 
-// QueryTradePositionRsp 持仓汇总查询返回模型
+// QueryTradePositionRsp 持仓汇总查询返回模型(合约市场)
 type QueryTradePositionRsp struct {
 	AccountID       uint64  `json:"accountid"  xorm:"'ACCOUNTID'"`             // 资金账户
 	BuyOrSell       int64   `json:"buyorsell"  xorm:"'BUYORSELL'" `            // 方向 - 0:买 1:卖
@@ -58,6 +59,7 @@ type QueryTradePositionRsp struct {
 // @Failure 500 {object} app.Response
 // @Router /Order/QueryTradePosition [get]
 // @Tags 通用单据
+// 参考通用查询:SearchTradePositionDetail
 func QueryTradePosition(c *gin.Context) {
 	appG := app.Gin{C: c}
 
@@ -164,3 +166,114 @@ func QueryTradePosition(c *gin.Context) {
 	logger.GetLogger().Infof("QueryTradePosition successed: %v", rst)
 	appG.Response(http.StatusOK, e.SUCCESS, rst)
 }
+
+// QueryTradeOrderDetailReq 委托单查询请求参数(合约市场)
+type QueryTradeOrderDetailReq struct {
+	AccountID   string `form:"accountID" binding:"required"`
+	OrderStatus string `form:"orderStatus"`
+	TradeMode   string `form:"tradeMode"`
+	OrderID     int    `form:"orderID"`
+}
+
+// QueryTradeOrderDetailRsp 委托单查询返回模型(合约市场)
+type QueryTradeOrderDetailRsp struct {
+	// 委托单字段
+	Orderid             int64     `json:"orderid"  xorm:"'ORDERID'" binding:"required"`         // 委托单号(100+Unix秒时间戳(10位)+2位(MarketServiceID)+xxxx)
+	Tradedate           string    `json:"tradedate"  xorm:"'TRADEDATE'" binding:"required"`     // 交易日(yyyyMMdd)
+	Buildtype           int64     `json:"buildtype"  xorm:"'BUILDTYPE'" binding:"required"`     // 委托单据类型 - 1:建仓 2:平仓 3:先平后建
+	Preorderid          int64     `json:"preorderid"  xorm:"'PREORDERID'"`                      // 关联预埋单号(止盈止损单时填写)
+	Cancelorderid       int64     `json:"cancelorderid"  xorm:"'CANCELORDERID'"`                // 撤单单号(撤单时填写)
+	Relatedid           int64     `json:"relatedid"  xorm:"'RELATEDID'"`                        // 关联单号(交割单)
+	Marketid            int64     `json:"marketid"  xorm:"'MARKETID'" binding:"required"`       // 市场ID
+	Goodsid             int64     `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`         // 商品ID
+	Accountid           int64     `json:"accountid"  xorm:"'ACCOUNTID'" binding:"required"`     // 账户ID[报价币种]
+	Buyorsell           int64     `json:"buyorsell"  xorm:"'BUYORSELL'" binding:"required"`     // 买卖 - 0:买 1:卖
+	Pricemode           int64     `json:"pricemode"  xorm:"'PRICEMODE'" binding:"required"`     // 取价方式 - 1:市价 2: 限价
+	Orderprice          float64   `json:"orderprice"  xorm:"'ORDERPRICE'"`                      // 委托价格
+	Orderqty            int64     `json:"orderqty"  xorm:"'ORDERQTY'" binding:"required"`       // 委托数量
+	Tradeqty            int64     `json:"tradeqty"  xorm:"'TRADEQTY'"`                          // 成交数量
+	Cancelqty           int64     `json:"cancelqty"  xorm:"'CANCELQTY'"`                        // 撤单数量
+	Openqty             int64     `json:"openqty"  xorm:"'OPENQTY'"`                            // 开仓数量(先建后平操作,需要记录)
+	Closeqty            int64     `json:"closeqty"  xorm:"'CLOSEQTY'"`                          // 平仓数量(先建后平操作 需要记录)
+	Opentradeqty        int64     `json:"opentradeqty"  xorm:"'OPENTRADEQTY'"`                  // 开仓成交数量(先建后平操作,需要记录)
+	Closetradeqty       int64     `json:"closetradeqty"  xorm:"'CLOSETRADEQTY'"`                // 平仓成交数量(先建后平操作,需要记录)
+	Freezemargin        float64   `json:"freezemargin"  xorm:"'FREEZEMARGIN'"`                  // 冻结保证金(冻结交易金额)
+	Unfreezemargin      float64   `json:"unfreezemargin"  xorm:"'UNFREEZEMARGIN'"`              // 解冻保证金
+	Freezecharge        float64   `json:"freezecharge"  xorm:"'FREEZECHARGE'"`                  // 冻结手续费
+	Unfreezecharge      float64   `json:"unfreezecharge"  xorm:"'UNFREEZECHARGE'"`              // 解冻手续费
+	Openfreezecharge    float64   `json:"openfreezecharge"  xorm:"'OPENFREEZECHARGE'"`          // 开仓冻结手续费(先建后平操作,需要记录)
+	Closefreezecharge   float64   `json:"closefreezecharge"  xorm:"'CLOSEFREEZECHARGE'"`        // 平仓冻结手续费(先建后平操作,需要记录)
+	Openunfreezecharge  float64   `json:"openunfreezecharge"  xorm:"'OPENUNFREEZECHARGE'"`      // 开仓解冻手续费(先建后平操作,需要记录)
+	Closeunfreezecharge float64   `json:"closeunfreezecharge"  xorm:"'CLOSEUNFREEZECHARGE'"`    // 平仓解冻手续费(先建后平操作,需要记录)
+	Validtype           int64     `json:"validtype"  xorm:"'VALIDTYPE'" binding:"required"`     // 有效类型 - 1当日有效 2本周有效 3指定日期有效 4一直有效 5指定时间有效
+	Validtime           time.Time `json:"validtime"  xorm:"'VALIDTIME'"`                        // 有效期限
+	Volumetype          int64     `json:"volumetype"  xorm:"'VOLUMETYPE'"`                      // 当时间有效类型为 “立即执行否则取消 IOC” 时,需要此项 - 0:任意量  1:最小量(暂时不支持) 2:全部量
+	Operatetype         int64     `json:"operatetype"  xorm:"'OPERATETYPE'" binding:"required"` // 操作类型 - 1:正常下单 2:斩仓 3:转单 4:结算撤单 5:系统卖出(适用于先平后建的卖出) 6:行情源报价 7:(结算)到期强平 8:(结算)协议转让 9:系统对冲单 10:(结算)到期无效 11:交割协议转让 12:交割协议平仓 13:交割成交(所有权) 14:管理端强行平仓 15:管理端协议转让
+	Ordertime           time.Time `json:"ordertime"  xorm:"'ORDERTIME'" binding:"required"`     // 委托时间
+	Orderstatus         int64     `json:"orderstatus"  xorm:"'ORDERSTATUS'"`                    // 委托状态 - 1: 委托请求 2:待冻结 3:委托成功 4: 委托失败 5:配对成功 6: 已撤销 7:部分成交 8:已成交 9:部成部撤 10:成交失败 11:已拒绝 12:经过摘牌(先摘后挂专用-先摘后挂已摘过) 13:冻结成功(通道交易专用) 14:通道已撤 15:通道部成部撤 16:成交失败违约(荷兰式竞拍专用)
+	Listingselecttype   int64     `json:"listingselecttype"  xorm:"'LISTINGSELECTTYPE'"`        // 挂牌点选类型 - 1:挂牌 2:摘牌 3:先摘后挂
+	Delistingtype       int64     `json:"delistingtype"  xorm:"'DELISTINGTYPE'"`                // 摘牌类型 - 1:价格最优 2:点选成交
+
+	// 关联字段
+	GoodsCode  string `json:"goodscode" xorm:"GOODSCODE"`      // 商品代码
+	GoodsName  string `json:"goodsname" xorm:"GOODSNAME"`      // 商品名称
+	Marketname string `json:"marketname"  xorm:"'MARKETNAME'"` // 市场名称
+	TradeMode  uint32 `json:"trademode"  xorm:"'TRADEMODE'"`   // 交易模式
+
+	// 计算字段
+	Enableqty int64 `json:"enableqty" xorm:"ENABLEQTY"` // 可用数量, 委托数量 - 成交数量 - 撤单数量
+}
+
+// QueryTradeOrderDetail 委托单查询请求(合约市场)
+// @Summary 委托单查询请求(合约市场)
+// @Produce json
+// @Security ApiKeyAuth
+// @Param accountID query string true "资金账户 - 格式:1,2,3"
+// @Param tradeMode query string false "交易模式 - 格式:1,2,3"
+// @Param orderStatus query string false "委托状态 - 格式:1,2,3"
+// @Param orderID query int false "委托单号"
+// @Success 200 {object} QueryTradeOrderDetailRsp
+// @Failure 500 {object} app.Response
+// @Router /Order/QueryTradeOrderDetail [get]
+// @Tags 通用单据
+// 参考通用查询:SearchTradeOrderDetail
+func QueryTradeOrderDetail(c *gin.Context) {
+	appG := app.Gin{C: c}
+
+	// 获取请求参数
+	var req QueryTradeOrderDetailReq
+	if err := appG.C.ShouldBindQuery(&req); err != nil {
+		logger.GetLogger().Errorf("QueryTradeOrderDetail failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	datas := make([]QueryTradeOrderDetailRsp, 0)
+	engine := db.GetEngine()
+	s := engine.Table("TRADE_ORDERDETAIL").
+		Join("LEFT", "GOODS", "GOODS.GOODSID = TRADE_ORDERDETAIL.GOODSID").
+		Join("LEFT", "MARKET", "MARKET.MARKETID = TRADE_ORDERDETAIL.MARKETID").
+		Select(`TRADE_ORDERDETAIL.*, TRADE_ORDERDETAIL.ORDERPRICE - TRADE_ORDERDETAIL.TRADEQTY - TRADE_ORDERDETAIL.CANCELQTY as ENABLEQTY, 
+				GOODS.GOODSCODE, GOODS.GOODSNAME, MARKET.MARKETNAME, MARKET.TRADEMODE`).
+		Where("TRADE_ORDERDETAIL.ORDERSRC != 10 and TRADE_ORDERDETAIL.ACCOUNTID in (?)", req.AccountID).
+		Desc("TRADE_ORDERDETAIL.ORDERTIME")
+	if len(req.OrderStatus) > 0 {
+		s = s.And("TRADE_ORDERDETAIL.ORDERSTATUS in (?)", req.OrderStatus)
+	}
+	if len(req.TradeMode) > 0 {
+		s = s.And("TRADE_ORDERDETAIL.TRADEMODE in (?)", req.TradeMode)
+	}
+	if req.OrderID > 0 {
+		s = s.And("TRADE_ORDERDETAIL.ORDERID = ?", req.OrderID)
+	}
+	if err := s.Find(&datas); err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("QueryTradeOrderDetail failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+
+	// 查询成功
+	logger.GetLogger().Infof("QueryTradeOrderDetail successed: %v", datas)
+	appG.Response(http.StatusOK, e.SUCCESS, datas)
+}

+ 236 - 0
docs/docs.go

@@ -615,6 +615,63 @@ var doc = `{
                 }
             }
         },
+        "/Order/QueryTradeOrderDetail": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "通用单据"
+                ],
+                "summary": "委托单查询请求(合约市场)",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "资金账户 - 格式:1,2,3",
+                        "name": "accountID",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "交易模式 - 格式:1,2,3",
+                        "name": "tradeMode",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "委托状态 - 格式:1,2,3",
+                        "name": "orderStatus",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "委托单号",
+                        "name": "orderID",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/order.QueryTradeOrderDetailRsp"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Order/QueryTradePosition": {
             "get": {
                 "security": [
@@ -2460,6 +2517,185 @@ var doc = `{
                 }
             }
         },
+        "order.QueryTradeOrderDetailRsp": {
+            "type": "object",
+            "required": [
+                "accountid",
+                "buildtype",
+                "buyorsell",
+                "goodsid",
+                "marketid",
+                "operatetype",
+                "orderid",
+                "orderqty",
+                "ordertime",
+                "pricemode",
+                "tradedate",
+                "validtype"
+            ],
+            "properties": {
+                "accountid": {
+                    "description": "账户ID[报价币种]",
+                    "type": "integer"
+                },
+                "buildtype": {
+                    "description": "委托单据类型 - 1:建仓 2:平仓 3:先平后建",
+                    "type": "integer"
+                },
+                "buyorsell": {
+                    "description": "买卖 - 0:买 1:卖",
+                    "type": "integer"
+                },
+                "cancelorderid": {
+                    "description": "撤单单号(撤单时填写)",
+                    "type": "integer"
+                },
+                "cancelqty": {
+                    "description": "撤单数量",
+                    "type": "integer"
+                },
+                "closefreezecharge": {
+                    "description": "平仓冻结手续费(先建后平操作,需要记录)",
+                    "type": "number"
+                },
+                "closeqty": {
+                    "description": "平仓数量(先建后平操作 需要记录)",
+                    "type": "integer"
+                },
+                "closetradeqty": {
+                    "description": "平仓成交数量(先建后平操作,需要记录)",
+                    "type": "integer"
+                },
+                "closeunfreezecharge": {
+                    "description": "平仓解冻手续费(先建后平操作,需要记录)",
+                    "type": "number"
+                },
+                "delistingtype": {
+                    "description": "摘牌类型 - 1:价格最优 2:点选成交",
+                    "type": "integer"
+                },
+                "enableqty": {
+                    "description": "计算字段",
+                    "type": "integer"
+                },
+                "freezecharge": {
+                    "description": "冻结手续费",
+                    "type": "number"
+                },
+                "freezemargin": {
+                    "description": "冻结保证金(冻结交易金额)",
+                    "type": "number"
+                },
+                "goodscode": {
+                    "description": "关联字段",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "listingselecttype": {
+                    "description": "挂牌点选类型 - 1:挂牌 2:摘牌 3:先摘后挂",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "marketname": {
+                    "description": "市场名称",
+                    "type": "string"
+                },
+                "openfreezecharge": {
+                    "description": "开仓冻结手续费(先建后平操作,需要记录)",
+                    "type": "number"
+                },
+                "openqty": {
+                    "description": "开仓数量(先建后平操作,需要记录)",
+                    "type": "integer"
+                },
+                "opentradeqty": {
+                    "description": "开仓成交数量(先建后平操作,需要记录)",
+                    "type": "integer"
+                },
+                "openunfreezecharge": {
+                    "description": "开仓解冻手续费(先建后平操作,需要记录)",
+                    "type": "number"
+                },
+                "operatetype": {
+                    "description": "操作类型 - 1:正常下单 2:斩仓 3:转单 4:结算撤单 5:系统卖出(适用于先平后建的卖出) 6:行情源报价 7:(结算)到期强平 8:(结算)协议转让 9:系统对冲单 10:(结算)到期无效 11:交割协议转让 12:交割协议平仓 13:交割成交(所有权) 14:管理端强行平仓 15:管理端协议转让",
+                    "type": "integer"
+                },
+                "orderid": {
+                    "description": "委托单字段",
+                    "type": "integer"
+                },
+                "orderprice": {
+                    "description": "委托价格",
+                    "type": "number"
+                },
+                "orderqty": {
+                    "description": "委托数量",
+                    "type": "integer"
+                },
+                "orderstatus": {
+                    "description": "委托状态 - 1: 委托请求 2:待冻结 3:委托成功 4: 委托失败 5:配对成功 6: 已撤销 7:部分成交 8:已成交 9:部成部撤 10:成交失败 11:已拒绝 12:经过摘牌(先摘后挂专用-先摘后挂已摘过) 13:冻结成功(通道交易专用) 14:通道已撤 15:通道部成部撤 16:成交失败违约(荷兰式竞拍专用)",
+                    "type": "integer"
+                },
+                "ordertime": {
+                    "description": "委托时间",
+                    "type": "string"
+                },
+                "preorderid": {
+                    "description": "关联预埋单号(止盈止损单时填写)",
+                    "type": "integer"
+                },
+                "pricemode": {
+                    "description": "取价方式 - 1:市价 2: 限价",
+                    "type": "integer"
+                },
+                "relatedid": {
+                    "description": "关联单号(交割单)",
+                    "type": "integer"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "trademode": {
+                    "description": "交易模式",
+                    "type": "integer"
+                },
+                "tradeqty": {
+                    "description": "成交数量",
+                    "type": "integer"
+                },
+                "unfreezecharge": {
+                    "description": "解冻手续费",
+                    "type": "number"
+                },
+                "unfreezemargin": {
+                    "description": "解冻保证金",
+                    "type": "number"
+                },
+                "validtime": {
+                    "description": "有效期限",
+                    "type": "string"
+                },
+                "validtype": {
+                    "description": "有效类型 - 1当日有效 2本周有效 3指定日期有效 4一直有效 5指定时间有效",
+                    "type": "integer"
+                },
+                "volumetype": {
+                    "description": "当时间有效类型为 “立即执行否则取消 IOC” 时,需要此项 - 0:任意量  1:最小量(暂时不支持) 2:全部量",
+                    "type": "integer"
+                }
+            }
+        },
         "order.QueryTradePositionRsp": {
             "type": "object",
             "properties": {

+ 236 - 0
docs/swagger.json

@@ -599,6 +599,63 @@
                 }
             }
         },
+        "/Order/QueryTradeOrderDetail": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "通用单据"
+                ],
+                "summary": "委托单查询请求(合约市场)",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "资金账户 - 格式:1,2,3",
+                        "name": "accountID",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "交易模式 - 格式:1,2,3",
+                        "name": "tradeMode",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "委托状态 - 格式:1,2,3",
+                        "name": "orderStatus",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "委托单号",
+                        "name": "orderID",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/order.QueryTradeOrderDetailRsp"
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Order/QueryTradePosition": {
             "get": {
                 "security": [
@@ -2444,6 +2501,185 @@
                 }
             }
         },
+        "order.QueryTradeOrderDetailRsp": {
+            "type": "object",
+            "required": [
+                "accountid",
+                "buildtype",
+                "buyorsell",
+                "goodsid",
+                "marketid",
+                "operatetype",
+                "orderid",
+                "orderqty",
+                "ordertime",
+                "pricemode",
+                "tradedate",
+                "validtype"
+            ],
+            "properties": {
+                "accountid": {
+                    "description": "账户ID[报价币种]",
+                    "type": "integer"
+                },
+                "buildtype": {
+                    "description": "委托单据类型 - 1:建仓 2:平仓 3:先平后建",
+                    "type": "integer"
+                },
+                "buyorsell": {
+                    "description": "买卖 - 0:买 1:卖",
+                    "type": "integer"
+                },
+                "cancelorderid": {
+                    "description": "撤单单号(撤单时填写)",
+                    "type": "integer"
+                },
+                "cancelqty": {
+                    "description": "撤单数量",
+                    "type": "integer"
+                },
+                "closefreezecharge": {
+                    "description": "平仓冻结手续费(先建后平操作,需要记录)",
+                    "type": "number"
+                },
+                "closeqty": {
+                    "description": "平仓数量(先建后平操作 需要记录)",
+                    "type": "integer"
+                },
+                "closetradeqty": {
+                    "description": "平仓成交数量(先建后平操作,需要记录)",
+                    "type": "integer"
+                },
+                "closeunfreezecharge": {
+                    "description": "平仓解冻手续费(先建后平操作,需要记录)",
+                    "type": "number"
+                },
+                "delistingtype": {
+                    "description": "摘牌类型 - 1:价格最优 2:点选成交",
+                    "type": "integer"
+                },
+                "enableqty": {
+                    "description": "计算字段",
+                    "type": "integer"
+                },
+                "freezecharge": {
+                    "description": "冻结手续费",
+                    "type": "number"
+                },
+                "freezemargin": {
+                    "description": "冻结保证金(冻结交易金额)",
+                    "type": "number"
+                },
+                "goodscode": {
+                    "description": "关联字段",
+                    "type": "string"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "goodsname": {
+                    "description": "商品名称",
+                    "type": "string"
+                },
+                "listingselecttype": {
+                    "description": "挂牌点选类型 - 1:挂牌 2:摘牌 3:先摘后挂",
+                    "type": "integer"
+                },
+                "marketid": {
+                    "description": "市场ID",
+                    "type": "integer"
+                },
+                "marketname": {
+                    "description": "市场名称",
+                    "type": "string"
+                },
+                "openfreezecharge": {
+                    "description": "开仓冻结手续费(先建后平操作,需要记录)",
+                    "type": "number"
+                },
+                "openqty": {
+                    "description": "开仓数量(先建后平操作,需要记录)",
+                    "type": "integer"
+                },
+                "opentradeqty": {
+                    "description": "开仓成交数量(先建后平操作,需要记录)",
+                    "type": "integer"
+                },
+                "openunfreezecharge": {
+                    "description": "开仓解冻手续费(先建后平操作,需要记录)",
+                    "type": "number"
+                },
+                "operatetype": {
+                    "description": "操作类型 - 1:正常下单 2:斩仓 3:转单 4:结算撤单 5:系统卖出(适用于先平后建的卖出) 6:行情源报价 7:(结算)到期强平 8:(结算)协议转让 9:系统对冲单 10:(结算)到期无效 11:交割协议转让 12:交割协议平仓 13:交割成交(所有权) 14:管理端强行平仓 15:管理端协议转让",
+                    "type": "integer"
+                },
+                "orderid": {
+                    "description": "委托单字段",
+                    "type": "integer"
+                },
+                "orderprice": {
+                    "description": "委托价格",
+                    "type": "number"
+                },
+                "orderqty": {
+                    "description": "委托数量",
+                    "type": "integer"
+                },
+                "orderstatus": {
+                    "description": "委托状态 - 1: 委托请求 2:待冻结 3:委托成功 4: 委托失败 5:配对成功 6: 已撤销 7:部分成交 8:已成交 9:部成部撤 10:成交失败 11:已拒绝 12:经过摘牌(先摘后挂专用-先摘后挂已摘过) 13:冻结成功(通道交易专用) 14:通道已撤 15:通道部成部撤 16:成交失败违约(荷兰式竞拍专用)",
+                    "type": "integer"
+                },
+                "ordertime": {
+                    "description": "委托时间",
+                    "type": "string"
+                },
+                "preorderid": {
+                    "description": "关联预埋单号(止盈止损单时填写)",
+                    "type": "integer"
+                },
+                "pricemode": {
+                    "description": "取价方式 - 1:市价 2: 限价",
+                    "type": "integer"
+                },
+                "relatedid": {
+                    "description": "关联单号(交割单)",
+                    "type": "integer"
+                },
+                "tradedate": {
+                    "description": "交易日(yyyyMMdd)",
+                    "type": "string"
+                },
+                "trademode": {
+                    "description": "交易模式",
+                    "type": "integer"
+                },
+                "tradeqty": {
+                    "description": "成交数量",
+                    "type": "integer"
+                },
+                "unfreezecharge": {
+                    "description": "解冻手续费",
+                    "type": "number"
+                },
+                "unfreezemargin": {
+                    "description": "解冻保证金",
+                    "type": "number"
+                },
+                "validtime": {
+                    "description": "有效期限",
+                    "type": "string"
+                },
+                "validtype": {
+                    "description": "有效类型 - 1当日有效 2本周有效 3指定日期有效 4一直有效 5指定时间有效",
+                    "type": "integer"
+                },
+                "volumetype": {
+                    "description": "当时间有效类型为 “立即执行否则取消 IOC” 时,需要此项 - 0:任意量  1:最小量(暂时不支持) 2:全部量",
+                    "type": "integer"
+                }
+            }
+        },
         "order.QueryTradePositionRsp": {
             "type": "object",
             "properties": {

+ 172 - 0
docs/swagger.yaml

@@ -1226,6 +1226,142 @@ definitions:
     required:
     - autoid
     type: object
+  order.QueryTradeOrderDetailRsp:
+    properties:
+      accountid:
+        description: 账户ID[报价币种]
+        type: integer
+      buildtype:
+        description: 委托单据类型 - 1:建仓 2:平仓 3:先平后建
+        type: integer
+      buyorsell:
+        description: 买卖 - 0:买 1:卖
+        type: integer
+      cancelorderid:
+        description: 撤单单号(撤单时填写)
+        type: integer
+      cancelqty:
+        description: 撤单数量
+        type: integer
+      closefreezecharge:
+        description: 平仓冻结手续费(先建后平操作,需要记录)
+        type: number
+      closeqty:
+        description: 平仓数量(先建后平操作 需要记录)
+        type: integer
+      closetradeqty:
+        description: 平仓成交数量(先建后平操作,需要记录)
+        type: integer
+      closeunfreezecharge:
+        description: 平仓解冻手续费(先建后平操作,需要记录)
+        type: number
+      delistingtype:
+        description: 摘牌类型 - 1:价格最优 2:点选成交
+        type: integer
+      enableqty:
+        description: 计算字段
+        type: integer
+      freezecharge:
+        description: 冻结手续费
+        type: number
+      freezemargin:
+        description: 冻结保证金(冻结交易金额)
+        type: number
+      goodscode:
+        description: 关联字段
+        type: string
+      goodsid:
+        description: 商品ID
+        type: integer
+      goodsname:
+        description: 商品名称
+        type: string
+      listingselecttype:
+        description: 挂牌点选类型 - 1:挂牌 2:摘牌 3:先摘后挂
+        type: integer
+      marketid:
+        description: 市场ID
+        type: integer
+      marketname:
+        description: 市场名称
+        type: string
+      openfreezecharge:
+        description: 开仓冻结手续费(先建后平操作,需要记录)
+        type: number
+      openqty:
+        description: 开仓数量(先建后平操作,需要记录)
+        type: integer
+      opentradeqty:
+        description: 开仓成交数量(先建后平操作,需要记录)
+        type: integer
+      openunfreezecharge:
+        description: 开仓解冻手续费(先建后平操作,需要记录)
+        type: number
+      operatetype:
+        description: 操作类型 - 1:正常下单 2:斩仓 3:转单 4:结算撤单 5:系统卖出(适用于先平后建的卖出) 6:行情源报价 7:(结算)到期强平 8:(结算)协议转让 9:系统对冲单 10:(结算)到期无效 11:交割协议转让 12:交割协议平仓 13:交割成交(所有权) 14:管理端强行平仓 15:管理端协议转让
+        type: integer
+      orderid:
+        description: 委托单字段
+        type: integer
+      orderprice:
+        description: 委托价格
+        type: number
+      orderqty:
+        description: 委托数量
+        type: integer
+      orderstatus:
+        description: 委托状态 - 1: 委托请求 2:待冻结 3:委托成功 4: 委托失败 5:配对成功 6: 已撤销 7:部分成交 8:已成交 9:部成部撤 10:成交失败 11:已拒绝 12:经过摘牌(先摘后挂专用-先摘后挂已摘过) 13:冻结成功(通道交易专用) 14:通道已撤 15:通道部成部撤 16:成交失败违约(荷兰式竞拍专用)
+        type: integer
+      ordertime:
+        description: 委托时间
+        type: string
+      preorderid:
+        description: 关联预埋单号(止盈止损单时填写)
+        type: integer
+      pricemode:
+        description: '取价方式 - 1:市价 2: 限价'
+        type: integer
+      relatedid:
+        description: 关联单号(交割单)
+        type: integer
+      tradedate:
+        description: 交易日(yyyyMMdd)
+        type: string
+      trademode:
+        description: 交易模式
+        type: integer
+      tradeqty:
+        description: 成交数量
+        type: integer
+      unfreezecharge:
+        description: 解冻手续费
+        type: number
+      unfreezemargin:
+        description: 解冻保证金
+        type: number
+      validtime:
+        description: 有效期限
+        type: string
+      validtype:
+        description: 有效类型 - 1当日有效 2本周有效 3指定日期有效 4一直有效 5指定时间有效
+        type: integer
+      volumetype:
+        description: 当时间有效类型为 “立即执行否则取消 IOC” 时,需要此项 - 0:任意量  1:最小量(暂时不支持) 2:全部量
+        type: integer
+    required:
+    - accountid
+    - buildtype
+    - buyorsell
+    - goodsid
+    - marketid
+    - operatetype
+    - orderid
+    - orderqty
+    - ordertime
+    - pricemode
+    - tradedate
+    - validtype
+    type: object
   order.QueryTradePositionRsp:
     properties:
       accountid:
@@ -1710,6 +1846,42 @@ paths:
       summary: 查询现货合同表信息(指定策略ID、未结束的)
       tags:
       - 风险管理
+  /Order/QueryTradeOrderDetail:
+    get:
+      parameters:
+      - description: 资金账户 - 格式:1,2,3
+        in: query
+        name: accountID
+        required: true
+        type: string
+      - description: 交易模式 - 格式:1,2,3
+        in: query
+        name: tradeMode
+        type: string
+      - description: 委托状态 - 格式:1,2,3
+        in: query
+        name: orderStatus
+        type: string
+      - description: 委托单号
+        in: query
+        name: orderID
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/order.QueryTradeOrderDetailRsp'
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 委托单查询请求(合约市场)
+      tags:
+      - 通用单据
   /Order/QueryTradePosition:
     get:
       parameters:

+ 2 - 0
routers/router.go

@@ -65,6 +65,8 @@ func InitRouter() *gin.Engine {
 	{
 		// 持仓汇总查询(合约市场)
 		orderR.GET("/QueryTradePosition", order.QueryTradePosition)
+		// 委托单查询请求(合约市场)
+		orderR.GET("/QueryTradeOrderDetail", order.QueryTradeOrderDetail)
 	}
 	// ************************ 仓单贸易 ************************
 	wrTradeR := apiR.Group("WRTrade")