use geometric mean probability to calculate fees for cfmm (a lot easier than solving the integral)
This commit is contained in:
parent
85a182b7f2
commit
a1c3a5e569
|
@ -63,8 +63,10 @@ export function getCpmmLiquidityFee(
|
||||||
bet: number,
|
bet: number,
|
||||||
outcome: string
|
outcome: string
|
||||||
) {
|
) {
|
||||||
const prob = getCpmmProbabilityAfterBetBeforeFees(contract, outcome, bet)
|
const probBefore = getCpmmProbability(contract.pool, contract.p)
|
||||||
const betP = outcome === 'YES' ? 1 - prob : prob
|
const probAfter = getCpmmProbabilityAfterBetBeforeFees(contract, outcome, bet)
|
||||||
|
const probMid = Math.sqrt(probBefore * probAfter)
|
||||||
|
const betP = outcome === 'YES' ? 1 - probMid : probMid
|
||||||
|
|
||||||
const liquidityFee = LIQUIDITY_FEE * betP * bet
|
const liquidityFee = LIQUIDITY_FEE * betP * bet
|
||||||
const platformFee = PLATFORM_FEE * betP * bet
|
const platformFee = PLATFORM_FEE * betP * bet
|
||||||
|
|
Loading…
Reference in New Issue
Block a user