You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/price-feeds/derive-cross-rate.mdx
+12-11Lines changed: 12 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
import { Callout } from"nextra/components";
2
2
3
-
# Combine Two Price Feeds / Derive a Cross Rate
3
+
# Derive Cross Rate
4
4
5
5
This guide shows how to combine two price feeds to derive a cross rate. These are also known as "synthetic" price feeds.
6
6
Cross rates or Synthetic Price feeds are useful for trading pairs that are not directly supported by Pyth.
@@ -20,7 +20,7 @@ $$
20
20
21
21
## Derive a cross rate
22
22
23
-
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.
23
+
The Pyth Solidity SDKprovides[`deriveCrossRate`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/PythUtils.sol#L77) function to combine two price feeds.
24
24
This method is available in [Pyth solidity SDK](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/ethereum/sdk/solidity).
25
25
26
26
This method takes the following parameters:
@@ -35,13 +35,6 @@ Returns:
35
35
36
36
-`crossRate`: The computed cross rate (a / c), scaled to targetExponent.
37
37
38
-
### ⚠️ Things to Keep in Mind
39
-
40
-
- The function reverts if either price is **negative**, or if any exponent is **less than -255**.
41
-
- The result is rounded down. If the result is smaller than 1 in the given `targetExponent{:jsx}`, it will return 0.
42
-
- Confidence intervals are not derived in this function. If needed, you have to derive them manually.
43
-
- Reverts with `PythErrors.ExponentOverflow{:jsx}` if `targetExponent + expo1 - expo2{:jsx}` is outside the range **[-58, 58]**.
0 commit comments