cache

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 13 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 CheckFilepath

func CheckFilepath(filename string) error

CheckFilepath

检查filename 文件路径, 如果不存在就创建

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(fullCode string) float64

GetFreeGuBen 获取自由流通股本

func GetInfoPath

func GetInfoPath() string

GetInfoPath 证券信息路径

func GetKLineFilename deprecated

func GetKLineFilename(fullCode string) string

GetKLineFilename 获取缓存的文件名

Deprecated: 不推荐使用, 建议使用 KLineFilename

func GetKaipanVol added in v1.1.15

func GetKaipanVol(fullCode string) float64

GetKaipanVol 获取开盘量

func GetLiuTongPan added in v1.1.15

func GetLiuTongPan(fullCode 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(fullCode 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 added in v0.7.6

func KLineFilename(code string) string

KLineFilename KLine缓存路径

func KLinePath

func KLinePath(fc string) (string, string, int)

func LastDate deprecated added in v0.7.6

func LastDate() time.Time

LastDate 最后一个有效交易日期

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  // 上市日期
	ZongGB       float64 // 总股本
	LiuTongGB    float64 // 流通股本
	FreeGB       float64 // 自由流通股本
}

Jump to

Keyboard shortcuts

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