mirror of
https://github.com/injoyai/tdx.git
synced 2025-11-26 21:25:35 +08:00
减少方法名称长度,去掉固定前缀Stock
This commit is contained in:
36
protocol/model_kline_test.go
Normal file
36
protocol/model_kline_test.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package protocol
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_stockKline_Frame(t *testing.T) {
|
||||
//预期0c02000000001c001c002d050000303030303031 0900 0100 0000 0a00 00000000000000000000
|
||||
// 0c00000000011c001c002d050000313030303030 0900 0000 0000 0a00 00000000000000000000
|
||||
f, _ := MStockKline.Frame(TypeKlineDay, &StockKlineReq{
|
||||
Exchange: ExchangeSH,
|
||||
Code: "000001",
|
||||
Start: 0,
|
||||
Count: 10,
|
||||
})
|
||||
t.Log(f.Bytes().HEX())
|
||||
}
|
||||
|
||||
func Test_stockKline_Decode(t *testing.T) {
|
||||
s := "0a0078da340198b8018404bc055ee8b3e949ad2b094f79da34010af801a002cc0260dec949859ded4e7ada34016882028e04e603b8f91e4a111f394f7dda3401e401c20200f604f84d2b4ad4d0444f7eda3401721eaa0268d87bc549ee80e34e7fda34011e288601c601d08db849230ed54e80da3401727c32da013023584999a0784e81da3401147c0ad001d0fa86498d989a4e84da34015e6800d60278c28e491ca6a14e85da340154d001b801da01403e924989d6a54e"
|
||||
bs, err := hex.DecodeString(s)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
resp, err := MStockKline.Decode(bs, 9)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(len(resp.List))
|
||||
for _, v := range resp.List {
|
||||
t.Log(v)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user