change sale formula

This commit is contained in:
mantikoros 2021-12-24 15:09:35 -05:00
parent a995df36c4
commit 87a8bfc4b6
2 changed files with 5 additions and 3 deletions

View File

@ -105,7 +105,9 @@ const getSellBetInfo = (
const startPool = yesStart + noStart
const pool = yesPool + noPool - startPool
const f = outcome === 'YES' ? pool / yesShares : pool / noShares
const probBefore = yesPool ** 2 / (yesPool ** 2 + noPool ** 2)
const f = pool / (probBefore * yesShares + (1 - probBefore) * noShares)
const myPool = outcome === 'YES' ? yesPool - yesStart : noPool - noStart
@ -121,7 +123,6 @@ const getSellBetInfo = (
? { YES: yesShares - shares, NO: noShares }
: { YES: yesShares, NO: noShares - shares }
const probBefore = yesPool ** 2 / (yesPool ** 2 + noPool ** 2)
const probAfter = newPool.YES ** 2 / (newPool.YES ** 2 + newPool.NO ** 2)
const creatorFee = CREATOR_FEE * adjShareValue

View File

@ -112,7 +112,8 @@ export function calculateSaleAmount(contract: Contract, bet: Bet) {
const startPool = yesStart + noStart
const pool = yesPool + noPool - startPool
const f = outcome === 'YES' ? pool / yesShares : pool / noShares
const probBefore = yesPool ** 2 / (yesPool ** 2 + noPool ** 2)
const f = pool / (probBefore * yesShares + (1 - probBefore) * noShares)
const myPool = outcome === 'YES' ? yesPool - yesStart : noPool - noStart