Pyth

Search…

Price Aggregation

As background, Pyth is an oracle that publishes an aggregate price and confidence interval for each product on every Solana slot. The Pyth program computes this price on-chain by aggregating the prices and confidence intervals submitted by individual publishers.

The first step of the algorithm computes the aggregate price by giving each publisher three votes — one vote at their price and one vote at each of their price +/- their confidence interval — then taking the median of all the votes.

The second step computes the distance from the aggregate price to the 25th and 75th percentiles of the votes, then selects the larger of the two as the aggregate confidence interval. Now, let’s put everything together and visualize it with 4 scenarios.

- Scenario 1

One “confident” publisher (tight confidence interval) is an outlier to the cohort but does not impact the final aggregated price. Its only impact will be a greater aggregated confidence interval that could highlight a price dislocation of the asset on different venues.

- Scenario 2

It demonstrates how publishers with tighter confidence intervals (while having overlapping quotes with the rest of the cohort) can exert greater influence over the location of the aggregate price.

- Scenario 3

It features publishers in overall “agreement” regarding the price and their relative uncertainty towards it. The final result shows that the aggregate confidence interval accounts for each publishers’ CI and gives identical results to the ordinary median.

- Scenario 4

Publishers publish distinct prices with non-overlapping confidence intervals. In this case, all votes of a single publisher will be adjacent in the sorted list and will be treated as a single vote.

In addition, we’re working on a staking system for publishers that incentivizes them to provide accurate data, and in that system, each publisher will have a varying amount of stake. All of the results also hold for stake weights if we simply replace the % of publishers with the % of stake controlled.

Note that in the future the weight calculation can be extended to include other non-price factors such as quoter stake (mentioned above), historical quoter performance, and many other relevant metrics.

Last modified 5mo ago

Copy link