MCPcopy
hub / github.com/thrasher-corp/gocryptotrader / GetTickers

Method GetTickers

engine/rpcserver.go:472–498  ·  view source on GitHub ↗

GetTickers returns a list of tickers for all enabled exchanges and all enabled currency pairs

(_ context.Context, _ *gctrpc.GetTickersRequest)

Source from the content-addressed store, hash-verified

470// GetTickers returns a list of tickers for all enabled exchanges and all
471// enabled currency pairs
472func (s *RPCServer) GetTickers(_ context.Context, _ *gctrpc.GetTickersRequest) (*gctrpc.GetTickersResponse, error) {
473 activeTickers := s.GetAllActiveTickers()
474 tickers := make([]*gctrpc.Tickers, len(activeTickers))
475 for x := range activeTickers {
476 ticks := make([]*gctrpc.TickerResponse, len(activeTickers[x].ExchangeValues))
477 for y, val := range activeTickers[x].ExchangeValues {
478 ticks[y] = &gctrpc.TickerResponse{
479 Pair: &gctrpc.CurrencyPair{
480 Delimiter: val.Pair.Delimiter,
481 Base: val.Pair.Base.String(),
482 Quote: val.Pair.Quote.String(),
483 },
484 LastUpdated: s.unixTimestamp(val.LastUpdated),
485 Last: val.Last,
486 High: val.High,
487 Low: val.Low,
488 Bid: val.Bid,
489 Ask: val.Ask,
490 Volume: val.Volume,
491 PriceAth: val.PriceATH,
492 }
493 }
494 tickers[x] = &gctrpc.Tickers{Exchange: activeTickers[x].ExchangeName, Tickers: ticks}
495 }
496
497 return &gctrpc.GetTickersResponse{Tickers: tickers}, nil
498}
499
500// GetOrderbook returns an orderbook for a specific exchange, currency pair
501// and asset type

Callers

nothing calls this directly

Calls 3

unixTimestampMethod · 0.95
GetAllActiveTickersMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected