|
|
@@ -24,20 +24,22 @@ type QueryErmcpTradePositionRsp struct {
|
|
|
EnableQTY int64 `json:"enableqty"` // 可用量(总仓可用)
|
|
|
CurPositionQTY int64 `json:"curpositionqty"` // 当前持仓总数量(总仓数量)
|
|
|
Last float64 `json:"last"` // 现价
|
|
|
- CurHolderAmount float64 `json:"curholderamount" ` // 当前持仓总金额[商品币种](成本???)
|
|
|
+ CurHolderAmount float64 `json:"curholderamount" ` // 当前持仓总金额[商品币种]
|
|
|
PositionPL float64 `json:"positionpl"` // 持仓盈亏
|
|
|
PositionPLRate float64 `json:"positionplrate"` // 持仓盈亏率
|
|
|
CurTDPosition int64 `json:"curtdposition"` // 期末今日头寸(今仓数量)
|
|
|
CurTDPositionEnabled int64 `json:"curtdpositionenabled"` // 今仓可用
|
|
|
AveragePrice float64 `json:"averageprice"` // 持仓均价
|
|
|
UsedMargin float64 `json:"usedmargin"` // 占用保证金[商品币种]
|
|
|
- ExExehangeName string `json:"exexchangename"` // 外部交易所名称(简称)
|
|
|
+ ExExehangeName string `json:"exexchangename"` // 外部交易所名称
|
|
|
|
|
|
Goodsid int64 `json:"goodsid"` // 商品ID(自增ID SEQ_GOODS)
|
|
|
Goodscode string `json:"goodscode"` // 商品代码(内部)
|
|
|
Outgoodscode string `json:"outgoodscode"` // 商品代码(外部)
|
|
|
Agreeunit float64 `json:"agreeunit"` // 合约单位
|
|
|
Decimalplace int64 `json:"decimalplace"` // 报价小数位
|
|
|
+
|
|
|
+ Marketid int64 `json:"marketid"` // 所属市场ID
|
|
|
}
|
|
|
|
|
|
// QueryErmcpTradePosition 获取企业风管期货持仓头寸信息
|
|
|
@@ -101,6 +103,8 @@ func QueryErmcpTradePosition(c *gin.Context) {
|
|
|
UsedMargin: 0, // FIXME: - 缺少数据?
|
|
|
|
|
|
Goodsid: v.Hedgegoodsid,
|
|
|
+
|
|
|
+ Marketid: int64(v.Marketid),
|
|
|
}
|
|
|
// 获取对应商品信息
|
|
|
goods, err := models.GetGoods(int(v.Hedgegoodsid))
|
|
|
@@ -165,6 +169,8 @@ func QueryErmcpTradePosition(c *gin.Context) {
|
|
|
UsedMargin: 0, // FIXME: - 缺少数据?
|
|
|
|
|
|
Goodsid: v.Hedgegoodsid,
|
|
|
+
|
|
|
+ Marketid: int64(v.Marketid),
|
|
|
}
|
|
|
// 获取对应商品信息
|
|
|
goods, err := models.GetGoods(int(v.Hedgegoodsid))
|
|
|
@@ -242,6 +248,20 @@ func QueryErmcpTradePosition(c *gin.Context) {
|
|
|
|
|
|
Goodsid: int64(v.Goodsid),
|
|
|
}
|
|
|
+ // 获取对应市场信息
|
|
|
+ market, err := models.GetMarketByGoodsID(int(v.Goodsid))
|
|
|
+ if err != nil {
|
|
|
+ // 查询失败
|
|
|
+ logger.GetLogger().Errorf("QueryErmcpTradePosition failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.ERROR_GET_GOODS_FAILED, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if market == nil {
|
|
|
+ logger.GetLogger().Errorf("QueryErmcpTradePosition failed")
|
|
|
+ appG.Response(http.StatusBadRequest, e.ERROR_GET_GOODS_FAILED, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ item.Marketid = int64(market.Marketid)
|
|
|
// 获取对应商品信息
|
|
|
goods, err := models.GetGoods(int(v.Goodsid))
|
|
|
if err != nil {
|
|
|
@@ -314,6 +334,20 @@ func QueryErmcpTradePosition(c *gin.Context) {
|
|
|
|
|
|
Goodsid: int64(v.Goodsid),
|
|
|
}
|
|
|
+ // 获取对应市场信息
|
|
|
+ market, err := models.GetMarketByGoodsID(int(v.Goodsid))
|
|
|
+ if err != nil {
|
|
|
+ // 查询失败
|
|
|
+ logger.GetLogger().Errorf("QueryErmcpTradePosition failed: %s", err.Error())
|
|
|
+ appG.Response(http.StatusBadRequest, e.ERROR_GET_GOODS_FAILED, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if market == nil {
|
|
|
+ logger.GetLogger().Errorf("QueryErmcpTradePosition failed")
|
|
|
+ appG.Response(http.StatusBadRequest, e.ERROR_GET_GOODS_FAILED, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ item.Marketid = int64(market.Marketid)
|
|
|
// 获取对应商品信息
|
|
|
goods, err := models.GetGoods(int(v.Goodsid))
|
|
|
if err != nil {
|