Documentation
¶
Index ¶
- type Conversion
- type Fixer
- func (f *Fixer) ConvertCurrency(from, to, date string, amount float64) (float64, error)
- func (f *Fixer) GetFluctuationData(startDate, endDate, baseCurrency string, symbols []string) (map[string]Flux, error)
- func (f *Fixer) GetHistoricalRates(date, baseCurrency string, symbols []string) (map[string]float64, error)
- func (f *Fixer) GetLatestRates(baseCurrency, symbols string) (map[string]float64, error)
- func (f *Fixer) GetRates(baseCurrency, symbols string) (map[string]float64, error)
- func (f *Fixer) GetSupportedCurrencies() ([]string, error)
- func (f *Fixer) GetTimeSeriesData(startDate, endDate, baseCurrency string, symbols []string) (map[string]interface{}, error)
- func (f *Fixer) SendOpenHTTPRequest(endpoint string, v url.Values, result interface{}) error
- func (f *Fixer) Setup(config base.Settings) error
- type Fluctuation
- type Flux
- type Rates
- type RespError
- type Symbols
- type TimeSeries
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conversion ¶
type Conversion struct {
Success bool `json:"success"`
Error RespError `json:"error"`
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"`
Date string `json:"date"`
Result float64 `json:"result"`
}
Conversion contains data for currency conversion
type Fixer ¶
Fixer is a foreign exchange rate provider at https://fixer.io/ NOTE DEFAULT BASE CURRENCY IS EUR upgrade to basic to change
func (*Fixer) ConvertCurrency ¶
ConvertCurrency allows for conversion of any amount from one currency to another. from - The three-letter currency code of the currency you would like to convert from. to - The three-letter currency code of the currency you would like to convert to. amount - The amount to be converted. date - [optional] Specify a date (format YYYY-MM-DD) to use historical rates for this conversion.
func (*Fixer) GetFluctuationData ¶
func (f *Fixer) GetFluctuationData(startDate, endDate, baseCurrency string, symbols []string) (map[string]Flux, error)
GetFluctuationData returns fluctuation data between two specified dates for all available or a specific set of currencies.
func (*Fixer) GetHistoricalRates ¶
func (f *Fixer) GetHistoricalRates(date, baseCurrency string, symbols []string) (map[string]float64, 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 base - USD [optional] symbols - the desired symbols
func (*Fixer) GetLatestRates ¶
GetLatestRates returns real-time exchange rate data for all available or a specific set of currencies. NOTE DEFAULT BASE CURRENCY IS EUR
func (*Fixer) GetSupportedCurrencies ¶
GetSupportedCurrencies returns supported currencies
func (*Fixer) GetTimeSeriesData ¶
func (f *Fixer) GetTimeSeriesData(startDate, endDate, baseCurrency string, symbols []string) (map[string]interface{}, error)
GetTimeSeriesData returns daily historical exchange rate data between two specified dates for all available or a specific set of currencies.
func (*Fixer) SendOpenHTTPRequest ¶
SendOpenHTTPRequest sends a typical get request
type Fluctuation ¶
type Fluctuation struct {
Success bool `json:"success"`
Error RespError `json:"error"`
Fluctuation bool `json:"fluctuation"`
StartDate string `json:"start_date"`
EndDate string `json:"end_date"`
Base string `json:"base"`
Rates map[string]Flux `json:"rates"`
}
Fluctuation holds fluctuation data
type Flux ¶
type Flux struct {
StartRate float64 `json:"start_rate"`
EndRate float64 `json:"end_rate"`
Change float64 `json:"change"`
ChangePCT float64 `json:"change_pct"`
}
Flux is a sub type holding fluctation data
type Rates ¶
type Rates struct {
Success bool `json:"success"`
Error RespError `json:"error"`
Historical bool `json:"historical"`
Timestamp int64 `json:"timestamp"`
Base string `json:"base"`
Date string `json:"date"`
Rates map[string]float64 `json:"rates"`
}
Rates contains the data fields for the currencies you have requested.
type RespError ¶
type RespError struct {
Code int `json:"code"`
Type string `json:"type"`
Info string `json:"info"`
}
RespError defines a general resp error sub type
type Symbols ¶
type Symbols struct {
Success bool `json:"success"`
Error RespError `json:"error"`
Map map[string]string `json:"symbols"`
}
Symbols defines a symbols list
type TimeSeries ¶
type TimeSeries struct {
Success bool `json:"success"`
Error RespError `json:"error"`
Timeseries bool `json:"timeseries"`
StartDate string `json:"start_date"`
EndDate string `json:"end_date"`
Base string `json:"base"`
Rates map[string]interface{} `json:"rates"`
}
TimeSeries holds timeseries data