gitee.com/quant1x/engine@v1.8.4/factors/dataset_kline.go (about)

     1  package factors
     2  
     3  import (
     4  	"context"
     5  	"gitee.com/quant1x/engine/cache"
     6  	"gitee.com/quant1x/engine/datasource/base"
     7  	"gitee.com/quant1x/gotdx/quotes"
     8  )
     9  
    10  type DataKLine struct {
    11  	cache.DataSummary
    12  	Date string
    13  	Code string
    14  }
    15  
    16  func init() {
    17  	summary := __mapDataSets[BaseKLine]
    18  	_ = cache.Register(&DataKLine{DataSummary: summary})
    19  }
    20  
    21  func (k *DataKLine) Clone(date, code string) DataSet {
    22  	summary := __mapDataSets[BaseKLine]
    23  	var dest = DataKLine{
    24  		DataSummary: summary,
    25  		Date:        date,
    26  		Code:        code,
    27  	}
    28  	return &dest
    29  }
    30  
    31  func (k *DataKLine) GetDate() string {
    32  	return k.Date
    33  }
    34  
    35  func (k *DataKLine) GetSecurityCode() string {
    36  	return k.Code
    37  }
    38  
    39  func (k *DataKLine) Init(ctx context.Context, date string) error {
    40  	//_ = barIndex
    41  	_ = ctx
    42  	_ = date
    43  	return nil
    44  }
    45  
    46  func (k *DataKLine) Checkout(securityCode, date string) {
    47  	//TODO implement me
    48  	_ = securityCode
    49  	_ = date
    50  	panic("implement me")
    51  }
    52  
    53  func (k *DataKLine) Check(cacheDate, featureDate string) error {
    54  	//TODO implement me
    55  	_ = cacheDate
    56  	_ = featureDate
    57  	panic("implement me")
    58  }
    59  
    60  func (k *DataKLine) Filename(date, code string) string {
    61  	//TODO implement me
    62  	_ = code
    63  	_ = date
    64  	panic("implement me")
    65  }
    66  
    67  func (k *DataKLine) Print(code string, date ...string) {
    68  	//TODO implement me
    69  	_ = code
    70  	_ = date
    71  	panic("implement me")
    72  }
    73  
    74  func (k *DataKLine) Update(date string) {
    75  	base.UpdateAllBasicKLine(k.GetSecurityCode())
    76  	_ = date
    77  }
    78  
    79  func (k *DataKLine) Repair(date string) {
    80  	base.UpdateAllBasicKLine(k.GetSecurityCode())
    81  	_ = date
    82  }
    83  
    84  func (k *DataKLine) Increase(snapshot quotes.Snapshot) {
    85  	//TODO K线增量更新数据的条件是缓存的数据最晚的日期是上一个交易日, 否则会缺失缓存数据中最后1条数据和当日之间的数据, 所以只能按照K线的更新方法, 不适合用快照更新
    86  	// 第一步: 取出最后一条数据的记录
    87  	// 第二步: 检查时间的有效性
    88  	// 第三步: 用快照组织K线结构
    89  	// 第四步: 如果不符合快照更新, 则忽略
    90  	_ = snapshot
    91  	panic("implement me")
    92  }