exchange

package
v0.0.0-...-907a525 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

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

func NewAggregator

func NewAggregator(options Options, formatter Formatter) *Aggregator

NewAggregator creates a new default clients

func (*Aggregator) Close

func (c *Aggregator) Close() error

func (*Aggregator) Register

func (c *Aggregator) Register(format ...string) error

Register adds a new markets. The format is exchange:marketname

func (*Aggregator) SetFormatter

func (c *Aggregator) SetFormatter(formatter Formatter)

func (*Aggregator) Start

func (c *Aggregator) Start()

type Candle

type Candle struct {
	Open  float64
	High  float64
	Low   float64
	Close float64
}

func (Candle) Percent

func (m Candle) Percent() float64

func (Candle) ToSatoshi

func (m Candle) ToSatoshi() Candle

func (*Candle) Update

func (m *Candle) Update(close float64)

type Exchange

type Exchange interface {
	// Register a market to listen for price changes
	Register(base string, quote string) error
	// Start listening for price changes in the registered markets
	Start(ctx context.Context, update chan<- Market) error
}

Exchange listens for price changes in realtime

func NewBinance

func NewBinance() Exchange

func NewFake

func NewFake() Exchange

NewFake returns a test exchange

type Formatter

type Formatter interface {
	Open()
	Show(market Market)
	Close()
}

type Market

type Market struct {
	Exchange string
	Base     string
	Quote    string
	Candle   Candle
}

type Options

type Options struct {
	ConvertToSatoshi bool
}

Jump to

Keyboard shortcuts

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