Documentation ¶
Index ¶
- type Client
- func (c *Client) GetCachedLatestPriceUpdates(ctx context.Context, priceFeeds ...string) (map[string]*types.LatestPriceData, error)
- func (c *Client) GetLatestPriceUpdatesAsync(ctx context.Context, priceFeeds ...string) (map[string]*types.LatestPriceData, error)
- func (c *Client) GetLatestPriceUpdatesSync(_ context.Context, priceFeeds ...string) (map[string]*types.LatestPriceData, error)
- func (c *Client) Shutdown()
- func (c *Client) SubscribePriceStreaming(ctx context.Context, priceFeeds ...string)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for the Pyth Hermes API (https://hermes.pyth.network/docs)
func (*Client) GetCachedLatestPriceUpdates ¶
func (c *Client) GetCachedLatestPriceUpdates( ctx context.Context, priceFeeds ...string, ) (map[string]*types.LatestPriceData, error)
Queries cached price feed update data, obtained from sse streaming endpoints. Returns the Pyth PriceFeed struct and the price feed update data for each pair.
func (*Client) GetLatestPriceUpdatesAsync ¶
func (c *Client) GetLatestPriceUpdatesAsync( ctx context.Context, priceFeeds ...string, ) (map[string]*types.LatestPriceData, error)
Queries the `v2/updates/price/latest` endpoint for each price feed individually, in parallel. Takes the price feed keys (uses corresponding Pyth feed ID). Returns the Pyth PriceFeed struct and the price feed update data for each pair.
func (*Client) GetLatestPriceUpdatesSync ¶
func (c *Client) GetLatestPriceUpdatesSync( _ context.Context, priceFeeds ...string, ) (map[string]*types.LatestPriceData, error)
Queries the `v2/updates/price/latest` endpoint for all price feed ID together. Takes the price feed keys (uses corresponding Pyth feed ID). Returns the Pyth PriceFeed struct and the price feed update data for each pair.
func (*Client) Shutdown ¶
func (c *Client) Shutdown()
Shutdown gracefully shuts down the Pyth Hermes client.
func (*Client) SubscribePriceStreaming ¶
Subscribe price feed from the streaming `v2/updates/price/stream` endpoint. Ensures this only happens once in the scope of runtime. Any further calls to this are unnecessary and no-ops.