Documentation ¶
Index ¶
- func ExchangeRate(from, to string) (v float64, err error)
- type OriginalValues
- type RatesRequest
- type RatesResponse
- type RestClient
- func (c *RestClient) AskPrice(ctx context.Context, baseCurrency string, quoteCurrency string) (float64, error)
- func (c *RestClient) BidPrice(ctx context.Context, baseCurrency string, quoteCurrency string) (float64, error)
- func (c *RestClient) CalculateConversion(ctx context.Context, request RatesRequest) (response *RatesResponse, err error)
- func (c *RestClient) ExchangeRate(ctx context.Context, from, to string) (v float64, err error)
- func (c *RestClient) NewRequest(ctx context.Context, method string, refURL string, params url.Values) (*http.Request, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExchangeRate ¶ added in v0.3.0
Types ¶
type OriginalValues ¶
type OriginalValues struct { FromCurrency string `json:"fromCurrency"` FromCurrencyName string `json:"fromCurrencyName"` ToCurrency string `json:"toCurrency"` ToCurrencyName string `json:"toCurrencyName"` AsOfDate int `json:"asOfDate"` FromAmount string `json:"fromAmount"` ToAmountWithVisaRate string `json:"toAmountWithVisaRate"` ToAmountWithAdditionalFee string `json:"toAmountWithAdditionalFee"` FxRateVisa string `json:"fxRateVisa"` FxRateWithAdditionalFee string `json:"fxRateWithAdditionalFee"` LastUpdatedVisaRate int `json:"lastUpdatedVisaRate"` Benchmarks []interface{} `json:"benchmarks"` }
type RatesRequest ¶
type RatesRequest struct { Amount float64 `json:"amount"` Fee float64 `json:"fee,omitempty"` UTCConvertedDate time.Time `json:"utcConvertedDate,omitempty"` ExchangeDate time.Time `json:"exchangedate,omitempty"` FromCurr string `json:"fromCurr"` ToCurr string `json:"toCurr"` }
func (*RatesRequest) Values ¶
func (o *RatesRequest) Values() url.Values
type RatesResponse ¶
type RatesResponse struct { OriginalValues OriginalValues `json:"originalValues"` ConversionAmountValue string `json:"conversionAmountValue"` ConversionBankFee string `json:"conversionBankFee"` ConversionInputDate string `json:"conversionInputDate"` ConversionFromCurrency string `json:"conversionFromCurrency"` ConversionToCurrency string `json:"conversionToCurrency"` FromCurrencyName string `json:"fromCurrencyName"` ToCurrencyName string `json:"toCurrencyName"` ConvertedAmount string `json:"convertedAmount"` BenchMarkAmount string `json:"benchMarkAmount"` FxRateWithAdditionalFee string `json:"fxRateWithAdditionalFee"` ReverseAmount string `json:"reverseAmount"` DisclaimerDate string `json:"disclaimerDate"` Status string `json:"status"` }
{ "originalValues":{ "fromCurrency":"USD", "fromCurrencyName":"United States Dollar", "toCurrency":"TWD", "toCurrencyName":"New Taiwan Dollar", "asOfDate":1682899200, "fromAmount":"100000", "toAmountWithVisaRate":"3074900", "toAmountWithAdditionalFee":"3074900", "fxRateVisa":"30.749", "fxRateWithAdditionalFee":"30.749", "lastUpdatedVisaRate":1682725860, "benchmarks":[] }, "conversionAmountValue":"100000", "conversionBankFee":"0.0", "conversionInputDate":"05/01/2023", "conversionFromCurrency":"TWD", "conversionToCurrency":"USD", "fromCurrencyName":"United States Dollar", "toCurrencyName":"New Taiwan Dollar", "convertedAmount":"3,074,900.000000", "benchMarkAmount":"", "fxRateWithAdditionalFee":"30.749", "reverseAmount":"0.032521", "disclaimerDate":"May 1, 2023", "status":"success" }
type RestClient ¶
type RestClient struct {
// contains filtered or unexported fields
}
func NewRestClient ¶
func NewRestClient() *RestClient
func (*RestClient) CalculateConversion ¶ added in v0.2.3
func (c *RestClient) CalculateConversion(ctx context.Context, request RatesRequest) (response *RatesResponse, err error)
func (*RestClient) ExchangeRate ¶ added in v0.2.3
Click to show internal directories.
Click to hide internal directories.