centrifuge / pools-subql

Subquery for Pools on Centrifuge
MIT License
1 stars 4 forks source link

Calculate YTM per asset tx and per asset #208

Open hieronx opened 1 week ago

hieronx commented 1 week ago

YTM calculation: https://github.com/centrifuge/apps/blob/main/centrifuge-app/src/pages/Loan/TransactionTable.tsx#L86


type AssetTransaction @entity {
  ..
  yieldToMaturity: BigInt # REPAID transactions only
}

type Asset @entity {
  ..
  weightedPurchaseYTM: BigInt # weighted average of asset transactions
  currentYTM: BigInt # based on current face value and date
}