Skip to content

Commit da24627

Browse files
authored
Remove P&L (#2668)
1 parent 0a36063 commit da24627

4 files changed

Lines changed: 0 additions & 95 deletions

File tree

centrifuge-app/src/components/LoanList.tsx

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ type Row = (Loan | TinlakeLoan) & {
3737
maturityDate: string | null
3838
marketPrice: CurrencyBalance
3939
marketValue: CurrencyBalance
40-
unrealizedPL: CurrencyBalance
41-
realizedPL: CurrencyBalance
4240
portfolioPercentage: string
4341
}
4442

@@ -80,8 +78,6 @@ export function LoanList({ loans }: Props) {
8078
acc[id] = {
8179
marketPrice: snapshot.currentPrice,
8280
marketValue: snapshot.presentValue,
83-
unrealizedPL: snapshot.unrealizedProfitAtMarketPrice,
84-
realizedPL: snapshot.sumRealizedProfitFifo,
8581
}
8682
return acc
8783
}, {}) ?? {}
@@ -206,28 +202,6 @@ export function LoanList({ loans }: Props) {
206202
sortKey: 'marketValue',
207203
},
208204
]),
209-
...(isTinlakePool
210-
? []
211-
: [
212-
{
213-
align: 'left',
214-
header: <SortableTableHeader label="Unrealized P&L" />,
215-
cell: (l: Row) => formatBalance(l.unrealizedPL ?? 0, pool.currency, 2, 0),
216-
sortKey: 'unrealizedPL',
217-
width: '140px',
218-
},
219-
]),
220-
...(isTinlakePool
221-
? []
222-
: [
223-
{
224-
align: 'left',
225-
header: <SortableTableHeader label="Realized P&L" />,
226-
cell: (l: Row) => formatBalance(l.realizedPL ?? 0, pool.currency, 2, 0),
227-
sortKey: 'realizedPL',
228-
width: '140px',
229-
},
230-
]),
231205
...(isTinlakePool
232206
? []
233207
: [
@@ -252,8 +226,6 @@ export function LoanList({ loans }: Props) {
252226
Quantity: `${quantity ?? '-'}`,
253227
'Market Price': loan.marketPrice ? loan.marketPrice : '-',
254228
'Market Value': loan.marketValue ? loan.marketValue : '-',
255-
'Unrealized P&L': loan.unrealizedPL ? loan.unrealizedPL : '-',
256-
'Realized P&L': loan.realizedPL ? loan.realizedPL : '-',
257229
'Portfolio %': loan.portfolioPercentage ? loan.portfolioPercentage : '-',
258230
}
259231
})

centrifuge-app/src/pages/Loan/KeyMetrics.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,6 @@ export function KeyMetrics({ pool, loan }: Props) {
9898
Dec(0)
9999
)
100100

