cache

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: Apache-2.0 Imports: 11 Imported by: 6

Documentation

Index

Constants

View Source
const (
	DAY_PATH  = "day"  // 日线路径
	INFO_PATH = "info" // 信息路径
	TICK_PATH = "tick" // tick路径
)
View Source
const (
	CACHE_TARS  CacheType = iota
	CACHE_CSV             = 1 // CSV
	CACHE_EXCEL           = 2 // EXCEL
)

Variables

This section is empty.

Functions

func CacheId added in v0.7.4

func CacheId(code string) string

CacheId 通过代码构建目录结构

func CheckFilepath

func CheckFilepath(filename string) error

CheckFilepath

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

func FileExist added in v0.7.4

func FileExist(path string) bool

FileExist 路径是否存在

func GetCache

func GetCache(fullCode string) *os.File

func GetDayPath

func GetDayPath() string

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

func GetInfoPath

func GetInfoPath() string

GetInfoPath 证券信息路径

func GetKLineFilename

func GetKLineFilename(fullCode string) string

GetKLineFilename 获取缓存的文件名

func GetTickPath added in v0.7.4

func GetTickPath() string

func IdPath added in v0.7.4

func IdPath(code string) string

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

func KLine added in v0.7.4

func KLine(code string) pandas.DataFrame

KLine 加载K线

func KLinePath

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

func TickFilename added in v0.7.4

func TickFilename(code string, date string) (string, error)

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

Types

type CacheType

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

type DataFrame

type DataFrame struct {
	Length int       `json:"length"`
	Date   []string  `json:"date"`
	Open   []float64 `json:"open"`
	High   []float64 `json:"high"`
	Low    []float64 `json:"low"`
	Close  []float64 `json:"close"`
	Volume []int64   `json:"volume"`
}

DataFrame 数据帧

func (DataFrame) Offset

func (this DataFrame) Offset(n int) (date []string, vOpen []float64, vClose []float64, vHigh []float64, vLow []float64, vVolume []int64)

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()

Jump to

Keyboard shortcuts

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