Skip to content

Commit

Permalink
fix swapline
Browse files Browse the repository at this point in the history
  • Loading branch information
dtmkeng committed Feb 18, 2024
1 parent e94eedc commit 5c53049
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions dexs/swapline/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,15 @@ interface IVolumeall {
date: number;
}

const fetch = async (_timestamp: number , _: ChainBlocks, { startOfDay,api }: FetchOptions) => {
const fetch = async (_timestamp: number , _: ChainBlocks, { startOfDay,api, createBalances }: FetchOptions) => {
const dayTimestamp = startOfDay
const dailyVolume = createBalances();
const historicalVolume: IVolumeall[] = (await fetchURL(historicalVolumeEndpoint + api.getChainId()))[0]?.chainEntries;
const totalVolume = historicalVolume
.filter(volItem => volItem.date <= dayTimestamp)
.reduce((acc, { volumeUSD }) => acc + Number(volumeUSD), 0)

const dailyVolume = historicalVolume
const dailyVolumes = historicalVolume
.find(dayItem => dayItem.date === dayTimestamp)?.volumeUSD
dailyVolume.addCGToken('tether', dailyVolumes)

return {
totalVolume: totalVolume,
dailyVolume: dailyVolume,
timestamp: dayTimestamp,
}
Expand Down

0 comments on commit 5c53049

Please sign in to comment.