diff --git a/common/calculate-cpmm.ts b/common/calculate-cpmm.ts index ce46cc34..3470088a 100644 --- a/common/calculate-cpmm.ts +++ b/common/calculate-cpmm.ts @@ -116,7 +116,9 @@ export function calculateCpmmPurchase( return { shares, newPool, newP, fees } } -export function calculateCpmmAmount( +// Note: there might be a closed form solution for this. +// If so, feel free to switch out this implementation. +export function calculateCpmmAmountToProb( state: CpmmState, prob: number, outcome: 'YES' | 'NO' diff --git a/common/new-bet.ts b/common/new-bet.ts index ea5c7f89..6c3e6856 100644 --- a/common/new-bet.ts +++ b/common/new-bet.ts @@ -9,7 +9,7 @@ import { calculateNumericDpmShares, } from './calculate-dpm' import { - calculateCpmmAmount, + calculateCpmmAmountToProb, calculateCpmmPurchase, CpmmState, getCpmmProbability, @@ -79,7 +79,7 @@ const computeFill = ( const buyAmount = limit === undefined ? amount - : Math.min(amount, calculateCpmmAmount(cpmmState, limit, outcome)) + : Math.min(amount, calculateCpmmAmountToProb(cpmmState, limit, outcome)) const { shares, newPool, newP, fees } = calculateCpmmPurchase( cpmmState,