Documentation ¶
Index ¶
- Variables
- type Base
- func (b *Base) AppendStream(s ...Event) error
- func (b *Base) GetDetails() (string, asset.Item, currency.Pair, error)
- func (b *Base) GetStream() (Events, error)
- func (b *Base) History() (Events, error)
- func (b *Base) IsLastEvent() (bool, error)
- func (b *Base) IsLive() (bool, error)
- func (b *Base) Latest() (Event, error)
- func (b *Base) List() (Events, error)
- func (b *Base) Next() (Event, error)
- func (b *Base) Offset() (int64, error)
- func (b *Base) Reset() error
- func (b *Base) SetLive(isLive bool) error
- func (b *Base) SetStream(s []Event) error
- type Event
- type Events
- type Handler
- type HandlerHolder
- type Holder
- type Loader
- type Streamer
Constants ¶
This section is empty.
Variables ¶
var ( // ErrHandlerNotFound returned when a handler is not found for specified exchange, asset, pair ErrHandlerNotFound = errors.New("handler not found") // ErrInvalidEventSupplied returned when a bad event is supplied ErrInvalidEventSupplied = errors.New("invalid event supplied") // ErrEmptySlice is returned when the supplied slice is nil or empty ErrEmptySlice = errors.New("empty slice") // ErrEndOfData is returned when attempting to load the next offset when there is no more ErrEndOfData = errors.New("no more data to retrieve") )
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
Base is the base implementation of some interface functions where further specific functions are implemented in DataFromKline
func (*Base) AppendStream ¶
AppendStream appends new datas onto the stream, however, will not add duplicates. Used for live analysis
func (*Base) GetDetails ¶
GetDetails returns data about the Base Holder
func (*Base) IsLastEvent ¶
IsLastEvent determines whether the latest event is the last event for live Data, this will be false, as all appended Data is the latest available Data and this signal cannot be completely relied upon
func (*Base) IsLive ¶
IsLive returns if the Data source is a live one less scrutiny on checks is required on live Data sourcing
func (*Base) List ¶
List returns all future Data events from the current iteration ill-advised to use this in strategies because you don't know the future in real life
func (*Base) Offset ¶
Offset returns the current iteration of candle Data the backtester is assessing
type Event ¶
type Event interface { common.Event GetUnderlyingPair() currency.Pair GetClosePrice() decimal.Decimal GetHighPrice() decimal.Decimal GetLowPrice() decimal.Decimal GetOpenPrice() decimal.Decimal GetVolume() decimal.Decimal }
Event interface used for loading and interacting with Data
type Events ¶
type Events []Event
Events allows for some common functions on a slice of events
type Handler ¶
type Handler interface { Loader Streamer GetDetails() (string, asset.Item, currency.Pair, error) Reset() error }
Handler interface for Loading and Streaming Data
type HandlerHolder ¶
type HandlerHolder struct {
// contains filtered or unexported fields
}
HandlerHolder stores an event handler per exchange asset pair
func NewHandlerHolder ¶
func NewHandlerHolder() *HandlerHolder
NewHandlerHolder returns a new HandlerHolder
func (*HandlerHolder) GetAllData ¶
func (h *HandlerHolder) GetAllData() ([]Handler, error)
GetAllData returns all set Data in the Data map
func (*HandlerHolder) GetDataForCurrency ¶
func (h *HandlerHolder) GetDataForCurrency(ev common.Event) (Handler, error)
GetDataForCurrency returns the Handler for a specific exchange, asset, currency
func (*HandlerHolder) Reset ¶
func (h *HandlerHolder) Reset() error
Reset returns the struct to defaults
func (*HandlerHolder) SetDataForCurrency ¶
func (h *HandlerHolder) SetDataForCurrency(e string, a asset.Item, p currency.Pair, k Handler) error
SetDataForCurrency assigns a Data Handler to the Data map by exchange, asset and currency
type Holder ¶
type Holder interface { SetDataForCurrency(string, asset.Item, currency.Pair, Handler) error GetAllData() ([]Handler, error) GetDataForCurrency(ev common.Event) (Handler, error) Reset() error }
Holder interface dictates what a Data holder is expected to do
type Streamer ¶
type Streamer interface { Next() (Event, error) GetStream() (Events, error) History() (Events, error) Latest() (Event, error) List() (Events, error) IsLastEvent() (bool, error) Offset() (int64, error) StreamOpen() ([]decimal.Decimal, error) StreamHigh() ([]decimal.Decimal, error) StreamLow() ([]decimal.Decimal, error) StreamClose() ([]decimal.Decimal, error) StreamVol() ([]decimal.Decimal, error) HasDataAtTime(time.Time) (bool, error) }
Streamer interface handles loading, parsing, distributing BackTest Data