event

package
v2.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownType     = errors.New("unknown type")
	ErrMismatchingType = errors.New("mismatching type")
)

Functions

This section is empty.

Types

type Event

type Event struct {
	Type    Type
	Time    time.Time
	Content interface{}
}

func NewPriceEvent

func NewPriceEvent(t time.Time, content tick.Tick) Event

func NewStatusEvent

func NewStatusEvent(t time.Time, content Status) Event

func OnlyKeepEarliestSameTimeEvents

func OnlyKeepEarliestSameTimeEvents(evts []Event, endTime time.Time) (earliestTime time.Time, filtered []Event)

func PriceEventFromCandlestick

func PriceEventFromCandlestick(
	exchange, pair string,
	currentPriceType candlestick.Price,
	t time.Time,
	cs candlestick.Candlestick,
) (Event, error)

func (Event) MarshalBinary

func (e Event) MarshalBinary() ([]byte, error)

func (*Event) UnmarshalBinary

func (e *Event) UnmarshalBinary(data []byte) error

type PricesSubscription

type PricesSubscription struct {
	Exchange string `json:"exchange"`
	Pair     string `json:"pair"`
}

type Status

type Status struct {
	Finished bool `json:"finished"`
}

type Type

type Type string
const (
	TypeIsPrice Type = "price"
	// Backtest specific
	TypeIsStatus Type = "status"
)

func (Type) MarshalBinary

func (t Type) MarshalBinary() ([]byte, error)

func (Type) String

func (t Type) String() string

func (*Type) UnmarshalBinary

func (t *Type) UnmarshalBinary(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL