Documentation ¶
Overview ¶
Package ecbratex provides a convenient interface and useful data structures for fetching and manipulating currency exchange rate records from the European Central Bank (https://ecb.europa.eu).
Index ¶
- Variables
- func FetchLatest() (*record.WithDate, error)
- func FetchOrderedTimeSeries(period Period) (timeseries.OrderedRecords, error)
- func FetchOrderedUnorderedTimeSeries(period Period) (*timeseries.OrderedUnorderedRecords, error)
- func FetchTimeSeries(period Period) (timeseries.UnorderedRecords, error)
- func SetProvider(p provider.Provider)
- type Period
Constants ¶
This section is empty.
Variables ¶
var ErrUnexpectedPeriod = errors.New("unexpected period")
var Provider provider.Provider = provider.NewHTTPProvider(
"https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml",
"https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.xml",
"https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml",
)
Provider is provider.Provider which will be used to fetch rates data across the ecbratex. provider.HTTPProvider with URLs to the ECB website is used by default.
Functions ¶
func FetchLatest ¶
FetchLatest fetches latest available exchange rates using Provider.
func FetchOrderedTimeSeries ¶
func FetchOrderedTimeSeries(period Period) (timeseries.OrderedRecords, error)
FetchOrderedTimeSeries fetches rate records within the given period using Provider. Returns records represented as timeseries.RecordsSlice.
func FetchOrderedUnorderedTimeSeries ¶
func FetchOrderedUnorderedTimeSeries(period Period) (*timeseries.OrderedUnorderedRecords, error)
FetchOrderedUnorderedTimeSeries fetches rate records within the given period using Provider. Returns records represented as timeseries.RecordsSliceMap.
func FetchTimeSeries ¶
func FetchTimeSeries(period Period) (timeseries.UnorderedRecords, error)
FetchTimeSeries fetches rate records within the given period using Provider. Returns records represented as timeseries.RecordsMap.
func SetProvider ¶
SetProvider sets data provider which will be used across the ecbratex to fetch exchange rates records.
Types ¶
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
latest-rates/convert-minors
This simple example illustrates usage of ConvertMinors function.
|
This simple example illustrates usage of ConvertMinors function. |
pkg
|
|