Documentation
¶
Overview ¶
Copyright (c) of parts are held by the various contributors (see the CLA) Licensed under the MIT License. See LICENSE file in the project root for full license information.
Index ¶
- func AlwaysOnePolling() *polling.DataSources
- func GetClientWithFixedResp(resp []byte) *http.Client
- func NewHTTPServerWithFixedResp(port int, resp []byte) *http.Server
- func NewTestClient(fn RoundTripFunc) *http.Client
- func PriceCheck(asset string, rate float64) error
- type RoundTripFunc
- type UnitTestDataSource
- func (d *UnitTestDataSource) FetchPegPrice(peg string) (i polling.PegItem, err error)
- func (d *UnitTestDataSource) FetchPegPrices() (peg polling.PegAssets, err error)
- func (d *UnitTestDataSource) Name() string
- func (d *UnitTestDataSource) SupportedPegs() []string
- func (d *UnitTestDataSource) Url() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlwaysOnePolling ¶ added in v0.2.0
func AlwaysOnePolling() *polling.DataSources
AlwaysOnePolling returns 1 for all prices
func GetClientWithFixedResp ¶
GetClientWithFixedResp will return a client that no matter what the request is, will always respond with the 'resp' as the body. From http://hassansin.github.io/Unit-Testing-http-client-in-Go
func NewHTTPServerWithFixedResp ¶
NewHTTPServerWithFixedResp will only return the fixed reponse, always
func NewTestClient ¶
func NewTestClient(fn RoundTripFunc) *http.Client
NewTestClient returns *http.Client with Transport replaced to avoid making real calls
func PriceCheck ¶ added in v0.2.0
PriceCheck checks if the price is "reasonable" to see if we inverted the prices
Types ¶
type RoundTripFunc ¶
RoundTripFunc .
type UnitTestDataSource ¶ added in v0.2.0
type UnitTestDataSource struct {
Value float64
Assets []string
SourceName string
// How to timestamp price quotes
Timestamp func() time.Time
}
UnitTestDataSource just reports the Value for the supported Assets
func NewUnitTestDataSource ¶ added in v0.2.0
func NewUnitTestDataSource(config *config.Config) (*UnitTestDataSource, error)
func (*UnitTestDataSource) FetchPegPrice ¶ added in v0.2.0
func (d *UnitTestDataSource) FetchPegPrice(peg string) (i polling.PegItem, err error)
func (*UnitTestDataSource) FetchPegPrices ¶ added in v0.2.0
func (d *UnitTestDataSource) FetchPegPrices() (peg polling.PegAssets, err error)
func (*UnitTestDataSource) Name ¶ added in v0.2.0
func (d *UnitTestDataSource) Name() string
func (*UnitTestDataSource) SupportedPegs ¶ added in v0.2.0
func (d *UnitTestDataSource) SupportedPegs() []string
func (*UnitTestDataSource) Url ¶ added in v0.2.0
func (d *UnitTestDataSource) Url() string