quotes

package
v2.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2023 License: MIT Imports: 32 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DefaultRetryTimes  = 3 // 重试次数
	MessageHeaderBytes = 0x10
	MessageMaxBytes    = 1 << 15
)
View Source
const (
	// POOL_INITED 连接池初始化
	POOL_INITED = 1
	// POOL_MAX 连接池最大 2
	POOL_MAX = 5
	// CONN_TIMEOUT 链接超时 10 s
	CONN_TIMEOUT = 10
	// RECV_TIMEOUT 接收数据超时
	RECV_TIMEOUT = 5
)
View Source
const (
	TDX_HOST_HQ = "HQ"
	TDX_HOST_EX = "EX"
	TDX_HOST_GP = "GP"
)
View Source
const (
	// HQ_HOSTS 标准市场 主机列表
	HQ_HOSTS = `` /* 4841-byte string literal not displayed */

	// EX_HOSTS 扩展市场主机列表
	EX_HOSTS = `` /* 305-byte string literal not displayed */

	// GP_HOSTS 财务数据 主机列表
	GP_HOSTS = `[
{"name":"默认财务数据线路", "host":"120.76.152.87", "port": 7709}
]`
)
View Source
const (
	BLOCK_ZHISHU      = "block_zs.dat" // 指数
	BLOCK_FENGGE      = "block_fg.dat" // 风格
	BLOCK_GAINIAN     = "block_gn.dat" // 概念
	BLOCK_DEFAULT     = "block.dat"    // 早期的板块数据文件, 与block_zs.dat
	BLOCK_CHUNKS_SIZE = 0x7530         // 板块文件默认一个请求包最大数据
)

板块相关参数

View Source
const (
	TDX_SECURITY_BARS_MAX = 800 // 单次最大获取800条K线数据
)
View Source
const (
	TDX_SECURITY_LIST_MAX = 1000 // 单次最大获取多少条股票数据
)
View Source
const (
	TDX_SECURITY_QUOTES_MAX = 80 // 单次最大获取80条实时数据
)
View Source
const (
	TDX_SECURITY_QUOTES_MAX_V2 = 80 // 单次最大获取80条实时数据
)
View Source
const (
	TDX_TRANSACTION_MAX = 1800 // 单次最多获取多少条分笔成交记录
)

Variables

View Source
var (
	DefaultHQServer = Server{
		Name:      "临时主机",
		Host:      "119.147.212.81",
		Port:      7709,
		CrossTime: 0,
	}
	DefaultEXServer = DefaultHQServer
)
View Source
var (
	ErrBadData = errors.New("more than 8M data")
)
View Source
var (
	XDXR_CATEGORY_MAPPING = map[int]string{
		1:  "除权除息",
		2:  "送配股上市",
		3:  "非流通股上市",
		4:  "未知股本变动",
		5:  "股本变化",
		6:  "增发新股",
		7:  "股份回购",
		8:  "增发新股上市",
		9:  "转配股上市",
		10: "可转债上市",
		11: "扩缩股",
		12: "非流通股缩股",
		13: "送认购权证",
		14: "送认沽权证",
	}
)

Functions

func BestIP

func BestIP()

BestIP 测试最快的服务器

func CacheServers

func CacheServers(as AllServers) error

func CommandWithConn

func CommandWithConn(cli *LabClient, callback std.Factory) (std.Unmarshaler, error)

func ExamplePinger

func ExamplePinger()

Types

type AllServers

type AllServers struct {
	//Server ServerGroup `json:"Server"`
	BestIP ServerGroup `json:"BestIP"`
}

AllServers 全部主机

func OpenConfig

func OpenConfig() *AllServers

type BlockInfo

type BlockInfo struct {
	BlockName  string
	BlockType  uint16
	StockCount uint16
	Codelist   []string
}

type BlockInfoPackage

type BlockInfoPackage struct {
	// contains filtered or unexported fields
}

BlockInfoPackage 板块信息

func NewBlockInfoPackage

func NewBlockInfoPackage() *BlockInfoPackage

func (*BlockInfoPackage) Reply

func (obj *BlockInfoPackage) Reply() interface{}

func (*BlockInfoPackage) Serialize

func (obj *BlockInfoPackage) Serialize() ([]byte, error)

func (*BlockInfoPackage) SetParams

func (obj *BlockInfoPackage) SetParams(req *BlockInfoRequest)

func (*BlockInfoPackage) UnSerialize

func (obj *BlockInfoPackage) UnSerialize(header interface{}, data []byte) error

type BlockInfoReply

type BlockInfoReply struct {
	BlockNum uint16      `struc:"uint16,little"` // 板块个数
	Block    []BlockInfo // 板块列表
}

type BlockInfoRequest

type BlockInfoRequest struct {
	Start     uint32    `struc:"uint32,little"`
	Size      uint32    `struc:"uint32,little"`
	BlockFile [100]byte `struc:"[100]byte,little"` // 板块文件名
}

BlockInfoRequest 请求包

type BlockInfoResponse

type BlockInfoResponse struct {
	Size uint32 `struc:"uint32,little"`
	Data []byte `struc:"sizefrom=Size"`
}

type BlockMeta

type BlockMeta struct {
	Size      uint32   `struc:"uint32,little"`   // 尺寸
	C1        byte     `struc:"byte,little"`     // C1
	HashValue [32]byte `struc:"[32]byte,little"` // hash值
	C2        byte     `struc:"byte,little"`     // C2
}

BlockMeta 响应包结构

type BlockMetaPackage

type BlockMetaPackage struct {
	// contains filtered or unexported fields
}

BlockMetaPackage 板块信息

func NewBlockMetaPackage

func NewBlockMetaPackage() *BlockMetaPackage

func (*BlockMetaPackage) Reply

func (obj *BlockMetaPackage) Reply() interface{}

func (*BlockMetaPackage) Serialize

func (obj *BlockMetaPackage) Serialize() ([]byte, error)

func (*BlockMetaPackage) SetParams

func (obj *BlockMetaPackage) SetParams(req *BlockMetaRequest)

func (*BlockMetaPackage) UnSerialize

func (obj *BlockMetaPackage) UnSerialize(header interface{}, data []byte) error

type BlockMetaRequest

type BlockMetaRequest struct {
	BlockFile [40]byte // 板块文件名
}

BlockMetaRequest 请求包

type CompanyInfoCategory

type CompanyInfoCategory struct {
	Name     string `struc:"[64]byte,little" dataframe:"name"`     // 名称
	Filename string `struc:"[80]byte,little" dataframe:"filename"` // 文件名
	Offset   uint32 `struc:"uint32,little" dataframe:"offset"`     // 偏移量
	Length   uint32 `struc:"uint32,little" dataframe:"length"`     // 长度
}

