calculateMoneyRatio
This commit is contained in:
parent
1c74afd741
commit
3cffccdd3f
|
@ -69,15 +69,11 @@ export function calculateRawShareValue(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function calculateMoneyRatio(contract: Contract) {
|
export function calculateMoneyRatio(contract: Contract) {
|
||||||
const { totalShares, phantomShares, pool } = contract
|
const { totalShares, pool } = contract
|
||||||
const [yesShares, noShares] = [totalShares.YES, totalShares.NO]
|
const p = getProbability(totalShares)
|
||||||
const { YES: yesFake, NO: noFake } = phantomShares
|
|
||||||
|
|
||||||
const actual = pool.YES + pool.NO
|
const actual = pool.YES + pool.NO
|
||||||
|
const expected = p * contract.totalBets.YES + (1 - p) * contract.totalBets.NO
|
||||||
const expected = Math.sqrt(
|
|
||||||
(yesShares - yesFake) ** 2 + (noShares - noFake) ** 2
|
|
||||||
)
|
|
||||||
|
|
||||||
return expected === 0 ? 0 : actual / expected
|
return expected === 0 ? 0 : actual / expected
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user