Skip to content

Commit

Permalink
fix: multiply confidence intervals by constant
Browse files Browse the repository at this point in the history
  • Loading branch information
chambaz committed Oct 5, 2024
1 parent 70812b9 commit 96b570f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/marginfi-client-v2/src/models/price.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ function parseOraclePriceData(oracleSetup: OracleSetup, rawData: Buffer): Oracle
const exponent = new BigNumber(10 ** data.priceMessage.exponent);

const priceRealTime = new BigNumber(Number(data.priceMessage.price)).times(exponent);
const confidenceRealTime = new BigNumber(Number(data.priceMessage.conf)).times(exponent);
const confidenceRealTime = new BigNumber(Number(data.priceMessage.conf)).times(exponent).times(PYTH_PRICE_CONF_INTERVALS);
const cappedConfidenceRealTime = capConfidenceInterval(priceRealTime, confidenceRealTime, MAX_CONFIDENCE_INTERVAL_RATIO);
const lowestPriceRealTime = priceRealTime.minus(cappedConfidenceRealTime);
const highestPriceRealTime = priceRealTime.plus(cappedConfidenceRealTime);

const priceTimeWeighted = new BigNumber(Number(data.priceMessage.emaPrice)).times(exponent);
const confidenceTimeWeighted = new BigNumber(Number(data.priceMessage.emaConf)).times(exponent);
const confidenceTimeWeighted = new BigNumber(Number(data.priceMessage.emaConf)).times(exponent).times(PYTH_PRICE_CONF_INTERVALS);
const cappedConfidenceWeighted = capConfidenceInterval(priceTimeWeighted, confidenceTimeWeighted, MAX_CONFIDENCE_INTERVAL_RATIO);
const lowestPriceWeighted = priceTimeWeighted.minus(cappedConfidenceWeighted);
const highestPriceWeighted = priceTimeWeighted.plus(cappedConfidenceWeighted);
Expand Down

0 comments on commit 96b570f

Please sign in to comment.