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 }
|
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,
|
state: CpmmState,
|
||||||
prob: number,
|
prob: number,
|
||||||
outcome: 'YES' | 'NO'
|
outcome: 'YES' | 'NO'
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
calculateNumericDpmShares,
|
calculateNumericDpmShares,
|
||||||
} from './calculate-dpm'
|
} from './calculate-dpm'
|
||||||
import {
|
import {
|
||||||
calculateCpmmAmount,
|
calculateCpmmAmountToProb,
|
||||||
calculateCpmmPurchase,
|
calculateCpmmPurchase,
|
||||||
CpmmState,
|
CpmmState,
|
||||||
getCpmmProbability,
|
getCpmmProbability,
|
||||||
|
@ -79,7 +79,7 @@ const computeFill = (
|
||||||
const buyAmount =
|
const buyAmount =
|
||||||
limit === undefined
|
limit === undefined
|
||||||
? amount
|
? amount
|
||||||
: Math.min(amount, calculateCpmmAmount(cpmmState, limit, outcome))
|
: Math.min(amount, calculateCpmmAmountToProb(cpmmState, limit, outcome))
|
||||||
|
|
||||||
const { shares, newPool, newP, fees } = calculateCpmmPurchase(
|
const { shares, newPool, newP, fees } = calculateCpmmPurchase(
|
||||||
cpmmState,
|
cpmmState,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user