Documentation
¶
Index ¶
Constants ¶
const ( ErrOrderbookForExchangeNotFound = "Ticker for exchange does not exist." ErrPrimaryCurrencyNotFound = "Error primary currency for orderbook not found." ErrSecondaryCurrencyNotFound = "Error secondary currency for orderbook not found." Spot = "SPOT" )
Const values for orderbook package
Variables ¶
var (
Orderbooks []Orderbook
)
Vars for the orderbook package
Functions ¶
func FirstCurrencyExists ¶
func FirstCurrencyExists(exchange string, currency pair.CurrencyItem) bool
FirstCurrencyExists checks to see if the first currency of the orderbook map exists
func ProcessOrderbook ¶
func ProcessOrderbook(exchangeName string, p pair.CurrencyPair, orderbookNew Base, orderbookType string)
ProcessOrderbook processes incoming orderbooks, creating or updating the Orderbook list
func SecondCurrencyExists ¶
func SecondCurrencyExists(exchange string, p pair.CurrencyPair) bool
SecondCurrencyExists checks to see if the second currency of the orderbook map exists
Types ¶
type Base ¶
type Base struct { Pair pair.CurrencyPair `json:"pair"` CurrencyPair string `json:"CurrencyPair"` Bids []Item `json:"bids"` Asks []Item `json:"asks"` LastUpdated time.Time `json:"last_updated"` }
Base holds the fields for the orderbook base
func GetOrderbook ¶
GetOrderbook checks and returns the orderbook given an exchange name and currency pair if it exists
func (*Base) CalculateTotalAsks ¶
CalculateTotalAsks returns the total amount of asks and the total orderbook asks value
func (*Base) CalculateTotalBids ¶
CalculateTotalBids returns the total amount of bids and the total orderbook bids value
type Orderbook ¶
type Orderbook struct { Orderbook map[pair.CurrencyItem]map[pair.CurrencyItem]map[string]Base ExchangeName string }
Orderbook holds the orderbook information for a currency pair and type
func CreateNewOrderbook ¶
func CreateNewOrderbook(exchangeName string, p pair.CurrencyPair, orderbookNew Base, orderbookType string) Orderbook
CreateNewOrderbook creates a new orderbook
func GetOrderbookByExchange ¶
GetOrderbookByExchange returns an exchange orderbook