orderbook

package
v0.0.0-...-77ca9cc Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOrderbookForExchangeNotFound = "Ticker for exchange does not exist."
	ErrPrimaryCurrencyNotFound      = "Error primary currency for orderbook not found."
	ErrSecondaryCurrencyNotFound    = "Error secondary currency for orderbook not found."

	Orderbooks []Orderbook
)

Functions

func FirstCurrencyExists

func FirstCurrencyExists(exchange string, currency pair.CurrencyItem) bool

func ProcessOrderbook

func ProcessOrderbook(exchangeName string, p pair.CurrencyPair, orderbookNew OrderbookBase)

func SecondCurrencyExists

func SecondCurrencyExists(exchange string, p pair.CurrencyPair) bool

Types

type Orderbook

type Orderbook struct {
	Orderbook    map[pair.CurrencyItem]map[pair.CurrencyItem]OrderbookBase
	ExchangeName string
}

func CreateNewOrderbook

func CreateNewOrderbook(exchangeName string, p pair.CurrencyPair, orderbookNew OrderbookBase) Orderbook

func GetOrderbookByExchange

func GetOrderbookByExchange(exchange string) (*Orderbook, error)

type OrderbookBase

type OrderbookBase struct {
	Pair         pair.CurrencyPair `json:"pair"`
	CurrencyPair string            `json:"CurrencyPair"`
	Bids         []OrderbookItem   `json:"bids"`
	Asks         []OrderbookItem   `json:"asks"`
	LastUpdated  time.Time         `json:"last_updated"`
}

func GetOrderbook

func GetOrderbook(exchange string, p pair.CurrencyPair) (OrderbookBase, error)

func (*OrderbookBase) CalculateTotalAsks

func (o *OrderbookBase) CalculateTotalAsks() (float64, float64)

func (*OrderbookBase) CalculateTotalBids

func (o *OrderbookBase) CalculateTotalBids() (float64, float64)

func (*OrderbookBase) Update

func (o *OrderbookBase) Update(Bids, Asks []OrderbookItem)

type OrderbookItem

type OrderbookItem struct {
	Amount float64
	Price  float64
}

Jump to

Keyboard shortcuts

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