mirror of
https://github.com/injoyai/tdx.git
synced 2025-11-26 21:25:35 +08:00
修复分时K线成交量数据未除以100的问题,修改成交量为int64,浮点时0是很长的小数0.0...xxx
This commit is contained in:
@@ -42,7 +42,7 @@ type Kline struct {
|
|||||||
High Price //最高价
|
High Price //最高价
|
||||||
Low Price //最低价
|
Low Price //最低价
|
||||||
Close Price //收盘价,如果是当天,则是最新价/实时价
|
Close Price //收盘价,如果是当天,则是最新价/实时价
|
||||||
Volume float64 //成交量
|
Volume int64 //成交量
|
||||||
Amount float64 //成交额
|
Amount float64 //成交额
|
||||||
Time time.Time //时间
|
Time time.Time //时间
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ func (this *Kline) String() string {
|
|||||||
this.Time.Format("2006-01-02 15:04:05"),
|
this.Time.Format("2006-01-02 15:04:05"),
|
||||||
this.Last, this.Open, this.High, this.Low, this.Close,
|
this.Last, this.Open, this.High, this.Low, this.Close,
|
||||||
this.RisePrice(), this.RiseRate(),
|
this.RisePrice(), this.RiseRate(),
|
||||||
FloatUnitString(this.Volume), FloatUnitString(this.Amount),
|
Int64UnitString(this.Volume), FloatUnitString(this.Amount),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ func (kline) Decode(bs []byte, Type uint8) (*KlineResp, error) {
|
|||||||
k.Low = (open + last + low) / 10
|
k.Low = (open + last + low) / 10
|
||||||
last = last + open + _close
|
last = last + open + _close
|
||||||
|
|
||||||
k.Volume = getVolume(Uint32(bs[:4]))
|
k.Volume = int64(getVolume(Uint32(bs[:4])) / 100)
|
||||||
k.Amount = getVolume(Uint32(bs[4:8]))
|
k.Amount = getVolume(Uint32(bs[4:8]))
|
||||||
|
|
||||||
bs = bs[8:]
|
bs = bs[8:]
|
||||||
|
|||||||
@@ -89,6 +89,10 @@ func IntUnitString(n int) string {
|
|||||||
return FloatUnitString(float64(n))
|
return FloatUnitString(float64(n))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Int64UnitString(n int64) string {
|
||||||
|
return FloatUnitString(float64(n))
|
||||||
|
}
|
||||||
|
|
||||||
func GetHourMinute(bs [2]byte) string {
|
func GetHourMinute(bs [2]byte) string {
|
||||||
n := Uint16(bs[:])
|
n := Uint16(bs[:])
|
||||||
h := n / 60
|
h := n / 60
|
||||||
|
|||||||
Reference in New Issue
Block a user