-
Notifications
You must be signed in to change notification settings - Fork 31
feat:-add-fetch-update-data-guide #286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a bunch of minor comments. The one more significant one is the websocket one -- we actually need to provide those instructions here. See inline comment for more details.
## Websocket | ||
|
||
Hermes also provides a WebSocket API to fetch the latest price updates. | ||
Consult the [Schedule Price Updates](/price-feeds/schedule-price-updates) guide to learn how to subscribe to Hermes websocket for streaming price updates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the guide referenced here is solving this problem. We don't have instructions for websocket or streaming at the moment.
However, SSE is actually super easy to use (much easier than websocket). Just run this command:
curl -N https://hermes.pyth.network/v2/updates/price/stream?ids[]=0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43
// Get the latest price updates for the given price IDs. | ||
// If you set `binary: true` above, then this method also returns signed price updates for the on-chain Pyth contract. | ||
const priceUpdates = await connection.getLatestVaas(priceIds); | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's also a way to subscribe to updates here, maybe worth including that as well?
|
||
# How To Fetch Price Updates | ||
|
||
The following guides explain how to fetch price updates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this one guide? I think this should say "The following guide" or "This guide"
The following guides explain how to fetch price updates. | ||
Price updates can be submitted to the Pyth Price Feeds contract to update the on-chain price. | ||
|
||
Price updates are fetched from [Hermes](/price-feeds/how-pyth-works/hermes) which are verified on-chain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comments from last PR -- the on-chain bit is redundant with the sentence before, and I still think this sentence would be better located together with "there are three different ways to fetch price updates". All three of those ways use Hermes, so you could make a coherent thought like "Price updates can be fetched from Hermes in several different ways:"
|
||
<Callout emoji="ℹ️"> | ||
Fetching a price from Hermes requires a price feed ID. These IDs are unique | ||
identifiers for price feeds (e.g., BTC/USD). The complete list of Pyth price |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comment on the "these ids" sentence. It would read slightly better if you could phrase this in the singular so the "e.g." part works. "This ID is a unique identifier for each price feed (e.g., BTC/USD)"
|
||
## REST API | ||
|
||
Hermes exposes APIs to fetch the latest price updates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hermes exposes several endpoints to fetch price updates
* first update * pre-commit * update * update * comment fix * minor edits --------- Co-authored-by: Jayant Krishnamurthy <[email protected]>
No description provided.