func (b *Base) SortStream() {
	sort.Slice(b.stream, func(i, j int) bool {
		b1 := b.stream[i]
		b2 := b.stream[j]
		return b1.GetTime().Before(b2.GetTime())
	})
}
SortStream sorts the stream by timestamp
package data
import (
	"sort"
	"strings"
	"github.com/thrasher-corp/gocryptotrader/backtester/common"
	"github.com/thrasher-corp/gocryptotrader/currency"
	"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
)
func (h *HandlerPerCurrency) Setup() {
	if h.data == nil {
		h.data = make(map[string]map[asset.Item]map[currency.Pair]Handler)
	}
}
func (h *HandlerPerCurrency) SetDataForCurrency(e string, a asset.Item, p currency.Pair, k Handler) {
	if h.data == nil {
		h.Setup()
	}
	e = strings.ToLower(e)
	if h.data[e] == nil {
		h.data[e] = make(map[asset.Item]map[currency.Pair]Handler)
	}
	if h.data[e][a] == nil {
		h.data[e][a] = make(map[currency.Pair]Handler)
	}
	h.data[e][a][p] = k
}
func (h *HandlerPerCurrency) GetAllData() map[string]map[asset.Item]map[currency.Pair]Handler {
	return h.data
}
func (h *HandlerPerCurrency) GetDataForCurrency(e string, a asset.Item, p currency.Pair) Handler {
	return h.data[e][a][p]
}
func (h *HandlerPerCurrency) Reset() {
	h.data = nil
}
func (b *Base) Reset() {
	b.latest = nil
	b.offset = 0
	b.stream = nil
}
func (b *Base) GetStream() []common.DataEventHandler {
	return b.stream
}
func (b *Base) Offset() int {
	return b.offset
}
func (b *Base) SetStream(s []common.DataEventHandler) {
	b.stream = s
}
func (b *Base) AppendStream(s ...common.DataEventHandler) {
	for i := range s {
		if s[i] == nil {
			continue
		}
		b.stream = append(b.stream, s[i])
	}
}
func (b *Base) Next() (dh common.DataEventHandler) {
	if len(b.stream) <= b.offset {
		return nil
	}
	ret := b.stream[b.offset]
	b.offset++
	b.latest = ret
	return ret
}
func (b *Base) History() []common.DataEventHandler {
	return b.stream[:b.offset]
}
func (b *Base) Latest() common.DataEventHandler {
	return b.latest
}
func (b *Base) List() []common.DataEventHandler {
	return b.stream[b.offset:]
}