diff --git a/protocol/model_kline.go b/protocol/model_kline.go index bd27f70..9e9e495 100644 --- a/protocol/model_kline.go +++ b/protocol/model_kline.go @@ -43,7 +43,7 @@ type Kline struct { Low Price //最低价 Close Price //收盘价,如果是当天,则是最新价/实时价 Volume int64 //成交量 - Amount float64 //成交额 + Amount Price //成交额 Time time.Time //时间 } @@ -52,7 +52,7 @@ func (this *Kline) String() string { this.Time.Format("2006-01-02 15:04:05"), this.Last, this.Open, this.High, this.Low, this.Close, this.RisePrice(), this.RiseRate(), - Int64UnitString(this.Volume), FloatUnitString(this.Amount), + Int64UnitString(this.Volume), FloatUnitString(this.Amount.Float64()), ) } @@ -138,7 +138,7 @@ func (kline) Decode(bs []byte, Type uint8) (*KlineResp, error) { last = last + open + _close k.Volume = int64(getVolume(Uint32(bs[:4])) / 100) - k.Amount = getVolume(Uint32(bs[4:8])) + k.Amount = Price(getVolume(Uint32(bs[4:8])) * 100) //转为分,并去除多余的小数 bs = bs[8:] resp.List = append(resp.List, k)