rates

package
v0.0.0-...-30ce4d9 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const FREE_API_URL = "https://api.coingecko.com/api"
View Source
const PRO_API_URL = "https://pro-api.coingecko.com/api"

Variables

This section is empty.

Functions

This section is empty.

Types

type FiatRates

type FiatRates = map[string]decimal.Decimal

type Rates

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

func NewService

func NewService(config *RatesConfig) *Rates

func (*Rates) FetchRates

func (rates *Rates) FetchRates() (RatesResult, error)

func (*Rates) SaveRates

func (rates *Rates) SaveRates(prices RatesResult, db *sql.DB) error

type RatesConfig

type RatesConfig struct {
	ApiKey  string
	Cryptos map[string]string
	Fiats   []string
}

*

  • ApiKey is the CoinGecko API key; use the empty string for basic API
  • access (with lower access limits_ *
  • Cryptos is a map of localId -> remoteId pairs. *
  • Fiats is an array of fiat currencies for which we want rates.

type RatesResult

type RatesResult = map[string]FiatRates

Jump to

Keyboard shortcuts

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