change dpm elasticity

This commit is contained in:
mantikoros 2022-10-06 16:47:52 -05:00
parent 7ca0fb72fc
commit a63405ca7c
2 changed files with 8 additions and 9 deletions

View File

@ -1,11 +1,7 @@
import { last, sortBy, sum, sumBy } from 'lodash' import { last, sortBy, sum, sumBy } from 'lodash'
import { calculatePayout } from './calculate' import { calculatePayout } from './calculate'
import { Bet, LimitBet } from './bet' import { Bet, LimitBet } from './bet'
import { import { Contract, CPMMContract, DPMContract } from './contract'
Contract,
CPMMContract,
DPMContract,
} from './contract'
import { PortfolioMetrics, User } from './user' import { PortfolioMetrics, User } from './user'
import { DAY_MS } from './util/time' import { DAY_MS } from './util/time'
import { getBinaryCpmmBetInfo, getNewMultiBetInfo } from './new-bet' import { getBinaryCpmmBetInfo, getNewMultiBetInfo } from './new-bet'
@ -61,7 +57,7 @@ export const computeElasticity = (
export const computeBinaryCpmmElasticity = ( export const computeBinaryCpmmElasticity = (
bets: Bet[], bets: Bet[],
contract: CPMMContract, contract: CPMMContract,
betAmount = 50 betAmount: number
) => { ) => {
const limitBets = bets const limitBets = bets
.filter( .filter(
@ -91,8 +87,11 @@ export const computeBinaryCpmmElasticity = (
return resultYes - resultNo return resultYes - resultNo
} }
export const computeDpmElasticity = (contract: DPMContract, betAmount = 50) => { export const computeDpmElasticity = (
return getNewMultiBetInfo('', betAmount, contract).newBet.probAfter contract: DPMContract,
betAmount: number
) => {
return getNewMultiBetInfo('', 2 * betAmount, contract).newBet.probAfter
} }
const computeTotalPool = (userContracts: Contract[], startTime = 0) => { const computeTotalPool = (userContracts: Contract[], startTime = 0) => {

View File

@ -70,7 +70,7 @@ export function getNewContract(
volume: 0, volume: 0,
volume24Hours: 0, volume24Hours: 0,
volume7Days: 0, volume7Days: 0,
elasticity: propsByOutcomeType.mechanism === 'cpmm-1' ? 0.38 : 0.56, elasticity: propsByOutcomeType.mechanism === 'cpmm-1' ? 0.38 : 0.75,
collectedFees: { collectedFees: {
creatorFee: 0, creatorFee: 0,