type CompanyInfoCategoryPackage

type CompanyInfoCategoryPackage struct {
	// contains filtered or unexported fields
}

CompanyInfoCategoryPackage 企业基本信息

func NewCompanyInfoCategoryPackage

func NewCompanyInfoCategoryPackage() *CompanyInfoCategoryPackage

func (*CompanyInfoCategoryPackage) Reply

func (obj *CompanyInfoCategoryPackage) Reply() interface{}

func (*CompanyInfoCategoryPackage) Serialize

func (obj *CompanyInfoCategoryPackage) Serialize() ([]byte, error)

func (*CompanyInfoCategoryPackage) SetParams

func (*CompanyInfoCategoryPackage) UnSerialize

func (obj *CompanyInfoCategoryPackage) UnSerialize(header interface{}, data []byte) error

type CompanyInfoCategoryReply

type CompanyInfoCategoryReply struct {
	Count uint16                   `struc:"uint16,little,sizeof=Data"` // 词条总数
	Data  []RawCompanyInfoCategory `struc:"[152]byte, little"`         // 词条数据
}

CompanyInfoCategoryReply 响应包结构,

type CompanyInfoCategoryRequest

type CompanyInfoCategoryRequest struct {
	Market  uint16  // 市场代码
	Code    [6]byte // 股票代码
	Unknown uint32  // 未知数据
}

type CompanyInfoContent

type CompanyInfoContent struct {
	Market  proto.MarketType `dataframe:"market"`  // 市场代码
	Code    string           `dataframe:"code"`    // 短码
	Name    string           `dataframe:"name"`    // 名称
	Length  uint32           `dataframe:"length"`  // 长度
	Content string           `dataframe:"content"` // 内容
}

func (*CompanyInfoContent) Map

func (this *CompanyInfoContent) Map(unit string) *linkedhashmap.Map

type CompanyInfoContentPackage

type CompanyInfoContentPackage struct {
	// contains filtered or unexported fields
}

CompanyInfoContentPackage 企业基本信息

func NewCompanyInfoContentPackage

func NewCompanyInfoContentPackage() *CompanyInfoContentPackage

func (*CompanyInfoContentPackage) Reply

func (obj *CompanyInfoContentPackage) Reply() interface{}

func (*CompanyInfoContentPackage) Serialize

func (obj *CompanyInfoContentPackage) Serialize() ([]byte, error)

func (*CompanyInfoContentPackage) SetParams

func (*CompanyInfoContentPackage) UnSerialize

func (obj *CompanyInfoContentPackage) UnSerialize(header interface{}, data []byte) error

type CompanyInfoContentReply

type CompanyInfoContentReply struct {
	Market   uint16 `struc:"uint16,little"`  // 市场代码
	Code     string `struc:"[6]byte,little"` // 股票代码
	Unknown1 []byte `struc:"[2]byte,little"` // 未知
	Length   uint16 `struc:"uint16,little"`  // 词条总数
	Data     []byte `struc:"sizefrom=Length"`
}

CompanyInfoContentReply 响应包结构,

type CompanyInfoContentRequest

type CompanyInfoContentRequest struct {
	Market   uint16   // 市场代码
	Code     [6]byte  // 股票代码
	Unknown1 uint16   // 未知数据
	Filename [80]byte // 文件名
	Offset   uint32   // 偏移量
	Length   uint32   // 长度
	Unknown2 uint32   // 未知数据
}

type ConnPool

type ConnPool struct {
	// contains filtered or unexported fields
}

ConnPool 连接池

func NewConnPool

func NewConnPool(opt Opt, size int, factory func() (interface{}, error), close func(interface{}) error, ping func(interface{}) error) (*ConnPool, error)

NewConnPool 创新一个新连接池

func (*ConnPool) Close

func (p *ConnPool) Close()

func (*ConnPool) CloseAll

func (p *ConnPool) CloseAll()

func (*ConnPool) CloseConn

func (p *ConnPool) CloseConn(conn interface{}) error

func (*ConnPool) GetConn

func (p *ConnPool) GetConn() interface{}

func (*ConnPool) ReturnConn

func (p *ConnPool) ReturnConn(conn interface{})

type ExchangeState

type ExchangeState int8
const (
	TDX_EXCHANGE_STATE_DELISTING ExchangeState = iota - 1 // 终止上市
	TDX_EXCHANGE_STATE_CLOSING                            // 收盘
	TDX_EXCHANGE_STATE_NORMAL                             // 正常交易
	TDX_EXCHANGE_STATE_PAUSE                              // 暂停交易
)

type FinanceInfo

type FinanceInfo struct {
	Code               string  `json:"code"`
	LiuTongGuBen       float64 `struc:"float32,little" json:"liu_tong_gu_ben"`
	Province           uint16  `struc:"uint16,little" json:"province"`
	Industry           uint16  `struc:"uint16,little" json:"industry"`
	UpdatedDate        uint32  `struc:"uint32,little" json:"updatedDate"`
	IPODate            uint32  `struc:"uint32,little" json:"ipo_date"`
	ZongGuBen          float64 `struc:"float32,little" json:"zong_gu_ben"`
	GuoJiaGu           float64 `struc:"float32,little" json:"guo_jia_gu"`
	FaQiRenFaRenGu     float64 `struc:"float32,little" json:"fa_qi_ren_fa_ren_gu"`
	FaRenGu            float64 `struc:"float32,little" json:"fa_ren_gu"`
	BGu                float64 `struc:"float32,little" json:"b_gu"`
	HGu                float64 `struc:"float32,little" json:"h_gu"`
	ZhiGongGu          float64 `struc:"float32,little" json:"zhi_gong_gu"`
	ZongZiChan         float64 `struc:"float32,little" json:"zong_zi_chan"`
	LiuDongZiChan      float64 `struc:"float32,little" json:"liu_dong_zi_chan"`
	GuDingZiChan       float64 `struc:"float32,little" json:"gu_ding_zi_chan"`
	WuXingZiChan       float64 `struc:"float32,little" json:"wu_xing_zi_chan"`
	GuDongRenShu       float64 `struc:"float32,little" json:"gu_dong_ren_shu"`
	LiuDongFuZhai      float64 `struc:"float32,little" json:"liu_dong_fu_zhai"`
	ChangQiFuZhai      float64 `struc:"float32,little" json:"chang_qi_fu_zhai"`
	ZiBenGongJiJin     float64 `struc:"float32,little" json:"zi_ben_gong_ji_jin"`
	JingZiChan         float64 `struc:"float32,little" json:"jing_zi_chan"`
	ZhuYingShouRu      float64 `struc:"float32,little" json:"zhu_ying_shou_ru"`
	ZhuYingLiRun       float64 `struc:"float32,little" json:"zhu_ying_li_run"`
	YingShouZhangKuan  float64 `struc:"float32,little" json:"ying_shou_zhang_kuan"`
	YingyeLiRun        float64 `struc:"float32,little" json:"yingye_li_run"`
	TouZiShouYu        float64 `struc:"float32,little" json:"tou_zi_shou_yu"`
	JingYingxianJinLiu float64 `struc:"float32,little" json:"jing_yingxian_jin_liu"`
	ZongXianJinLiu     float64 `struc:"float32,little" json:"zong_xian_jin_liu"`
	CunHuo             float64 `struc:"float32,little" json:"cun_huo"`
	LiRunZongHe        float64 `struc:"float32,little" json:"li_run_zong_he"`
	ShuiHouLiRun       float64 `struc:"float32,little" json:"shui_hou_li_run"`
	JingLiRun          float64 `struc:"float32,little" json:"jing_li_run"`
	WeiFenLiRun        float64 `struc:"float32,little" json:"wei_fen_li_run"`
	MeiGuJingZiChan    float64 `struc:"float32,little" json:"mei_gu_jing_zi_chan"`
	BaoLiu2            float64 `struc:"float32,little" json:"bao_liu_2"`
}

