Documentation
¶
Index ¶
- Constants
- Variables
- func CombineSignatureToString(signature Signature) (result string)
- func ConvertDataToAssetPair(data Data, assetId string, refTimestamp uint64) (result oracletypes.AssetPair)
- func ConvertSignedPrice(signeds SignedPrice) oracletypes.SignedPriceOfAssetPair
- func ConvertTimestampToSecond(timestamp uint64) uint64
- func NewStorkFetcher(storkMessage string, storkTickers []string) *storkFetcher
- type Data
- type FeedConfig
- type FeedProvider
- type PriceData
- type PriceFeedConfig
- type PricePuller
- type Service
- type Signature
- type SignedPrice
- type StorkConfig
- type StorkFetcher
- type Ticker
- type TimestampedSignature
Constants ¶
View Source
const (
MaxRetriesReConnectWebSocket = 5
)
View Source
const (
MaxStorkTimestampIntervalNano = 500_000_000 // 5000ms
)
Variables ¶
View Source
var ErrInvalidMessage = errors.New("received invalid message")
Functions ¶
func CombineSignatureToString ¶
CombineSignatureToString combines a signature to a string
func ConvertDataToAssetPair ¶
func ConvertDataToAssetPair(data Data, assetId string, refTimestamp uint64) (result oracletypes.AssetPair)
ConvertDataToAssetPair converts data get from websocket to list of asset pairs
func ConvertSignedPrice ¶
func ConvertSignedPrice(signeds SignedPrice) oracletypes.SignedPriceOfAssetPair
ConvertSignedPrice converts signed price to SignedPriceOfAssetPair of Stork
func NewStorkFetcher ¶
NewStorkFetcher returns a new StorkFetcher instance.
Types ¶
type FeedConfig ¶
type FeedConfig struct {
ProviderName string `toml:"provider"`
Ticker string `toml:"ticker"`
PullInterval string `toml:"pullInterval"`
ObservationSource string `toml:"observationSource"`
OracleType string `toml:"oracleType"`
}
func ParseDynamicFeedConfig ¶
func ParseDynamicFeedConfig(body []byte) (*FeedConfig, error)
func ParseStorkFeedConfig ¶
func ParseStorkFeedConfig(body []byte) (*FeedConfig, error)
func (*FeedConfig) Hash ¶
func (c *FeedConfig) Hash() string
type FeedProvider ¶
type FeedProvider string
const ( FeedProviderDynamic FeedProvider = "_" FeedProviderBinance FeedProvider = "binance" FeedProviderStork FeedProvider = "stork" )
func (FeedProvider) String ¶
func (f FeedProvider) String() string
type PriceData ¶
type PriceData struct {
// Ticker is BASE/QUOTE pair name
Ticker Ticker
// ProviderName is the name of the feed
ProviderName string
// Symbol is provider-specific
Symbol string
// Price is the reported price by feed integarion
Price decimal.Decimal
// Asset pair - for Stork Oracle
AssetPair *oracletypes.AssetPair
// Timestamp of the report
Timestamp time.Time
OracleType oracletypes.OracleType
}
PriceData stores additional meta info for a price report.
type PriceFeedConfig ¶
type PriceFeedConfig struct {
Symbol string
FeedProvider FeedProvider
PullInterval time.Duration
DynamicConfig *FeedConfig
}
type PricePuller ¶
type PricePuller interface {
Provider() FeedProvider
ProviderName() string
Symbol() string
Interval() time.Duration
// PullPrice method must be implemented in order to get a price
// from external source, handled by PricePuller.
PullPrice(ctx context.Context) (priceData *PriceData, err error)
OracleType() oracletypes.OracleType
}
func NewDynamicPriceFeed ¶
func NewDynamicPriceFeed(cfg *FeedConfig) (PricePuller, error)
NewDynamicPriceFeed returns price puller that is implemented by Chainlink's job spec runner that accepts dotDag graphs as a definition of the observation source.
func NewStorkPriceFeed ¶
func NewStorkPriceFeed(storkFetcher StorkFetcher, cfg *FeedConfig) (PricePuller, error)
NewStorkPriceFeed returns price puller
type Service ¶
func NewService ¶
func NewService( _ context.Context, cosmosClients []chainclient.ChainClient, feedConfigs map[string]*FeedConfig, storkFetcher StorkFetcher, ) (Service, error)
type SignedPrice ¶
type StorkConfig ¶
type StorkFetcher ¶
type TimestampedSignature ¶
Click to show internal directories.
Click to hide internal directories.