calculateMoneyRatio
This commit is contained in:
parent
de043de589
commit
bc454e89ba
|
@ -69,12 +69,17 @@ export function calculateRawShareValue(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function calculateMoneyRatio(contract: Contract) {
|
export function calculateMoneyRatio(contract: Contract) {
|
||||||
const { totalShares, pool } = contract
|
const { totalShares, phantomShares, pool } = contract
|
||||||
const [yesShares, noShares] = [totalShares.YES, totalShares.NO]
|
const [yesShares, noShares] = [totalShares.YES, totalShares.NO]
|
||||||
|
const { YES: yesFake, NO: noFake } = phantomShares
|
||||||
|
|
||||||
const actual = pool.YES + pool.NO
|
const actual = pool.YES + pool.NO
|
||||||
const expected = Math.sqrt(yesShares ** 2 + noShares ** 2)
|
|
||||||
return actual / expected
|
const expected = Math.sqrt(
|
||||||
|
(yesShares - yesFake) ** 2 + (noShares - noFake) ** 2
|
||||||
|
)
|
||||||
|
|
||||||
|
return expected === 0 ? 0 : actual / expected
|
||||||
}
|
}
|
||||||
|
|
||||||
export function calculateShareValue(contract: Contract, bet: Bet) {
|
export function calculateShareValue(contract: Contract, bet: Bet) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user