From befa7afe326929c1a7d1c7d1558b76b83a59b803 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Wed, 31 Jul 2024 20:22:51 +0100 Subject: [PATCH 1/5] do it --- pages/price-feeds/how-pyth-works.mdx | 11 ++++------- .../how-pyth-works/ema-price-aggregation.mdx | 4 ++-- pages/price-feeds/how-pyth-works/pythnet.mdx | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/pages/price-feeds/how-pyth-works.mdx b/pages/price-feeds/how-pyth-works.mdx index d39be3d2..bf8d57b0 100644 --- a/pages/price-feeds/how-pyth-works.mdx +++ b/pages/price-feeds/how-pyth-works.mdx @@ -6,16 +6,13 @@ Pyth is a protocol that allows market participants to publish pricing informatio 2. Pyth's _oracle program_ combines publishers' data to produce a single aggregate price and confidence interval. 3. _Consumers_ read the price information produced by the oracle program. -Pyth's oracle program runs simultaneously on both Solana mainnet and [Pythnet](how-pyth-works/pythnet.md). -Each instance of the program is responsible for its own set of price feeds. -[Solana Price Feeds](solana-price-feeds.md) are available for use by Solana protocols. -In this case, since the oracle program itself runs on Solana, the resulting prices are immediately available to consumers without requiring any additional work. -[Pythnet Price Feeds](pythnet-price-feeds.md) are available on 12+ blockchains. +Pyth's oracle program runs on [Pythnet](how-pyth-works/pythnet.md). +[Pythnet Price Feeds](pythnet-price-feeds.md) are available on 50+ blockchains. The prices constructed on Pythnet are transferred [cross-chain](how-pyth-works/cross-chain.md) to reach consumers on these blockchains. -In both cases, the critical component of the system is the [oracle program](how-pyth-works/oracle-program.md) that combines the data from each individual publisher. +The critical component of the system is the [oracle program](how-pyth-works/oracle-program.md) that combines the data from each individual publisher. This program maintains a number of different [Solana accounts](how-pyth-works/account-structure.md) that list the products on Pyth and their current price data. Publishers publish their price and confidence by interacting with the oracle program on every slot. The program stores this information in its accounts. The first price update in a slot additionally triggers [price aggregation](how-pyth-works/price-aggregation.md), which combines the price data from the previous slot into a single aggregate price and confidence interval. -This aggregate price is written to the Solana account where it is readable by other on-chain programs and available for transmission to other blockchains. +This aggregate price is written to the Solana account where it is available for transmission to other blockchains. diff --git a/pages/price-feeds/how-pyth-works/ema-price-aggregation.mdx b/pages/price-feeds/how-pyth-works/ema-price-aggregation.mdx index c3df02b3..cd4d36de 100644 --- a/pages/price-feeds/how-pyth-works/ema-price-aggregation.mdx +++ b/pages/price-feeds/how-pyth-works/ema-price-aggregation.mdx @@ -31,11 +31,11 @@ Find the implementation in our [GitHub](https://github.com/pyth-network/pyth-cli **How does Pyth calculate its EMA Price and EMA Confidence?** -The EMA Price (`ema_price`) and EMA Confidence (`ema_confidence`) values are derived directly from the aggregated prices and confidences Pyth has generated on-chain. Publishers do not submit either EMA Price or EMA Confidence values, they only publish to Solana a “live” price and its associated confidence interval which will, in turn, be used for EMA Price and EMA Confidence calculation. +The EMA Price (`ema_price`) and EMA Confidence (`ema_confidence`) values are derived directly from the aggregated prices and confidences Pyth has generated on-chain. Publishers do not submit either EMA Price or EMA Confidence values, they only publish to Pythnet a “live” price and its associated confidence interval which will, in turn, be used for EMA Price and EMA Confidence calculation. The current Pyth averaging method is a slot-weighted, inverse confidence-weighted exponential moving average of the aggregate price (and confidence interval). -- **Slot weighted** — The Pyth EMA uses the Solana slot number to measure the passage of time. The averaging period is 5921 slots, which corresponds to approximately 1 hour on Solana mainnet. +- **Slot weighted** — The Pyth EMA uses the Pythnet slot number to measure the passage of time. The averaging period is 5921 slots, which corresponds to approximately 1 hour on Pythnet. - **Inverse confidence weighted** — Weighting each sample by 1/Confidence lets the EMA give more weight to samples with tight confidence and ignore samples with very wide confidence. Below is an example of an outlier aggregate price with a wide confidence interval. Notice how the average using inverse confidence weighting does not get pulled up by the outlier sample while the uniform weighted average does. ![](../../../images/EMA_Price_Aggregation_2.png) diff --git a/pages/price-feeds/how-pyth-works/pythnet.mdx b/pages/price-feeds/how-pyth-works/pythnet.mdx index 34521cdd..8525fc11 100644 --- a/pages/price-feeds/how-pyth-works/pythnet.mdx +++ b/pages/price-feeds/how-pyth-works/pythnet.mdx @@ -2,7 +2,7 @@ Pythnet is an application-specific blockchain operated by Pyth's data providers. This blockchain is a computation substrate to securely combine the data provider's prices into a single aggregate price for each Pyth price feed. -Pythnet forms the core of Pyth's off-chain price feeds that serve all blockchains (except Solana mainnet). +Pythnet forms the core of Pyth's off-chain price feeds that serve all blockchains. Pythnet is powered by Solana technology: it runs the same validator software, but is a Pyth specific chain that is independent of Solana's mainnet. The Pyth Data Association enables each data provider to operate one validator by delegating them the necessary stake. From 810f2d90f6159c04224e10d5619c50239e673172 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Wed, 31 Jul 2024 20:29:45 +0100 Subject: [PATCH 2/5] fix link --- pages/price-feeds/how-pyth-works.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/price-feeds/how-pyth-works.mdx b/pages/price-feeds/how-pyth-works.mdx index bf8d57b0..92758517 100644 --- a/pages/price-feeds/how-pyth-works.mdx +++ b/pages/price-feeds/how-pyth-works.mdx @@ -7,7 +7,7 @@ Pyth is a protocol that allows market participants to publish pricing informatio 3. _Consumers_ read the price information produced by the oracle program. Pyth's oracle program runs on [Pythnet](how-pyth-works/pythnet.md). -[Pythnet Price Feeds](pythnet-price-feeds.md) are available on 50+ blockchains. +[Pythnet Price Feeds](use-real-time-data) are available on 50+ blockchains. The prices constructed on Pythnet are transferred [cross-chain](how-pyth-works/cross-chain.md) to reach consumers on these blockchains. The critical component of the system is the [oracle program](how-pyth-works/oracle-program.md) that combines the data from each individual publisher. From 4bf46b1def4ee9a34716c773f09d590ed302436d Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Wed, 31 Jul 2024 20:34:48 +0100 Subject: [PATCH 3/5] fix: links --- pages/price-feeds/how-pyth-works.mdx | 2 +- pages/price-feeds/how-pyth-works/oracle-program.mdx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/price-feeds/how-pyth-works.mdx b/pages/price-feeds/how-pyth-works.mdx index 92758517..748e2326 100644 --- a/pages/price-feeds/how-pyth-works.mdx +++ b/pages/price-feeds/how-pyth-works.mdx @@ -11,7 +11,7 @@ Pyth's oracle program runs on [Pythnet](how-pyth-works/pythnet.md). The prices constructed on Pythnet are transferred [cross-chain](how-pyth-works/cross-chain.md) to reach consumers on these blockchains. The critical component of the system is the [oracle program](how-pyth-works/oracle-program.md) that combines the data from each individual publisher. -This program maintains a number of different [Solana accounts](how-pyth-works/account-structure.md) that list the products on Pyth and their current price data. +This program maintains a number of different [Solana accounts](pythnet-reference/account-structure.md) that list the products on Pyth and their current price data. Publishers publish their price and confidence by interacting with the oracle program on every slot. The program stores this information in its accounts. The first price update in a slot additionally triggers [price aggregation](how-pyth-works/price-aggregation.md), which combines the price data from the previous slot into a single aggregate price and confidence interval. diff --git a/pages/price-feeds/how-pyth-works/oracle-program.mdx b/pages/price-feeds/how-pyth-works/oracle-program.mdx index 9e463c7e..04a6b81f 100644 --- a/pages/price-feeds/how-pyth-works/oracle-program.mdx +++ b/pages/price-feeds/how-pyth-works/oracle-program.mdx @@ -7,8 +7,8 @@ The oracle program is responsible for several tasks: 3. Combining the individual data providers' prices into a single aggregate price and confidence interval. 4. Performing any additional stateful computations on the resulting price series, such as computing moving averages. -The oracle solves these problems by maintaining a collection of [Solana accounts](account-structure.md) to represent the set of price feeds. -Each feed has two accounts: a product account to store [metadata](product-metadata.md) and a price account. +The oracle solves these problems by maintaining a collection of [Solana accounts](pythnet-reference/account-structure.md) to represent the set of price feeds. +Each feed has two accounts: a product account to store [metadata](pythnet-reference/product-metadata.md) and a price account. The price account stores a list of authorized data providers for this specific price feed, and allocates storage space for each data provider's price. The oracle program exposes an instruction called `upd_price` that enables an authorized data provider to update the price account with their current estimate of the price and confidence interval. Additionally, the first time that `upd_price` is called in a slot, it will [aggregate](price-aggregation.md) the individual data provider's prices into an aggregate price and confidence interval. From 46008de960c2b45fd8aa856186fef6cc00ef42b1 Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Wed, 31 Jul 2024 20:38:49 +0100 Subject: [PATCH 4/5] fix: link --- pages/price-feeds/how-pyth-works.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/price-feeds/how-pyth-works.mdx b/pages/price-feeds/how-pyth-works.mdx index 748e2326..c4028368 100644 --- a/pages/price-feeds/how-pyth-works.mdx +++ b/pages/price-feeds/how-pyth-works.mdx @@ -7,7 +7,7 @@ Pyth is a protocol that allows market participants to publish pricing informatio 3. _Consumers_ read the price information produced by the oracle program. Pyth's oracle program runs on [Pythnet](how-pyth-works/pythnet.md). -[Pythnet Price Feeds](use-real-time-data) are available on 50+ blockchains. +[Pythnet Price Feeds](./) are available on 50+ blockchains. The prices constructed on Pythnet are transferred [cross-chain](how-pyth-works/cross-chain.md) to reach consumers on these blockchains. The critical component of the system is the [oracle program](how-pyth-works/oracle-program.md) that combines the data from each individual publisher. From 139c7953dd0f8974bc4e289b681d25678fc13e3d Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Wed, 31 Jul 2024 20:42:09 +0100 Subject: [PATCH 5/5] fix links --- pages/price-feeds/how-pyth-works/oracle-program.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/price-feeds/how-pyth-works/oracle-program.mdx b/pages/price-feeds/how-pyth-works/oracle-program.mdx index 04a6b81f..af0194f9 100644 --- a/pages/price-feeds/how-pyth-works/oracle-program.mdx +++ b/pages/price-feeds/how-pyth-works/oracle-program.mdx @@ -7,8 +7,8 @@ The oracle program is responsible for several tasks: 3. Combining the individual data providers' prices into a single aggregate price and confidence interval. 4. Performing any additional stateful computations on the resulting price series, such as computing moving averages. -The oracle solves these problems by maintaining a collection of [Solana accounts](pythnet-reference/account-structure.md) to represent the set of price feeds. -Each feed has two accounts: a product account to store [metadata](pythnet-reference/product-metadata.md) and a price account. +The oracle solves these problems by maintaining a collection of [Solana accounts](../pythnet-reference/account-structure.md) to represent the set of price feeds. +Each feed has two accounts: a product account to store [metadata](../pythnet-reference/product-metadata.md) and a price account. The price account stores a list of authorized data providers for this specific price feed, and allocates storage space for each data provider's price. The oracle program exposes an instruction called `upd_price` that enables an authorized data provider to update the price account with their current estimate of the price and confidence interval. Additionally, the first time that `upd_price` is called in a slot, it will [aggregate](price-aggregation.md) the individual data provider's prices into an aggregate price and confidence interval.