Documentation
¶
Index ¶
- Variables
- type ConvertCurrency
- type ExchangeRateHost
- func (e *ExchangeRateHost) ConvertCurrency(from, to, baseCurrency, symbols, source string, date time.Time, amount float64, ...) (*ConvertCurrency, error)
- func (e *ExchangeRateHost) GetFluctuations(startDate, endDate time.Time, baseCurrency, symbols string, amount float64, ...) (*Fluctuations, error)
- func (e *ExchangeRateHost) GetHistoricalRates(date time.Time, baseCurrency, symbols string, amount float64, places int64, ...) (*HistoricRates, error)
- func (e *ExchangeRateHost) GetLatestRates(baseCurrency, symbols string, amount float64, places int64, source string) (*LatestRates, error)
- func (e *ExchangeRateHost) GetRates(baseCurrency, symbols string) (map[string]float64, error)
- func (e *ExchangeRateHost) GetSupportedCurrencies() ([]string, error)
- func (e *ExchangeRateHost) GetSupportedSymbols() (*SupportedSymbols, error)
- func (e *ExchangeRateHost) GetTimeSeries(startDate, endDate time.Time, baseCurrency, symbols string, amount float64, ...) (*TimeSeries, error)
- func (e *ExchangeRateHost) SendHTTPRequest(endpoint string, v url.Values, result interface{}) error
- func (e *ExchangeRateHost) Setup(config base.Settings) error
- type Fluctuation
- type Fluctuations
- type HistoricRates
- type LatestRates
- type MessageOfTheDay
- type SupportedSymbols
- type Symbol
- type TimeSeries
Constants ¶
This section is empty.
Variables ¶
var (
// DefaultSource uses the ecb for forex rates
DefaultSource = "ecb"
)
Functions ¶
This section is empty.
Types ¶
type ConvertCurrency ¶
type ConvertCurrency struct {
MessageOfTheDay MessageOfTheDay `json:"motd"`
Query struct {
From string `json:"from"`
To string `json:"to"`
Amount float64 `json:"amount"`
} `json:"query"`
Info struct {
Rate float64 `json:"rate"`
} `json:"info"`
Historical bool `json:"historical"`
Date string `json:"date"`
Result float64 `json:"result"`
}
ConvertCurrency stores currency conversion data
type ExchangeRateHost ¶
ExchangeRateHost stores the struct for the exchangerate.host API
func (*ExchangeRateHost) ConvertCurrency ¶
func (e *ExchangeRateHost) ConvertCurrency(from, to, baseCurrency, symbols, source string, date time.Time, amount float64, places int64) (*ConvertCurrency, error)
ConvertCurrency converts a currency based on the supplied params
func (*ExchangeRateHost) GetFluctuations ¶
func (e *ExchangeRateHost) GetFluctuations(startDate, endDate time.Time, baseCurrency, symbols string, amount float64, places int64, source string) (*Fluctuations, error)
GetFluctuations returns a list of forex price fluctuations based on the supplied params
func (*ExchangeRateHost) GetHistoricalRates ¶
func (e *ExchangeRateHost) GetHistoricalRates(date time.Time, baseCurrency, symbols string, amount float64, places int64, source string) (*HistoricRates, error)
GetHistoricalRates returns a list of historical rates based on the supplied params
func (*ExchangeRateHost) GetLatestRates ¶
func (e *ExchangeRateHost) GetLatestRates(baseCurrency, symbols string, amount float64, places int64, source string) (*LatestRates, error)
GetLatestRates returns a list of forex rates based on the supplied params
func (*ExchangeRateHost) GetRates ¶
func (e *ExchangeRateHost) GetRates(baseCurrency, symbols string) (map[string]float64, error)
GetRates returns the forex rates based on the supplied base currency and symbols
func (*ExchangeRateHost) GetSupportedCurrencies ¶
func (e *ExchangeRateHost) GetSupportedCurrencies() ([]string, error)
GetSupportedCurrencies returns a list of supported currencies
func (*ExchangeRateHost) GetSupportedSymbols ¶
func (e *ExchangeRateHost) GetSupportedSymbols() (*SupportedSymbols, error)
GetSupportedSymbols returns a list of supported symbols
func (*ExchangeRateHost) GetTimeSeries ¶
func (e *ExchangeRateHost) GetTimeSeries(startDate, endDate time.Time, baseCurrency, symbols string, amount float64, places int64, source string) (*TimeSeries, error)
GetTimeSeries returns time series forex data based on the supplied params
func (*ExchangeRateHost) SendHTTPRequest ¶
func (e *ExchangeRateHost) SendHTTPRequest(endpoint string, v url.Values, result interface{}) error
SendHTTPRequest sends a typical get request
type Fluctuation ¶
type Fluctuation struct {
StartRate float64 `json:"start_rate"`
EndRate float64 `json:"end_rate"`
Change float64 `json:"change"`
ChangePercentage float64 `json:"change_pct"`
}
Fluctuation stores an individual rate flucutation
type Fluctuations ¶
type Fluctuations struct {
MessageOfTheDay MessageOfTheDay `json:"motd"`
Success bool `json:"success"`
Flucutation bool `json:"fluctuation"`
StartDate string `json:"start_date"`
EndDate string `json:"end_date"`
Rates map[string]Fluctuation `json:"rate"`
}
Fluctuations stores a collection of rate fluctuations
type HistoricRates ¶
type HistoricRates struct {
LatestRates
Historical bool `json:"historical"`
}
HistoricRates stores the hostoric rates
type LatestRates ¶
type LatestRates struct {
MessageOfTheDay MessageOfTheDay `json:"motd"`
Success bool `json:"success"`
Base string `json:"base"`
Date string `json:"date"`
Rates map[string]float64 `json:"rates"`
}
LatestRates stores the latest forex rates
type MessageOfTheDay ¶
MessageOfTheDay stores the message of the day
type SupportedSymbols ¶
type SupportedSymbols struct {
MessageOfTheDay MessageOfTheDay `json:"motd"`
Success bool `json:"success"`
Symbols map[string]Symbol `json:"symbols"`
}
SupportedSymbols store a collection of supported symbols
type TimeSeries ¶
type TimeSeries struct {
MessageOfTheDay MessageOfTheDay `json:"motd"`
Success bool `json:"success"`
TimeSeries bool `json:"timeseries"`
Base string `json:"base"`
StartDate string `json:"start_date"`
EndDate string `json:"end_date"`
Rates map[string]map[string]float64 `json:"rates"`
}
TimeSeries stores time series data