Skip to content

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

Merged
merged 6 commits into from
May 3, 2024
Merged

Conversation

aditya520
Copy link
Member

No description provided.

Copy link

vercel bot commented May 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
documentation ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 3, 2024 5:02pm

Copy link
Contributor

@jayantk jayantk left a 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.
Copy link
Contributor

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);
```
Copy link
Contributor

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.
Copy link
Contributor

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.
Copy link
Contributor

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
Copy link
Contributor

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.
Copy link
Contributor

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

@aditya520 aditya520 merged commit c75f09e into main May 3, 2024
4 checks passed
@aditya520 aditya520 deleted the (feat)-add-guide-update-data branch May 3, 2024 17:16
aditya520 added a commit that referenced this pull request May 15, 2024
* first update

* pre-commit

* update

* update

* comment fix

* minor edits

---------

Co-authored-by: Jayant Krishnamurthy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants