From 3cffccdd3fa5caf1cfd61a0a25c2fbf9a34fa512 Mon Sep 17 00:00:00 2001 From: mantikoros Date: Thu, 13 Jan 2022 20:52:03 -0600 Subject: [PATCH] calculateMoneyRatio --- common/calculate.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/common/calculate.ts b/common/calculate.ts index 5c169367..197efad1 100644 --- a/common/calculate.ts +++ b/common/calculate.ts @@ -69,15 +69,11 @@ export function calculateRawShareValue( } export function calculateMoneyRatio(contract: Contract) { - const { totalShares, phantomShares, pool } = contract - const [yesShares, noShares] = [totalShares.YES, totalShares.NO] - const { YES: yesFake, NO: noFake } = phantomShares + const { totalShares, pool } = contract + const p = getProbability(totalShares) const actual = pool.YES + pool.NO - - const expected = Math.sqrt( - (yesShares - yesFake) ** 2 + (noShares - noFake) ** 2 - ) + const expected = p * contract.totalBets.YES + (1 - p) * contract.totalBets.NO return expected === 0 ? 0 : actual / expected }