diff --git a/common/calculate.ts b/common/calculate.ts index 5edf1211..6481734f 100644 --- a/common/calculate.ts +++ b/common/calculate.ts @@ -210,7 +210,6 @@ export function getContractBetMetrics(contract: Contract, yourBets: Bet[]) { } } - const netPayout = payout - loan const profit = payout + saleValue + redeemed - totalInvested const profitPercent = (profit / totalInvested) * 100 @@ -221,8 +220,8 @@ export function getContractBetMetrics(contract: Contract, yourBets: Bet[]) { return { invested, + loan, payout, - netPayout, profit, profitPercent, totalShares, @@ -233,8 +232,8 @@ export function getContractBetMetrics(contract: Contract, yourBets: Bet[]) { export function getContractBetNullMetrics() { return { invested: 0, + loan: 0, payout: 0, - netPayout: 0, profit: 0, profitPercent: 0, totalShares: {} as { [outcome: string]: number }, diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index 247bb63b..bfe9ca95 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -160,26 +160,31 @@ export function BetsList(props: { user: User }) { unsettled, (c) => contractsMetrics[c.id].payout ) - const currentNetInvestment = sumBy( - unsettled, - (c) => contractsMetrics[c.id].netPayout - ) + const currentLoan = sumBy(unsettled, (c) => contractsMetrics[c.id].loan) const investedProfitPercent = ((currentBetsValue - currentInvested) / (currentInvested + 0.1)) * 100 return ( - - -
- Investment value -
-
- {formatMoney(currentNetInvestment)}{' '} - -
- + + + +
+ Investment value +
+
+ {formatMoney(currentBetsValue)}{' '} + +
+ + +
+ Total loans +
+
{formatMoney(currentLoan)}
+ +
-
+ {displayedContracts.length === 0 ? (