query

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllLatestPrices

func GetAllLatestPrices(
	ctx context.Context, pythClient client.Hermes, qs *Settings,
	pairIndexes map[string]uint64, oracleFeeds map[string][]string, uniqueFeeds []string,
) (lib.PriceUpdates, error)

Requires a Pyth client to fetch prices from Pyth Hermes API. Assumes that all required feeds to be queried for `oracleFeeds` are in the `uniqueFeeds` slice.

func GetAllPricesAt

func GetAllPricesAt(
	ctx context.Context, timestamp time.Time, pythClient client.Benchmarks, qs *Settings,
	pairIndexes map[string]uint64, oracleFeeds map[string][]string, uniqueFeeds []string,
) (lib.PriceUpdates, error)

Requires a Pyth client to fetch prices from Pyth Benchmarks API. Assumes that all required feeds to be queried for `oracleFeeds` are in the `uniqueFeeds` slice.

Types

type Settings

type Settings struct {
	UseEma           bool
	DesiredPrecision int
	RequestType      Type
	SingleUpdateFee  uint
}

Settings is a struct that holds the settings for querying Hermes using the Pythnet client.

type Type

type Type string

Type is an enum that represents the type of query to be made to the Pythnet Hermes API.

const (
	// LatestSync is a query type that fetches all latest prices together & synchronously.
	LatestSync Type = "latest-sync"
	// LatestAsync is a query type that fetches all latest prices individually, in parallel.
	LatestAsync Type = "latest-async"
	// Stream is a query type that subscribes to price updates and returns the latest cached price.
	StreamCached Type = "stream"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL