stats

package
v0.0.0-...-ad9d088 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeSpan7Days  SymbolWithAssetsTimeSpan = "7d"
	TimeSpan15Days SymbolWithAssetsTimeSpan = "15d"
	TimeSpan30Days SymbolWithAssetsTimeSpan = "30d"

	TimeSpan2DaysTopCorridors TopCorridorsTimeSpan = "2d"
	TimeSpan7DaysTopCorridors TopCorridorsTimeSpan = "7d"

	HourNttTimespan  NttTimespan = "1h"
	DayNttTimespan   NttTimespan = "1d"
	MonthNttTimespan NttTimespan = "1mo"
	YearNttTimespan  NttTimespan = "1y"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type NativeTokenTransferActivity

type NativeTokenTransferActivity struct {
	EmitterChainID     sdk.ChainID     `json:"emitterChain"`
	DestinationChainID sdk.ChainID     `json:"destinationChain"`
	Symbol             string          `json:"symbol"`
	Value              decimal.Decimal `json:"value"`
}

type NativeTokenTransferByTime

type NativeTokenTransferByTime struct {
	Time   time.Time       `json:"time"`
	Symbol string          `json:"symbol"`
	Value  decimal.Decimal `json:"value"`
}

type NativeTokenTransferSummary

type NativeTokenTransferSummary struct {
	TotalValueTokenTransferred *decimal.Decimal `json:"totalValueTokenTransferred"`
	TotalTokenTransferred      *decimal.Decimal `json:"totalTokenTransferred"`
	AverageTransferSize        *decimal.Decimal `json:"averageTransferSize"`
	MedianTransferSize         *decimal.Decimal `json:"medianTransferSize"`
	MarketCap                  *decimal.Decimal `json:"marketCap"`
	CirculatingSupply          *decimal.Decimal `json:"circulatingSupply"`
}

type NttTimespan

type NttTimespan string

func ParseNttTimespan

func ParseNttTimespan(s string) (*NttTimespan, error)

type Repository

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

func NewRepository

func NewRepository(
	nttRepo *stats.NTTRepository,
	client influxdb2.Client,
	org string,
	bucket24HoursRetention string,
	bucketInfiniteRetention string,
	coingeckoAPI *coingecko.CoinGeckoAPI,
	tokenProvider *domain.TokenProvider,
	logger *zap.Logger,
) *Repository

func (*Repository) GetNativeTokenTransferActivity

func (r *Repository) GetNativeTokenTransferActivity(ctx context.Context, isNotional bool, symbol string) ([]NativeTokenTransferActivity, error)

func (*Repository) GetNativeTokenTransferByTime

func (r *Repository) GetNativeTokenTransferByTime(ctx context.Context, timespan NttTimespan, symbol string, isNotional bool, from, to time.Time) ([]NativeTokenTransferByTime, error)

func (*Repository) GetNativeTokenTransferSummary

func (r *Repository) GetNativeTokenTransferSummary(ctx context.Context, symbol string) (*NativeTokenTransferSummary, error)

func (*Repository) GetSymbolWithAssets

func (r *Repository) GetSymbolWithAssets(ctx context.Context, timeSpan SymbolWithAssetsTimeSpan) ([]SymbolWithAssetDTO, error)

func (*Repository) GetTopCorridores

func (r *Repository) GetTopCorridores(ctx context.Context, timeSpan TopCorridorsTimeSpan) ([]TopCorridorsDTO, error)

type Service

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

func NewService

func NewService(repo *Repository, statsRepository *stats.AddressRepository,
	holderRepository *stats.HolderRepositoryReadable, cache cache.Cache,
	expiration time.Duration, metrics metrics.Metrics, logger *zap.Logger) *Service

NewService create a new Service.

func (*Service) GetNativeTokenTransferActivity

func (s *Service) GetNativeTokenTransferActivity(ctx context.Context, isNotional bool, symbol string) ([]NativeTokenTransferActivity, error)

func (*Service) GetNativeTokenTransferAddressTop

func (s *Service) GetNativeTokenTransferAddressTop(ctx context.Context, symbol string, isNotional bool) ([]stats.NativeTokenTransferTopAddress, error)

func (*Service) GetNativeTokenTransferByTime

func (s *Service) GetNativeTokenTransferByTime(ctx context.Context, timespan NttTimespan, symbol string, isNotional bool, from, to time.Time) ([]NativeTokenTransferByTime, error)

func (*Service) GetNativeTokenTransferSummary

func (s *Service) GetNativeTokenTransferSummary(ctx context.Context, symbol string) (*NativeTokenTransferSummary, error)

func (*Service) GetNativeTokenTransferTopHolder

func (s *Service) GetNativeTokenTransferTopHolder(ctx context.Context, symbol string) ([]stats.NativeTokenTransferTopHolder, error)

func (*Service) GetSymbolWithAssets

func (s *Service) GetSymbolWithAssets(ctx context.Context, ts SymbolWithAssetsTimeSpan) ([]SymbolWithAssetDTO, error)

func (*Service) GetTopCorridors

func (s *Service) GetTopCorridors(ctx context.Context, ts TopCorridorsTimeSpan) ([]TopCorridorsDTO, error)

type SymbolWithAssetDTO

type SymbolWithAssetDTO struct {
	Symbol         string
	EmitterChainID sdk.ChainID
	TokenChainID   sdk.ChainID
	TokenAddress   string
	Volume         decimal.Decimal
	Txs            decimal.Decimal
}

type SymbolWithAssetsTimeSpan

type SymbolWithAssetsTimeSpan string

SymbolWithAssetsTimeSpan is used as an input parameter for the functions `GetTopAssets` and `GetTopChainPairs`.

func ParseSymbolsWithAssetsTimeSpan

func ParseSymbolsWithAssetsTimeSpan(s string) (*SymbolWithAssetsTimeSpan, error)

ParseSymbolsWithAssetsTimeSpan parses a string and returns a `SymbolsWithAssetsTimeSpan`.

type TopCorridorsDTO

type TopCorridorsDTO struct {
	EmitterChainID     sdk.ChainID
	DestinationChainID sdk.ChainID
	TokenChainID       sdk.ChainID
	TokenAddress       string
	Txs                uint64
}

type TopCorridorsTimeSpan

type TopCorridorsTimeSpan string

func ParseTopCorridorsTimeSpan

func ParseTopCorridorsTimeSpan(s string) (*TopCorridorsTimeSpan, error)

Jump to

Keyboard shortcuts

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