ticker

package
v0.0.0-...-3240a16 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrTickerForExchangeNotFound = "Ticker for exchange does not exist."
	ErrPrimaryCurrencyNotFound   = "Error primary currency for ticker not found."
	ErrSecondaryCurrencyNotFound = "Error secondary currency for ticker not found."

	Spot = "SPOT"
)

Const values for the ticker package

Variables

View Source
var (
	Tickers []Ticker
)

Vars for the ticker package

Functions

func FirstCurrencyExists

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

FirstCurrencyExists checks to see if the first currency of the Price map exists

func ProcessTicker

func ProcessTicker(exchangeName string, p pair.CurrencyPair, tickerNew Price, tickerType string)

ProcessTicker processes incoming tickers, creating or updating the Tickers list

func SecondCurrencyExists

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

SecondCurrencyExists checks to see if the second currency of the Price map exists

Types

type Price

type Price struct {
	Pair         pair.CurrencyPair `json:"Pair"`
	CurrencyPair string            `json:"CurrencyPair"`
	Last         float64           `json:"Last"`
	High         float64           `json:"High"`
	Low          float64           `json:"Low"`
	Bid          float64           `json:"Bid"`
	Ask          float64           `json:"Ask"`
	Volume       float64           `json:"Volume"`
	PriceATH     float64           `json:"PriceATH"`
}

Price struct stores the currency pair and pricing information

func GetTicker

func GetTicker(exchange string, p pair.CurrencyPair, tickerType string) (Price, error)

GetTicker checks and returns a requested ticker if it exists

type Ticker

type Ticker struct {
	Price        map[pair.CurrencyItem]map[pair.CurrencyItem]map[string]Price
	ExchangeName string
}

Ticker struct holds the ticker information for a currency pair and type

func CreateNewTicker

func CreateNewTicker(exchangeName string, p pair.CurrencyPair, tickerNew Price, tickerType string) Ticker

CreateNewTicker creates a new Ticker

func GetTickerByExchange

func GetTickerByExchange(exchange string) (*Ticker, error)

GetTickerByExchange returns an exchange Ticker

func (*Ticker) PriceToString

func (t *Ticker) PriceToString(p pair.CurrencyPair, priceType, tickerType string) string

PriceToString returns the string version of a stored price field

Jump to

Keyboard shortcuts

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