features

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockPath = "/T0002/blocknew"
	ZxgBlk    = "zxg.blk"
	BkltBlk   = "BKLT.blk"
	ZdBk      = "ZDBK.blk"
)

Variables

View Source
var (
	FBarsRaw        = []string{"Open", "Close", "High", "Low", "Vol", "Amount", "DateTime", "UpCount", "DownCount"}
	FBarsRename     = []string{"open", "close", "high", "low", "volume", "amount", "date", "up", "down"}
	FBarsHelfFields = []string{"date", "open", "close", "high", "low", "volume", "amount", "up", "down", "open_volume", "open_turnz", "open_unmatched", "close_volume", "close_turnz", "close_unmatched", "inner_volume", "outer_volume", "inner_amount", "outer_amount"}
	FBarsFields     = []string{"date", "open", "close", "high", "low", "volume", "amount", "up", "down", "last_close", "turnover_rate", "open_volume", "open_turnz", "open_unmatched", "close_volume", "close_turnz", "close_unmatched", "inner_volume", "outer_volume", "inner_amount", "outer_amount"}

	// BasicFields 特征基础字段
	BasicFields = []string{"date", "open", "close", "high", "low", "volume", "amount"}
)
View Source
var (
	// DataDaysDiff 日期差异偏移量
	DataDaysDiff = 1
)

Functions

func AnalyseAuction added in v1.5.18

func AnalyseAuction(index int, resultMap map[string]CallAuctionResult)

func AnalyseAuctionAll added in v1.5.18

func AnalyseAuctionAll()

func BatchCallAuction added in v1.5.4

func BatchCallAuction(codes []string, index int) error

BatchCallAuction 批量获取集合竞价数据

func BatchQuoteSnapshot added in v1.6.8

func BatchQuoteSnapshot(codes []string) []quotes.SecurityQuote

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

func BatchRealtime

func BatchRealtime(codes []string) error

BatchRealtime 批量获取实时行情数据

func BatchRealtimeBasicKLine added in v1.6.7

func BatchRealtimeBasicKLine(codes []string) error

BatchRealtimeBasicKLine 批量获取实时行情数据

func BlockList added in v1.3.25

func BlockList() pandas.DataFrame

BlockList 获取板块列表

func CallAuctionFilename added in v1.5.4

func CallAuctionFilename(auctionType CallAuctionType) string

CallAuctionFilename 集合竞价数据缓存路径

func FinanceInfo

func FinanceInfo(securityCode string) (*quotes.FinanceInfo, error)

FinanceInfo 个股基本信息

func GetAnalyseAuctionResult added in v1.5.18

func GetAnalyseAuctionResult() map[string]CallAuctionResult

func GetAnalyseAuctionResultDF added in v1.6.3

func GetAnalyseAuctionResultDF() pandas.DataFrame

func GetAnalyseAuctionResultMap added in v1.6.3

func GetAnalyseAuctionResultMap() map[string][]float64

func GetCacheKLine

func GetCacheKLine(code string, adjust ...bool) pandas.DataFrame

GetCacheKLine 加载K线

第2个参数, 是否前复权

func GetCacheXdxr

func GetCacheXdxr(securityCode string) pandas.DataFrame

GetCacheXdxr 获得除权除息的缓存

func GetCacheXdxrList added in v1.7.6

func GetCacheXdxrList(securityCode string) []quotes.XdxrInfo

GetCacheXdxrList 获取除权除息的数据列表

func GetKLineAll

func GetKLineAll(securityCode string, argv ...int) pandas.DataFrame

GetKLineAll 获取日K线

func GetMinMax added in v1.5.18

func GetMinMax(input []float64) (low float64, high float64, err error)

func GetMinuteHistory

func GetMinuteHistory(securityCode, date string) *quotes.HistoryMinuteTimeReply

GetMinuteHistory 获得指定日期的分时数据

func GetSecurityList

func GetSecurityList() pandas.DataFrame

GetSecurityList 证券列表

func GetStockName

func GetStockName(securityCode string) (string, bool)

GetStockName 获取证券名称

func GetTickAll

func GetTickAll(securityCode string) (vol float64)

GetTickAll 下载全部tick数据

func GetTickData

func GetTickData(securityCode string, date string) pandas.DataFrame

GetTickData 获取指定日期的分笔成交记录

func GetXdxrInfo

func GetXdxrInfo(securityCode string) pandas.DataFrame

GetXdxrInfo 除权除息数据

func GetZxgList

func GetZxgList() []string

func InflowCount

func InflowCount(df pandas.DataFrame, securityCode string) (summary cache.TurnoverDataSummary)

InflowCount 统计内外盘

func QuantityRelativeRatio

func QuantityRelativeRatio(securityCode string) float64

QuantityRelativeRatio 获得指定日期的分时数据

量比是衡量相对成交量的指标。
它是指股市开市后平均每分钟的成交量与过去5个交易日(不包含当日)平均每分钟成交量之比。
其计算公式为:量比=(现成交总手数 / 现累计开市时间(分) )/ 过去5日平均每分钟成交量

func WriteCSVAppend added in v1.5.4

func WriteCSVAppend(out any, last pandas.DataFrame) error

Types

type CallAuctionFeature added in v1.5.4

type CallAuctionFeature struct {
	Code    string  `dataframe:"code,string"`   // 代码
	BSumVol int64   `dataframe:"bSumVol,int64"` //委买价求和1+2+3+4+5
	ASumVol int64   `dataframe:"aSumVol,int64"` //委卖价求和1+2+3+4+5
	Close   float64 `dataframe:"close,float64"`
	Date    string  `dataframe:"date,string"`
	Bid1    float64 `dataframe:"bid1,float64"`  //委买价1
	Ask1    float64 `dataframe:"ask1,float64"`  //委卖价1
	BidVol1 int64   `dataframe:"bidVol1,int64"` //委买量1
	AskVol1 int64   `dataframe:"askVol1,int64"` //委卖量1
	Bid2    float64 `dataframe:"bid2,float64"`  //委买价2
	Ask2    float64 `dataframe:"ask2,float64"`  //委卖价2
	BidVol2 int64   `dataframe:"bidVol2,int64"` //委买量2
	AskVol2 int64   `dataframe:"askVol2,int64"` //委卖量2
	Bid3    float64 `dataframe:"bid3,float64"`  //委买价3
	Ask3    float64 `dataframe:"ask3,float64"`  //委卖价3
	BidVol3 int64   `dataframe:"bidVol3,int64"` //委买量3
	AskVol3 int64   `dataframe:"askVol3,int64"` //委卖量3
	Bid4    float64 `dataframe:"bid4,float64"`  // 委买价4
	Ask4    float64 `dataframe:"ask4,float64"`  // 委卖价4
	BidVol4 int64   `dataframe:"bidVol4,int64"` //委买量4
	AskVol4 int64   `dataframe:"askVol4,int64"` //委卖量4
	Bid5    float64 `dataframe:"bid5,float64"`  //委买价5
	Ask5    float64 `dataframe:"ask5,float64"`  //委卖价5
	BidVol5 int64   `dataframe:"bidVol5,int64"` //委买量5
	AskVol5 int64   `dataframe:"askVol5,int64"` //委卖量5
}

type CallAuctionResult added in v1.6.3

type CallAuctionResult struct {
	Code             string  `dataframe:"code"`
	AOpen            float64 `dataframe:"a_open"`            //上午开盘价
	ALow             float64 `dataframe:"a_low"`             //上午集合竞价最低价
	AHigh            float64 `dataframe:"a_high"`            //上午集合竞价最高价
	POpen            float64 `dataframe:"p_open"`            //下午收盘价
	PLow             float64 `dataframe:"p_low"`             //下午集合竞价最低价
	PHigh            float64 `dataframe:"p_high"`            //下午集合竞价最高价
	BiddingDirection int     `dataframe:"bidding_direction"` //竞价方向:-1 -下跌,0 -评判, 1-竟拉
	VolumeDirection  int     `dataframe:"volume_direction"`  //委托量方向: 买盘综合-卖盘综合 09:25:00

}

type CallAuctionType added in v1.6.3

type CallAuctionType = int
const (
	AuactionAM        CallAuctionType = 1 // 上午
	AuactionPM        CallAuctionType = 2 // 下午
	AuactionIntegrate CallAuctionType = 3 // 聚合结果
	AuactionResult    CallAuctionType = 4 // 聚合结果
)

type KLine added in v1.6.7

type KLine struct {
	Date   string  `dataframe:"date"`   // 日期
	Open   float64 `dataframe:"open"`   // 开盘价
	Close  float64 `dataframe:"close"`  // 收盘价
	High   float64 `dataframe:"high"`   // 最高价
	Low    float64 `dataframe:"low"`    // 最低价
	Volume float64 `dataframe:"volume"` // 成交量
	Amount float64 `dataframe:"amount"` // 成交金额
}

KLine 日K线基础结构

func UpdateAllBasicKLine added in v1.6.7

func UpdateAllBasicKLine(securityCode string) []KLine

UpdateAllBasicKLine 更新全部日K线基础数据并保存文件

type QuoteSnapshot

type QuoteSnapshot 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     // 外盘
	IndexOpenAmount int     // 指数-集合竞价成交金额=开盘成交金额
	StockOpenAmount int     // 个股-集合竞价成交金额=开盘成交金额
	OpenVolume      int     // 集合竞价-开盘量, 单位是股
	TurnZ           float64 // 开盘换手率Z
	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  // 活跃度
}

func BatchSnapShot

func BatchSnapShot(codes []string) []QuoteSnapshot

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

type SentimentSnapshot added in v1.6.8

type SentimentSnapshot struct {
	Code            string  // 代码
	ServerTime      string  // 时间
	IndexUp         int     //上涨家数
	IndexDown       int     //下降家数
	Sentiment       float64 // 情绪数值
	SentimentStatus int     //情绪方向:0 -情绪一般 1 -情绪高涨 -1 -情绪低迷
}

Jump to

Keyboard shortcuts

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