Allow people to sell all their shares

This commit is contained in:
Marshall Polaris 2022-06-29 17:59:55 -07:00
parent 8fdc44f7f3
commit 609194e6d7

View File

@ -46,7 +46,7 @@ export const sellshares = newEndpoint({}, async (req, auth) => {
const outcomeBets = userBets.filter((bet) => bet.outcome == outcome)
const maxShares = sumBy(outcomeBets, (bet) => bet.shares)
if (shares > maxShares + 0.000000000001)
if (shares > maxShares)
throw new APIError(400, `You can only sell up to ${maxShares} shares.`)
const { newBet, newPool, newP, fees } = getCpmmSellBetInfo(