proto

package
v1.0.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	STD_MSG_HEARTBEAT                = 0x0004 // 心跳维持
	STD_MSG_LOGIN1                   = 0x000d // 第一次登录
	STD_MSG_LOGIN2                   = 0x0fdb // 第二次登录
	STD_MSG_XDXR_INFO                = 0x000f // 除权除息信息
	STD_MSG_FINANCE_INFO             = 0x0010 // 财务信息
	STD_MSG_PING                     = 0x0015 // 测试连接
	STD_MSG_COMPANY_CATEGORY         = 0x02cf // 公司信息文件信息
	STD_MSG_COMPANY_CONTENT          = 0x02d0 // 公司信息描述
	STD_MSG_SECURITY_COUNT           = 0x044e // 证券数量
	STD_MSG_SECURITY_LIST            = 0x0450 // 证券列表
	STD_MSG_INDEXBARS                = 0x052d // 指数K线
	STD_MSG_SECURITY_BARS            = 0x052d // 股票K线
	STD_MSG_SECURITY_QUOTES_old      = 0x053e // 行情信息
	STD_MSG_SECURITY_QUOTES_new      = 0x054c // 行情信息
	STD_MSG_MINUTETIME_DATA          = 0x051d // 分时数据
	STD_MSG_BLOCK_META               = 0x02c5 // 板块文件信息
	STD_MSG_BLOCK_DATA               = 0x06b9 // 板块文件数据
	STD_MSG_TRANSACTION_DATA         = 0x0fc5 // 分笔成交信息
	STD_MSG_HISTORY_MINUTETIME_DATA  = 0x0fb4 // 历史分时信息
	STD_MSG_HISTORY_TRANSACTION_DATA = 0x0fb5 // 历史分笔成交信息

)

标准行情-命令字

View Source
const (
	KLINE_TYPE_5MIN      = 0  //  5 分钟 K线
	KLINE_TYPE_15MIN     = 1  // 15 分钟 K线
	KLINE_TYPE_30MIN     = 2  // 30 分钟 K线
	KLINE_TYPE_1HOUR     = 3  //  1 小时 K线
	KLINE_TYPE_DAILY     = 4  //      日 K线
	KLINE_TYPE_WEEKLY    = 5  // 周 K线
	KLINE_TYPE_MONTHLY   = 6  // 月 K线
	KLINE_TYPE_EXHQ_1MIN = 7  // 1分钟
	KLINE_TYPE_1MIN      = 8  // 1 分钟 K线
	KLINE_TYPE_RI_K      = 9  // 日 K线
	KLINE_TYPE_3MONTH    = 10 // 季 K线
	KLINE_TYPE_YEARLY    = 11 // 年 K线
)

K线种类

View Source
const (
	Compressed    = uint8(0x10)                       // 压缩标志
	FlagNotZipped = uint8(0x0c)                       // zip未压缩
	FlagZipped    = uint8(Compressed | FlagNotZipped) // zip已压缩 消息头标志 0x789C
)
View Source
const (
	MarketShangHai string = "sh" // 上海
	MarketShenZhen string = "sz" // 深圳
	MarketBeiJing  string = "bj" // 北京
	MarketHongKong string = "hk" // 香港
	MarketUSA      string = "us" // 美国
)
View Source
const (
	MARKET_CN_FIRST_DATE     = "19901219"   // 上证指数的第一个交易日
	MARKET_CH_FIRST_LISTTIME = "1990-12-19" // 个股上市日期
)

Variables

This section is empty.

Functions

func AssertBlockBySecurityCode

func AssertBlockBySecurityCode(securityCode *string) (isBlock bool)

AssertBlockBySecurityCode 断言证券代码是否板块

func AssertIndexByMarketAndCode

func AssertIndexByMarketAndCode(marketId MarketType, symbol string) (isIndex bool)

AssertIndexByMarketAndCode 通过市场id和短码判断是否指数

func AssertIndexBySecurityCode

func AssertIndexBySecurityCode(securityCode string) (isIndex bool)

AssertIndexBySecurityCode 通过证券代码判断是否指数

func AssertStockByMarketAndCode

func AssertStockByMarketAndCode(marketId MarketType, symbol string) (isStock bool)

AssertStockByMarketAndCode 通过市场id和代码判断是否个股

func AssertStockBySecurityCode

func AssertStockBySecurityCode(securityCode string) (isStock bool)

AssertStockBySecurityCode 通过证券代码判断是否个股

func CorrectSecurityCode

func CorrectSecurityCode(securityCode string) string

CorrectSecurityCode 修正证券代码

func CorrectTradingDay

func CorrectTradingDay(date string)

CorrectTradingDay 校正当前交易日期

func GetMarket

func GetMarket(symbol string) string

GetMarket 判断股票ID对应的证券市场匹配规则

['50', '51', '60', '90', '110'] 为 sh
['00', '12','13', '18', '15', '16', '18', '20', '30', '39', '115'] 为 sz
['5', '6', '9'] 开头的为 sh, 其余为 sz

func GetMarketFlag

func GetMarketFlag(marketId MarketType) string

func GetMarketId

func GetMarketId(symbol string) uint8

GetMarketId 获得市场ID

func GetSecurityCode

func GetSecurityCode(market MarketType, symbol string) (securityCode string)

func GetTradingDay

func GetTradingDay() string

GetTradingDay 获取当前日期

func LimtUp

func LimtUp(securityCode string, price float64) float64

LimtUp 返回涨停板价格

func MarketLimit

func MarketLimit(securityCode string) float64

MarketLimit 涨跌停板限制

Types

type MarketType

type MarketType = uint8
const (
	MarketIdShenZhen MarketType = iota // 深圳
	MarketIdShangHai MarketType = 1    // 上海
	MarketIdBeiJing  MarketType = 2    // 北京
	MarketIdHongKong MarketType = 21   // 香港
	MarketIdUSA      MarketType = 22   // 美国

	StockDelisting = "DELISTING" // 退市
)

func DetectMarket

func DetectMarket(symbol string) (marketId MarketType, market string, code string)

DetectMarket 检测市场代码

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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