quotes

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: MIT Imports: 26 Imported by: 15

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 = 2
	// CONN_TIMEOUT 链接超时 30 s
	CONN_TIMEOUT = 30
)
View Source
const (
	// HQ_HOSTS 标准市场 主机列表
	HQ_HOSTS = `` /* 2678-byte string literal not displayed */

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

	// GP_HOSTS 财务数据 主机列表
	GP_HOSTS = `[
{"name":"默认财务数据线路", "host":"120.76.152.87", "port": 7709}
]`

	CONFIG = `` /* 129-byte string literal not displayed */

)
View Source
const (
	TDX_HOST_HQ = "HQ"
	TDX_HOST_EX = "EX"
	TDX_HOST_GP = "GP"
)

Variables

View Source
var (
	ErrBadData = errors.New("more than 8M data")
)

Functions

func BestIP

func BestIP()

BestIP 测试最快的服务器

func CacheServers

func CacheServers(as AllServers) error

func Command

func Command(pool *ConnPool, factory v1.Factory) v1.Unmarshaler

Command 命令字

func CommandWithConn

func CommandWithConn(cli *v1.Client, callback v1.Factory) v1.Unmarshaler

func Utf8ToGbk

func Utf8ToGbk(text []byte) string

Types

type AllServers

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

AllServers 全部主机

func OpenConfig

func OpenConfig() *AllServers

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) GetConn

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

func (*ConnPool) ReturnConn

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

type FinanceInfo

type FinanceInfo struct {
	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"`
}

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 //  总数
	//Market 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 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

结果数据都是\n,\t分隔的中文字符串,比如查询K线数据,返回的结果字符串就形如 /“时间\t开盘价\t收盘价\t最高价\t最低价\t成交量\t成交额\n /20150519\t4.644000\t4.732000\t4.747000\t4.576000\t146667487\t683638848.000000\n /20150520\t4.756000\t4.850000\t4.960000\t4.756000\t353161092\t1722953216.000000”

type HistoryMinuteTimeReply

type HistoryMinuteTimeReply struct {
	Count uint16
	List  []HistoryMinuteTime
}

type HistoryMinuteTimeRequest

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

type HistoryTransaction

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

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 HistoryTransactionReply

type HistoryTransactionReply struct {
	Count uint16
	List  []HistoryTransaction
}

type HistoryTransactionRequest

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

type IndexBar

type IndexBar 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
}

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 *IndexBarsRequest)

func (*IndexBarsPackage) UnSerialize

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

type IndexBarsReply

type IndexBarsReply struct {
	Count uint16
	List  []IndexBar
}

type IndexBarsRequest

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

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

结果数据都是\n,\t分隔的中文字符串,比如查询K线数据,返回的结果字符串就形如 /“时间\t开盘价\t收盘价\t最高价\t最低价\t成交量\t成交额\n /20150519\t4.644000\t4.732000\t4.747000\t4.576000\t146667487\t683638848.000000\n /20150520\t4.756000\t4.850000\t4.960000\t4.756000\t353161092\t1722953216.000000”

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 // 服务器组

	Timeout       time.Duration // 超时
	MaxRetryTimes int           // 最大重试次数
	RetryDuration time.Duration // 重试时间
	// contains filtered or unexported fields
}

type RawFinanceInfo added in v1.1.3

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"`
	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"`
}

RawFinanceInfo 响应包结构

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

type RawFinanceInfo1 added in v1.1.3

type RawFinanceInfo1 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"`
	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 Security

type Security struct {
	Code         string
	VolUnit      uint16
	DecimalPoint int8
	Name         string
	PreClose     float64
}

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
}

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