func (FinanceInfo) IsDelisting

func (info FinanceInfo) IsDelisting() bool

IsDelisting 是否退市

type FinanceInfoPackage

type FinanceInfoPackage struct {
	// contains filtered or unexported fields
}

FinanceInfoPackage 财务数据

func NewFinanceInfoPackage

func NewFinanceInfoPackage() *FinanceInfoPackage

func (*FinanceInfoPackage) Reply

func (obj *FinanceInfoPackage) Reply() interface{}

func (*FinanceInfoPackage) Serialize

func (obj *FinanceInfoPackage) Serialize() ([]byte, error)

func (*FinanceInfoPackage) SetParams

func (obj *FinanceInfoPackage) SetParams(req *FinanceInfoRequest)

func (*FinanceInfoPackage) UnSerialize

func (obj *FinanceInfoPackage) UnSerialize(header interface{}, data []byte) error

type FinanceInfoReply

type FinanceInfoReply struct {
	Count uint16 //  总数
	//MarketType uint8   `struc:"uint8,little"`
	//Code   [6]byte `struc:"[6]byte,little"`
	First RawFinanceInfo
}

FinanceInfoReply 响应包结构

type FinanceInfoRequest

type FinanceInfoRequest struct {
	Count  uint16  // 总数
	Market uint8   // 市场代码
	Code   [6]byte // 股票代码
}

type HeartBeatPackage

type HeartBeatPackage struct {
	// contains filtered or unexported fields
}

func NewHeartBeat

func NewHeartBeat() *HeartBeatPackage

func (*HeartBeatPackage) Reply

func (obj *HeartBeatPackage) Reply() interface{}

func (*HeartBeatPackage) Serialize

func (obj *HeartBeatPackage) Serialize() ([]byte, error)

func (*HeartBeatPackage) UnSerialize

func (obj *HeartBeatPackage) UnSerialize(header interface{}, data []byte) error

type HeartBeatReply

type HeartBeatReply struct {
	Info string // 10个字节的消息, 未解
}

type HeartBeatRequest

type HeartBeatRequest struct {
}

type Hello1Package

type Hello1Package struct {
	// contains filtered or unexported fields
}

func NewHello1

func NewHello1() *Hello1Package

func (*Hello1Package) Reply

func (obj *Hello1Package) Reply() interface{}

func (*Hello1Package) Serialize

func (obj *Hello1Package) Serialize() ([]byte, error)

func (*Hello1Package) UnSerialize

func (obj *Hello1Package) UnSerialize(header interface{}, data []byte) error

00e60708051 50 f0 00 d3 a02b2020c03840384038403840384033a02b2020c0384038403840384038403 00 5a8a3401 f94a0100 5a8a3401 fd4a0100ff00e 700000101013f

分  时    秒                                                                      日期

type Hello1Reply

type Hello1Reply struct {
	Info string
	// contains filtered or unexported fields
}

type Hello1Request

type Hello1Request struct {
}

type Hello2Package

type Hello2Package struct {
	// contains filtered or unexported fields
}

func NewHello2

func NewHello2() *Hello2Package

func (*Hello2Package) Reply

func (obj *Hello2Package) Reply() interface{}

func (*Hello2Package) Serialize

func (obj *Hello2Package) Serialize() ([]byte, error)

func (*Hello2Package) UnSerialize

func (obj *Hello2Package) UnSerialize(header interface{}, data []byte) error

0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011f85e34068747470733a2f2f626967352e6e65776f6e652e636f6d2e636e2f7a797968742f7a645f7a737a712e7a6970000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004150503a414c4c0d0a54494d453a303a30312d31353a30352c31353a30362d32333a35390d0a20202020c4facab9d3c3b5c4b0e6b1bebcb4bdabcda3d3c3a3acceaac1cbc4fab5c4d5fdb3a3cab9d3c32cc7ebbea1bfecc9fdd6c1d5d0c9ccd6a4c8af5043b0e6a1a30d0a20202020c8e7b9fbb2bbc4dcd7d4b6afc9fdbcb6a3acc7ebb5bdb9d9cdf868747470733a2f2f7777772e636d736368696e612e636f6d2fcfc2d4d8b0b2d7b0a3acd0bbd0bbc4fab5c4d6a7b3d6a3a100 年月日 年月日

type Hello2Reply

type Hello2Reply struct {
	Info string
	// contains filtered or unexported fields
}

type Hello2Request

type Hello2Request struct {
}

type HistoryMinuteTime

type HistoryMinuteTime struct {
	Price float32
	Vol   int
}

type HistoryMinuteTimePackage

type HistoryMinuteTimePackage struct {
	// contains filtered or unexported fields
}

func NewHistoryMinuteTimePackage

func NewHistoryMinuteTimePackage() *HistoryMinuteTimePackage

func (*HistoryMinuteTimePackage) Reply

func (obj *HistoryMinuteTimePackage) Reply() interface{}

func (*HistoryMinuteTimePackage) Serialize

func (obj *HistoryMinuteTimePackage) Serialize() ([]byte, error)

func (*HistoryMinuteTimePackage) SetParams

SetParams 设置参数

func (*HistoryMinuteTimePackage) UnSerialize

func (obj *HistoryMinuteTimePackage) UnSerialize(header interface{}, data []byte) error

