Documentation ¶
Index ¶
- func GenerateHeader(eventId uint16, cmdId uint16, pkgLen uint16, isRaw byte, idx uint16) []byte
- type MarketInitInfo
- type ReportData
- type ReportHeader
- type ReportItem
- type RequestNode
- func GenerateDeviceNode(mainVersion, coreVersion float32) RequestNode
- func GenerateMarketInitInfo() RequestNode
- func GenerateMarketStockBase(market uint16, offset uint16) RequestNode
- func GenerateMarketStockCount(market int) RequestNode
- func GenerateNotice() RequestNode
- func GenerateStockBonus(stocks []StockBonus, index uint16) RequestNode
- func GenerateStockDayItem(market uint16, code string, start, end uint32, index uint16) RequestNode
- func GenerateStockMinsItem(market uint16, code string, start, end uint32, index uint16) RequestNode
- type ResponseHeader
- type ResponseNode
- type StockBaseItem
- type StockBonus
- type StockBonusItem
- type StockDayItem
- type StockMinsItem
- type TdxPacketProtocolImpl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MarketInitInfo ¶
type MarketInitInfo struct { Unknown1 [10]uint32 // 10L: unknown Unknown2 uint16 // H: unknown DateSZ uint32 // L: 深最后交易日期 LastSZFlag uint32 // L: 深最后交易Flag DateSH uint32 // L: 沪最后交易日期 LastSHFlag uint32 // L: 沪最后交易Flag Unknown3 uint32 // L: unknown Unknown4 uint16 // H: unknown Unknown5 uint32 // L: unknown ServerName [21]byte // 21s: 服务器名称 DomainUrl [18]byte // 18s: domain }
*
- 市场最后交易的数据信息
type ReportData ¶
type ReportData struct {
Prices [264]float32
}
type ReportItem ¶
type RequestNode ¶
type RequestNode struct { EventId uint16 CmdId uint16 IsRaw byte Index uint16 RawData interface{} // 原始请求封包体的原始数据 }
*
- 请求封包的基本包装
func GenerateDeviceNode ¶
func GenerateDeviceNode(mainVersion, coreVersion float32) RequestNode
func GenerateMarketInitInfo ¶
func GenerateMarketInitInfo() RequestNode
func GenerateMarketStockBase ¶
func GenerateMarketStockBase(market uint16, offset uint16) RequestNode
func GenerateMarketStockCount ¶
func GenerateMarketStockCount(market int) RequestNode
func GenerateStockBonus ¶
func GenerateStockBonus(stocks []StockBonus, index uint16) RequestNode
func GenerateStockDayItem ¶
func GenerateStockDayItem(market uint16, code string, start, end uint32, index uint16) RequestNode
func GenerateStockMinsItem ¶
func GenerateStockMinsItem(market uint16, code string, start, end uint32, index uint16) RequestNode
type ResponseHeader ¶
type ResponseHeader struct { PacketFlag uint32 // 封包标识 IsCompress byte // 封包是否被压缩 Index uint16 // 索引(股票索引) CmdId uint16 // Unknown1 byte // 未知标识 EventId uint16 // 事件标识, 靠此字段可以确定封包的类别 BodyLength uint16 // 分别是封包长度 BodyMaxLength uint16 // 解压所需要的空间大小 }
*
- 应答封包的包头结构
type ResponseNode ¶
type ResponseNode struct { ResponseHeader // 收到的封包头信息 RawData interface{} // 原始相应封包体的原始数据 }
*
- 响应封包的基本包装
type StockBaseItem ¶
type StockBaseItem struct { Code [6]byte // 股票代码 Unknown1 uint16 // 未知 固定0x64 Name [8]byte // 股票名称 Unknown2 uint32 // 未知 Unknown3 byte // 未知 固定0x02 Price float32 // 价格(昨收) Bonus1 uint16 // 用于计算权息数据 Bonus2 uint16 // 权息数量 }
*
- 股票基础信息
type StockBonus ¶
type StockBonusItem ¶
type StockBonusItem struct { Market byte // B: 市场(market): 0深, 1沪 Code [6]byte // 6s: 股票代码(code) Unknown1 byte // B: 股票代码的0结束符(python解析麻烦,所以单独解析出来不使用) Date int32 // L: 日期(date) Type byte // B: 分红配股类型(type): 1标识除权除息, 2: 配送股上市; 3: 非流通股上市; 4:未知股本变动; 5: 股本变动,6: 增发新股, 7: 股本回购, 8: 增发新股上市, 9:转配股上市 Money float32 // 送现金 Price float32 // 配股价 Count float32 // 送股数 Rate float32 // 配股比例 }
*
- 股票权息数据结构
type StockDayItem ¶
type StockDayItem struct { Date uint32 Open uint32 High uint32 Low uint32 Close uint32 Amount float32 Volume uint32 Unknown1 uint32 }
*
- 日线数据结构
B1 A2 33 01 BD 03 00 00 C3 03 00 00 BB 03 00 00 C0 03 00 00 71 BB 13 4E 75 B9 D9 03 00 00 01 00 B2 A2 33 01 C0 03 00 00 C0 03 00 00 B0 03 00 00 BB 03 00 00 7C 5C 3C 4E 4A 00 F2 04 00 00 01 00 ----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- 日期(十进制) 开*100 高*100 低*100 收*100 成交额(float) 成交量
type StockMinsItem ¶
type StockMinsItem struct { Date uint16 Time uint16 Open float32 High float32 Low float32 Close float32 Amount float32 Volume uint32 Unknown1 uint32 }
*
- 五分钟线结构
97 63 3F 02 D7 A3 35 42 3D 0A 37 42 D7 A3 35 42 33 33 36 42 B0 9E B4 49 90 7E 00 00 00 00 00 00 ----- ----- ----------- ----------- ----------- ----------- ----------- ----------- ----------- date time open high low close amount volume unkown
type TdxPacketProtocolImpl ¶
type TdxPacketProtocolImpl struct {
// contains filtered or unexported fields
}
只做最简单实现: IPacketProtocol 接口
func NewDefaultProtocol ¶
func NewDefaultProtocol() *TdxPacketProtocolImpl
func (*TdxPacketProtocolImpl) BuildPacket ¶
func (tdx *TdxPacketProtocolImpl) BuildPacket(pkgNode interface{}) []byte
*
- 组包方法
func (*TdxPacketProtocolImpl) ReadPacket ¶
func (tdx *TdxPacketProtocolImpl) ReadPacket(s cnet.ISession) (interface{}, error)
*
- 直接返回所有封包内容,不做任何处理
func (*TdxPacketProtocolImpl) SendPacket ¶
func (tdx *TdxPacketProtocolImpl) SendPacket(conn net.Conn, buff []byte) error