Skip to content

Commit

Permalink
fix: filter NaN and Infinity from data of trader pnl calc
Browse files Browse the repository at this point in the history
  • Loading branch information
fr0ntenddev committed Feb 23, 2023
1 parent 7b66e00 commit fec598a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/v2/dn-gmx-vault-apy/trader-pnl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ export const getTraderPnl = async (networkName: NetworkName) => {

return (foundDay?.totalTraderPnL || 0) / entry.juniorVaultInfo.vaultMarketValue
})

const dataSum = data
.filter((num) => !Number.isNaN(num) && Number.isFinite(num))
.reduce((acc, curr) => acc + curr, 0)

return data * 100
return dataSum * 100
}

0 comments on commit fec598a

Please sign in to comment.