Documentation
¶
Index ¶
- Variables
- func MergeData[T float32 | float64](destData []Record[T], sourceData []Record[T], multiplier int) []Record[T]
- 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[T float32 | float64] interface { GetData(security *Security, period Period) (error, []Record[T]) GetDataEx(security *Security, period Period, startDate uint64, count int) (error, []Record[T]) GetRangeData(security *Security, period Period, startDate, endDate uint64) (error, []Record[T]) GetDataFromLast(security *Security, period Period, endDate uint64, count int) (error, []Record[T]) GetLastRecord(security *Security, period Period) (error, *Record[T]) GetForwardAdjustedRangeData(security *Security, period Period, startDate, endDate uint64) (error, []Record[T]) AppendData(security *Security, period Period, data []Record[T]) error // Append data SaveData(security *Security, period Period, data []Record[T]) error // Replace data with new data RemoveData(security *Security, period Period, startDate, endDate uint64) error }
endDate: inclusive
type CompositeDataSource ¶
type CompositeDataSource[T float32 | float64] interface { BaseDataSource[T] AddSubDatasource(ds BaseDataSource[T]) }
type DataSource ¶
type DataSource[T float32 | float64] interface { InfoExDataSource BaseDataSource[T] // 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[T]) GetForwardAdjustedRangeData(security *Security, period Period, startDate, endDate uint64) (error, []Record[T]) GetForwardAdjustedDataFromLast(security *Security, period Period, endDate uint64, count int) (error, []Record[T]) 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[T float32 | float64] interface { BaseDataSource[T] SetMapper(mapper DateRangeMapper) SetTargetDataSource(ds BaseDataSource[T]) }
type RecordMarshaller ¶
type RecordReader ¶
type RecordReader[T float32 | float64] interface { Read(start, end int) (error, []Record[T]) Count() (error, int) }
func NewRecordReader ¶
func NewRecordReader[T float32 | float64](file *os.File, recordSize int, marshaller RecordMarshaller[T]) RecordReader[T]
type RecordWriter ¶
type RecordWriter[T float32 | float64] interface { Write(from int, data []Record[T]) error WriteRaw(from int, data []byte) error }
func NewRecordWriter ¶
func NewRecordWriter[T float32 | float64](file *os.File, recordSize int, marshaller RecordMarshaller[T]) RecordWriter[T]
type StockNameItem ¶
Click to show internal directories.
Click to hide internal directories.