Sfoglia il codice sorgente

修改企业风管持仓头寸开仓均价等计算错误问题

zhou.xiaoning 4 anni fa
parent
commit
da6e5a29b3
3 ha cambiato i file con 10 aggiunte e 9 eliminazioni
  1. 6 6
      config/config.xml
  2. 2 2
      controllers/ermcp/qryOrder.go
  3. 2 1
      models/ermcpOrder.go

+ 6 - 6
config/config.xml

@@ -13,11 +13,11 @@
     <DbAddress value="192.168.31.117"/>
     <DbName value="orcl"/>
     <DbPort value="1521"/>
-    <DbUser value="mtp2_test171"/>
+    <DbUser value="mtp2_test104"/>
     <DbPwd value="muchinfo"/>
   </DbSetting>
   <RedisSetting>
-    <Address value="192.168.31.171"/>
+    <Address value="192.168.31.114"/>
     <Port value="5007"/>
     <Timeout value="3"/>
     <ConnNum value="1"/>
@@ -25,11 +25,11 @@
     <Pwd value=""/>
   </RedisSetting>
   <MqSetting>
-    <Url value="amqp://guest:guest@192.168.31.171:5020/test"/>
+    <Url value="amqp://guest:guest@192.168.31.114:5020/test"/>
     <Exchange value="entry"/>
   </MqSetting>
   <MongoDBSetting>
-    <HostName value="192.168.31.171"/>
+    <HostName value="192.168.31.114"/>
     <Port value="5025"/>
     <DBName value="HistoryQuote"/>
     <Username value="quote_test01"/>
@@ -38,8 +38,8 @@
   <MySQLSetting>
     <Host value="192.168.30.140"/>
     <Port value="3306"/>
-    <DBName value="historyquote_test171"/>
-    <Username value="root"/>
+    <DBName value="historyquote_test114"/>
+    <Username value="quote_test114"/>
     <Password value="123456"/>
   </MySQLSetting>
 </Configuration>

+ 2 - 2
controllers/ermcp/qryOrder.go

@@ -345,7 +345,7 @@ func QueryErmcpTradePosition(c *gin.Context) {
 					}
 				}
 				// 子账户需要从内部持仓明细(通道)表汇总计划开仓成本和开仓均价
-				hedgeInnerHolderDetails, _ := models.GetHedgeInnerHolderDetails(int(item.Goodsid), 0)
+				hedgeInnerHolderDetails, _ := models.GetHedgeInnerHolderDetails(req.AccountID, int(item.Goodsid), 0)
 				for _, detail := range hedgeInnerHolderDetails {
 					// 开仓成本 = 建仓价 * 持仓数量 * 合约单位
 					item.OpenCost += detail.Openprice * float64(detail.Holderqty) * goods.Agreeunit
@@ -446,7 +446,7 @@ func QueryErmcpTradePosition(c *gin.Context) {
 					}
 				}
 				// 子账户需要从内部持仓明细(通道)表汇总计划开仓成本和开仓均价
-				hedgeInnerHolderDetails, _ := models.GetHedgeInnerHolderDetails(int(item.Goodsid), 1)
+				hedgeInnerHolderDetails, _ := models.GetHedgeInnerHolderDetails(req.AccountID, int(item.Goodsid), 1)
 				for _, detail := range hedgeInnerHolderDetails {
 					// 开仓成本 = 建仓价 * 持仓数量 * 合约单位
 					item.OpenCost += detail.Openprice * float64(detail.Holderqty) * goods.Agreeunit

+ 2 - 1
models/ermcpOrder.go

@@ -272,12 +272,13 @@ func GetHedgeOutTradePositions(accountID int, marketID int) ([]Hedgeouttradeposi
 }
 
 // GetHedgeInnerHolderDetails 获取指定商品和方向的通道交易内部持仓明细数据
-func GetHedgeInnerHolderDetails(goodsID, buyOrSell int) ([]Hedgeinnerholderdetail, error) {
+func GetHedgeInnerHolderDetails(accountID, goodsID, buyOrSell int) ([]Hedgeinnerholderdetail, error) {
 	hedgeInnerHolderDetails := make([]Hedgeinnerholderdetail, 0)
 
 	if err := db.GetEngine().
 		Where("GOODSID = ?", goodsID).
 		And("BUYORSELL = ?", buyOrSell).
+		And("ACCOUNTID = ?", accountID).
 		Find(&hedgeInnerHolderDetails); err != nil {
 		return nil, err
 	}