exchangerates

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Initialize a exchange rates data source container singleton instance

Functions

func InitializeExchangeRatesDataSource

func InitializeExchangeRatesDataSource(config *settings.Config) error

InitializeExchangeRatesDataSource initializes the current exchange rates data source according to the config

Types

type BankOfCanadaDataSource

type BankOfCanadaDataSource struct {
	ExchangeRatesDataSource
}

BankOfCanadaDataSource defines the structure of exchange rates data source of bank of Canada

func (*BankOfCanadaDataSource) GetRequestUrls

func (e *BankOfCanadaDataSource) GetRequestUrls() []string

GetRequestUrls returns the bank of Canada data source urls

func (*BankOfCanadaDataSource) Parse

Parse returns the common response entity according to the bank of Canada data source raw response

type BankOfCanadaExchangeRateData

type BankOfCanadaExchangeRateData struct {
	Observations []BankOfCanadaObservationData `json:"observations"`
}

BankOfCanadaExchangeRateData represents the whole data from bank of Canada

func (*BankOfCanadaExchangeRateData) ToLatestExchangeRateResponse

func (e *BankOfCanadaExchangeRateData) ToLatestExchangeRateResponse(c *core.Context) *models.LatestExchangeRateResponse

ToLatestExchangeRateResponse returns a view-object according to original data from bank of Canada

type BankOfCanadaObservationData

type BankOfCanadaObservationData map[string]any

BankOfCanadaObservationData represents the observation data from bank of Canada

type CzechNationalBankDataSource

type CzechNationalBankDataSource struct {
	ExchangeRatesDataSource
}

CzechNationalBankDataSource defines the structure of exchange rates data source of Czech National Bank

func (*CzechNationalBankDataSource) GetRequestUrls

func (e *CzechNationalBankDataSource) GetRequestUrls() []string

GetRequestUrls returns the czech nation bank data source urls

func (*CzechNationalBankDataSource) Parse

Parse returns the common response entity according to the czech nation bank data source raw response

type EuroCentralBankDataSource

type EuroCentralBankDataSource struct {
	ExchangeRatesDataSource
}

EuroCentralBankDataSource defines the structure of exchange rates data source of euro central bank

func (*EuroCentralBankDataSource) GetRequestUrls

func (e *EuroCentralBankDataSource) GetRequestUrls() []string

GetRequestUrls returns the euro central bank data source urls

func (*EuroCentralBankDataSource) Parse

Parse returns the common response entity according to the euro central bank data source raw response

type EuroCentralBankExchangeRate

type EuroCentralBankExchangeRate struct {
	Currency string `xml:"currency,attr"`
	Rate     string `xml:"rate,attr"`
}

EuroCentralBankExchangeRate represents the exchange rate data from euro central bank

func (*EuroCentralBankExchangeRate) ToLatestExchangeRate

func (e *EuroCentralBankExchangeRate) ToLatestExchangeRate() *models.LatestExchangeRate

ToLatestExchangeRate returns a data pair according to original data from euro central bank

type EuroCentralBankExchangeRateData

type EuroCentralBankExchangeRateData struct {
	XMLName          xml.Name                        `xml:"Envelope"`
	AllExchangeRates []*EuroCentralBankExchangeRates `xml:"Cube>Cube"`
}

EuroCentralBankExchangeRateData represents the whole data from euro central bank

func (*EuroCentralBankExchangeRateData) ToLatestExchangeRateResponse

func (e *EuroCentralBankExchangeRateData) ToLatestExchangeRateResponse(c *core.Context) *models.LatestExchangeRateResponse

ToLatestExchangeRateResponse returns a view-object according to original data from euro central bank

type EuroCentralBankExchangeRates

type EuroCentralBankExchangeRates struct {
	Date          string                         `xml:"time,attr"`
	ExchangeRates []*EuroCentralBankExchangeRate `xml:"Cube"`
}

EuroCentralBankExchangeRates represents the exchange rates data from euro central bank

type ExchangeRatesDataSource

type ExchangeRatesDataSource interface {
	// GetRequestUrl returns the data source urls
	GetRequestUrls() []string

	// Parse returns the common response entity according to the data source raw response
	Parse(c *core.Context, content []byte) (*models.LatestExchangeRateResponse, error)
}

ExchangeRatesDataSource defines the structure of exchange rates data source

type ExchangeRatesDataSourceContainer

type ExchangeRatesDataSourceContainer struct {
	Current ExchangeRatesDataSource
}

ExchangeRatesDataSourceContainer contains the current exchange rates data source

type MonetaryAuthorityOfSingaporeDataSource

type MonetaryAuthorityOfSingaporeDataSource struct {
	ExchangeRatesDataSource
}

MonetaryAuthorityOfSingaporeDataSource defines the structure of exchange rates data source of Monetary Authority of Singapore

func (*MonetaryAuthorityOfSingaporeDataSource) GetRequestUrls

func (e *MonetaryAuthorityOfSingaporeDataSource) GetRequestUrls() []string

GetRequestUrls returns the Monetary Authority of Singapore data source urls

func (*MonetaryAuthorityOfSingaporeDataSource) Parse

Parse returns the common response entity according to the Monetary Authority of Singapore data source raw response

type MonetaryAuthorityOfSingaporeExchangeRateData

type MonetaryAuthorityOfSingaporeExchangeRateData struct {
	Success bool                                `json:"success"`
	Result  *MonetaryAuthorityOfSingaporeResult `json:"result"`
}

MonetaryAuthorityOfSingaporeExchangeRateData represents the whole data from Monetary Authority of Singapore

