6 Star 23 Fork 32

王布衣/gotdx

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
security_count.go 1.24 KB
一键复制 编辑 原始数据 按行查看 历史
package std
import (
"gitee.com/quant1x/exchange"
"gitee.com/quant1x/gotdx/internal"
)
// SecurityCountRequest 请求包结构
type SecurityCountRequest struct {
Unknown1 []byte `struc:"[12]byte"`
Market exchange.MarketType `struc:"uint16,little" json:"market"`
Unknown2 []byte `struc:"[4]byte"`
}
// Marshal 请求包序列化输出
func (req *SecurityCountRequest) Marshal() ([]byte, error) {
return DefaultMarshal(req)
}
// SecurityCountResponse 响应包结构
type SecurityCountResponse struct {
Count uint `struc:"uint16,little" json:"count"`
}
func (resp *SecurityCountResponse) Unmarshal(data []byte) error {
return DefaultUnmarshal(data, resp)
}
// todo: 检测market是否为合法值
func NewSecurityCountRequest(market exchange.MarketType) (*SecurityCountRequest, error) {
request := &SecurityCountRequest{
Unknown1: internal.HexString2Bytes("0c 0c 18 6c 00 01 08 00 08 00 4e 04"),
Market: market,
Unknown2: internal.HexString2Bytes("75 c7 33 01"),
}
return request, nil
}
func NewSecurityCount(market exchange.MarketType) (*SecurityCountRequest, *SecurityCountResponse, error) {
var response SecurityCountResponse
var request, err = NewSecurityCountRequest(market)
return request, &response, err
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/quant1x/gotdx.git
git@gitee.com:quant1x/gotdx.git
quant1x
gotdx
gotdx
v1.22.13

搜索帮助