@@ -10,29 +10,50 @@ import (
1010 "github.com/calbera/go-pyth-client/types"
1111)
1212
13- // Benchmarks is the interface that wraps the methods of the benchmarks.Client .
13+ // Benchmarks is the interface of the Benchmarks client .
1414type Benchmarks interface {
15+ // Queries the `v1/updates/price/{timestamp}` endpoint for all price feed IDs together. Takes
16+ // the price feed keys (uses corresponding Pyth feed ID). Returns the Pyth PriceFeed struct
17+ // and the price feed update data for each pair.
1518 GetHistoricalPriceUpdatesSync (
1619 ctx context.Context , timestamp time.Time , priceFeeds ... string ,
1720 ) (map [string ]* apyth.PythStructsPriceFeed , error )
21+
22+ // Shutdown gracefully shuts down the Pyth Benchmarks client.
1823 Shutdown ()
1924}
2025
2126// NewBenchmarks creates a new Pyth Benchmarks client.
2227var NewBenchmarks = benchmarks .NewClient
2328
24- // Hermes is the interface that wraps the methods of the hermes.Client .
29+ // Hermes is the interface of the Hermes client .
2530type Hermes interface {
26- GetCachedLatestPriceUpdates (
27- ctx context. Context , priceFeeds ... string ,
28- ) ( map [ string ] * types. LatestPriceData , error )
31+ // Queries the `v2/updates/price/latest` endpoint for each price feed individually, in
32+ // parallel. Takes the price feed keys (uses corresponding Pyth feed ID). Returns the Pyth
33+ // PriceFeed struct and the price feed update data for each pair.
2934 GetLatestPriceUpdatesAsync (
3035 ctx context.Context , priceFeeds ... string ,
3136 ) (map [string ]* types.LatestPriceData , error )
37+
38+ // Queries the `v2/updates/price/latest` endpoint for all price feed ID together. Takes the
39+ // price feed keys (uses corresponding Pyth feed ID). Returns the Pyth PriceFeed struct and the
40+ // price feed update data for each pair.
3241 GetLatestPriceUpdatesSync (
3342 ctx context.Context , priceFeeds ... string ,
3443 ) (map [string ]* types.LatestPriceData , error )
44+
45+ // Subscribe price feed from the streaming `v2/updates/price/stream` endpoint. Ensures this
46+ // only happens once in the scope of runtime. Any further calls to this are unnecessary and
47+ // no-ops.
3548 SubscribePriceStreaming (ctx context.Context , priceFeeds ... string )
49+
50+ // Queries cached price feed update data, obtained from the SSE streaming endpoint.
51+ // Returns the Pyth PriceFeed struct and the price feed update data for each pair.
52+ GetCachedLatestPriceUpdates (
53+ ctx context.Context , priceFeeds ... string ,
54+ ) (map [string ]* types.LatestPriceData , error )
55+
56+ // Gracefully shuts down the Pyth Hermes client.
3657 Shutdown ()
3758}
3859
0 commit comments