校对数据,多条数据已全部成功解析

This commit is contained in:
钱纯净
2024-10-24 23:18:16 +08:00
parent 9c7923d939
commit a12b6cafe9
2 changed files with 59 additions and 48 deletions

View File

@@ -17,10 +17,12 @@ func (this Price) String() string {
}
type PriceLevel struct {
Price Price //价
Vol int //量,是否是成交量?
Price Price //价 想买卖的价格
Number int //量 想买卖的数量
}
type PriceLevels [5]PriceLevel
// K k线图
type K struct {
Last Price //昨天收盘价
@@ -34,25 +36,26 @@ func (this K) String() string {
return fmt.Sprintf("昨收:%0.2f, 今开:%0.2f, 最高:%0.2f, 最低:%0.2f, 今收:%0.2f", this.Last.Float64(), this.Open.Float64(), this.High.Float64(), this.Low.Float64(), this.Close.Float64())
}
// DecodeK 一般是占用6字节
func DecodeK(bs []byte) ([]byte, K) {
k := K{}
//当日收盘价
//当日收盘价一般2字节
bs, k.Close = GetPrice(bs)
//前日收盘价
//前日收盘价一般1字节
bs, k.Last = GetPrice(bs)
k.Last += k.Close
//当日开盘价
//当日开盘价一般1字节
bs, k.Open = GetPrice(bs)
k.Open += k.Close
//当日最高价
//当日最高价一般1字节
bs, k.High = GetPrice(bs)
k.High += k.Close
//当日最低价
//当日最低价一般1字节
bs, k.Low = GetPrice(bs)
k.Low += k.Close