tokenprice

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer interface {
	Price(token tokens.Token) float64
	Stream(ctx context.Context)
}

func NewBuffer

func NewBuffer(price tokens.Pricer, tkns []tokens.Token, threshold float64, ticker ticker.Ticker) Buffer

NewBuffer creates a new token price buffer.

A token price buffer maintains a buffered view of token prices for multiple tokens. Buffered token prices are not updated unless they are outside the threshold percentage. Start steaming token prices with Buffer.Stream(ctx).

type MockBuffer added in v0.11.0

type MockBuffer struct {
	// contains filtered or unexported fields
}

func NewMockBuffer added in v0.11.0

func NewMockBuffer() *MockBuffer

func (*MockBuffer) Price added in v0.11.0

func (b *MockBuffer) Price(token tokens.Token) float64

func (*MockBuffer) SetPrice added in v0.11.0

func (b *MockBuffer) SetPrice(token tokens.Token, price float64)

func (*MockBuffer) Stream added in v0.11.0

func (*MockBuffer) Stream(context.Context)

Jump to

Keyboard shortcuts

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