type HistoryMinuteTimeReply

type HistoryMinuteTimeReply struct {
	Count uint16
	List  []HistoryMinuteTime
}

type HistoryMinuteTimeRequest

type HistoryMinuteTimeRequest struct {
	Date   uint32
	Market uint8
	Code   [6]byte
}

type HistoryTransactionPackage

type HistoryTransactionPackage struct {
	// contains filtered or unexported fields
}

func NewHistoryTransactionPackage

func NewHistoryTransactionPackage() *HistoryTransactionPackage

func (*HistoryTransactionPackage) Reply

func (obj *HistoryTransactionPackage) Reply() interface{}

func (*HistoryTransactionPackage) Serialize

func (obj *HistoryTransactionPackage) Serialize() ([]byte, error)

func (*HistoryTransactionPackage) SetParams

SetParams 设置参数

func (*HistoryTransactionPackage) UnSerialize

func (obj *HistoryTransactionPackage) UnSerialize(header interface{}, data []byte) error

type HistoryTransactionRequest

type HistoryTransactionRequest struct {
	Date   uint32
	Market uint16
	Code   [6]byte
	Start  uint16
	Count  uint16
}

type IndexBarsPackage

type IndexBarsPackage struct {
	// contains filtered or unexported fields
}

IndexBarsPackage 指数K线

func NewIndexBarsPackage

func NewIndexBarsPackage() *IndexBarsPackage

func (*IndexBarsPackage) Reply

func (obj *IndexBarsPackage) Reply() interface{}

func (*IndexBarsPackage) Serialize

func (obj *IndexBarsPackage) Serialize() ([]byte, error)

func (*IndexBarsPackage) SetParams

func (obj *IndexBarsPackage) SetParams(req *SecurityBarsRequest)

func (*IndexBarsPackage) UnSerialize

func (obj *IndexBarsPackage) UnSerialize(header interface{}, data []byte) error

type LabClient

type LabClient struct {

	//Host          string
	//Port          int
	Timeout       time.Duration
	MaxRetryTimes int
	RetryDuration time.Duration
	// contains filtered or unexported fields
}

func NewClientForTest

func NewClientForTest(addr string) (*LabClient, error)

func (*LabClient) Close

func (cli *LabClient) Close() error

func (*LabClient) Do

func (cli *LabClient) Do(request std.Marshaler, response std.Unmarshaler) error

type Level

type Level struct {
	Price float64
	Vol   int
}

type Message

type Message interface {
	// Serialize 编码
	Serialize() ([]byte, error)
	// UnSerialize 解码
	UnSerialize(head interface{}, in []byte) error
	// Reply 获取返回值
	Reply() interface{}
}

Message 消息接口

type MinuteTime

type MinuteTime struct {
	Price float32
	Vol   int
}

type MinuteTimePackage

type MinuteTimePackage struct {
	// contains filtered or unexported fields
}

func NewMinuteTimePackage

func NewMinuteTimePackage() *MinuteTimePackage

func (*MinuteTimePackage) Reply

func (obj *MinuteTimePackage) Reply() interface{}

func (*MinuteTimePackage) Serialize

func (obj *MinuteTimePackage) Serialize() ([]byte, error)

func (*MinuteTimePackage) SetParams

func (obj *MinuteTimePackage) SetParams(req *MinuteTimeRequest)

func (*MinuteTimePackage) UnSerialize

func (obj *MinuteTimePackage) UnSerialize(header interface{}, data []byte) error

type MinuteTimeReply

type MinuteTimeReply struct {
	Count uint16
	List  []MinuteTime
}

type MinuteTimeRequest

type MinuteTimeRequest struct {
	Market uint16
	Code   [6]byte
	Date   uint32
}

type Opt

type Opt struct {
	Servers []Server // 服务器组

	ConnectionTimeout time.Duration // 连接超时
	ReadTimeout       time.Duration // 读超时
	WriteTimeout      time.Duration // 写超时
	MaxRetryTimes     int           // 最大重试次数
	RetryDuration     time.Duration // 重试时间
	// contains filtered or unexported fields
}

type RawCompanyInfoCategory

type RawCompanyInfoCategory struct {
	Name     []byte `struc:"[64]byte,little"` // 名称
	Filename []byte `struc:"[80]byte,little"` // 文件名
	Offset   uint32 `struc:"uint32,little"`   // 偏移量
	Length   uint32 `struc:"uint32,little"`   // 长度
}

RawCompanyInfoCategory 响应包结构

type RawFinanceInfo

type RawFinanceInfo struct {
	//Unknown1           [2]byte `struc:"[2]byte,little"`
	Market             uint8   `struc:"uint8,little"`
	Code               [6]byte `struc:"[6]byte,little"`
	LiuTongGuBen       float32 `struc:"float32,little"` // 流通股本
	Province           uint16  `struc:"uint16,little"`  // 所属省份
	Industry           uint16  `struc:"uint16,little"`
	UpdatedDate        uint32  `struc:"uint32,little"`
	IPODate            uint32  `struc:"uint32,little"`
	ZongGuBen          float32 `struc:"float32,little"`
	GuoJiaGu           float32 `struc:"float32,little"`
	FaQiRenFaRenGu     float32 `struc:"float32,little"`
	FaRenGu            float32 `struc:"float32,little"`
	BGu                float32 `struc:"float32,little"` // B股
	HGu                float32 `struc:"float32,little"` // H股
	ZhiGongGu          float32 `struc:"float32,little"`
	ZongZiChan         float32 `struc:"float32,little"`
	LiuDongZiChan      float32 `struc:"float32,little"`
	GuDingZiChan       float32 `struc:"float32,little"`
	WuXingZiChan       float32 `struc:"float32,little"`
	GuDongRenShu       float32 `struc:"float32,little"`
	LiuDongFuZhai      float32 `struc:"float32,little"`
	ChangQiFuZhai      float32 `struc:"float32,little"`
	ZiBenGongJiJin     float32 `struc:"float32,little"`
	JingZiChan         float32 `struc:"float32,little"`
	ZhuYingShouRu      float32 `struc:"float32,little"`
	ZhuYingLiRun       float32 `struc:"float32,little"`
	Yingshouzhangkuan  float32 `struc:"float32,little"`
	YingyeLiRun        float32 `struc:"float32,little"`
	TouZiShouYu        float32 `struc:"float32,little"`
	JingYingxianJinLiu float32 `struc:"float32,little"`
	ZongXianJinLiu     float32 `struc:"float32,little"`
	CunHuo             float32 `struc:"float32,little"`
	LiRunZongHe        float32 `struc:"float32,little"`
	ShuiHouLiRun       float32 `struc:"float32,little"`
	JingLiRun          float32 `struc:"float32,little"`
	WeiFenLiRun        float32 `struc:"float32,little"`
	BaoLiu1            float32 `struc:"float32,little"`
	BaoLiu2            float32 `struc:"float32,little"`
}

RawFinanceInfo 响应包结构

一次返回145个字节, 现在有136个字节, 空余9个字节分别是总数、市场和代码
Num每加1, 返回字节数增加143

type RawFinanceInfo1

type RawFinanceInfo1 struct {
	//Unknown1           [2]byte `struc:"[2]byte,little"`
	//MarketType             uint8   `struc:"uint8,little"`
	//Code               [6]byte `struc:"[6]byte,little"`
	LiuTongGuBen       float32 `struc:"float32,little"`
	Province           uint16  `struc:"uint16,little"`
	Industry           uint16  `struc:"uint16,little"`
	UpdatedDate        uint32  `struc:"uint32,little"`
	IPODate            uint32  `struc:"uint32,little"`
	ZongGuBen          float32 `struc:"float32,little"`
	GuoJiaGu           float32 `struc:"float32,little"`
	FaQiRenFaRenGu     float32 `struc:"float32,little"`
	FaRenGu            float32 `struc:"float32,little"`
	BGu                float32 `struc:"float32,little"`
	HGu                float32 `struc:"float32,little"`
	ZhiGongGu          float32 `struc:"float32,little"`
	ZongZiChan         float32 `struc:"float32,little"`
	LiuDongZiChan      float32 `struc:"float32,little"`
	GuDingZiChan       float32 `struc:"float32,little"`
	WuXingZiChan       float32 `struc:"float32,little"`
	GuDongRenShu       float32 `struc:"float32,little"`
	LiuDongFuZhai      float32 `struc:"float32,little"`
	ChangQiFuZhai      float32 `struc:"float32,little"`
	ZiBenGongJiJin     float32 `struc:"float32,little"`
	JingZiChan         float32 `struc:"float32,little"`
	ZhuYingShouRu      float32 `struc:"float32,little"`
	ZhuYingLiRun       float32 `struc:"float32,little"`
	Yingshouzhangkuan  float32 `struc:"float32,little"`
	YingyeLiRun        float32 `struc:"float32,little"`
	TouZiShouYu        float32 `struc:"float32,little"`
	JingYingxianJinLiu float32 `struc:"float32,little"`
	ZongXianJinLiu     float32 `struc:"float32,little"`
	CunHuo             float32 `struc:"float32,little"`
	LiRunZongHe        float32 `struc:"float32,little"`
	ShuiHouLiRun       float32 `struc:"float32,little"`
	JingLiRun          float32 `struc:"float32,little"`
	WeiFenLiRun        float32 `struc:"float32,little"`
	BaoLiu1            float32 `struc:"float32,little"`
	BaoLiu2            float32 `struc:"float32,little"`
	BaoLiu3            [7]byte `struc:"[7]byte,little"`
}

type RawXdxrInfo

type RawXdxrInfo struct {
	Market   int    `struc:"uint8,little"`   // 市场代码
	Code     string `struc:"[6]byte,little"` // 股票代码
	Unknown  int    `struc:"uint8,little"`   // 未知
	Date     uint32 `struc:"uint32,little"`  // 日期
	Category int    `struc:"uint8,little"`   // 类型
	Data     []byte `struc:"[16]byte,little"`
}

type Security

type Security struct {
	Code      string
	VolUnit   uint16
	Reversed1 [4]byte `dataframe:"-"`
	//R1           uint32
	//P1           float64
	DecimalPoint int8
	Name         string
	PreClose     float64
	Reversed2    [4]byte `dataframe:"-"`
}

type SecurityBar

type SecurityBar struct {
	Open      float64
	Close     float64
	High      float64
	Low       float64
	Vol       float64
	Amount    float64
	Year      int
	Month     int
	Day       int
	Hour      int
	Minute    int
	DateTime  string
	UpCount   uint16 // 指数有效, 上涨家数
	DownCount uint16 // 指数有效, 下跌家数
}

SecurityBar K线数据

type SecurityBarsPackage

type SecurityBarsPackage struct {
	// contains filtered or unexported fields
}

SecurityBars K线

func NewSecurityBarsPackage

func NewSecurityBarsPackage() *SecurityBarsPackage

func (*SecurityBarsPackage) Reply

func (obj *SecurityBarsPackage) Reply() interface{}

func (*SecurityBarsPackage) Serialize

func (obj *SecurityBarsPackage) Serialize() ([]byte, error)

func (*SecurityBarsPackage) SetParams

func (obj *SecurityBarsPackage) SetParams(req *SecurityBarsRequest)

func (*SecurityBarsPackage) UnSerialize

func (obj *SecurityBarsPackage) UnSerialize(header interface{}, data []byte) error

type SecurityBarsReply

type SecurityBarsReply struct {
	Count uint16
	List  []SecurityBar
}

type SecurityBarsRequest

type SecurityBarsRequest struct {
	Market   uint16
	Code     [6]byte
	Category uint16 // 种类 5分钟  10分钟
	I        uint16 // 未知 填充
	Start    uint16
	Count    uint16
}

type SecurityCountPackage

type SecurityCountPackage struct {
	// contains filtered or unexported fields
}

SecurityCountPackage 市场股票数量

func NewSecurityCountPackage

func NewSecurityCountPackage() *SecurityCountPackage

func (*SecurityCountPackage) Reply

func (obj *SecurityCountPackage) Reply() interface{}

func (*SecurityCountPackage) Serialize

func (obj *SecurityCountPackage) Serialize() ([]byte, error)

func (*SecurityCountPackage) SetParams

func (obj *SecurityCountPackage) SetParams(req *SecurityCountRequest)

func (*SecurityCountPackage) UnSerialize

func (obj *SecurityCountPackage) UnSerialize(header interface{}, data []byte) error

type SecurityCountReply

type SecurityCountReply struct {
	Count uint16
}

type SecurityCountRequest

type SecurityCountRequest struct {
	Market uint16
}

type SecurityListPackage

type SecurityListPackage struct {
	// contains filtered or unexported fields
}

SecurityListPackage 股票列表

func NewSecurityListPackage

func NewSecurityListPackage() *SecurityListPackage

func (*SecurityListPackage) Reply

func (obj *SecurityListPackage) Reply() interface{}

func (*SecurityListPackage) Serialize

func (obj *SecurityListPackage) Serialize() ([]byte, error)

func (*SecurityListPackage) SetParams

func (obj *SecurityListPackage) SetParams(req *SecurityListRequest)

func (*SecurityListPackage) UnSerialize

