cache

package
v1.3.43 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 12 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" // 特征路径
)

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 矫正日期, 统一格式

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 FinanceInfoFilename added in v1.1.5

func FinanceInfoFilename() string

FinanceInfoFilename F10缓存路径

func GetBkPath added in v0.8.11

func GetBkPath() string

GetBkPath 板块路径

func GetCache

func GetCache(fullCode string) *os.File

func GetDayPath

func GetDayPath() string

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

func GetFeaturesPath added in v1.2.9

func GetFeaturesPath() string

GetFeaturesPath 获取特征路径

func GetFreeGuBen added in v1.1.15

func GetFreeGuBen(securityCode string) float64

GetFreeGuBen 获取自由流通股本

func GetInfoPath

func GetInfoPath() string

GetInfoPath 证券信息路径

func GetKaipanVol added in v1.1.15

func GetKaipanVol(securityCode string) float64

GetKaipanVol 获取开盘量

func GetLiuTongPan added in v1.1.15

func GetLiuTongPan(securityCode string) float64

GetLiuTongPan 获取流通盘

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 GetXdxrPath added in v0.7.18

func GetXdxrPath() string

GetXdxrPath 除权除息文件存储路径

func GetZongGuben added in v1.1.17

func GetZongGuben(securityCode string) float64

GetZongGuben 获取总股本

func GetZxgFile added in v0.7.13

func GetZxgFile() string

GetZxgFile 自选股文件路径

func HoldingFilename added in v1.1.6

func HoldingFilename() string

HoldingFilename 十大流通股东缓存路径

func KLineFilename deprecated added in v0.7.6

func KLineFilename(code string) string

KLineFilename KLine缓存路径

Deprecated: 弃用

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 TickKaiPanFilename added in v1.1.9

func TickKaiPanFilename() string

TickKaiPanFilename 开盘量缓存文件

func Today added in v0.7.6

func Today() string

func UpdateTickStartDate added in v0.8.0

func UpdateTickStartDate(date string)

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

func XdxrFilename added in v0.7.18

func XdxrFilename(code string) string

XdxrFilename XDXR缓存路径

Types

type CacheKaipan added in v1.1.15

type CacheKaipan struct {
	Code string
	Vol  float64
}

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  // 更新日期
	ZongGB         float64 // 总股本
	LiuTongGB      float64 // 流通股本
	Top10GB        float64 // 前十大流通股东股本
	FreeGB         float64 // 自由流通股本
	ChangeGB       float64 // 前十大流通股东持仓变化
	IncreaseRatio  float64 // 当期增持比例
	ReductionRatio float64 // 当期减持比例
}

Security 证券基础信息

func GetF10 added in v1.3.33

func GetF10(securityCode string) *Security

GetF10 获取最近一个季度的前十大流通股东减持数据情况

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