diff --git a/src/mappings/handlers/blockHandlers.ts b/src/mappings/handlers/blockHandlers.ts index 5d3d12c0..7e274c61 100644 --- a/src/mappings/handlers/blockHandlers.ts +++ b/src/mappings/handlers/blockHandlers.ts @@ -66,7 +66,6 @@ async function _handleBlock(block: SubstrateBlock): Promise { for (const loanId in activeLoanData) { const asset = await AssetService.getById(pool.id, loanId) await asset.updateActiveAssetData(activeLoanData[loanId]) - await asset.updateUnrealizedProfit( await AssetPositionService.computeUnrealizedProfitAtPrice(asset.id, asset.currentPrice), await AssetPositionService.computeUnrealizedProfitAtPrice(asset.id, asset.notional) diff --git a/src/mappings/services/assetService.ts b/src/mappings/services/assetService.ts index 62085d46..23c77f71 100644 --- a/src/mappings/services/assetService.ts +++ b/src/mappings/services/assetService.ts @@ -227,13 +227,9 @@ export class AssetService extends Asset { public updateUnrealizedProfit(atMarketPrice: bigint, atNotional: bigint) { logger.info(`Updating unrealizedProfit for asset ${this.id}: ${atMarketPrice}, ${atNotional}`) + this.unrealizedProfitByPeriod = atMarketPrice - this.unrealizedProfitAtMarketPrice this.unrealizedProfitAtMarketPrice = atMarketPrice this.unrealizedProfitAtNotional = atNotional - - logger.info( - `byPeriod: ${atMarketPrice} - ${this.unrealizedProfitByPeriod} = ${atMarketPrice - this.unrealizedProfitByPeriod}` - ) - this.unrealizedProfitByPeriod = atMarketPrice - this.unrealizedProfitByPeriod } }