Documentation ¶
Index ¶
- Variables
- func MergeData(destData []Record, sourceData []Record, multiplier int) []Record
- type BaseDataSource
- type CompositeDataSource
- type Converter
- type DataSource
- type DateRange
- type DateRangeMapper
- type InfoExDataSource
- type MappedDataSource
- type RecordMarshaller
- type RecordReader
- type RecordWriter
- type StockNameItem
- type TickDataSource
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ERR_FILE_DAMAGED = errors.New("file damaged")
)
Functions ¶
Types ¶
type BaseDataSource ¶
type BaseDataSource interface { GetData(security *Security, period Period) (error, []Record) GetDataEx(security *Security, period Period, startDate uint64, count int) (error, []Record) GetRangeData(security *Security, period Period, startDate, endDate uint64) (error, []Record) GetDataFromLast(security *Security, period Period, endDate uint64, count int) (error, []Record) GetLastRecord(security *Security, period Period) (error, *Record) AppendData(security *Security, period Period, data []Record) error // Append data SaveData(security *Security, period Period, data []Record) error // Replace data with new data RemoveData(security *Security, period Period, startDate, endDate uint64) error }
endDate: inclusive
type CompositeDataSource ¶
type CompositeDataSource interface { BaseDataSource AddSubDatasource(ds BaseDataSource) }
type Converter ¶
type Converter interface {
Convert(sourceData []Record) []Record
}
func NewForwardAdjustConverter ¶
func NewForwardAdjustConverter(period Period, items []InfoExItem) Converter
func NewPeriodConverter ¶
func NewPeriodConverter(srcPeriod Period, destPeriod Period) Converter
type DataSource ¶
type DataSource interface { InfoExDataSource BaseDataSource // market - 市场代码, sz-深交所, sh-上交所 GetStockCodes(exchange string) []string GetStockNameHistory(security *Security) []StockNameItem GetStockName(security *Security) string GetStockNames() map[string]string Reset() SupportedPeriods() []Period GetForwardAdjustedData(security *Security, period Period) (error, []Record) GetForwardAdjustedRangeData(security *Security, period Period, startDate, endDate uint64) (error, []Record) GetForwardAdjustedDataFromLast(security *Security, period Period, endDate uint64, count int) (error, []Record) AppendRawData(security *Security, period Period, data []byte) error // Append raw data // Remove data which date is greater or equal to date TruncateTo(security *Security, period Period, date uint64) error }
type DateRangeMapper ¶
type DateRangeMapper interface {
MapDateRanges(security *Security) []DateRange
}
type InfoExDataSource ¶
type MappedDataSource ¶
type MappedDataSource interface { BaseDataSource SetMapper(mapper DateRangeMapper) SetTargetDataSource(ds BaseDataSource) }
type RecordMarshaller ¶
type RecordReader ¶
func NewRecordReader ¶
func NewRecordReader(file *os.File, recordSize int, marshaller RecordMarshaller) RecordReader
type RecordWriter ¶
type RecordWriter interface { Write(from int, data []Record) error WriteRaw(from int, data []byte) error }
func NewRecordWriter ¶
func NewRecordWriter(file *os.File, recordSize int, marshaller RecordMarshaller) RecordWriter
type StockNameItem ¶
Click to show internal directories.
Click to hide internal directories.