cache

package
v1.7.5 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2023 License: Apache-2.0 Imports: 14 Imported by: 6

Documentation

Index

Constants

View Source
const (
	DAY_PATH      = "day"      // 日线路径
	INFO_PATH     = "info"     // 信息路径
	TICK_PATH     = "tick"     // tick路径
	XDXR_PATH     = "xdxr"     // 除权除息路径
	BLOCK_PATH    = "bk"       // 板块数据
	SNAPSHOT_PATH = "snapshot" // 快照数据路径
	FEATURE_PATH  = "features" // 特征路径
	FINANCE_PATH  = "finance"  //财务信息路径
	ZYZB_PATH     = "zyzb"     //季报的主要指标
	ZCFZB_PATH    = "zcfzb"    //季报的资产负债表
	LRB_PATH      = "lrb"      //季报的利润表
	XJLLB_PATH    = "xjllb"    //季报的现金流量表
	ALL_PATH      = "all"      //季报的所有票的汇总
	YJBBAllFile   = "yjbb_all" //季报汇总
)

Variables

View Source
var (
	// TickStartDate 最早的时间
	TickStartDate = "20220101"
)

Functions

func BlockFilename added in v0.8.11

func BlockFilename(ns ...string) string

BlockFilename 板块缓存路径

func CacheId added in v0.7.4

func CacheId(code string) string

CacheId 通过代码构建目录结构

func CacheIdPath added in v0.7.6

func CacheIdPath(code string) string

CacheIdPath code从后保留3位, 市场缩写+从头到倒数第3的代码, 确保每个目录只有000~999个代码

func CorrectDate added in v0.7.6

func CorrectDate(date string) string

CorrectDate 矫正日期, 统一格式: 20060102

func F10Apply added in v1.5.19

func F10Apply(update func(securityCode string, f10 *Security) (ok bool))

F10Apply 遍历更新基础数据

F10的基础数据要先更新

func F10Length added in v1.5.19

func F10Length() int

F10Length 获取F10数据总数

func FeatureFilename added in v1.2.9

func FeatureFilename(code string) string

FeatureFilename 特征数据缓存路径

func FileExist added in v0.7.4

func FileExist(path string) bool

FileExist 路径是否存在

func FileIsValid added in v1.0.7

func FileIsValid(path string) bool

FileIsValid 检查文件是否有效

func FinanceFilename added in v1.5.18

func FinanceFilename(code string) string

FinanceFilename Finance缓存路径

func FinanceInfoFilename added in v1.1.5

func FinanceInfoFilename() string

FinanceInfoFilename F10缓存路径

func GetALLPath added in v1.5.18

func GetALLPath() string

GetALLPath 季报所有票汇总文件存储路径

func GetBkPath added in v0.8.11

func GetBkPath() string

GetBkPath 板块路径

func GetCache

func GetCache(fullCode string) *os.File

func GetCacheAllSecurityList added in v1.7.0

func GetCacheAllSecurityList() pandas.DataFrame

GetCacheAllSecurityList 获取A股证券基础列表

func GetCacheBlockList added in v1.7.0

func GetCacheBlockList() pandas.DataFrame

GetCacheBlockList 获取板块列表

func GetCapital added in v1.5.10

func GetCapital(securityCode string) float64

GetCapital 获取流通盘

func GetCreateTime added in v1.5.6

func GetCreateTime(finfo os.FileInfo) time.Time

GetCreateTime 获取文件创建时间

func GetDayPath

func GetDayPath() string

GetDayPath 历史数据-日线缓存路径

func GetFeaturesPath added in v1.2.9

func GetFeaturesPath() string

GetFeaturesPath 获取特征路径

func GetFinancePath added in v1.5.18

func GetFinancePath() string

GetFinancePath 财务信息文件存储路径

func GetFreeCapital added in v1.5.10

func GetFreeCapital(securityCode string) float64

GetFreeCapital 获取自由流通股本

func GetInfoPath

func GetInfoPath() string

GetInfoPath 证券信息路径

func GetKaipanVol added in v1.1.15

func GetKaipanVol(securityCode string) float64

GetKaipanVol 获取开盘量

func GetLRBPath added in v1.5.18

func GetLRBPath() string

GetLRBPath 季报利润表文件存储路径

func GetSecurityList added in v1.7.0

func GetSecurityList() []string

GetSecurityList 加载全部股票代码

func GetSecurityName added in v1.7.0

func GetSecurityName(securityCode string) (string, bool)

GetSecurityName 获取证券名称

func GetSnapshotPath added in v0.8.16

func GetSnapshotPath() string

GetSnapshotPath 获取快照路径

func GetTickFilename added in v1.0.0

func GetTickFilename(code string, date string, createPath bool) string

func GetTickPath added in v0.7.4

func GetTickPath() string

GetTickPath tick数据路径

func GetTotalCapital added in v1.5.10

