Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/EMA_Price_Aggregation_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/EMA_Price_Aggregation_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Price_Aggregation_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Price_Aggregation_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Price_Aggregation_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Price_Aggregation_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Price_Aggregation_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Price_Aggregation_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Price_Aggregation_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed images/image (1).png
Binary file not shown.
Binary file removed images/image (2).png
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file added images/publisher-metrics/Calibration.jpg
Binary file added images/publisher-metrics/Price_Series.jpg
Binary file added images/publisher-metrics/Quality.jpg
Binary file added images/publisher-metrics/Uptime.jpg
12 changes: 6 additions & 6 deletions pages/home/metrics/publisher-metrics.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ Pyth Publishers Metrics is a feature that provides insights that will empower de

The **price graph** shows how a publisher’s price compares to the aggregate price, illustrating how closely the two prices track each other, and whether there were any periods where the publisher deviated significantly from the rest of the market.

![](../../../images/publisher-metrics/1_ybM6UzoRYw0OXUZ0FURlJw.jpeg)
![](../../../images/publisher-metrics/Price_Series.jpg)

**Uptime**

The **uptime graph** shows when the publisher was actively contributing prices. The x-axis subdivides the time interval into bins, and the y-axis is the % of slots in that bin where the publisher’s price was recent enough to be included in the aggregate. This graph lets you determine the regularity and reliability of a publisher.

![](../../../images/publisher-metrics/1_HnDeXZSuCMvA_jNwxdonUg.jpeg)
![](../../../images/publisher-metrics/Uptime.jpg)

**Quality**

