market

package
v0.142.2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataPerTokenAndCurrency

type DataPerTokenAndCurrency = map[string]map[string]DataPoint

type DataPoint

type DataPoint struct {
	Price     float64
	UpdatedAt int64
}

type Manager

type Manager struct {
	IsConnected   bool
	LastCheckedAt int64
	// contains filtered or unexported fields
}

func (*Manager) FetchHistoricalDailyPrices

func (pm *Manager) FetchHistoricalDailyPrices(symbol string, currency string, limit int, allData bool, aggregate int) ([]thirdparty.HistoricalPrice, error)

func (*Manager) FetchHistoricalHourlyPrices

func (pm *Manager) FetchHistoricalHourlyPrices(symbol string, currency string, limit int, aggregate int) ([]thirdparty.HistoricalPrice, error)

func (*Manager) FetchPrice

func (pm *Manager) FetchPrice(symbol string, currency string) (float64, error)

func (*Manager) FetchPrices

func (pm *Manager) FetchPrices(symbols []string, currencies []string) (map[string]map[string]float64, error)

func (*Manager) FetchTokenDetails

func (pm *Manager) FetchTokenDetails(symbols []string) (map[string]thirdparty.TokenDetails, error)

func (*Manager) FetchTokenMarketValues

func (pm *Manager) FetchTokenMarketValues(symbols []string, currency string) (map[string]thirdparty.TokenMarketValues, error)

func (*Manager) GetCachedPrices

func (pm *Manager) GetCachedPrices() DataPerTokenAndCurrency

func (*Manager) GetOrFetchPrices

func (pm *Manager) GetOrFetchPrices(symbols []string, currencies []string, maxAgeInSeconds int64) (DataPerTokenAndCurrency, error)

Return cached price if present in cache and age is less than maxAgeInSeconds. Fetch otherwise.

Jump to

Keyboard shortcuts

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