func (obj *SecurityListPackage) UnSerialize(header interface{}, data []byte) error

type SecurityListReply

type SecurityListReply struct {
	Count uint16
	List  []Security
}

type SecurityListRequest

type SecurityListRequest struct {
	Market uint16
	Start  uint16
}

type SecurityQuote

type SecurityQuote struct {
	State           TradeState // 交易状态
	Market          uint8      // 市场
	Code            string     // 代码
	Active1         uint16     // 活跃度
	Price           float64    // 现价
	LastClose       float64    // 昨收
	Open            float64    // 开盘
	High            float64    // 最高
	Low             float64    // 最低
	ServerTime      string     // 时间
	ReversedBytes0  int        // 保留(时间 ServerTime)
	ReversedBytes1  int        // 保留
	Vol             int        // 总量
	CurVol          int        // 个股-现成交量,板块指数-现成交额
	Amount          float64    // 总金额
	SVol            int        // 个股有效-内盘
	BVol            int        // 个股有效-外盘
	IndexOpenAmount int        // 指数有效-集合竞价成交金额=开盘成交金额
	StockOpenAmount int        // 个股有效-集合竞价成交金额=开盘成交金额
	OpenVolume      int        // 集合竞价-开盘量, 单位是股
	CloseVolume     int        // 集合竞价-收盘量, 单位是股
	IndexUp         int        // 指数有效-上涨数
	IndexUpLimit    int        // 指数有效-涨停数
	IndexDown       int        // 指数有效-下跌数
	IndexDownLimit  int        // 指数有效-跌停数
	Bid1            float64    // 个股-委买价1
	Ask1            float64    // 个股-委卖价1
	BidVol1         int        // 个股-委买量1 板块-上涨数
	AskVol1         int        // 个股-委卖量1 板块-下跌数
	Bid2            float64    // 个股-委买价2
	Ask2            float64    // 个股-委卖价2
	BidVol2         int        // 个股-委买量2 板块-涨停数
	AskVol2         int        // 个股-委卖量2 板块-跌停数
	Bid3            float64    // 个股-委买价3
	Ask3            float64    // 个股-委卖价3
	BidVol3         int        // 个股-委买量3
	AskVol3         int        // 个股-委卖量3
	Bid4            float64    // 个股-委买价4
	Ask4            float64    // 个股-委卖价4
	BidVol4         int        // 个股-委买量4
	AskVol4         int        // 个股-委卖量4
	Bid5            float64    // 个股-委买价5
	Ask5            float64    // 个股-委卖价5
	BidVol5         int        // 个股-委买量5
	AskVol5         int        // 个股-委卖量5
	ReversedBytes4  uint16     // 保留
	ReversedBytes5  int        // 保留
	ReversedBytes6  int        // 保留
	ReversedBytes7  int        // 保留
	ReversedBytes8  int        // 保留
	Rate            float64    // 涨速
	Active2         uint16     // 活跃度, 如果是指数则为0, 个股同Active1
}

type SecurityQuotesPackage

type SecurityQuotesPackage struct {
	// contains filtered or unexported fields
}

SecurityQuotesPackage 盘口五档报价

func NewSecurityQuotesPackage

func NewSecurityQuotesPackage() *SecurityQuotesPackage

func (*SecurityQuotesPackage) Reply

func (obj *SecurityQuotesPackage) Reply() interface{}

func (*SecurityQuotesPackage) Serialize

func (obj *SecurityQuotesPackage) Serialize() ([]byte, error)

func (*SecurityQuotesPackage) SetParams

func (obj *SecurityQuotesPackage) SetParams(req *SecurityQuotesRequest)

func (*SecurityQuotesPackage) UnSerialize

func (obj *SecurityQuotesPackage) UnSerialize(header interface{}, data []byte) error

type SecurityQuotesReply

type SecurityQuotesReply struct {
	Count uint16
	List  []SecurityQuote
}

type SecurityQuotesRequest

type SecurityQuotesRequest struct {
	Count     uint16
	StockList []Stock
}

type Server

type Server struct {
	Name      string `json:"name"`
	Host      string `json:"host"`
	Port      int    `json:"port"`
	CrossTime int64  `json:"crossTime"`
}

Server 主机信息

func GetFastHost

func GetFastHost(key string) []Server

func (Server) Addr

func (s Server) Addr() string

type ServerGroup

type ServerGroup struct {
	HQ []Server `json:"HQ"`
	EX []Server `json:"EX"`
	GP []Server `json:"GP"`
}

ServerGroup 主机组

type Snapshot

type Snapshot struct {
	Date            string        // 交易日期
	SecurityCode    string        // 证券代码
	ExchangeState   ExchangeState // 交易状态
	State           TradeState    // 上市公司状态
	Market          uint8         // 市场
	Code            string        // 代码
	Active          uint16        // 活跃度
	Price           float64       // 现价
	LastClose       float64       // 昨收
	Open            float64       // 开盘
	High            float64       // 最高
	Low             float64       // 最低
	ServerTime      string        // 时间
	ReversedBytes0  int           // 保留(时间 ServerTime)
	ReversedBytes1  int           // 保留
	Vol             int           // 总量
	CurVol          int           // 个股-现成交量,板块指数-现成交额
	Amount          float64       // 总金额
	SVol            int           // 个股有效-内盘
	BVol            int           // 个股有效-外盘
	IndexOpenAmount int           // 指数有效-集合竞价成交金额=开盘成交金额
	StockOpenAmount int           // 个股有效-集合竞价成交金额=开盘成交金额
	OpenVolume      int           // 集合竞价-开盘量, 单位是股
	CloseVolume     int           // 集合竞价-收盘量, 单位是股
	IndexUp         int           // 指数有效-上涨数
	IndexUpLimit    int           // 指数有效-涨停数
	IndexDown       int           // 指数有效-下跌数
	IndexDownLimit  int           // 指数有效-跌停数
	Bid1            float64       // 个股-委买价1
	Ask1            float64       // 个股-委卖价1
	BidVol1         int           // 个股-委买量1 板块-上涨数
	AskVol1         int           // 个股-委卖量1 板块-下跌数
	Bid2            float64       // 个股-委买价2
	Ask2            float64       // 个股-委卖价2
	BidVol2         int           // 个股-委买量2 板块-涨停数
	AskVol2         int           // 个股-委卖量2 板块-跌停数
	Bid3            float64       // 个股-委买价3
	Ask3            float64       // 个股-委卖价3
	BidVol3         int           // 个股-委买量3
	AskVol3         int           // 个股-委卖量3
	Bid4            float64       // 个股-委买价4
	Ask4            float64       // 个股-委卖价4
	BidVol4         int           // 个股-委买量4
	AskVol4         int           // 个股-委卖量4
	Bid5            float64       // 个股-委买价5
	Ask5            float64       // 个股-委卖价5
	BidVol5         int           // 个股-委买量5
	AskVol5         int           // 个股-委卖量5
	ReversedBytes4  uint16        // 保留
	ReversedBytes5  int           // 保留
	ReversedBytes6  int           // 保留
	ReversedBytes7  int           // 保留
	ReversedBytes8  int           // 保留
	Rate            float64       // 涨速
	Active2         uint16        // 活跃度, 如果是指数则为0, 个股同Active1
}

