Skip to content

Commit

Permalink
fix: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
fr0ntenddev committed Feb 23, 2023
1 parent fec598a commit 303be4a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions scripts/v2/dn-gmx-vault-apy/trader-pnl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'isomorphic-unfetch'

import type { NetworkName } from '@ragetrade/sdk'
import { fetchJson } from 'ethers/lib/utils'

import type {
Expand All @@ -8,7 +9,6 @@ import type {
VaultInfoResult
} from '../../aggregated'
import { combineStatsData } from '../../aggregated/util/combineStatsData'
import { NetworkName } from '@ragetrade/sdk'

export const getTraderPnl = async (networkName: NetworkName) => {
const { result: glpPnl }: { result: GlobalGlpPnlResult } = await fetchJson({
Expand Down Expand Up @@ -44,12 +44,11 @@ export const getTraderPnl = async (networkName: NetworkName) => {
}
)

const data = vaultInfo.data
.map((entry) => {
const foundDay = combined.find((d) => d.Day === entry.timestamp)
const data = vaultInfo.data.map((entry) => {
const foundDay = combined.find((d) => d.Day === entry.timestamp)

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

const dataSum = data
.filter((num) => !Number.isNaN(num) && Number.isFinite(num))
Expand Down

0 comments on commit 303be4a

Please sign in to comment.