func GetTotalCapital(securityCode string) float64

GetTotalCapital 获取总股本

func GetXJLLBPath added in v1.5.18

func GetXJLLBPath() string

GetXJLLBPath 季报现金流量表文件存储路径

func GetXdxrPath added in v0.7.18

func GetXdxrPath() string

GetXdxrPath 除权除息文件存储路径

func GetZCFZBPath added in v1.5.18

func GetZCFZBPath() string

GetZCFZBPath 季报资产负债表文件存储路径

func GetZYZBPath added in v1.5.18

func GetZYZBPath() string

GetZYZBPath 季报主要指标文件存储路径

func GetZxgFile added in v0.7.13

func GetZxgFile() string

GetZxgFile 自选股文件路径

func HoldingFilename added in v1.1.6

func HoldingFilename() string

HoldingFilename 十大流通股东缓存路径

func IsNeedIgnore added in v1.7.0

func IsNeedIgnore(securityCode string) bool

IsNeedIgnore 需要忽略的个股

func KLineFilename added in v0.7.6

func KLineFilename(code string) string

KLineFilename KLine缓存路径

func LRBFilename added in v1.5.18

func LRBFilename(code string) string

LRBFilename 季报利润表缓存路径

func LoadCacheSecurityList added in v1.7.0

func LoadCacheSecurityList()

LoadCacheSecurityList 加载股票列表

func RiskAssessmentFilename added in v1.5.7

func RiskAssessmentFilename() string

RiskAssessmentFilename 风险测评信息缓存路径

func SecutiryListFilename added in v1.7.0

func SecutiryListFilename() string

SecutiryListFilename 证券列表文件名

func SentimentSnapshotFilename added in v1.6.8

func SentimentSnapshotFilename() string

SentimentSnapshotFilename 情绪快照缓存路径

func SnapshotFilename added in v0.8.16

func SnapshotFilename(code string) string

SnapshotFilename snapshot缓存路径

func TickFilename added in v0.7.4

func TickFilename(code string, date string) string

TickFilename tick文件比较多, 目录结构${tick}/${YYYY}/${YYYYMMDD}/${CacheIdPath}

func TickOpenFilename added in v1.5.10

func TickOpenFilename() string

TickOpenFilename 开盘量缓存文件

func Today added in v0.7.6

func Today() string

func UpdateF10 added in v1.6.15

func UpdateF10(f10 Security)

UpdateF10 更新F10

func UpdateSecurityName added in v1.7.0

func UpdateSecurityName(securityCode, name string)

UpdateSecurityName 更新证券名称

func UpdateTickStartDate added in v0.8.0

func UpdateTickStartDate(date string)

UpdateTickStartDate 修改tick数据开始下载的日期

func XJLLBFilename added in v1.5.18

func XJLLBFilename(code string) string

XJLLBFilename 季报现金流量表缓存路径

func XdxrFilename added in v0.7.18

func XdxrFilename(code string) string

XdxrFilename XDXR缓存路径

func YJBBAllFilename added in v1.5.18

func YJBBAllFilename() string

YJBBAllFilename 季报业绩报表汇总缓存路径

func ZCFZBFilename added in v1.5.18

func ZCFZBFilename(code string) string

ZCFZBFilename 季报资产负债表缓存路径

func ZYZBFilename added in v1.5.18

func ZYZBFilename(code string) string

ZYZBFilename 季报主要指标缓存路径

Types

type CacheKaipan added in v1.1.15

type CacheKaipan struct {
	Code string  `dataframe:"code"`
	Vol  float64 `dataframe:"vol"`
}

type CacheType

type CacheType int
const (
	CACHE_CSV      CacheType = iota // CSV
	CACHE_EXCEL    CacheType = 1    // EXCEL
	CACHE_TARS     CacheType = 2    // Tencent Tars
	CACHE_PROTOBUF CacheType = 3    // ProtoBuf
)

缓存类型

var (
	// CACHE_ROOT_PATH cache路径
	CACHE_ROOT_PATH           = category.DATA_ROOT_PATH
	CACHE_TYPE      CacheType = CACHE_TARS
)

type FastCache

type FastCache struct {
	Data []byte
	// contains filtered or unexported fields
}

func Create

func Create(filename string, size int64) (*FastCache, error)

func Open

func Open(filename string) (*FastCache, error)

func (*FastCache) Close

func (fc *FastCache) Close()

type Security added in v1.1.5

