Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrMissingMapping = errors.New("missing mapping")
)
Functions ¶
func SetDefaultTimeFormat ¶
SetDefaultTimeFormat sets the default time format for DateTime parsing, and it returns the previous value. the default is `2006-01-02T15:04:05+0000`
Types ¶
type DateTime ¶
type DateTime string
DateTime is a generic helper date/time type since every dataset uses a different format for their timestamp
func (DateTime) MarshalJSON ¶
func (DateTime) Time ¶
Time tries to convert the DateTime to time.Time rules: - if it's a number, it tries to parse it as nanoseconds, milliseconds or seconds - if it's a string it'll try to parse it with the default time fmt see `SetDefaultTimeFormat`
func (*DateTime) UnmarshalJSON ¶
type Mapping ¶
type Mapping struct { SkipFirstRow bool Decoder func(r io.Reader) (io.Reader, error) TS *Idx Symbol *Idx Open *Idx High *Idx Low *Idx Close *Idx Volume *Idx FillSymbol string // contains filtered or unexported fields }
Mapping defines how to read a CSV file
type Tick ¶
type Tick struct { TS DateTime `json:"date"` Symbol string `json:"symbol"` Open ta.Decimal `json:"open"` High ta.Decimal `json:"high"` Low ta.Decimal `json:"low"` Close ta.Decimal `json:"close"` Volume int64 `json:"volume"` }
Tick represents a single tick
type Ticks ¶
type Ticks []*Tick
func ConvertToTicks ¶
ConvertToTicks converts a slice of structs to a Ticks, it expects: Symbol, if available, to be string TS|Date|DateTime, if available, to be a string, time.Time or int64 Open|High|Low|Closem, if available, to be float(32|64) or an alias for it. Volume to be int type.