Show total loan amount on portfolio
This commit is contained in:
parent
ed6ea011c2
commit
ca6197c7bb
|
@ -210,7 +210,6 @@ export function getContractBetMetrics(contract: Contract, yourBets: Bet[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const netPayout = payout - loan
|
|
||||||
const profit = payout + saleValue + redeemed - totalInvested
|
const profit = payout + saleValue + redeemed - totalInvested
|
||||||
const profitPercent = (profit / totalInvested) * 100
|
const profitPercent = (profit / totalInvested) * 100
|
||||||
|
|
||||||
|
@ -221,8 +220,8 @@ export function getContractBetMetrics(contract: Contract, yourBets: Bet[]) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
invested,
|
invested,
|
||||||
|
loan,
|
||||||
payout,
|
payout,
|
||||||
netPayout,
|
|
||||||
profit,
|
profit,
|
||||||
profitPercent,
|
profitPercent,
|
||||||
totalShares,
|
totalShares,
|
||||||
|
@ -233,8 +232,8 @@ export function getContractBetMetrics(contract: Contract, yourBets: Bet[]) {
|
||||||
export function getContractBetNullMetrics() {
|
export function getContractBetNullMetrics() {
|
||||||
return {
|
return {
|
||||||
invested: 0,
|
invested: 0,
|
||||||
|
loan: 0,
|
||||||
payout: 0,
|
payout: 0,
|
||||||
netPayout: 0,
|
|
||||||
profit: 0,
|
profit: 0,
|
||||||
profitPercent: 0,
|
profitPercent: 0,
|
||||||
totalShares: {} as { [outcome: string]: number },
|
totalShares: {} as { [outcome: string]: number },
|
||||||
|
|
|
@ -160,26 +160,31 @@ export function BetsList(props: { user: User }) {
|
||||||
unsettled,
|
unsettled,
|
||||||
(c) => contractsMetrics[c.id].payout
|
(c) => contractsMetrics[c.id].payout
|
||||||
)
|
)
|
||||||
const currentNetInvestment = sumBy(
|
const currentLoan = sumBy(unsettled, (c) => contractsMetrics[c.id].loan)
|
||||||
unsettled,
|
|
||||||
(c) => contractsMetrics[c.id].netPayout
|
|
||||||
)
|
|
||||||
|
|
||||||
const investedProfitPercent =
|
const investedProfitPercent =
|
||||||
((currentBetsValue - currentInvested) / (currentInvested + 0.1)) * 100
|
((currentBetsValue - currentInvested) / (currentInvested + 0.1)) * 100
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col>
|
<Col>
|
||||||
<Row className="justify-between gap-4 sm:flex-row">
|
<Col className="justify-between gap-4 sm:flex-row">
|
||||||
<Col>
|
<Row className="gap-4">
|
||||||
<div className="text-greyscale-6 text-xs sm:text-sm">
|
<Col>
|
||||||
Investment value
|
<div className="text-greyscale-6 text-xs sm:text-sm">
|
||||||
</div>
|
Investment value
|
||||||
<div className="text-lg">
|
</div>
|
||||||
{formatMoney(currentNetInvestment)}{' '}
|
<div className="text-lg">
|
||||||
<ProfitBadge profitPercent={investedProfitPercent} />
|
{formatMoney(currentBetsValue)}{' '}
|
||||||
</div>
|
<ProfitBadge profitPercent={investedProfitPercent} />
|
||||||
</Col>
|
</div>
|
||||||
|
</Col>
|
||||||
|
<Col>
|
||||||
|
<div className="text-greyscale-6 text-xs sm:text-sm">
|
||||||
|
Total loans
|
||||||
|
</div>
|
||||||
|
<div className="text-lg">{formatMoney(currentLoan)}</div>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
|
||||||
<Row className="gap-2">
|
<Row className="gap-2">
|
||||||
<select
|
<select
|
||||||
|
@ -206,7 +211,7 @@ export function BetsList(props: { user: User }) {
|
||||||
<option value="closeTime">Close date</option>
|
<option value="closeTime">Close date</option>
|
||||||
</select>
|
</select>
|
||||||
</Row>
|
</Row>
|
||||||
</Row>
|
</Col>
|
||||||
|
|
||||||
<Col className="mt-6 divide-y">
|
<Col className="mt-6 divide-y">
|
||||||
{displayedContracts.length === 0 ? (
|
{displayedContracts.length === 0 ? (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user