type Security struct {
	Code             string  // 代码
	Name             string  // 名称
	VolUnit          int     // 每手单位
	DecimalPoint     int     // 小数点
	IpoDate          string  // 上市日期
	UpdateDate       string  // 更新日期
	TotalCapital     float64 // 总股本
	Capital          float64 // 流通股本
	Top10Capital     float64 // 前十大流通股东股本
	FreeCapital      float64 // 自由流通股本
	ChangeCapital    float64 // 前十大流通股东持仓变化
	IncreaseRatio    float64 // 当期增持比例
	ReductionRatio   float64 // 当期减持比例
	FinanceValue     float64 // 净增长
	FinanceEps       float64 // 每股收益, 用作计算动态市盈率 earnings per share
	SafetyScore      int     // 通达信安全分
	BiddingDirection int     //竞价方向:-1 -下跌,0 -评判, 1-竟拉
	VolumeDirection  int     //委托量方向: 买盘综合-卖盘综合 09:25:00
}

Security 证券基础信息

func GetF10 added in v1.3.33

func GetF10(securityCode string) *Security

GetF10 获取F10基础数据

type SecurityFeature added in v1.3.26

type SecurityFeature struct {
	Date   string  `json:"Date" array:"0" name:"日期" dataframe:"date,string"`
	Open   float64 `json:"Open" array:"1" name:"开盘" dataframe:"open,float64"`
	Close  float64 `json:"Close" array:"2" name:"收盘" dataframe:"close,float64"`
	High   float64 `json:"High" array:"3" name:"最高" dataframe:"high,float64"`
	Low    float64 `json:"Low" array:"4" name:"最低" dataframe:"low,float64"`
	Volume int64   `json:"Volume" array:"5" name:"成交量" dataframe:"volume,int64"`
	Amount float64 `json:"Amount" array:"6" name:"成交额" dataframe:"amount,float64"`
	Up     int     `json:"Up" array:"7" name:"上涨家数" dataframe:"up,int64"`
	Down   int     `json:"Down" array:"8" name:"下跌家数" dataframe:"down,int64"`

	LastClose    float64 `json:"LastClose" array:"9" name:"昨收" dataframe:"last_close,float64"`
	TurnoverRate float64 `json:"TurnoverRate" array:"10" name:"换手率" dataframe:"turnover_rate,float64"`

	OpenVolume    int64   `json:"OpenVolume" array:"11" name:"开盘量" dataframe:"open_volume,int64"`
	OpenTurnZ     float64 `json:"OpenTurnZ" array:"12" name:"开盘换手z" dataframe:"open_turnz,float64"`
	OpenUnmatched int64   `json:"OpenUnmatched" array:"13" name:"开盘未匹配" dataframe:"open_unmatched,int64"`

	CloseVolume    int64   `json:"CloseVolume" array:"14" name:"收盘量" dataframe:"close_volume,int64"`
	CloseTurnZ     float64 `json:"CloseTurnZ" array:"15" name:"收盘换手z" dataframe:"close_turnz,float64"`
	CloseUnmatched int64   `json:"CloseUnmatched" array:"16" name:"收盘未匹配" dataframe:"close_unmatched,int64"`

	InnerVolume int64   `json:"InnerVolume" array:"17" name:"内盘" dataframe:"inner_volume,int64"`
	OuterVolume int64   `json:"OuterVolume" array:"18" name:"外盘" dataframe:"outer_volume,int64"`
	InnerAmount float64 `json:"InnerAmount" array:"19" name:"流出金额" dataframe:"inner_amount,float64"`
	OuterAmount float64 `json:"OuterAmount" array:"20" name:"流入金额" dataframe:"outer_amount,float64"`
}

SecurityFeature 证券特征信息

type TurnoverDataSummary added in v1.3.26

type TurnoverDataSummary struct {
	OpenVolume     int64   `json:"OpenVolume" array:"0" name:"开盘量" dataframe:"open_volume,int64"`
	OpenTurnZ      float64 `json:"OpenTurnZ" array:"1" name:"开盘换手z" dataframe:"open_turnz,float64"`
	OpenUnmatched  int64   `json:"OpenUnmatched" array:"2" name:"开盘未匹配" dataframe:"open_unmatched,int64"`
	CloseVolume    int64   `json:"CloseVolume" array:"3" name:"收盘量" dataframe:"close_volume,int64"`
	CloseTurnZ     float64 `json:"CloseTurnZ" array:"4" name:"收盘换手z" dataframe:"close_turnz,float64"`
	CloseUnmatched int64   `json:"CloseUnmatched" array:"5" name:"收盘未匹配" dataframe:"close_unmatched,int64"`
	InnerVolume    int64   `json:"InnerVolume" array:"6" name:"内盘" dataframe:"inner_volume,int64"`
	OuterVolume    int64   `json:"OuterVolume" array:"7" name:"外盘" dataframe:"outer_volume,int64"`
	InnerAmount    float64 `json:"InnerAmount" array:"8" name:"流出金额" dataframe:"inner_amount,float64"`
	OuterAmount    float64 `json:"OuterAmount" array:"9" name:"流入金额" dataframe:"outer_amount,float64"`
}

TurnoverDataSummary 换手数据概要

Jump to

Keyboard shortcuts

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