Snapshot L1 行情快照

func (*Snapshot) CheckDirection

func (this *Snapshot) CheckDirection() (biddingDirection, volumeDirection int)

CheckDirection 检测当前交易方向

todo: 只能检测即时行情数据, 对于历史数据无效

type StdApi

type StdApi struct {
	// contains filtered or unexported fields
}

func NewStdApi

func NewStdApi() (*StdApi, error)

NewStdApi 创建一个标准接口

func NewStdApiWithServers

func NewStdApiWithServers(srvs []Server) (*StdApi, error)

NewStdApiWithServers 通过服务器组创建一个标准接口

func (*StdApi) Close

func (this *StdApi) Close()

Close 关闭

func (*StdApi) GetBlockInfo

func (this *StdApi) GetBlockInfo(blockFile string) (*BlockInfoResponse, error)

func (*StdApi) GetBlockMeta

func (this *StdApi) GetBlockMeta(blockFile string) (*BlockMeta, error)

func (*StdApi) GetCompanyInfoCategory

func (this *StdApi) GetCompanyInfoCategory(code string) ([]CompanyInfoCategory, error)

func (*StdApi) GetCompanyInfoContent

func (this *StdApi) GetCompanyInfoContent(code string, name string) (*CompanyInfoContent, error)

func (*StdApi) GetFinanceInfo

func (this *StdApi) GetFinanceInfo(code string) (*FinanceInfo, error)

GetFinanceInfo 基本面

func (*StdApi) GetHistoryMinuteTimeData

func (this *StdApi) GetHistoryMinuteTimeData(code string, date uint32) (*HistoryMinuteTimeReply, error)

GetHistoryMinuteTimeData 获取历史分时图数据

func (*StdApi) GetHistoryTransactionData

func (this *StdApi) GetHistoryTransactionData(code string, date uint32, start uint16, count uint16) (*TransactionReply, error)

GetHistoryTransactionData 获取历史分时成交

func (*StdApi) GetIndexBars

func (this *StdApi) GetIndexBars(code string, category uint16, start uint16, count uint16) (*SecurityBarsReply, error)

GetIndexBars 指数K线

func (*StdApi) GetKLine

func (this *StdApi) GetKLine(code string, category uint16, start uint16, count uint16) (*SecurityBarsReply, error)

GetKLine K线

func (*StdApi) GetMinuteTimeData

func (this *StdApi) GetMinuteTimeData(code string) (*MinuteTimeReply, error)

GetMinuteTimeData 获取分时图数据

func (*StdApi) GetSecurityCount

func (this *StdApi) GetSecurityCount(market proto.MarketType) (*SecurityCountReply, error)

GetSecurityCount 获取指定市场内的证券数目

func (*StdApi) GetSecurityList

func (this *StdApi) GetSecurityList(market proto.MarketType, start uint16) (*SecurityListReply, error)

GetSecurityList 股票列表

func (*StdApi) GetSecurityQuotes

func (this *StdApi) GetSecurityQuotes(markets []proto.MarketType, symbols []string) (*SecurityQuotesReply, error)

GetSecurityQuotes 获取盘口五档报价

deprecated: 不推荐

func (*StdApi) GetSnapshot

func (this *StdApi) GetSnapshot(codes []string) (list []Snapshot, err error)

GetSnapshot 获取快照数据

func (*StdApi) GetTransactionData

func (this *StdApi) GetTransactionData(code string, start uint16, count uint16) (*TransactionReply, error)

GetTransactionData 获取分时成交

func (*StdApi) GetXdxrInfo

func (this *StdApi) GetXdxrInfo(code string) ([]XdxrInfo, error)

GetXdxrInfo 获取除权除息信息

func (*StdApi) HeartBeat

func (this *StdApi) HeartBeat() (*HeartBeatReply, error)

func (*StdApi) Hello1

func (this *StdApi) Hello1() (*Hello1Reply, error)

func (*StdApi) Hello2

func (this *StdApi) Hello2() (*Hello2Reply, error)

func (*StdApi) V2GetSecurityQuotes

func (this *StdApi) V2GetSecurityQuotes(markets []proto.MarketType, symbols []string) (*V2SecurityQuotesReply, error)

V2GetSecurityQuotes 测试版本快照

deprecated: 不推荐

type StdRequestHeader

type StdRequestHeader struct {
	ZipFlag    uint8  `struc:"uint8,little"`  // ZipFlag
	SeqID      uint32 `struc:"uint32,little"` // 请求编号
	PacketType uint8  `struc:"uint8,little"`  // 包类型
	PkgLen1    uint16 `struc:"uint16,little"` // 消息体长度1
	PkgLen2    uint16 `struc:"uint16,little"` // 消息体长度2
	Method     uint16 `struc:"uint16,little"` // method 请求方法
}

StdRequestHeader 标准行情-请求-消息头

type StdResponseHeader

type StdResponseHeader struct {
	I1        uint32 `struc:"uint32,little"`
	ZipFlag   uint8  `struc:"uint8,little"`  // ZipFlag
	SeqID     uint32 `struc:"uint32,little"` // 请求编号
	I3        uint8  `struc:"uint8,little"`
	Method    uint16 `struc:"uint16,little"` // method
	ZipSize   uint16 `struc:"uint16,little"` // 长度
	UnZipSize uint16 `struc:"uint16,little"` // 未压缩长度
}

StdResponseHeader 标准行情-响应-消息头

type Stock

type Stock struct {
	Market uint8
	Code   string
}

type TcpClient

type TcpClient struct {
	sync.Mutex

	Addr string // 当前连接成功的服务器地址
	// contains filtered or unexported fields
}

func NewClient

func NewClient(opt *Opt) *TcpClient

func (*TcpClient) Close

func (client *TcpClient) Close() error

Close 断开服务器

func (*TcpClient) Command

func (client *TcpClient) Command(msg Message) error

Command 执行通达信指令

func (*TcpClient) Connect

func (client *TcpClient) Connect() error

Connect 连接服务器

type TdxMarket