func (*MonetaryAuthorityOfSingaporeExchangeRateData) ToLatestExchangeRateResponse

ToLatestExchangeRateResponse returns a view-object according to original data from Monetary Authority of Singapore

type MonetaryAuthorityOfSingaporeRecord

type MonetaryAuthorityOfSingaporeRecord map[string]string

MonetaryAuthorityOfSingaporeRecord represents the record from Monetary Authority of Singapore

type MonetaryAuthorityOfSingaporeResult

type MonetaryAuthorityOfSingaporeResult struct {
	Records []MonetaryAuthorityOfSingaporeRecord `json:"records"`
}

MonetaryAuthorityOfSingaporeResult represents the actual result from Monetary Authority of Singapore

type NationalBankOfPolandDataSource

type NationalBankOfPolandDataSource struct {
	ExchangeRatesDataSource
}

NationalBankOfPolandDataSource defines the structure of exchange rates data source of National Bank of Poland

func (*NationalBankOfPolandDataSource) GetRequestUrls

func (e *NationalBankOfPolandDataSource) GetRequestUrls() []string

GetRequestUrls returns the National Bank of Poland data source urls

func (*NationalBankOfPolandDataSource) Parse

Parse returns the common response entity according to the National Bank of Poland data source raw response

type NationalBankOfPolandExchangeRate

type NationalBankOfPolandExchangeRate struct {
	Currency string `xml:"Code"`
	Rate     string `xml:"Mid"`
}

NationalBankOfPolandExchangeRate represents the exchange rate data from National Bank of Poland

func (*NationalBankOfPolandExchangeRate) ToLatestExchangeRate

ToLatestExchangeRate returns a data pair according to original data from National Bank of Poland

type NationalBankOfPolandExchangeRateData

type NationalBankOfPolandExchangeRateData struct {
	XMLName          xml.Name                            `xml:"ArrayOfExchangeRatesTable"`
	Date             string                              `xml:"ExchangeRatesTable>EffectiveDate"`
	AllExchangeRates []*NationalBankOfPolandExchangeRate `xml:"ExchangeRatesTable>Rates>Rate"`
}

NationalBankOfPolandExchangeRateData represents the whole data from National Bank of Poland

func (*NationalBankOfPolandExchangeRateData) ToLatestExchangeRateResponse

ToLatestExchangeRateResponse returns a view-object according to original data from National Bank of Poland

type ReserveBankOfAustraliaData

type ReserveBankOfAustraliaData struct {
	XMLName xml.Name                          `xml:"RDF"`
	Channel *ReserveBankOfAustraliaRssChannel `xml:"channel"`
	Items   []*ReserveBankOfAustraliaRssItem  `xml:"item"`
}

ReserveBankOfAustraliaData represents the whole data from the reserve bank of Australia

func (*ReserveBankOfAustraliaData) ToLatestExchangeRateResponse

func (e *ReserveBankOfAustraliaData) ToLatestExchangeRateResponse(c *core.Context) *models.LatestExchangeRateResponse

ToLatestExchangeRateResponse returns a view-object according to original data from the reserve bank of Australia

type ReserveBankOfAustraliaDataSource

type ReserveBankOfAustraliaDataSource struct {
	ExchangeRatesDataSource
}

ReserveBankOfAustraliaDataSource defines the structure of exchange rates data source of the reserve bank of Australia

func (*ReserveBankOfAustraliaDataSource) GetRequestUrls

func (e *ReserveBankOfAustraliaDataSource) GetRequestUrls() []string

GetRequestUrls returns the the reserve bank of Australia data source urls

func (*ReserveBankOfAustraliaDataSource) Parse

Parse returns the common response entity according to the the reserve bank of Australia data source raw response

type ReserveBankOfAustraliaExchangeRate

type ReserveBankOfAustraliaExchangeRate struct {
	BaseCurrency   string                                         `xml:"baseCurrency"`
	TargetCurrency string                                         `xml:"targetCurrency"`
	Observation    *ReserveBankOfAustraliaExchangeRateObservation `xml:"observation"`
}

ReserveBankOfAustraliaExchangeRate represents the exchange rate from the reserve bank of Australia

func (*ReserveBankOfAustraliaExchangeRate) ToLatestExchangeRate

ToLatestExchangeRate returns a data pair according to original data from the reserve bank of Australia

type ReserveBankOfAustraliaExchangeRateObservation

type ReserveBankOfAustraliaExchangeRateObservation struct {
	Value string `xml:"value"`
	Unit  string `xml:"unit"`
}

ReserveBankOfAustraliaExchangeRateObservation represents the exchange rate data from the reserve bank of Australia

type ReserveBankOfAustraliaItemStatistics

type ReserveBankOfAustraliaItemStatistics struct {
	ExchangeRate *ReserveBankOfAustraliaExchangeRate `xml:"exchangeRate"`
}

ReserveBankOfAustraliaItemStatistics represents the item statistics from the reserve bank of Australia

type ReserveBankOfAustraliaRssChannel

type ReserveBankOfAustraliaRssChannel struct {
	Date string `xml:"date"`
}

ReserveBankOfAustraliaRssChannel represents the rss channel from the reserve bank of Australia

type ReserveBankOfAustraliaRssItem

type ReserveBankOfAustraliaRssItem struct {
	Statistics *ReserveBankOfAustraliaItemStatistics `xml:"statistics"`
}

ReserveBankOfAustraliaRssItem represents the rss item from the reserve bank of Australia

Jump to

Keyboard shortcuts

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