mirror of
https://github.com/injoyai/tdx.git
synced 2025-11-26 21:25:35 +08:00
拆分不同类型到不同的文件
This commit is contained in:
25
protocol/model_stock_count.go
Normal file
25
protocol/model_stock_count.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package protocol
|
||||
|
||||
import "errors"
|
||||
|
||||
type StockCountResp struct {
|
||||
Count uint16
|
||||
}
|
||||
|
||||
type stockCount struct{}
|
||||
|
||||
// Frame 0c0200000001080008004e04000075c73301
|
||||
func (this *stockCount) Frame(exchange Exchange) *Frame {
|
||||
return &Frame{
|
||||
Control: Control01,
|
||||
Type: TypeStockCount,
|
||||
Data: []byte{exchange.Uint8(), 0x0, 0x75, 0xc7, 0x33, 0x01}, //后面的4字节不知道啥意思
|
||||
}
|
||||
}
|
||||
|
||||
func (this *stockCount) Decode(bs []byte) (*StockCountResp, error) {
|
||||
if len(bs) < 2 {
|
||||
return nil, errors.New("数据长度不足")
|
||||
}
|
||||
return &StockCountResp{Count: Uint16(bs)}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user