6 Star 19 Fork 30

王布衣 / gotdx

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
security_count.go 1.24 KB
Copy Edit Raw Blame History
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.18

Search

344bd9b3 5694891 D2dac590 5694891