Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
FetchRate(ctx context.Context, base string, currency string) (*RateResponse, error)
}
Client abstracts over the underlying client
type ClientWithPrometheus ¶
type ClientWithPrometheus struct {
// contains filtered or unexported fields
}
ClientWithPrometheus implements Client interface with all methods wrapped with Prometheus metrics
func NewClientWithPrometheus ¶
func NewClientWithPrometheus(base Client, instanceName string) ClientWithPrometheus
NewClientWithPrometheus returns an instance of the Client decorated with prometheus summary metric
func (ClientWithPrometheus) FetchRate ¶
func (_d ClientWithPrometheus) FetchRate(ctx context.Context, base string, currency string) (rp1 *RateResponse, err error)
FetchRate implements Client
type FetchOptions ¶
type FetchOptions struct {
Currency string `url:"currency,omitempty"`
}
FetchOptions options for fetching rates from ratios
func (*FetchOptions) GenerateQueryString ¶
func (fo *FetchOptions) GenerateQueryString() (url.Values, error)
GenerateQueryString - implement the QueryStringBody interface
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient wraps http.Client for interacting with the ratios server
func (*HTTPClient) FetchRate ¶
func (c *HTTPClient) FetchRate(ctx context.Context, base string, currency string) (*RateResponse, error)
FetchRate fetches the rate of a currency to BAT
type RateResponse ¶
type RateResponse struct { LastUpdated time.Time `json:"lastUpdated"` Payload map[string]decimal.Decimal `json:"payload"` }
RateResponse is the response received from ratios
type RelativeResponse ¶
type RelativeResponse struct { Payload coingecko.SimplePriceResponse `json:"payload"` LastUpdated time.Time `json:"lastUpdated"` }
RelativeResponse - the relative response structure
Click to show internal directories.
Click to hide internal directories.