Use generic payout function for leaderboard profit calculation. Exclude redemptions in volume calculation
This commit is contained in:
parent
c183e00d47
commit
77b2c9893d
|
@ -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)))
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user