cachel5

package
v0.7.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterCacheLoader

func RegisterCacheLoader(key string, loader CacheAdapter)

func SwitchDate

func SwitchDate(date string)

SwitchDate 统一切换数据的缓存日期

Types

type Cache1D

type Cache1D[T factors.Feature] struct {
	Date string // 日期
	// contains filtered or unexported fields
}

Cache1D 缓存所有证券代码的特征组合数据

每天1个证券代码1条数据

func NewCache1D

func NewCache1D[T factors.Feature](key string, factory func(date, securityCode string) T) *Cache1D[T]

NewCache1D 创建一个新的C1D对象

key支持多级相对路径, 比如a/b, 创建的路径是~/.quant1x/a/b.yyyy-mm-dd

func (*Cache1D[T]) Apply

func (this *Cache1D[T]) Apply(merge func(code string, local *T) (updated bool))

Apply 数据合并

泛型T需要保持一个string类型的Date字段

func (*Cache1D[T]) Check added in v0.2.3

func (this *Cache1D[T]) Check(cacheDate, featureDate string)

func (*Cache1D[T]) Checkout

func (this *Cache1D[T]) Checkout(date ...string)

func (*Cache1D[T]) Factory

func (this *Cache1D[T]) Factory(date, securityCode string) factors.Feature

func (*Cache1D[T]) Get

func (this *Cache1D[T]) Get(securityCode string, date ...string) *T

Get 获取指定证券代码的数据

func (*Cache1D[T]) Init added in v0.1.7

func (this *Cache1D[T]) Init(ctx context.Context, date, securityCode string) error

func (*Cache1D[T]) Key

func (this *Cache1D[T]) Key() string

func (*Cache1D[T]) Kind added in v0.1.7

func (this *Cache1D[T]) Kind() cache.Kind

func (*Cache1D[T]) Length

func (this *Cache1D[T]) Length() int

Length 获取长度

func (*Cache1D[T]) Merge

func (this *Cache1D[T]) Merge(p *treemap.Map)

func (*Cache1D[T]) Name

func (this *Cache1D[T]) Name() string

func (*Cache1D[T]) Owner added in v0.3.2

func (this *Cache1D[T]) Owner() string

func (*Cache1D[T]) Print added in v0.2.0

func (this *Cache1D[T]) Print(code string, date ...string)

func (*Cache1D[T]) ReplaceCache

func (this *Cache1D[T]) ReplaceCache()

ReplaceCache 替换当前缓存数据

func (*Cache1D[T]) Set

func (this *Cache1D[T]) Set(securityCode string, newValue T, date ...string)

Set 更新map中指定证券代码的数据

func (*Cache1D[T]) Usage added in v0.2.0

func (this *Cache1D[T]) Usage() string

type CacheAdapter

type CacheAdapter interface {
	// Name 名称
	Name() string
	// Checkout 加载指定日期的缓存
	Checkout(date ...string)
	// Merge 合并数据
	Merge(p *treemap.Map)
	// Factory 工厂
	Factory(date, securityCode string) factors.Feature
}

CacheAdapter 缓存适配器

一天一个特征组合缓存文件

func Get

func Get(key string) CacheAdapter

Jump to

Keyboard shortcuts

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