currency

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidBase = errors.New("invalid base currency")
)

Functions

This section is empty.

Types

type Client

type Client interface {
	// GetCurrentRates gets the current set of exchange rates against a base
	// currency.
	GetCurrentRates(ctx context.Context, base string) (*ExchangeData, error)

	// GetHistoricalRates gets the historical set of exchange rates against a
	// base currency. Granularity of time intervals may be significantly reduced.
	// A databse of cached rates from periodic calls to GetCurrentRates is the
	// recommended workaround.
	GetHistoricalRates(ctx context.Context, base string, timestamp time.Time) (*ExchangeData, error)
}

type Code

type Code string
const (
	KIN Code = "kin"
	AED Code = "aed"
	AFN Code = "afn"
	ALL Code = "all"
	AMD Code = "amd"
	ANG Code = "ang"
	AOA Code = "aoa"
	ARS Code = "ars"
	AUD Code = "aud"
	AWG Code = "awg"
	AZN Code = "azn"
	BAM Code = "bam"
	BBD Code = "bbd"
	BDT Code = "bdt"
	BGN Code = "bgn"
	BHD Code = "bhd"
	BIF Code = "bif"
	BMD Code = "bmd"
	BND Code = "bnd"
	BOB Code = "bob"
	BRL Code = "brl"
	BSD Code = "bsd"
	BTC Code = "btc"
	BTN Code = "btn"
	BWP Code = "bwp"
	BYN Code = "byn"
	BYR Code = "byr"
	BZD Code = "bzd"
	CAD Code = "cad"
	CDF Code = "cdf"
	CHF Code = "chf"
	CLF Code = "clf"
	CLP Code = "clp"
	CNY Code = "cny"
	COP Code = "cop"
	CRC Code = "crc"
	CUC Code = "cuc"
	CUP Code = "cup"
	CVE Code = "cve"
	CZK Code = "czk"
	DJF Code = "djf"
	DKK Code = "dkk"
	DOP Code = "dop"
	DZD Code = "dzd"
	EGP Code = "egp"
	ERN Code = "ern"
	ETB Code = "etb"
	EUR Code = "eur"
	FJD Code = "fjd"
	FKP Code = "fkp"
	GBP Code = "gbp"
	GEL Code = "gel"
	GGP Code = "ggp"
	GHS Code = "ghs"
	GIP Code = "gip"
	GMD Code = "gmd"
	GNF Code = "gnf"
	GTQ Code = "gtq"
	GYD Code = "gyd"
	HKD Code = "hkd"
	HNL Code = "hnl"
	HRK Code = "hrk"
	HTG Code = "htg"
	HUF Code = "huf"
	IDR Code = "idr"
	ILS Code = "ils"
	IMP Code = "imp"
	INR Code = "inr"
	IQD Code = "iqd"
	IRR Code = "irr"
	ISK Code = "isk"
	JEP Code = "jep"
	JMD Code = "jmd"
	JOD Code = "jod"
	JPY Code = "jpy"
	KES Code = "kes"
	KGS Code = "kgs"
	KHR Code = "khr"
	KMF Code = "kmf"
	KPW Code = "kpw"
	KRW Code = "krw"
	KWD Code = "kwd"
	KYD Code = "kyd"
	KZT Code = "kzt"
	LAK Code = "lak"
	LBP Code = "lbp"
	LKR Code = "lkr"
	LRD Code = "lrd"
	LSL Code = "lsl"
	LTL Code = "ltl"
	LVL Code = "lvl"
	LYD Code = "lyd"
	MAD Code = "mad"
	MDL Code = "mdl"
	MGA Code = "mga"
	MKD Code = "mkd"
	MMK Code = "mmk"
	MNT Code = "mnt"
	MOP Code = "mop"
	MRO Code = "mro"
	MRU Code = "mru"
	MUR Code = "mur"
	MVR Code = "mvr"
	MWK Code = "mwk"
	MXN Code = "mxn"
	MYR Code = "myr"
	MZN Code = "mzn"
	NAD Code = "nad"
	NGN Code = "ngn"
	NIO Code = "nio"
	NOK Code = "nok"
	NPR Code = "npr"
	NZD Code = "nzd"
	OMR Code = "omr"
	PAB Code = "pab"
	PEN Code = "pen"
	PGK Code = "pgk"
	PHP Code = "php"
	PKR Code = "pkr"
	PLN Code = "pln"
	PYG Code = "pyg"
	QAR Code = "qar"
	RON Code = "ron"
	RSD Code = "rsd"
	RUB Code = "rub"
	RWF Code = "rwf"
	SAR Code = "sar"
	SBD Code = "sbd"
	SCR Code = "scr"
	SDG Code = "sdg"
	SEK Code = "sek"
	SGD Code = "sgd"
	SHP Code = "shp"
	SLL Code = "sll"
	SOS Code = "sos"
	SRD Code = "srd"
	SSP Code = "ssp"
	STD Code = "std"
	STN Code = "stn"
	SVC Code = "svc"
	SYP Code = "syp"
	SZL Code = "szl"
	THB Code = "thb"
	TJS Code = "tjs"
	TMT Code = "tmt"
	TND Code = "tnd"
	TOP Code = "top"
	TRY Code = "try"
	TTD Code = "ttd"
	TWD Code = "twd"
	TZS Code = "tzs"
	UAH Code = "uah"
	UGX Code = "ugx"
	USD Code = "usd"
	UYU Code = "uyu"
	UZS Code = "uzs"
	VES Code = "ves"
	VND Code = "vnd"
	VUV Code = "vuv"
	WST Code = "wst"
	XAF Code = "xaf"
	XAG Code = "xag"
	XAU Code = "xau"
	XCD Code = "xcd"
	XDR Code = "xdr"
	XOF Code = "xof"
	XPF Code = "xpf"
	YER Code = "yer"
	ZAR Code = "zar"
	ZMK Code = "zmk"
	ZMW Code = "zmw"
	ZWL Code = "zwl"
)

type ExchangeData

type ExchangeData struct {
	Base      string
	Rates     map[string]float64
	Timestamp time.Time
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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