UnSerialize 结果数据都是\n,\t分隔的中文字符串,比如查询K线数据,返回的结果字符串就形如 /“时间\t开盘价\t收盘价\t最高价\t最低价\t成交量\t成交额\n /20150519\t4.644000\t4.732000\t4.747000\t4.576000\t146667487\t683638848.000000\n /20150520\t4.756000\t4.850000\t4.960000\t4.756000\t353161092\t1722953216.000000”

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 {
	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     // 保留
	BidLevels      []Level
	AskLevels      []Level
	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 SecurityQuotesPackage

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

盘口五档报价

func NewGetSecurityQuotesPackage

func NewGetSecurityQuotesPackage() *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 {
	StockList []Stock
}

type Server

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

Server 主机信息

var (
	DefaultHQServer Server
	DefaultEXServer Server
)

func GetFastHost

func GetFastHost(key string) []Server

func (Server) Addr added in v1.1.3

func (s Server) Addr() string

type ServerGroup

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

ServerGroup 主机组

type StdApi

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

func NewStdApi

func NewStdApi() (*StdApi, error)

NewStdApi 创建一个标准接口

func NewStdApiWithServers added in v1.1.1

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

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

func (*StdApi) Close

func (this *StdApi) Close()

Close 关闭

func (*StdApi) GetFinanceInfo

func (this *StdApi) GetFinanceInfo(market proto.Market, code string, num uint16) (*FinanceInfo, error)

GetFinanceInfo 基本面

func (*StdApi) GetHistoryMinuteTimeData

func (this *StdApi) GetHistoryMinuteTimeData(market proto.Market, code string, date uint32) (*HistoryMinuteTimeReply, error)

GetHistoryMinuteTimeData 获取历史分时图数据

func (*StdApi) GetHistoryTransactionData

func (this *StdApi) GetHistoryTransactionData(market proto.Market, code string, date uint32, start uint16, count uint16) (*HistoryTransactionReply, error)

GetHistoryTransactionData 获取历史分时成交

func (*StdApi) GetIndexBars

func (this *StdApi) GetIndexBars(market proto.Market, code string, category uint16, start uint16, count uint16) (*IndexBarsReply, error)

GetIndexBars 指数K线

func (*StdApi) GetKLine

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

GetKLine K线

func (*StdApi) GetMinuteTimeData

func (this *StdApi) GetMinuteTimeData(market proto.Market, code string) (*MinuteTimeReply, error)

GetMinuteTimeData 获取分时图数据

func (*StdApi) GetSecurityCount

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

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

func (*StdApi) GetSecurityList

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

GetSecurityList 股票列表

func (*StdApi) GetSecurityQuotes

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

GetSecurityQuotes 获取盘口五档报价

func (*StdApi) GetTransactionData

func (this *StdApi) GetTransactionData(market proto.Market, code string, start uint16, count uint16) (*TransactionReply, error)

GetTransactionData 获取分时成交

func (*StdApi) Hello1

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

func (*StdApi) Hello2

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

type StdRequestHeader

type StdRequestHeader struct {
	Zip        uint8  // ZipFlag
	SeqID      uint32 // 请求编号
	PacketType uint8
	PkgLen1    uint16
	PkgLen2    uint16
	Method     uint16 // method 请求方法
}

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

type StdResponseHeader

type StdResponseHeader struct {
	I1        uint32
	I2        uint8
	SeqID     uint32 // 请求编号
	I3        uint8
	Method    uint16 // method
	ZipSize   uint16 // 长度
	UnZipSize uint16 // 未压缩长度
}

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

type Stock

type Stock struct {
	Market uint8
	Code   string
}

type TcpClient

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

func NewClient

func NewClient(opt *Opt) *TcpClient

func (*TcpClient) Close

func (client *TcpClient) Close() error

Disconnect 断开服务器

func (*TcpClient) Connect

func (client *TcpClient) Connect() error

Connect 连接服务器

func (*TcpClient) GetConn

func (client *TcpClient) GetConn() net.Conn

func (*TcpClient) GetOpt

func (client *TcpClient) GetOpt() Opt

type TdxMarket

type TdxMarket int

type TickTransaction

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

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
}

Jump to

Keyboard shortcuts

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