exchangerates

package
v0.0.0-...-eb07c7e Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExchangeRates

type ExchangeRates struct {
	base.Base
	Requester *request.Requester
}

ExchangeRates stores the struct for the ExchangeRatesAPI API

func (*ExchangeRates) GetHistoricalRates

func (e *ExchangeRates) GetHistoricalRates(date, baseCurrency string, symbols []string) (HistoricalRates, error)

GetHistoricalRates returns historical exchange rate data for all available or a specific set of currencies. date - YYYY-MM-DD [required] A date in the past baseCurrency - USD [optional] The base currency to use for forex rates, defaults to EUR symbols - AUD,USD [optional] The symbols to query the forex rates for, default is all supported currencies

func (*ExchangeRates) GetLatestRates

func (e *ExchangeRates) GetLatestRates(baseCurrency, symbols string) (Rates, error)

GetLatestRates returns a map of forex rates based on the supplied params baseCurrency - USD [optional] The base currency to use for forex rates, defaults to EUR symbols - AUD,USD [optional] The symbols to query the forex rates for, default is all supported currencies

func (*ExchangeRates) GetRates

func (e *ExchangeRates) GetRates(baseCurrency, symbols string) (map[string]float64, error)

GetRates is a wrapper function to return forex rates

func (*ExchangeRates) GetSupportedCurrencies

func (e *ExchangeRates) GetSupportedCurrencies() ([]string, error)

GetSupportedCurrencies returns the supported currency list

func (*ExchangeRates) GetTimeSeriesRates

func (e *ExchangeRates) GetTimeSeriesRates(startDate, endDate, baseCurrency string, symbols []string) (TimeSeriesRates, error)

GetTimeSeriesRates returns daily historical exchange rate data between two specified dates for all available or a specific set of currencies. startDate - YYYY-MM-DD [required] A date in the past endDate - YYYY-MM-DD [required] A date in the past but greater than the startDate baseCurrency - USD [optional] The base currency to use for forex rates, defaults to EUR symbols - AUD,USD [optional] The symbols to query the forex rates for, default is all supported currencies

func (*ExchangeRates) SendHTTPRequest

func (e *ExchangeRates) SendHTTPRequest(endPoint string, values url.Values, result interface{}) error

SendHTTPRequest sends a HTTPS request to the desired endpoint and returns the result

func (*ExchangeRates) Setup

func (e *ExchangeRates) Setup(config base.Settings) error

Setup sets appropriate values for CurrencyLayer

type HistoricalRates

type HistoricalRates Rates

HistoricalRates stores the historical rate info

type Rates

type Rates struct {
	Base  string             `json:"base"`
	Date  string             `json:"date"`
	Rates map[string]float64 `json:"rates"`
}

Rates holds the latest forex rates info

type TimeSeriesRates

type TimeSeriesRates struct {
	Base    string                 `json:"base"`
	StartAt string                 `json:"start_at"`
	EndAt   string                 `json:"end_at"`
	Rates   map[string]interface{} `json:"rates"`
}

TimeSeriesRates stores time series rate info

Jump to

Keyboard shortcuts

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