Update your trades to show total profit, invested value

This commit is contained in:
James Grugett 2022-03-02 15:42:59 -08:00
parent fa817c34a9
commit 6285212a1e

View File

@ -127,8 +127,8 @@ export function BetsList(props: { user: User }) {
const totalPortfolio = currentBetsValue + user.balance const totalPortfolio = currentBetsValue + user.balance
const totalPnl = totalPortfolio - user.totalDeposits const totalPnl = totalPortfolio - user.totalDeposits
const totalProfit = (totalPnl / user.totalDeposits) * 100 const totalProfitPercent = (totalPnl / user.totalDeposits) * 100
const investedProfit = const investedProfitPercent =
((currentBetsValue - currentInvestment) / currentInvestment) * 100 ((currentBetsValue - currentInvestment) / currentInvestment) * 100
return ( return (
@ -136,17 +136,17 @@ export function BetsList(props: { user: User }) {
<Col className="mx-4 gap-4 sm:flex-row sm:justify-between md:mx-0"> <Col className="mx-4 gap-4 sm:flex-row sm:justify-between md:mx-0">
<Row className="gap-8"> <Row className="gap-8">
<Col> <Col>
<div className="text-sm text-gray-500">Invested</div> <div className="text-sm text-gray-500">Invested value</div>
<div className="text-lg"> <div className="text-lg">
{formatMoney(currentInvestment)}{' '} {formatMoney(currentBetsValue)}{' '}
<ProfitBadge profitPercent={investedProfit} /> <ProfitBadge profitPercent={investedProfitPercent} />
</div> </div>
</Col> </Col>
<Col> <Col>
<div className="text-sm text-gray-500">Total portfolio</div> <div className="text-sm text-gray-500">Total profit</div>
<div className="text-lg"> <div className="text-lg">
{formatMoney(totalPortfolio)}{' '} {formatMoney(totalPnl)}{' '}
<ProfitBadge profitPercent={totalProfit} /> <ProfitBadge profitPercent={totalProfitPercent} />
</div> </div>
</Col> </Col>
</Row> </Row>