Skip to content

Commit

Permalink
Remove NAV change (#2163)
Browse files Browse the repository at this point in the history
* Change from date

* Remove nav change
  • Loading branch information
hieronx authored May 29, 2024
1 parent e375bf5 commit 2d6b3ec
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
24 changes: 8 additions & 16 deletions centrifuge-app/src/components/Report/PoolBalance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Pool } from '@centrifuge/centrifuge-js/dist/modules/pools'
import { Text } from '@centrifuge/fabric'
import * as React from 'react'
import { formatDate } from '../../utils/date'
import { formatBalance, formatPercentage } from '../../utils/formatting'
import { formatBalance } from '../../utils/formatting'
import { getCSVDownloadUrl } from '../../utils/getCSVDownloadUrl'
import { useDailyPoolStates, useMonthlyPoolStates } from '../../utils/usePools'
import { DataTable } from '../DataTable'
Expand Down Expand Up @@ -81,25 +81,17 @@ export function PoolBalance({ pool }: { pool: Pool }) {
heading: false,
},
{
name: 'NAV change',
value:
poolStates?.map((state, i) => {
if (i === 0) return ''
const prev = poolStates[i - 1].poolValue.toFloat()
const cur = state.poolValue.toFloat()
const change = (cur / prev - 1) * 100
return change < 0 ? change : `+${change}`
}) || [],
heading: false,
formatter: (v: any) => `${v < 0 ? '' : '+'}${formatPercentage(v, true, {}, 2)}`,
},
{
name: 'Asset value',
name: '+ Asset value',
value: poolStates?.map((state) => state.poolValue.toFloat() - state.poolState.totalReserve.toFloat()) || [],
heading: false,
},
// {
// name: '+ Offchain cash',
// value: poolStates?.map((state) => state.poolState.cashAssetValue.toFloat()) || [],
// heading: false,
// },
{
name: 'Onchain reserve',
name: '+ Onchain reserve',
value: poolStates?.map((state) => state.poolState.totalReserve.toFloat()) || [],
heading: false,
},
Expand Down
3 changes: 3 additions & 0 deletions centrifuge-js/src/modules/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ export type DailyTrancheState = {
export type DailyPoolState = {
poolState: {
portfolioValuation: CurrencyBalance
cashAssetValue: CurrencyBalance
totalReserve: CurrencyBalance
}
poolValue: CurrencyBalance
Expand Down Expand Up @@ -2215,6 +2216,7 @@ export function getPoolsModule(inst: Centrifuge) {
timestamp
totalReserve
portfolioValuation
cashAssetValue
blockNumber
sumPoolFeesChargedAmountByPeriod
sumPoolFeesAccruedAmountByPeriod
Expand Down Expand Up @@ -2400,6 +2402,7 @@ export function getPoolsModule(inst: Centrifuge) {
const poolState = {
id: state.id,
portfolioValuation: new CurrencyBalance(state.portfolioValuation, poolCurrency.decimals),
cashAssetValue: new CurrencyBalance(state.cashAssetValue, poolCurrency.decimals),
totalReserve: new CurrencyBalance(state.totalReserve, poolCurrency.decimals),
sumPoolFeesChargedAmountByPeriod: new CurrencyBalance(
state.sumPoolFeesChargedAmountByPeriod ?? 0,
Expand Down
1 change: 1 addition & 0 deletions centrifuge-js/src/types/subquery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type SubqueryPoolSnapshot = {
value: string
portfolioValuation: number
totalReserve: number
cashAssetValue: number
sumPoolFeesChargedAmountByPeriod: string | null
sumPoolFeesAccruedAmountByPeriod: string | null
sumBorrowedAmountByPeriod: string
Expand Down

0 comments on commit 2d6b3ec

Please sign in to comment.