internal

package
v1.3.22 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FIVE_MINUTES 五分钟
	FIVE_MINUTES = 5

	// FIFTEEN_MINUTES 十五分钟
	FIFTEEN_MINUTES = 15

	// THIRTY_MINUTES 三十分钟
	THIRTY_MINUTES = 30

	// ONE_HOUR 一小时
	ONE_HOUR = 60

	// ONE_DAY 一天
	ONE_DAY = 4 * ONE_HOUR

	// ONE_WEEK 一周
	ONE_WEEK = 7 * ONE_DAY

	// DEFAULT_DATALEN 全部数据
	DEFAULT_DATALEN = 1000000

	PrefixMessage = "【CTP微信助手】"
	SuffixMessage = " \r\n--以上内容,不构成任何投资建议,据此进行相关操作,风险自担。"

	T_STOCK = 0x10000000 // 个股
	T_INDEX = 0x20000000 // 指数

	D_OK    = 0x00000000 // 数据正常
	D_ERROR = 0x40000000 // 数据错误
	D_ECODE = 0x00000001 // 代码错误
	D_ENET  = 0x00000002 // 网络异常
	D_EDATA = 0x00000004 // 数据错误
	D_EDISK = 0x00000008 // 写文件错误
	D_ENEED = 0x00000010 // 不需要更新

	DefaultValue = 0.0000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DataApi

type DataApi interface {
	Name() string
	// CompleteKLine 获取全部日线数据
	CompleteKLine(code string) (kline []DayKLine, err error)
	// DailyFromDate 从 start 开始补全日线数据
	DailyFromDate(code string, start time.Time) ([]DayKLine, time.Time, error)
}

DataApi 数据接口

type DayKLine

type DayKLine struct {
	Date   string  `json:"date"`
	Open   float64 `json:"open"`
	High   float64 `json:"high"`
	Low    float64 `json:"low"`
	Close  float64 `json:"close"`
	Volume int64   `json:"volume"`
}

DayKLine struct implement

type QuoteSnapshot

type QuoteSnapshot struct {
	Market         uint8   // 市场
	Code           string  // 代码
	Name           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      []quotes.Level
	//AskLevels      []quotes.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  // 活跃度
	TopNo          int     // 板块排名
	TopCode        string  // 领涨个股
	TopName        string  // 领涨个股名称
	TopRate        float64 // 领涨个股涨幅
	ZhanTing       int     // 涨停数
	Ling           int     // 平盘数
	Count          int     // 总数
}

func BatchSnapShot

func BatchSnapShot(codes []string) []QuoteSnapshot

BatchSnapShot 批量获取即时行情数据快照

type RealTime

type RealTime struct {
	FullCode string `json:"full_code"`
	//0:  "未知",
	UnknownCode string `json:"unknown_code" array:"0"`
	//1:  "名字",
	Name string `json:"name" array:"1"`
	//2:  "代码",
	Code string `json:"code" array:"2"`
	//3:  "当前价格",
	New string `json:"new" array:"3"`
	//4:  "昨收",
	Close string `json:"close" array:"4"`
	//5:  "今开",
	Open string `json:"open" array:"5"`
	//6:  "成交量(手)",
	Volume string `json:"volume" array:"6"`
	//7:  "外盘",
	OuterVol string `json:"outer_vol" array:"7"`
	//8:  "内盘",
	InnerVol string `json:"inner_vol" array:"8"`
	//9:  "买一",
	Buy1Price string `json:"buy1_price" array:"9"`
	//10: "买一量(手)",
	Buy1Vol string `json:"buy1_vol" array:"10"`
	//11: "买二",
	Buy2Price string `json:"buy2_price" array:"11"`
	//12: "买二量(手)",
	Buy2Vol string `json:"buy2_vol" array:"12"`
	//13: "买三",
	Buy3Price string `json:"buy3_price" array:"13"`
	//14: "买三量(手)",
	Buy3Vol string `json:"buy3_vol" array:"14"`
	//15: "买四",
	Buy4Price string `json:"buy4_price" array:"15"`
	//16: "买四量(手)",
	Buy4Vol string `json:"buy4_vol" array:"16"`
	//17: "买五",
	Buy5Price string `json:"buy5_price" array:"17"`
	//18: "买五量(手)",
	Buy5Vol string `json:"buy5_vol" array:"18"`
	//19: "卖一",
	Sell1Price string `json:"sell1_price" array:"19"`
	//20: "卖一量",
	Sell1Vol string `json:"sell1_vol" array:"20"`
	//21: "卖二",
	Sell2Price string `json:"sell2_price" array:"21"`
	//22: "卖二量",
	Sell2Vol string `json:"sell2_vol" array:"22"`
	//23: "卖三",
	Sell3Price string `json:"sell3_price" array:"23"`
	//24: "卖三量",
	Sell3Vol string `json:"sell3_vol" array:"24"`
	//25: "卖四",
	Sell4Price string `json:"sell4_price" array:"25"`
	//26: "卖四量",
	Sell4Vol string `json:"sell4_vol" array:"26"`
	//27: "卖五",
	Sell5Price string `json:"sell5_price" array:"27"`
	//28: "卖五量",
	Sell5Vol string `json:"sell5_vol" array:"28"`
	//29: "最近逐笔成交",
	Deals string `json:"deals" array:"29"`
	//30: "时间",
	Time string `json:"time" array:"30"`
	//31: "涨跌",
	RiseFall string `json:"rise_fall" array:"31"`
	//32: "涨跌%",
	RiseFallPercent string `json:"rise_fall_percent" array:"32"`
	//33: "最高",
	High string `json:"high" array:"33"`
	//34: "最低",
	Low string `json:"low" array:"34"`
	//35: "价格/成交量(手)/成交额",
	TransactionInformation string `json:"transaction_information" array:"35"`
	//36: "成交量(手)",
	Volume1 string `json:"volume1" array:"36"`
	//37: "成交额(万)",
	Amount string `json:"amount" array:"37"`
	//38: "换手率",
	TurnoverRate string `json:"turnover_rate" array:"38"`
	//39: "市盈率",
	PeRatio string `json:"pe_ratio" array:"39"`
	//40: "未知",
	Unknown string `json:"unknown" array:"40"`
	//41: "最高",
	High1 string `json:"high_1" array:"41"`
	//42: "最低",
	Low1 string `json:"low_1" array:"42"`
	//43: "振幅",
	Amplitude string `json:"amplitude" array:"43"`
	//44: "流通市值",
	FreeFloatMarketValue string `json:"free_float_market_value" array:"44"`
	//45: "总市值",
	TotalMarketValue string `json:"total_market_value" array:"45"`
	//46: "市净率",
	MarketRate string `json:"market_rate" array:"46"`
	//47: "涨停价",
	LimitUp string `json:"limit_up" array:"47"`
	//48: "跌停价",
	LimitDown string `json:"limit_down" array:"48"`
}

RealTime 最新数据

type StockApi

type StockApi interface {
	// 实时接口
	RealTime0(code string) (*RealTime, error)
	RealTime(code string) (*RealTime, error)
}

StockApi stock interface

type StockInfo

type StockInfo struct {
	// 1-上证sh, 2-深圳sz
	Market string `json:"market" array:"0"`
	// 完整代码
	FullCode string `json:"full_code"`
	//1:  "名字",
	Name string `json:"name" array:"2"`
	//2:  "代码",
	Code string `json:"code" array:"1"`
	// 上市日期
	Start string `json:"start" array:"23"`
	// 最新有效时间
	Stop string `json:"end" array:"24"`
	// 最新价格
	New string `json:"new" array:"3"`
	// 最高价
	High string `json:"high" array:"9"`
	// 最低价
	Low string `json:"low" array:"10"`
	// 开盘价
	Open string `json:"open" array:"11"`
	// 昨日收盘
	FrontClose string `json:"front_close" array:"12"`
}

东方财富 字段分析 0 2 1=上证/2=深成 1 002547 股票代码 2 春兴精工 股票名称 3 7.77 当前价格 4 0.71 上涨价格 5 10.06 涨幅 6 2062612 206万手成交量 7 1549976928 成交额 8 13.31 振幅 9 7.77 盘中最高 10 6.83 盘中最低 11 6.93 开盘价 12 7.06 昨收盘价 13 0.00 5分钟涨速? 14 1.96 量比 15 25.86 换手率 16 148.87 动态市盈率 17 3.19 市净率 18 8765004174 总市值 19 6197961277 流通市值 20 81.12% 60日涨幅 21 36.8% 年初至今涨幅 22 0.00 涨速? 23 上市日期 24 最新有效日期

Jump to

Keyboard shortcuts

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