|
|
@@ -69,8 +69,7 @@ type HsbyTopGoods struct {
|
|
|
|
|
|
Trademode int32 `json:"trademode" xorm:"'TRADEMODE'" binding:"required"` // 交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式 21:竞拍-大宗式 22:受托竞价
|
|
|
|
|
|
- Last float64 `json:"last" xorm:"-"` // 现价
|
|
|
- LotSize float64 `json:"lotsize" xorm:"-"` // 最小变动单位
|
|
|
+ Last float64 `json:"last" xorm:"-"` // 现价
|
|
|
}
|
|
|
|
|
|
// GetHsbyTopGoodses 获取热门商品列表
|
|
|
@@ -127,8 +126,8 @@ func GetHsbyTopGoodses(marketIDs string, descProvinceID, descCityID int) ([]Hsby
|
|
|
topGoods := &topGoodses[i]
|
|
|
// FIXME: - 这里应该使用 Duck Typing,后期再处理
|
|
|
// 计算最小变动单位
|
|
|
- lotSize := float64(topGoods.Quoteminunit) * math.Pow(0.1, float64(topGoods.Decimalplace))
|
|
|
- topGoods.LotSize, _ = strconv.ParseFloat(utils.FormatFloat(lotSize, int(topGoods.Decimalplace)), 64)
|
|
|
+ // lotSize := float64(topGoods.Quoteminunit) * math.Pow(0.1, float64(topGoods.Decimalplace))
|
|
|
+ // topGoods.LotSize, _ = strconv.ParseFloat(utils.FormatFloat(lotSize, int(topGoods.Decimalplace)), 64)
|
|
|
|
|
|
for _, q := range quoteDays {
|
|
|
if g.Goodscode == q.Goodscode {
|
|
|
@@ -177,7 +176,6 @@ type HsbyListingGoodsDetail struct {
|
|
|
Last float64 `json:"last" xorm:"-"` // 现价
|
|
|
Limitup float64 `json:"limitup" xorm:"-"` // 涨停价
|
|
|
Limitdown float64 `json:"limitdown" xorm:"-"` // 跌停价
|
|
|
- LotSize float64 `json:"lotsize" xorm:"-"` // 最小变动单位
|
|
|
}
|
|
|
|
|
|
// GetHsbyListingGoodsDetail 获取二级市场(挂牌点选)商品信息详情
|
|
|
@@ -233,8 +231,8 @@ func GetHsbyListingGoodsDetail(goodsID int) (*HsbyListingGoodsDetail, error) {
|
|
|
|
|
|
// FIXME: - 这里应该使用 Duck Typing,后期再处理
|
|
|
// 计算最小变动单位
|
|
|
- lotSize := float64(hsbyListingGoodsDetail.Quoteminunit) * math.Pow(0.1, float64(hsbyListingGoodsDetail.Decimalplace))
|
|
|
- hsbyListingGoodsDetail.LotSize, _ = strconv.ParseFloat(utils.FormatFloat(lotSize, int(hsbyListingGoodsDetail.Decimalplace)), 64)
|
|
|
+ // lotSize := float64(hsbyListingGoodsDetail.Quoteminunit) * math.Pow(0.1, float64(hsbyListingGoodsDetail.Decimalplace))
|
|
|
+ // hsbyListingGoodsDetail.LotSize, _ = strconv.ParseFloat(utils.FormatFloat(lotSize, int(hsbyListingGoodsDetail.Decimalplace)), 64)
|
|
|
|
|
|
return &hsbyListingGoodsDetail, nil
|
|
|
}
|
|
|
@@ -546,8 +544,6 @@ type HsbyPreGoods struct {
|
|
|
Picurls string `json:"picurls" xorm:"'PICURLS'"` // 介绍图片[多张用逗号分隔]
|
|
|
|
|
|
Trademode int32 `json:"trademode" xorm:"'TRADEMODE'" binding:"required"` // 交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式 21:竞拍-大宗式 22:受托竞价
|
|
|
-
|
|
|
- LotSize float64 `json:"lotsize" xorm:"-"` // 最小变动单位
|
|
|
}
|
|
|
|
|
|
// GetHsbyPreGoodses 获取“新品上市”商品列表(一级市场产能预售)
|
|
|
@@ -584,14 +580,14 @@ func GetHsbyPreGoodses(marketIDs string, descProvinceID, descCityID int) ([]Hsby
|
|
|
return nil, err
|
|
|
}
|
|
|
|
|
|
- for i := range preGoodses {
|
|
|
- preGoods := &preGoodses[i]
|
|
|
+ // for i := range preGoodses {
|
|
|
+ // preGoods := &preGoodses[i]
|
|
|
|
|
|
- // FIXME: - 这里应该使用 Duck Typing,后期再处理
|
|
|
- // 计算最小变动单位
|
|
|
- lotSize := float64(preGoods.Quoteminunit) * math.Pow(0.1, float64(preGoods.Decimalplace))
|
|
|
- preGoods.LotSize, _ = strconv.ParseFloat(utils.FormatFloat(lotSize, int(preGoods.Decimalplace)), 64)
|
|
|
- }
|
|
|
+ // // FIXME: - 这里应该使用 Duck Typing,后期再处理
|
|
|
+ // // 计算最小变动单位
|
|
|
+ // lotSize := float64(preGoods.Quoteminunit) * math.Pow(0.1, float64(preGoods.Decimalplace))
|
|
|
+ // preGoods.LotSize, _ = strconv.ParseFloat(utils.FormatFloat(lotSize, int(preGoods.Decimalplace)), 64)
|
|
|
+ // }
|
|
|
|
|
|
return preGoodses, nil
|
|
|
}
|
|
|
@@ -633,14 +629,16 @@ type HsbyPreGoodsDetail struct {
|
|
|
|
|
|
Customername string `json:"customername" xorm:"'CUSTOMERNAME'"` // 发行单位
|
|
|
|
|
|
- LotSize float64 `json:"lotsize" xorm:"-"` // 最小变动单位
|
|
|
+ StepValue float64 `json:"stepValue" xorm:"-"` // 价格最小变动单位
|
|
|
+ LotSize int `json:"lotsize" xorm:"-"` // 手数最小变动单位
|
|
|
+ Buymaxqty int `json:"buymaxqty" xorm:"'-'"` // 购买上限 [71] - 0为不限
|
|
|
}
|
|
|
|
|
|
// GetHsbyPreGoodsDetail 获取一级市场(产能预售)商品信息详情
|
|
|
// 参数 goodsID int 目标商品ID
|
|
|
// 返回 *HsbyListingGoodsDetail 二级市场(挂牌点选)商品信息详情,查询无结果返回nil
|
|
|
// 返回 error error
|
|
|
-func GetHsbyPreGoodsDetail(goodsID int) (*HsbyPreGoodsDetail, error) {
|
|
|
+func GetHsbyPreGoodsDetail(goodsID, accountID int) (*HsbyPreGoodsDetail, error) {
|
|
|
engine := db.GetEngine()
|
|
|
|
|
|
details := make([]HsbyPreGoodsDetail, 0)
|
|
|
@@ -675,9 +673,19 @@ func GetHsbyPreGoodsDetail(goodsID int) (*HsbyPreGoodsDetail, error) {
|
|
|
preGoodsDetail := details[0]
|
|
|
|
|
|
// FIXME: - 这里应该使用 Duck Typing,后期再处理
|
|
|
- // 计算最小变动单位
|
|
|
+ // 计算价格最小变动单位
|
|
|
lotSize := float64(preGoodsDetail.Quoteminunit) * math.Pow(0.1, float64(preGoodsDetail.Decimalplace))
|
|
|
- preGoodsDetail.LotSize, _ = strconv.ParseFloat(utils.FormatFloat(lotSize, int(preGoodsDetail.Decimalplace)), 64)
|
|
|
+ preGoodsDetail.StepValue, _ = strconv.ParseFloat(utils.FormatFloat(lotSize, int(preGoodsDetail.Decimalplace)), 64)
|
|
|
+
|
|
|
+ // 计算手数最小变动单位,一级市场固定为1
|
|
|
+ preGoodsDetail.LotSize = 1
|
|
|
+
|
|
|
+ // 获取购买上限
|
|
|
+ buyMaxQty, err := GetCPTradeBuyLimit(goodsID, accountID)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ preGoodsDetail.Buymaxqty = buyMaxQty
|
|
|
|
|
|
return &preGoodsDetail, nil
|
|
|
}
|