101-
const unrealizedProfitAtMarketPrice = borrowerAssetTransactions?.reduce(
102-
(sum, tx) => sum.add(tx.unrealizedProfitAtMarketPrice?.toDecimal() ?? Dec(0)),
103-
Dec(0)
104-
)
105-
106101
const metrics = [
107102
...('valuationMethod' in loan.pricing && loan.pricing.valuationMethod !== 'cash'
108103
? templateMetadata?.keyAttributes
@@ -130,12 +125,6 @@ export function KeyMetrics({ pool, loan }: Props) {
130125
value: formatBalance(sumRealizedProfitFifo, pool.currency.symbol, 2, 2),
131126
}
132127
: (null as never),
133-
unrealizedProfitAtMarketPrice
134-
? {
135-
label: 'Unrealized P&L',
136-
value: formatBalance(unrealizedProfitAtMarketPrice, pool.currency.symbol, 2, 2),
137-
}
138-
: (null as never),
139128
].filter(Boolean)
140129
: []),
141130
...(loan.pricing.maturityDate &&

centrifuge-app/src/pages/Loan/TransactionTable.tsx

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ type Props = {
1919
poolType?: string
2020
maturityDate?: Date
2121
originationDate: Date | undefined
22-
loanStatus: string
2322
}
2423

2524
type Row = {
@@ -31,8 +30,6 @@ type Row = {
3130
faceValue: Decimal | null
3231
position: Decimal
3332
yieldToMaturity: Decimal | null
34-
realizedProfitFifo: CurrencyBalance | null
35-
unrealizedProfitAtMarketPrice: CurrencyBalance | null
3633
}
3734

3835
export const TransactionTable = ({
@@ -43,7 +40,6 @@ export const TransactionTable = ({
4340
pricing,
4441
poolType,
4542
maturityDate,
46-
loanStatus,
4743
}: Props) => {
4844
const assetTransactions = useMemo(() => {
4945
const sortedTransactions = transactions?.sort((a, b) => {
@@ -122,8 +118,6 @@ export const TransactionTable = ({
122118
}
123119
return sum
124120
}, Dec(0)),
125-
realizedProfitFifo: transaction.realizedProfitFifo,
126-
unrealizedProfitAtMarketPrice: transaction.unrealizedProfitAtMarketPrice,
127121
}
128122
})
129123
}, [transactions, maturityDate, pricing, decimals])
@@ -191,19 +185,6 @@ export const TransactionTable = ({
191185
cell: (row: Row) =>
192186
row.amount ? `${row.type === 'BORROWED' ? '-' : ''}${formatBalance(row.amount, undefined, 2, 2)}` : '-',
193187
},
194-
{
195-
align: 'left',
196-
header: loanStatus === 'Closed' || loanStatus === 'Repaid' ? 'Realized P&L' : 'Unrealized P&L',
197-
cell: (row: Row) =>
198-
row.realizedProfitFifo || row.unrealizedProfitAtMarketPrice
199-
? formatBalance(
200-
loanStatus === 'Closed' ? row.unrealizedProfitAtMarketPrice ?? 0 : row.realizedProfitFifo ?? 0,
201-
undefined,
202-
2,
203-
2
204-
)
205-
: '-',
206-
},
207188
{
208189
align: 'left',
209190
header: `Position (${currency})`,
@@ -221,19 +202,6 @@ export const TransactionTable = ({
221202
header: `Principal (${currency})`,
222203
cell: (row: Row) => (row.position ? `${formatBalance(row.position, undefined, 2, 2)}` : '-'),
223204
},
224-
{
225-
align: 'left',
226-
header: loanStatus === 'Closed' || loanStatus === 'Repaid' ? 'Realized P&L' : 'Unrealized P&L',
227-
cell: (row: Row) =>
228-
row.realizedProfitFifo || row.unrealizedProfitAtMarketPrice
229-
? formatBalance(
230-
loanStatus === 'Closed' ? row.unrealizedProfitAtMarketPrice ?? 0 : row.realizedProfitFifo ?? 0,
231-
undefined,
232-
2,
233-
2
234-
)
235-
: '-',
236-
},
237205
]),
238206
] as Column[]
239207

centrifuge-app/src/pages/Loan/index.tsx

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { AssetSummary } from '../../../src/components/AssetSummary'
1414
import { SimpleLineChart } from '../../../src/components/Charts/SimpleLineChart'
1515
import { LoanLabel, getLoanLabelStatus } from '../../../src/components/LoanLabel'
1616
import { RouterLinkButton } from '../../../src/components/RouterLinkButton'
17-
import { Dec } from '../../../src/utils/Decimal'
1817
import AssetPerformanceChart from '../../components/Charts/AssetPerformanceChart'
1918
import { LabelValueStack } from '../../components/LabelValueStack'
2019
import { LayoutSection } from '../../components/LayoutBase/LayoutSection'
@@ -132,16 +131,6 @@ function Loan() {
132131
})
133132
}, [borrowerAssetTransactions])
134133

135-
const sumRealizedProfitFifo = borrowerAssetTransactions?.reduce(
136-
(sum, tx) => sum.add(tx.realizedProfitFifo?.toDecimal() ?? Dec(0)),
137-
Dec(0)
138-
)
139-
140-
const unrealizedProfitAtMarketPrice = borrowerAssetTransactions?.reduce(
141-
(sum, tx) => sum.add(tx.unrealizedProfitAtMarketPrice?.toDecimal() ?? Dec(0)),
142-
Dec(0)
143-
)
144-
145134
const currentFace =
146135
loan?.pricing && 'outstandingQuantity' in loan.pricing
147136
? loan.pricing.outstandingQuantity.toDecimal().mul(loan.pricing.notional.toDecimal())
@@ -177,11 +166,6 @@ function Loan() {
177166
return 0
178167
}
179168

180-
const getValueProfit = () => {
181-
if (loanStatus === 'Closed' || loanStatus === 'Repaid') return sumRealizedProfitFifo ?? 0
182-
else return unrealizedProfitAtMarketPrice ?? 0
183-
}
184-
185169
if (metadataIsLoading) return
186170

187171
return (
@@ -206,13 +190,6 @@ function Loan() {
206190
value: `${formatBalance(getCurrentPrice(), undefined, 2, 2)}`,
207191
heading: false,
208192
},
209-
{
210-
label: `${loanStatus === 'Closed' || loanStatus === 'Repaid' ? 'Realized P&L' : 'Unrealized P&L'} (${
211-
pool.currency.symbol ?? 'USD'
212-
})`,
213-
value: `${formatBalance(getValueProfit(), undefined, 2, 2)}`,
214-
heading: false,
215-
},
216193
]
217194
: [
218195
{
@@ -333,7 +310,6 @@ function Loan() {
333310
pricing={loan.pricing as PricingInfo}
334311
maturityDate={loan.pricing.maturityDate ? new Date(loan.pricing.maturityDate) : undefined}
335312
originationDate={originationDate ? new Date(originationDate) : undefined}
336-
loanStatus={loanStatus ?? ''}
337313
/>
338314
</Stack>
339315
</Grid>

0 commit comments

Comments
 (0)