Add note that there might be closed form
This commit is contained in:
parent
09181f806f
commit
3283b2b24b
|
@ -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'
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user