The quality graph shows the dataset used in the regression model for computing the quality score described in section 4.1.1 of the [whitepaper](https://pyth.network/whitepaper.pdf). The quality score measures how well a publisher’s price series predicts future changes in the aggregate price. A smooth color gradient (from blue on the bottom left to pink on the top right) indicates a high-quality score.

![](../../../images/publisher-metrics/1_lWAHXKSWBCOImAwszfl2qA.jpeg)
![](../../../images/publisher-metrics/Quality.jpg)

**Calibration**

The **calibration graph** shows how closely the publisher’s prices and confidences match the expected Laplace distribution. The closer the fit between the two distributions, the higher the calibration score (described in section 4.1.2 of the whitepaper). In other words, a perfect publisher should produce a uniform histogram. As a reminder, the calibration score does not reward publishers for producing tighter confidence intervals; rather, the score captures whether the reported confidence interval corresponds to the publisher’s “true” confidence.

![](../../../images/publisher-metrics/1_V-AoQObS6SJLeIeUSwDUdg.jpeg)
![](../../../images/publisher-metrics/Calibration.jpg)

**Accessing the Metrics**

Expand All @@ -36,13 +36,13 @@ Each price feed page has a list of price components (representing each publisher

Once you are on a price feed, you can click on a publisher key (highlighted in yellow) under “Price Components” to access the Publishers Metrics page.

![](../../../images/publisher-metrics/1_7NkoWaF_c3EC61hCNt1w_Q.jpeg)
![](../../../images/publisher-metrics/Publisher_metrics_image_1.jpg)

On the Metrics Page for a specific publisher, you will find the metrics graphs and the option to download a Conformance Report (TSV file).

To open the metrics for another publisher (of that same price feed), you can click on the “Back to the [SOL/USD] market”.

![](../../../images/publisher-metrics/1_E52zxcRWkTtUAIAggbU-6Q.jpeg)
![](../../../images/publisher-metrics/Publisher_metrics_image_2.jpg)

If you want to review the Publisher Metrics of another price feed (e.g. ETH/USD), you will need to access the relevant asset. As mentioned, the [Pyth Price Feeds page](https://pyth.network/price-feeds/) has the full list of price feeds.

Expand Down
4 changes: 2 additions & 2 deletions pages/price-feeds/how-pyth-works/ema-price-aggregation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ price_account .. CqFJLrT4rSpA46RQkVYWn8tdBDuQ7p7RXcp6Um76oaph

In an EMA the most recent samples receive the most weight, and samples further back in time get exponentially less weight the farther in the past they are. For a 1 hour EMA, the samples 1 hour in the past get 50% of the weighting, samples 2 hours in the past get 25% of the weighting, 3 hours in the past get 12.5% of the weighting, etc.

![](<../../../images/Untitled (19) (1).png>)
![](../../../images/EMA_Price_Aggregation_1.png)

While conceptually not as simple as an SMA (Simple Moving Average), the EMA has a particularly simple implementation for streaming applications such as Pyth. The exponential weighting method allows the entire history of prices and weights to be represented by a single number.

Expand All @@ -38,6 +38,6 @@ The current Pyth averaging method is a slot-weighted, inverse confidence-weighte
- **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.
- **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/Untitled (20) (1) (1).png>)
![](../../../images/EMA_Price_Aggregation_2.png)

For more details and explanations, be sure to read our dedicated blog post on this topic [here](https://pythnetwork.medium.com/whats-in-a-name-302a03e6c3e1).
14 changes: 7 additions & 7 deletions pages/price-feeds/how-pyth-works/price-aggregation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ Price aggregation combines the prices and confidences submitted by individual da

The aggregation algorithm is designed to achieve 3 properties. First, it must be **robust to manipulation.** If most publishers are submitting a price of \$100 and one publisher submits a price of \$80, the aggregate price should remain near \$100 and not be overly influenced by the single outlying price. In the figure below, the aggregate price and confidence interval (represented by the red star) is not influenced by the blue publisher whose price is far away from the other publishers:

![](<../../../images/https___bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com_public_images_8c7da880-4157-4543-a293-37b5f5bfdac1_291x172 (1).jpeg>)
![](../../../images/Price_Aggregation_1.png)

Second, the **aggregate price should appropriately weight data sources with different levels of accuracy.** Pyth allows publishers to submit a confidence interval because they have varying levels of accuracy in observing the price of a product. This property can result in situations where one publisher reports a price of \$101 +/- 1, and another reports \$110 +/- 10. In these cases, we would like the aggregate price to be closer to \$101 than \$110, as in the figure below.

![](<../../../images/https___bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com_public_images_c0ab7e74-adb8-4324-9ef1-607c41bde1d4_292x171 (1).jpeg>)
![](../../../images/Price_Aggregation_2.png)

Finally, the **aggregate confidence interval should reflect the variation between publishers’ prices.**
Under normal market conditions, we expect the a product to trade at a similar price across exchanges.
In these cases, we would like the aggregate confidence interval to reflect the confidence intervals of the individual data providers, as shown in the figure on the left.
However, in some rare situations, a product can trade at different prices on different exchanges.
In these cases, the aggregate confidence interval should widen out to reflect the variation between these prices, as shown in the figure on the right.

![](<../../../images/https___bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com_public_images_0b4c8b1e-26bb-4131-8e2b-f725839d1bad_577x181 (1).jpeg>)
![](../../../images/Price_Aggregation_3.png)

**Algorithm**

Expand All @@ -41,21 +41,21 @@ Finally, the bold red star depicts the aggregate price and the bold red line dep
In the first scenario, one publisher with a tight confidence interval is an outlier.
Although this publisher does influence the objective function (the red line is lower on the left side than the right), it does not have enough influence to affect either the aggregate price or confidence interval.

![](<../../../images/https___bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com_public_images_a48fd6dc-356f-49fc-975a-290042f368e6_252x292 (1).jpeg>)
![](../../../images/Price_Aggregation_4.png)

The second scenario depicts how publishers with tighter confidence intervals can exert more influence over the location of the aggregate price, as long as their prices are consistent with the confidence intervals of other publishers.

![](<../../../images/https___bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com_public_images_26665263-76ef-43e7-ad50-37b7b3f2775a_250x295 (1).jpeg>)
![](../../../images/Price_Aggregation_5.png)

The third scenario demonstrates the typical case where there are many publishers whose prices and confidence intervals roughly agree.
In this case, the desired behavior is for the aggregate price and confidence to reflect those of the individual publishers.

![](<../../../images/https___bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com_public_images_8a2812c7-73d9-4d3f-8058-d5489ec3407b_230x290 (1) (1).jpeg>)
![](../../../images/Price_Aggregation_6.png)

Finally, the fourth scenario considers the case where the publishers publish distinct prices with non-overlapping confidence intervals.
In this case, the confidence interval widens out because the dispersion between publishers creates a large gap between the aggregate price and the 25th/75th percentiles of the votes.

![](<../../../images/https___bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com_public_images_812a2656-0c46-4b64-9538-fccb364cb343_260x283 (1).jpeg>)
![](../../../images/Price_Aggregation_7.png)

**Further Reading**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ This is to reflect the "after fee" effective prices that could be gotten on that

Example 1 - Exchange A has best aggressive fee of 10bps

![](../../../images/image.png)
![](../../../images/Confidence_Interval_and_Crypto_Exchange_Fees_Table_1.png)

Exchange A should publish a price of \$50,000.01 and a confidence of \$50.005 (half the bid-ask spread after fee adjustment). It would be wrong to publish a confidence of \$0.005 based on the "not fee-adjusted" raw exchange bid-ask spread.

Example 2 - Exchange A has a best aggressive fee of 10bps. Exchange B has a best aggressive fee of 1bps, and a publisher is combining them into a single combined book. Exchange books are combined by taking the best ask across both exchanges and the best bid across both exchanges.

![](<../../../images/image (1).png>)
![](../../../images/Confidence_Interval_and_Crypto_Exchange_Fees_Table_2.png)

In this example, if a publisher were combining the books of Exchange A and Exchange B to get a combined price, they should publish a price of \$49,978.13 and confidence of \$28.125, which corresponds to the midprice and half the bid-ask spread of the combined fee-adjusted books. It would be wrong to publish a price of \$50,000.01 and confidence of \$0.01 based on the "not fee-adjusted" raw exchange prices. Note that in this example, not only is the confidence changed by including the exchange fees, but the price reported is also substantially different once fees are properly accounted for.