diff --git a/functions/src/update-contract-metrics.ts b/functions/src/update-contract-metrics.ts index d203ee99..c3801df6 100644 --- a/functions/src/update-contract-metrics.ts +++ b/functions/src/update-contract-metrics.ts @@ -39,5 +39,5 @@ const computeVolumeFrom = async (contract: Contract, timeAgoMs: number) => { .where('createdTime', '>', Date.now() - timeAgoMs) ) - return _.sumBy(bets, (bet) => Math.abs(bet.amount)) + return _.sumBy(bets, (bet) => (bet.isRedemption ? 0 : Math.abs(bet.amount))) } diff --git a/functions/src/update-user-metrics.ts b/functions/src/update-user-metrics.ts index 50069423..70fd1bc5 100644 --- a/functions/src/update-user-metrics.ts +++ b/functions/src/update-user-metrics.ts @@ -6,8 +6,8 @@ import { getValues } from './utils' import { Contract } from '../../common/contract' import { Bet } from '../../common/bet' import { User } from '../../common/user' -import { calculateDpmPayout } from '../../common/calculate-dpm' import { batchedWaitAll } from '../../common/util/promise' +import { calculatePayout } from '../../common/calculate' const firestore = admin.firestore() @@ -53,7 +53,7 @@ const computeInvestmentValue = async ( if (!contract || contract.isResolved) return 0 if (bet.sale || bet.isSold) return 0 - const payout = calculateDpmPayout(contract, bet, 'MKT') + const payout = calculatePayout(contract, bet, 'MKT') return payout - (bet.loanAmount ?? 0) }) }