type TdxMarket int

type TickTransaction

type TickTransaction struct {
	Time      string
	Price     float64
	Vol       int
	Num       int
	BuyOrSell int
}

type TradeState

type TradeState int8
const (
	TDX_SECURITY_TRADE_STATE_DELISTING TradeState = iota // 终止上市
	TDX_SECURITY_TRADE_STATE_NORMAL                      // 正常交易
	TDX_SECURITY_TRADE_STATE_SUSPEND                     // 停牌
)

type TradeType

type TradeType = int32
const (
	TDX_TICK_BUY     TradeType = iota // 买入
	TDX_TICK_SELL    TradeType = 1    // 卖出
	TDX_TICK_NEUTRAL TradeType = 2    // 中性盘
	TDX_TICK_UNKNOWN TradeType = 3    // 未知类型, 出现在09:27分的历史数据中, 暂时确定为中性盘
)

type TransactionPackage

type TransactionPackage struct {
	// contains filtered or unexported fields
}

TransactionPackage 当日分笔成交信息

func NewTransactionPackage

func NewTransactionPackage() *TransactionPackage

func (*TransactionPackage) Reply

func (obj *TransactionPackage) Reply() interface{}

func (*TransactionPackage) Serialize

func (obj *TransactionPackage) Serialize() ([]byte, error)

func (*TransactionPackage) SetParams

func (obj *TransactionPackage) SetParams(req *TransactionRequest)

func (*TransactionPackage) UnSerialize

func (obj *TransactionPackage) UnSerialize(header interface{}, data []byte) error

type TransactionReply

type TransactionReply struct {
	Count uint16
	List  []TickTransaction
}

type TransactionRequest

type TransactionRequest struct {
	Market uint16
	Code   [6]byte
	Start  uint16
	Count  uint16
}

type V2Level

type V2Level struct {
	Price float64
	Vol   int
}

type V2SecurityQuote

type V2SecurityQuote struct {
	Market         uint8   // 市场
	Code           string  // 代码
	Active1        uint16  // 活跃度
	Price          float64 // 现价
	LastClose      float64 // 昨收
	Open           float64 // 开盘
	High           float64 // 最高
	Low            float64 // 最低
	ServerTime     string  // 时间
	ReversedBytes0 int     // 保留(时间 ServerTime)
	ReversedBytes1 int     // 保留
	Vol            int     // 总量
	CurVol         int     // 现量
	Amount         float64 // 总金额
	SVol           int     // 内盘
	BVol           int     // 外盘
	ReversedBytes2 int     // 保留
	ReversedBytes3 int     // 保留
	Bid1           float64
	Ask1           float64
	BidVol1        int
	AskVol1        int
	//Bid2           float64
	//Ask2           float64
	//BidVol2        int
	//AskVol2        int
	//Bid3           float64
	//Ask3           float64
	//BidVol3        int
	//AskVol3        int
	//Bid4           float64
	//Ask4           float64
	//BidVol4        int
	//AskVol4        int
	//Bid5           float64
	//Ask5           float64
	//BidVol5        int
	//AskVol5        int
	ReversedBytes4 uint16  // 保留
	ReversedBytes5 int     // 保留
	ReversedBytes6 int     // 保留
	ReversedBytes7 int     // 保留
	ReversedBytes8 int     // 保留
	Rate           float64 // 涨速
	Active2        uint16  // 活跃度
}

type V2SecurityQuotesPackage

type V2SecurityQuotesPackage struct {
	// contains filtered or unexported fields
}

V2SecurityQuotesPackage 盘口五档报价

func NewV2SecurityQuotesPackage

func NewV2SecurityQuotesPackage() *V2SecurityQuotesPackage

func (*V2SecurityQuotesPackage) Reply

func (obj *V2SecurityQuotesPackage) Reply() interface{}

func (*V2SecurityQuotesPackage) Serialize

func (obj *V2SecurityQuotesPackage) Serialize() ([]byte, error)

func (*V2SecurityQuotesPackage) SetParams

func (obj *V2SecurityQuotesPackage) SetParams(req *V2SecurityQuotesRequest)

func (*V2SecurityQuotesPackage) UnSerialize

func (obj *V2SecurityQuotesPackage) UnSerialize(header interface{}, data []byte) error

type V2SecurityQuotesReply

type V2SecurityQuotesReply struct {
	Count uint16
	List  []V2SecurityQuote
}

type V2SecurityQuotesRequest

type V2SecurityQuotesRequest struct {
	Count     uint16
	StockList []V2Stock
}

type V2Stock

type V2Stock struct {
	Market uint8
	Code   string
}

type XdxrInfo

type XdxrInfo struct {
	Date          string  // 日期
	Category      int     // 类型
	Name          string  // 类型名称
	FenHong       float64 // 分红
	PeiGuJia      float64 // 配股价
	SongZhuanGu   float64 // 送转股
	PeiGu         float64 // 配股
	SuoGu         float64 // 缩股
	QianLiuTong   float64 // 前流通
	HouLiuTong    float64 // 后流通
	QianZongGuBen float64 // 前总股本
	HouZongGuBen  float64 // 后总股本
	FenShu        float64 // 份数
	XingGuanJia   float64 // 行权价
}

func (*XdxrInfo) Adjust

func (x *XdxrInfo) Adjust() func(p float64) float64

Adjust 返回复权回调函数 factor

type XdxrInfoPackage

type XdxrInfoPackage struct {
	// contains filtered or unexported fields
}

XdxrInfoPackage 除权除息

func NewXdxrInfoPackage

func NewXdxrInfoPackage() *XdxrInfoPackage

func (*XdxrInfoPackage) Reply

func (obj *XdxrInfoPackage) Reply() interface{}

func (*XdxrInfoPackage) Serialize

func (obj *XdxrInfoPackage) Serialize() ([]byte, error)

func (*XdxrInfoPackage) SetParams

func (obj *XdxrInfoPackage) SetParams(req *XdxrInfoRequest)

func (*XdxrInfoPackage) UnSerialize

func (obj *XdxrInfoPackage) UnSerialize(header interface{}, data []byte) error

type XdxrInfoReply

type XdxrInfoReply struct {
	Unknown []byte        `struc:"[9]byte,little"`            // 未知
	Count   uint16        `struc:"uint16,little,sizeof=List"` //  总数
	List    []RawXdxrInfo `struc:"[29]byte, little"`          // [29]byte和title中间必须要有一个空格
}

XdxrInfoReply 响应包结构

type XdxrInfoRequest

type XdxrInfoRequest struct {
	//Count  uint16  // 总数
	Market uint8   // 市场代码
	Code   [6]byte // 股票代码
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL