Documentation ¶
Index ¶
- Constants
- type BalancerV2
- type BalancerV2Config
- type ContractAddresses
- type Curve
- type CurveConfig
- type ERC20
- type ERC20Details
- type HTTPCallback
- type IShares
- type ISharesConfig
- type Origin
- type RocketPool
- type RocketPoolConfig
- type Static
- type Sushiswap
- type SushiswapConfig
- type TickGenericHTTP
- type TickGenericHTTPConfig
- type TickGenericJQ
- type TickGenericJQConfig
- type UniswapV3
- type UniswapV3Config
- type WrappedStakedETH
- type WrappedStakedETHConfig
Constants ¶
const BalancerV2LoggerTag = "BALANCERV2_ORIGIN"
const CurveLoggerTag = "CURVE_ORIGIN"
const RocketPoolLoggerTag = "ROCKETPOOL_ORIGIN"
const SushiswapLoggerTag = "SUSHISWAP_ORIGIN"
const TickGenericHTTPLoggerTag = "TICK_GENERIC_HTTP_ORIGIN"
const TickGenericJQLoggerTag = "TICK_GENERIC_JQ_ORIGIN"
const UniswapV3LoggerTag = "UNISWAPV3_ORIGIN"
const WrappedStakedETHLoggerTag = "WSTETH_ORIGIN"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BalancerV2 ¶
type BalancerV2 struct {
// contains filtered or unexported fields
}
func NewBalancerV2 ¶
func NewBalancerV2(config BalancerV2Config) (*BalancerV2, error)
func (*BalancerV2) FetchDataPoints ¶
type BalancerV2Config ¶
type ContractAddresses ¶
type Curve ¶
type Curve struct {
// contains filtered or unexported fields
}
func NewCurve ¶
func NewCurve(config CurveConfig) (*Curve, error)
type CurveConfig ¶
type ERC20 ¶
type ERC20 struct {
// contains filtered or unexported fields
}
func (*ERC20) GetSymbolAndDecimals ¶
type ERC20Details ¶
type ERC20Details struct {
// contains filtered or unexported fields
}
type HTTPCallback ¶
type IShares ¶
type IShares struct {
// contains filtered or unexported fields
}
func NewIShares ¶
func NewIShares(config ISharesConfig) (*IShares, error)
type ISharesConfig ¶
type ISharesConfig struct {}
type Origin ¶
type Origin interface { // FetchDataPoints fetches data points for the given list of queries. // // A query is an any type that can be used to query the origin for a data // point. For example, a query could be a pair of assets. // // Note that this method does not guarantee that data points will be // returned for all pairs nor in the same order as the pairs. The caller // must verify returned data. FetchDataPoints(ctx context.Context, query []any) (map[any]datapoint.Point, error) }
Origin provides dataPoint prices for a given set of pairs from an external source.
type RocketPool ¶
type RocketPool struct {
// contains filtered or unexported fields
}
func NewRocketPool ¶
func NewRocketPool(config RocketPoolConfig) (*RocketPool, error)
func (*RocketPool) FetchDataPoints ¶
type RocketPoolConfig ¶
type Sushiswap ¶
type Sushiswap struct {
// contains filtered or unexported fields
}
func NewSushiswap ¶
func NewSushiswap(config SushiswapConfig) (*Sushiswap, error)
type SushiswapConfig ¶
type TickGenericHTTP ¶
type TickGenericHTTP struct {
// contains filtered or unexported fields
}
TickGenericHTTP is a generic http price provider that can fetch prices from an HTTP endpoint. The callback function is used to parse the response body.
func NewTickGenericHTTP ¶
func NewTickGenericHTTP(config TickGenericHTTPConfig) (*TickGenericHTTP, error)
NewTickGenericHTTP creates a new TickGenericHTTP instance.
func (*TickGenericHTTP) FetchDataPoints ¶
func (g *TickGenericHTTP) FetchDataPoints(ctx context.Context, query []any) (map[any]datapoint.Point, error)
FetchDataPoints implements the Origin interface.
type TickGenericHTTPConfig ¶
type TickGenericHTTPConfig struct { // URL is an TickGenericHTTP endpoint that returns JSON data. It may contain // the following variables: // - ${lcbase} - lower case base asset // - ${ucbase} - upper case base asset // - ${lcquote} - lower case quote asset // - ${ucquote} - upper case quote asset // - ${lcbases} - lower case base assets joined by commas // - ${ucbases} - upper case base assets joined by commas // - ${lcquotes} - lower case quote assets joined by commas // - ${ucquotes} - upper case quote assets joined by commas URL string // Headers is a set of TickGenericHTTP headers that are sent with each request. Headers http.Header // Callback is a function that is used to parse the response body. Callback HTTPCallback // Client is an TickGenericHTTP client that is used to fetch data from the // TickGenericHTTP endpoint. If nil, http.DefaultClient is used. Client *http.Client // Logger is an TickGenericHTTP logger that is used to log errors. If nil, // null logger is used. Logger log.Logger }
type TickGenericJQ ¶
type TickGenericJQ struct {
// contains filtered or unexported fields
}
TickGenericJQ is a generic origin implementation that uses JQ to parse JSON data from an TickGenericHTTP endpoint.
func NewTickGenericJQ ¶
func NewTickGenericJQ(config TickGenericJQConfig) (*TickGenericJQ, error)
NewTickGenericJQ creates a new TickGenericJQ instance.
The client argument is an TickGenericHTTP client that is used to fetch data from the TickGenericHTTP endpoint.
The url argument is an TickGenericHTTP endpoint that returns JSON data. It may contain the following variables:
- ${lcbase} - lower case base asset
- ${ucbase} - upper case base asset
- ${lcquote} - lower case quote asset
- ${ucquote} - upper case quote asset
- ${lcbases} - lower case base assets joined by commas
- ${ucbases} - upper case base assets joined by commas
- ${lcquotes} - lower case quote assets joined by commas
- ${ucquotes} - upper case quote assets joined by commas
The jq argument is a JQ query that is used to parse JSON data. It must return a single value that will be used as a price or an object with the following fields:
- price - a price
- time - a timestamp (optional)
- volume - a 24h volume (optional)
The JQ query may contain the following variables:
- $lcbase - lower case base asset
- $ucbase - upper case base asset
- $lcquote - lower case quote asset
- $ucquote - upper case quote asset
Price and volume must be a string that can be parsed as a number or a number.
Time must be a string that can be parsed as time or a number that represents a UNIX timestamp.
If JQ query returns multiple values, the dataPoint will be invalid.
func (*TickGenericJQ) FetchDataPoints ¶
func (g *TickGenericJQ) FetchDataPoints(ctx context.Context, query []any) (map[any]datapoint.Point, error)
FetchDataPoints implements the Origin interface.
type TickGenericJQConfig ¶
type TickGenericJQConfig struct { // URL is an TickGenericHTTP endpoint that returns JSON data. It may contain // the following variables: // - ${lcbase} - lower case base asset // - ${ucbase} - upper case base asset // - ${lcquote} - lower case quote asset // - ${ucquote} - upper case quote asset // - ${lcbases} - lower case base assets joined by commas // - ${ucbases} - upper case base assets joined by commas // - ${lcquotes} - lower case quote assets joined by commas // - ${ucquotes} - upper case quote assets joined by commas URL string // Query is a JQ query that is used to parse JSON data. It must // return a single value that will be used as a price or an object with the // following fields: // - price - a price // - time - a timestamp (optional) // - volume - a 24h volume (optional) // // The JQ query may contain the following variables: // - $lcbase - lower case base asset // - $ucbase - upper case base asset // - $lcquote - lower case quote asset // - $ucquote - upper case quote asset // // Price and volume must be a number or a string that can be parsed as a number. // Time must be a number or a string that can be parsed as a number or a string // that can be parsed as a time. Query string // Headers is a set of TickGenericHTTP headers that are sent with each request. Headers http.Header // Client is an TickGenericHTTP client that is used to fetch data from the // TickGenericHTTP endpoint. If nil, http.DefaultClient is used. Client *http.Client // Logger is an TickGenericHTTP logger that is used to log errors. If nil, // null logger is used. Logger log.Logger }
type UniswapV3 ¶
type UniswapV3 struct {
// contains filtered or unexported fields
}
func NewUniswapV3 ¶
func NewUniswapV3(config UniswapV3Config) (*UniswapV3, error)
type UniswapV3Config ¶
type WrappedStakedETH ¶
type WrappedStakedETH struct {
// contains filtered or unexported fields
}
func NewWrappedStakedETH ¶
func NewWrappedStakedETH(config WrappedStakedETHConfig) (*WrappedStakedETH, error)