marketstream

package
v0.0.0-...-ed45d8a Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info.

Types

type AggTrade

type AggTrade struct {
	EventType        string `json:"e"` // Event type
	EventTime        uint64 `json:"E"` // Event time
	Symbol           string `json:"s"` // Symbol
	AggregateTradeID uint64 `json:"a"` // Aggregate trade ID
	Price            string `json:"p"` // Price
	Quantity         string `json:"q"` // Quantity
	FirstTradeID     uint64 `json:"f"` // First trade ID
	LastTradeID      uint64 `json:"l"` // Last trade ID
	TradeTime        uint64 `json:"T"` // Trade time
	IsBuyer          bool   `json:"m"` // Is the buyer the market maker?
	Ignore           bool   `json:"M"` // Ignore
}

func (*AggTrade) GetPrice

func (t *AggTrade) GetPrice() float64

func (*AggTrade) GetSymbol

func (t *AggTrade) GetSymbol() string

func (*AggTrade) GetTradeTime

func (t *AggTrade) GetTradeTime() uint64

type BinanceStream

type BinanceStream struct {
	Pairs []TradingPair
	// contains filtered or unexported fields
}

func NewBinanceStream

func NewBinanceStream(callback func(symbol string, price TradingPrice), pairs ...TradingPair) (*BinanceStream, error)

func (*BinanceStream) GetTrade

func (s *BinanceStream) GetTrade(pair TradingPair) TradingPrice

func (*BinanceStream) GetTradeBySymbol

func (s *BinanceStream) GetTradeBySymbol(symbol string) TradingPrice

func (*BinanceStream) Run

func (s *BinanceStream) Run(ctx context.Context)

type Trading

type Trading interface {
	GetSymbol() string
	GetPrice() float64
	GetTradeTime() uint64
}

type TradingPair

type TradingPair struct {
	Base  uint32
	Quote uint32
}

type TradingPrice

type TradingPrice struct {
	Symbol    string
	Price     float64
	TradeTime uint64
}

Jump to

Keyboard shortcuts

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