Documentation ¶
Index ¶
- Constants
- type Convert
- type Historical
- type Latest
- type OHLC
- type OXR
- func (o *OXR) ConvertCurrency(amount float64, from, to string) (float64, error)
- func (o *OXR) GetCurrencies(showInactive, prettyPrint, showAlternative bool) (map[string]string, error)
- func (o *OXR) GetHistoricalRates(date, baseCurrency string, symbols []string, prettyPrint, showAlternative bool) (map[string]float64, error)
- func (o *OXR) GetLatest(baseCurrency, symbols string, prettyPrint, showAlternative bool) (map[string]float64, error)
- func (o *OXR) GetOHLC(startTime, period, baseCurrency string, symbols []string, prettyPrint bool) (map[string]interface{}, error)
- func (o *OXR) GetRates(baseCurrency, symbols string) (map[string]float64, error)
- func (o *OXR) GetSupportedCurrencies() ([]string, error)
- func (o *OXR) GetTimeSeries(baseCurrency, startDate, endDate string, symbols []string, ...) (map[string]interface{}, error)
- func (o *OXR) GetUsageStats(prettyPrint bool) (Usage, error)
- func (o *OXR) SendHTTPRequest(endpoint string, values url.Values, result interface{}) error
- func (o *OXR) Setup(config base.Settings) error
- type TimeSeries
- type Usage
Constants ¶
const ( APIDeveloperAccess = iota APIEnterpriseAccess APIUnlimitedAccess APIURL = "https://openexchangerates.org/api/" APIEndpointLatest = "latest.json" APIEndpointHistorical = "historical/%s.json" APIEndpointCurrencies = "currencies.json" APIEndpointTimeSeries = "time-series.json" APIEndpointConvert = "convert/%s/%s/%s" APIEndpointOHLC = "ohlc.json" APIEndpointUsage = "usage.json" )
These consts contain endpoint information
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Convert ¶
type Convert struct { Disclaimer string `json:"disclaimer"` License string `json:"license"` Request struct { Query string `json:"query"` Amount float64 `json:"amount"` From string `json:"from"` To string `json:"to"` } `json:"request"` Meta struct { Timestamp int64 `json:"timestamp"` Rate float64 `json:"rate"` } Response float64 `json:"response"` Error bool `json:"error"` Status int `json:"status"` Message string `json:"message"` Description string `json:"description"` }
Convert holds historic rate data
type Historical ¶
type Historical struct { Disclaimer string `json:"disclaimer"` License string `json:"license"` Timestamp int64 `json:"timestamp"` Base string `json:"base"` Rates map[string]float64 `json:"rates"` Error bool `json:"error"` Status int `json:"status"` Message string `json:"message"` Description string `json:"description"` }
Historical holds historic rate data
type Latest ¶
type Latest struct { Disclaimer string `json:"disclaimer"` License string `json:"license"` Timestamp int64 `json:"timestamp"` Base string `json:"base"` Rates map[string]float64 `json:"rates"` Error bool `json:"error"` Status int `json:"status"` Message string `json:"message"` Description string `json:"description"` }
Latest holds latest rate data
type OHLC ¶
type OHLC struct { Disclaimer string `json:"disclaimer"` License string `json:"license"` StartDate string `json:"start_date"` EndDate string `json:"end_date"` Base string `json:"base"` Rates map[string]interface{} `json:"rates"` Error bool `json:"error"` Status int `json:"status"` Message string `json:"message"` Description string `json:"description"` }
OHLC holds open high low close values
type OXR ¶
OXR is a foreign exchange rate provider at https://openexchangerates.org/ this is the overarching type across this package DOCs : https://docs.openexchangerates.org/docs
func (*OXR) ConvertCurrency ¶
ConvertCurrency converts any money value from one currency to another at the latest API rates
func (*OXR) GetCurrencies ¶
func (o *OXR) GetCurrencies(showInactive, prettyPrint, showAlternative bool) (map[string]string, error)
GetCurrencies returns a list of all currency symbols available from the Open Exchange Rates API,
func (*OXR) GetHistoricalRates ¶
func (o *OXR) GetHistoricalRates(date, baseCurrency string, symbols []string, prettyPrint, showAlternative bool) (map[string]float64, error)
GetHistoricalRates returns historical exchange rates for any date available from the Open Exchange Rates API.
func (*OXR) GetLatest ¶
func (o *OXR) GetLatest(baseCurrency, symbols string, prettyPrint, showAlternative bool) (map[string]float64, error)
GetLatest returns the latest exchange rates available from the Open Exchange Rates
func (*OXR) GetOHLC ¶
func (o *OXR) GetOHLC(startTime, period, baseCurrency string, symbols []string, prettyPrint bool) (map[string]interface{}, error)
GetOHLC returns historical Open, High Low, Close (OHLC) and Average exchange rates for a given time period, ranging from 1 month to 1 minute, where available.
func (*OXR) GetSupportedCurrencies ¶
GetSupportedCurrencies returns a list of supported currencies
func (*OXR) GetTimeSeries ¶
func (o *OXR) GetTimeSeries(baseCurrency, startDate, endDate string, symbols []string, prettyPrint, showAlternative bool) (map[string]interface{}, error)
GetTimeSeries returns historical exchange rates for a given time period, where available.
func (*OXR) GetUsageStats ¶
GetUsageStats returns basic plan information and usage statistics for an Open Exchange Rates App ID
func (*OXR) SendHTTPRequest ¶
SendHTTPRequest sends a HTTP request
type TimeSeries ¶
type TimeSeries struct { Disclaimer string `json:"disclaimer"` License string `json:"license"` StartDate string `json:"start_date"` EndDate string `json:"end_date"` Base string `json:"base"` Rates map[string]interface{} `json:"rates"` Error bool `json:"error"` Status int `json:"status"` Message string `json:"message"` Description string `json:"description"` }
TimeSeries holds historic rate data
type Usage ¶
type Usage struct { Status int `json:"status"` Data struct { AppID string `json:"app_id"` Status string `json:"status"` Plan struct { Name string `json:"name"` Quota string `json:"quota"` UpdateFrequency string `json:"update_frequency"` Features struct { Base bool `json:"base"` Symbols bool `json:"symbols"` Experimental bool `json:"experimental"` Timeseries bool `json:"time-series"` Convert bool `json:"convert"` } `json:"features"` } `json:"plaab"` } `json:"data"` Usages struct { Requests int64 `json:"requests"` RequestQuota int `json:"requests_quota"` RequestsRemaining int `json:"requests_remaining"` DaysElapsed int `json:"days_elapsed"` DaysRemaining int `json:"days_remaining"` DailyAverage int `json:"daily_average"` } Error bool `json:"error"` Message string `json:"message"` Description string `json:"description"` }
Usage holds usage statistical data