This repository was archived by the owner on Nov 28, 2025. It is now read-only.
chore(pricefeed) Add docs for cross rate#729
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
jayantk
approved these changes
Jun 23, 2025
| "use-real-time-data": "Use Real-Time Price Data", | ||
| "fetch-price-updates": "Fetch Price Updates", | ||
| "schedule-price-updates": "Schedule Price Updates", | ||
| "combine-two-price-feeds": "Combine Two Price Feeds / Derive a Cross Rate", |
Contributor
There was a problem hiding this comment.
just pick one of these titles -- this is too long.
Contributor
There was a problem hiding this comment.
imo "derive cross rate" is better than the other one
|
|
||
| # Combine Two Price Feeds / Derive a Cross Rate | ||
|
|
||
| This guide shows how to combine two price feeds to derive a cross rate. These are also known as "synthetic" price feeds. |
Contributor
There was a problem hiding this comment.
why is this called a synthetic feed? no need for new terminology here imo
Member
Author
There was a problem hiding this comment.
Alot of folks asked us if we support synthetic feeds. It helps us with SEO and docs internal search as well.
|
|
||
| ## Derive a cross rate | ||
|
|
||
| Pyth provides [`deriveCrossRate`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/PythUtils.sol#L77) function to combine two price feeds. |
Contributor
There was a problem hiding this comment.
Pyth here is imprecise. this should say
The Pyth Solidity SDK provides ...
| PythStructs.Price memory ethUsd = pyth.getPriceNoOlderThan(ethUsdId, 60); | ||
| PythStructs.Price memory eurUsd = pyth.getPriceNoOlderThan(eurUsdId, 60); | ||
|
|
||
| // Derive ETH/EUR = ETH/USD ÷ EUR/USD |
|
|
||
| - `crossRate`: The computed cross rate (a / c), scaled to targetExponent. | ||
|
|
||
| ### ⚠️ Things to Keep in Mind |
Contributor
There was a problem hiding this comment.
imo this should go after the example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Type of Change
Areas Affected
Checklist
pre-commit run --all-filesto check for linting errorsRelated Issues
Closes #
Additional Notes
Contributor Information
Screenshots