Documentation
¶
Index ¶
- type ConvertCurrency
- type ExchangeRates
- func (e *ExchangeRates) ConvertCurrency(from, to string, amount float64, date time.Time) (*ConvertCurrency, error)
- func (e *ExchangeRates) GetFluctuations(startDate, endDate time.Time, baseCurrency, symbols string) (*Fluctuations, error)
- func (e *ExchangeRates) GetHistoricalRates(date time.Time, baseCurrency string, symbols []string) (*HistoricalRates, error)
- func (e *ExchangeRates) GetLatestRates(baseCurrency, symbols string) (*Rates, error)
- func (e *ExchangeRates) GetRates(baseCurrency, symbols string) (map[string]float64, error)
- func (e *ExchangeRates) GetSupportedCurrencies() ([]string, error)
- func (e *ExchangeRates) GetSymbols() (map[string]string, error)
- func (e *ExchangeRates) GetTimeSeriesRates(startDate, endDate time.Time, baseCurrency string, symbols []string) (*TimeSeriesRates, error)
- func (e *ExchangeRates) SendHTTPRequest(endPoint string, values url.Values, result interface{}) error
- func (e *ExchangeRates) Setup(config base.Settings) error
- type Fluctuations
- type FlucutationItem
- type HistoricalRates
- type Rates
- type TimeSeriesRates
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConvertCurrency ¶
type ConvertCurrency struct {
Query struct {
From string `json:"from"`
To string `json:"to"`
Amount float64 `json:"amount"`
} `json:"query"`
Info struct {
Timestamp int64 `json:"timestamp"`
Rate float64 `json:"rate"`
} `json:"info"`
Historical bool `json:"historical"`
Result float64 `json:"result"`
}
ConvertCurrency stores the converted currency info
type ExchangeRates ¶
type ExchangeRates struct {
base.Base
Requester *request.Requester
// contains filtered or unexported fields
}
ExchangeRates stores the struct for the ExchangeRatesAPI API
func (*ExchangeRates) ConvertCurrency ¶
func (e *ExchangeRates) ConvertCurrency(from, to string, amount float64, date time.Time) (*ConvertCurrency, error)
ConvertCurrency converts a currency based on the supplied params
func (*ExchangeRates) GetFluctuations ¶
func (e *ExchangeRates) GetFluctuations(startDate, endDate time.Time, baseCurrency, symbols string) (*Fluctuations, error)
GetFluctuations returns rate fluctuations based on the supplied params
func (*ExchangeRates) GetHistoricalRates ¶
func (e *ExchangeRates) GetHistoricalRates(date time.Time, 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) GetSymbols ¶
func (e *ExchangeRates) GetSymbols() (map[string]string, error)
GetSymbols returns a list of supported symbols
func (*ExchangeRates) GetTimeSeriesRates ¶
func (e *ExchangeRates) GetTimeSeriesRates(startDate, endDate time.Time, 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
type Fluctuations ¶
type Fluctuations struct {
Fluctuation bool `json:"fluctuation"`
StartDate string `json:"start_date"`
EndDate string `json:"end_date"`
Base string `json:"base"`
Rates map[string]FlucutationItem `json:"rates"`
}
Fluctuations stores a collection of rate fluctuations
type FlucutationItem ¶
type FlucutationItem struct {
StartRate float64 `json:"start_rate"`
EndRate float64 `json:"end_rate"`
Change float64 `json:"change"`
ChangePercentage float64 `json:"change_pct"`
}
FlucutationItem stores an individual rate fluctuation
type HistoricalRates ¶
HistoricalRates stores the historical rate info