arrival

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProcessedUpdate

type ProcessedUpdate[T any] struct {
	Timestamp time.Time
	Slot      int
	Data      T
}

type SolanaRawUpdate

type SolanaRawUpdate struct {
	Data *solanaws.AccountResult
	Side gserum.Side
}

type SolanaUpdate

type SolanaUpdate struct {
	Side   gserum.Side
	Orders []*pb.OrderbookItem
	// contains filtered or unexported fields
}

func (SolanaUpdate) IsRedundant

func (s SolanaUpdate) IsRedundant() bool

type Source

type Source[T any, R any] interface {
	// Name returns an identifier for the source for printing
	Name() string

	// Run collects stream updates for the context duration. Run should avoid doing any other work besides collecting updates, so as to have accurate timestamps.
	Run(context.Context) ([]StreamUpdate[T], error)

	// Process deserializes the messages received by Run into useful formats for comparison.
	Process(updates []StreamUpdate[T], removeDuplicates bool) (map[int][]ProcessedUpdate[R], map[int][]ProcessedUpdate[R], error)
}

Source represents any streaming interface that provides timestamped updates for comparison.

func NewAPIOrderbookStream

func NewAPIOrderbookStream(address, market, authHeader string) (Source[[]byte, TraderAPIUpdate], error)

func NewSolanaOrderbookStream

func NewSolanaOrderbookStream(ctx context.Context, rpcAddress string, wsAddress, marketAddr string) (Source[SolanaRawUpdate, SolanaUpdate], error)

type StreamUpdate

type StreamUpdate[T any] struct {
	Timestamp time.Time
	Data      T
}

func NewStreamUpdate

func NewStreamUpdate[T any](data T) StreamUpdate[T]

type TraderAPIUpdate

type TraderAPIUpdate struct {
	Asks []*pb.OrderbookItem
	Bids []*pb.OrderbookItem
	// contains filtered or unexported fields
}

func (TraderAPIUpdate) IsRedundant

func (s TraderAPIUpdate) IsRedundant() bool

Jump to

Keyboard shortcuts

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