pkg

package
v0.0.0-...-4178c87 Latest Latest
Warning

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

Go to latest
Published: May 10, 2018 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Buckets []int

Functions

func Round3

func Round3(val float64) float64

func Round8

func Round8(val float64) float64

Types

type CommonTicker

type CommonTicker struct {
	// The coin and the pairing: ETHBTC, ETH-BTC...
	Symbol string

	Timestamp time.Time

	// The last, or closing price.
	LastPrice float64

	// Volume in the base pair. Usually 24h.
	QuoteVolume float64

	// The 24 hour price change as a percentage value.
	PriceChangePct24 float64

	Bid  float64
	Ask  float64
	High float64
	Low  float64
}

func CommonTickerFromBinanceTicker

func CommonTickerFromBinanceTicker(ticker binance.Ticker24) CommonTicker

func CommonTickerFromKuCoinTicker

func CommonTickerFromKuCoinTicker(ticker kucoin.TickEntry) CommonTicker

type RedisCacheEntry

type RedisCacheEntry struct {
	Timestamp int64  `json:"timestamp"`
	Message   string `json:"message"`
}

func DecodeRedisCacheEntry

func DecodeRedisCacheEntry(buf string) (RedisCacheEntry, error)

type RedisInputCache

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

func NewRedisInputCache

func NewRedisInputCache(key string) *RedisInputCache

func (*RedisInputCache) GetFirst

func (c *RedisInputCache) GetFirst() (*RedisCacheEntry, error)

func (*RedisInputCache) GetN

func (c *RedisInputCache) GetN(n int64) (*RedisCacheEntry, error)

func (*RedisInputCache) LRange

func (c *RedisInputCache) LRange(start, stop int64) ([]string, error)

func (*RedisInputCache) LRemove

func (c *RedisInputCache) LRemove()

Like LPop, but ignores the result.

func (*RedisInputCache) Len

func (c *RedisInputCache) Len() (int64, error)

func (*RedisInputCache) RPush

func (c *RedisInputCache) RPush(buf []byte)

type TickerMetrics

type TickerMetrics struct {
	// Common metrics.
	PriceChangePercent  float64
	VolumeChangePercent float64
	High                float64
	Low                 float64
	Range               float64
	RangePercent        float64

	// Require trades.
	Vwap        float64
	TotalVolume float64
	NetVolume   float64
	BuyVolume   float64
}

type TickerTracker

type TickerTracker struct {
	Symbol     string
	Ticks      []CommonTicker
	Metrics    map[int]*TickerMetrics
	LastUpdate time.Time
	H24Metrics TickerMetrics

	// Trades, in Binance format.
	Trades []binance.AggTrade

	HaveVwap        bool
	HaveTotalVolume bool
	HaveNetVolume   bool
}

func NewTickerTracker

func NewTickerTracker(symbol string) *TickerTracker

func (*TickerTracker) AddTrade

func (t *TickerTracker) AddTrade(trade binance.AggTrade)

func (*TickerTracker) LastTick

func (t *TickerTracker) LastTick() *CommonTicker

func (*TickerTracker) PruneTrades

func (t *TickerTracker) PruneTrades(now time.Time)

func (*TickerTracker) Recalculate

func (t *TickerTracker) Recalculate()

func (*TickerTracker) Update

func (t *TickerTracker) Update(ticker CommonTicker)

type TickerTrackerMap

type TickerTrackerMap struct {
	Trackers map[string]*TickerTracker
}

func NewTickerTrackerMap

func NewTickerTrackerMap() *TickerTrackerMap

func (*TickerTrackerMap) GetLastForSymbol

func (t *TickerTrackerMap) GetLastForSymbol(symbol string) *CommonTicker

func (*TickerTrackerMap) GetTracker

func (t *TickerTrackerMap) GetTracker(symbol string) *TickerTracker

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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