Documentation
¶
Index ¶
- Variables
- func NewGraphqlResponseGetter(authClient authentication.AuthClient) (*graphqlResponseGetter, error)
- func NewHttpResponseGetter() (*httpResponseGetter, error)
- func NewPriceAggregator(args ArgsPriceAggregator) (*priceAggregator, error)
- func NewPriceNotifier(args ArgsPriceNotifier) (*priceNotifier, error)
- type ArgsPair
- type ArgsPriceAggregator
- type ArgsPriceChanged
- type ArgsPriceNotifier
- type GraphqlGetter
- type PriceAggregator
- type PriceFetcher
- type PriceNotifee
- type ResponseGetter
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotEnoughResponses signals that not enough responses were fetched ErrNotEnoughResponses = errors.New("not enough responses to compute a valid price") // ErrInvalidMinNumberOfResults signals that an invalid minimum number of results value was provided ErrInvalidMinNumberOfResults = errors.New("invalid minimum number of results") // ErrInvalidNumberOfPriceFetchers signals that an invalid number of price fetchers were provided ErrInvalidNumberOfPriceFetchers = errors.New("invalid number of price fetchers") // ErrNilPriceFetcher signals that a nil price fetcher was provided ErrNilPriceFetcher = errors.New("nil price fetcher") // ErrNilPriceAggregator signals that a nil price aggregator was provided ErrNilPriceAggregator = errors.New("nil price aggregator") // ErrEmptyArgsPairsSlice signals that an empty arguments pair slice was provided ErrEmptyArgsPairsSlice = errors.New("empty pair arguments slice") // ErrNilArgsPair signals that a nil argument pair was found ErrNilArgsPair = errors.New("nil pair argument") // ErrNilPriceNotifee signals that a nil price notifee was provided ErrNilPriceNotifee = errors.New("nil price notifee") // ErrInvalidNumOfElementsToComputeMedian signals that an invalid number of elements to compute the median was provided ErrInvalidNumOfElementsToComputeMedian = errors.New("invalid number of elements to compute the median") // ErrInvalidDecimals signals that an invalid number of decimals was provided ErrInvalidDecimals = errors.New("invalid decimals") // ErrNilBaseName signals that an invalid base name was provided ErrNilBaseName = errors.New("nil base name") // ErrNilQuoteName signals that an invalid quote name was provided ErrNilQuoteName = errors.New("nil quote name") //ErrNilExchanges signals that an nil exchanges map was provided ErrNilExchanges = errors.New("nil exchanges map") // ErrInvalidAutoSendInterval signals that an invalid auto send interval value was provided ErrInvalidAutoSendInterval = errors.New("invalid auto send interval") // ErrPairNotSupported signals that the pair is not supported by the fetcher ErrPairNotSupported = errors.New("pair not supported") // ErrNilAuthClient signals that a nil auth client was provided ErrNilAuthClient = errors.New("nil auth client") )
Functions ¶
func NewGraphqlResponseGetter ¶
func NewGraphqlResponseGetter(authClient authentication.AuthClient) (*graphqlResponseGetter, error)
NewGraphqlResponseGetter returns a new graphql response getter instance
func NewHttpResponseGetter ¶
func NewHttpResponseGetter() (*httpResponseGetter, error)
NewHttpResponseGetter returns a new http response getter instance
func NewPriceAggregator ¶
func NewPriceAggregator(args ArgsPriceAggregator) (*priceAggregator, error)
NewPriceAggregator creates a new priceAggregator instance
func NewPriceNotifier ¶
func NewPriceNotifier(args ArgsPriceNotifier) (*priceNotifier, error)
NewPriceNotifier will create a new priceNotifier instance
Types ¶
type ArgsPair ¶
type ArgsPair struct {
Base string
Quote string
PercentDifferenceToNotify uint32
Decimals uint64
Exchanges map[string]struct{}
}
ArgsPair is the argument DTO for a pair
type ArgsPriceAggregator ¶
type ArgsPriceAggregator struct {
PriceFetchers []PriceFetcher
MinResultsNum int
}
ArgsPriceAggregator is the DTO used in the NewPriceAggregator function
type ArgsPriceChanged ¶
type ArgsPriceChanged struct {
Base string
Quote string
DenominatedPrice uint64
Decimals uint64
Timestamp int64
}
ArgsPriceChanged is the argument used when notifying the notifee instance
type ArgsPriceNotifier ¶
type ArgsPriceNotifier struct {
Pairs []*ArgsPair
Aggregator PriceAggregator
Notifee PriceNotifee
AutoSendInterval time.Duration
}
ArgsPriceNotifier is the argument DTO for the price notifier
type GraphqlGetter ¶
type GraphqlGetter interface {
Query(ctx context.Context, url string, query string, variables string) ([]byte, error)
}
GraphqlGetter is the graphql component able to execute a get operation on the provided URL
type PriceAggregator ¶
type PriceAggregator interface {
// contains filtered or unexported methods
}
PriceAggregator defines the behavior of a component able to query the median price of a provided pair from all the fetchers that has the pair
type PriceFetcher ¶
type PriceFetcher interface {
AddPair(base, quote string)
// contains filtered or unexported methods
}
PriceFetcher defines the behavior of a component able to query the price for the provided pairs
type PriceNotifee ¶
type PriceNotifee interface {
PriceChanged(ctx context.Context, priceChanges []*ArgsPriceChanged) error
IsInterfaceNil() bool
}
PriceNotifee defines the behavior of a component able to be notified over a price change