Clean up numeric bucket computation

This commit is contained in:
Marshall Polaris 2022-09-26 17:39:23 -07:00
parent 6b9b0760b1
commit 7fa11bdc4e

View File

@ -14,9 +14,9 @@ const getNumericChartData = (contract: NumericContract) => {
const { totalShares, bucketCount, min, max } = contract
const step = (max - min) / bucketCount
const bucketProbs = getDpmOutcomeProbabilities(totalShares)
const xs = range(bucketCount).map((i) => min + step * (i + 0.5))
const probs = range(bucketCount).map((i) => bucketProbs[`${i}`])
return probs.map((prob, i) => [xs[i], prob] as const)
return range(bucketCount).map(
(i) => [min + step * (i + 0.5), bucketProbs[`${i}`]] as const
)
}
export const NumericContractChart = (props: {