|
|
@@ -438,6 +438,7 @@ type HsbyMyGoods struct {
|
|
|
Goodsid int32 `json:"goodsid" xorm:"'GOODSID'" binding:"required"` // 商品Id
|
|
|
Buycurpositionqty int64 `json:"buycurpositionqty" xorm:"'BUYCURPOSITIONQTY'"` // 买当前持仓总数量
|
|
|
Buycurholderamount float64 `json:"buycurholderamount" xorm:"'BUYCURHOLDERAMOUNT'"` // 买当前持仓总金额[商品币种]
|
|
|
+ EnableQty int64 `json:"enableqty" xorm:"'ENABLEQTY'"` // 可用数量
|
|
|
|
|
|
Goodscode string `json:"goodscode" xorm:"'GOODSCODE'" binding:"required"` // 商品代码(内部)
|
|
|
Goodsname string `json:"goodsname" xorm:"'GOODSNAME'" binding:"required"` // 商品名称
|
|
|
@@ -461,7 +462,7 @@ func GetHsbyMyGoods(accountIDs string) ([]HsbyMyGoods, error) {
|
|
|
hsbyMyGoodses := make([]HsbyMyGoods, 0)
|
|
|
// 此定制版本,只查询出当前手数(期末)大于0的数据 (TRADEPOSITION.BUYCURPOSITIONQTY > 0)
|
|
|
if err := engine.Table("TRADEPOSITION").
|
|
|
- Select(`TRADEPOSITION.*,
|
|
|
+ Select(`TRADEPOSITION.*, (TRADEPOSITION.BUYCURPOSITIONQTY - TRADEPOSITION.BUYFROZENQTY - TRADEPOSITION.BUYOTHERFROZENQTY) ENABLEQTY,
|
|
|
GOODS.GOODSCODE, GOODS.GOODSNAME, GOODS.DECIMALPLACE, GOODS.AGREEUNIT,
|
|
|
HSBY_GOODSEX.PICURLS,
|
|
|
ENUMDICITEM.PARAM2 CURRENCYSIGN`).
|
|
|
@@ -472,10 +473,10 @@ func GetHsbyMyGoods(accountIDs string) ([]HsbyMyGoods, error) {
|
|
|
return nil, err
|
|
|
}
|
|
|
|
|
|
- // 计算持仓均价
|
|
|
for i := range hsbyMyGoodses {
|
|
|
myGoods := &hsbyMyGoodses[i]
|
|
|
|
|
|
+ // 持仓均价
|
|
|
averagePrice := myGoods.Buycurholderamount / float64(myGoods.Buycurpositionqty) / myGoods.Agreeunit
|
|
|
myGoods.Buyaverageprice, _ = strconv.ParseFloat(utils.FormatFloat(averagePrice, int(myGoods.Decimalplace)), 64)
|
|
|
}
|