Clean up numeric bucket computation
This commit is contained in:
parent
6b9b0760b1
commit
7fa11bdc4e
|
@ -14,9 +14,9 @@ const getNumericChartData = (contract: NumericContract) => {
|
||||||
const { totalShares, bucketCount, min, max } = contract
|
const { totalShares, bucketCount, min, max } = contract
|
||||||
const step = (max - min) / bucketCount
|
const step = (max - min) / bucketCount
|
||||||
const bucketProbs = getDpmOutcomeProbabilities(totalShares)
|
const bucketProbs = getDpmOutcomeProbabilities(totalShares)
|
||||||
const xs = range(bucketCount).map((i) => min + step * (i + 0.5))
|
return range(bucketCount).map(
|
||||||
const probs = range(bucketCount).map((i) => bucketProbs[`${i}`])
|
(i) => [min + step * (i + 0.5), bucketProbs[`${i}`]] as const
|
||||||
return probs.map((prob, i) => [xs[i], prob] as const)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const NumericContractChart = (props: {
|
export const NumericContractChart = (props: {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user