-
Notifications
You must be signed in to change notification settings - Fork 34
chore(pricefeed) Add docs for cross rate #729
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 ↗︎
|
pages/price-feeds/_meta.json
Outdated
@@ -26,6 +26,7 @@ | |||
"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", |
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.
just pick one of these titles -- this is too long.
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.
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. |
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.
why is this called a synthetic feed? no need for new terminology here imo
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.
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. |
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.
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 |
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.
/
not +
|
||
- `crossRate`: The computed cross rate (a / c), scaled to targetExponent. | ||
|
||
### ⚠️ Things to Keep in Mind |
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.
imo this should go after the example
Description
Type of Change
Areas Affected
Checklist
pre-commit run --all-files
to check for linting errorsRelated Issues
Closes #
Additional Notes
Contributor Information
Screenshots