dont over payout
This commit is contained in:
parent
793ae29f89
commit
3595fb3604
1 changed files with 3 additions and 1 deletions
|
|
@ -104,6 +104,8 @@ app.get('/bets', (req, res) => {
|
|||
return calculateMarginalPrice(i, bets).toFixed(4) as unknown as number
|
||||
})
|
||||
|
||||
const liquidity = countLiquidity(bets)
|
||||
|
||||
res.send(JSON.stringify({
|
||||
bets,
|
||||
odds,
|
||||
|
|
@ -111,7 +113,7 @@ app.get('/bets', (req, res) => {
|
|||
const userBets = shares[userId] ?? 0
|
||||
return {
|
||||
shares: userBets,
|
||||
winPayout: userBets * 1 / odds[team]
|
||||
winPayout: liquidity * Math.floor(100 * (userBets / bets[team])) / 100
|
||||
}
|
||||
})
|
||||
}))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue