stats

package module
v0.0.0-...-c62b328 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

README

stats

stats of permaswap

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTokenName

func GetTokenName(symbol string) (name string)

func GetTokenPrice

func GetTokenPrice(tokenSymbol string, currency string, timestamp string, date string) (price float64)

func GetTokenPriceByCoingecko

func GetTokenPriceByCoingecko(token, date string) (float64, error)

func GetTokenPriceByRedstone

func GetTokenPriceByRedstone(tokenSymbol string, currency string, timestamp string) (float64, error)

func GetTokenPriceByRedstoneWithRetry

func GetTokenPriceByRedstoneWithRetry(tokenSymbol string, currency string, timestamp string, retry int64) (float64, error)

func MustGetTokenPrice

func MustGetTokenPrice(symbol string, currency string, timestamp string) (price float64)

func MustGetTokenPriceByRedstone

func MustGetTokenPriceByRedstone(tokenSymbol string, currency string, timestamp string) float64

Types

type CoingeckoData

type CoingeckoData struct {
	MarketData struct {
		CurrentPrice struct {
			USD float64 `json:"usd"`
		} `json:"current_price"`
	} `json:"market_data"`
}

type Stats

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

func New

func New(chainID int64, routerAddr string, startTxRawID int64, startTxEverHash string, client *sdk.Client, dsn string) *Stats

func (*Stats) Close

func (s *Stats) Close()

func (*Stats) Run

func (s *Stats) Run(port string)

type WDB

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

func NewWDB

func NewWDB(dsn string) *WDB

func (*WDB) FindStatsSnapshot

func (w *WDB) FindStatsSnapshot(date time.Time) (statSnapshot *schema.StatsSnapshot, err error)

func (*WDB) FindStatsSnapshots

func (w *WDB) FindStatsSnapshots(start, end time.Time) (statSnapshots []*schema.StatsSnapshot, err error)

func (*WDB) LoadAllStats

func (w *WDB) LoadAllStats() (statSnapshots []*schema.StatsSnapshot, err error)

func (*WDB) LoadStats

func (w *WDB) LoadStats() (statSnapshot *schema.StatsSnapshot, err error)

func (*WDB) Migrate

func (w *WDB) Migrate()

func (*WDB) SaveStatsSnapshot

func (w *WDB) SaveStatsSnapshot(stats *schema.Stats, tx *gorm.DB) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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