Skip to content

Commit

Permalink
fix daily balance
Browse files Browse the repository at this point in the history
  • Loading branch information
dtmkeng committed Feb 19, 2024
1 parent 8e2c66d commit 566a60e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions dexs/jediswap/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FetchResult, SimpleAdapter } from "../../adapters/types";
import { ChainBlocks, FetchOptions, FetchResult, SimpleAdapter } from "../../adapters/types";
import { CHAIN } from "../../helpers/chains";
import { gql, request } from "graphql-request";
import { getUniqStartOfTodayTimestamp } from "../../helpers/getUniSubgraphVolume";
Expand All @@ -17,7 +17,7 @@ const blackList: string[] = [
"0x3d56e63387bc55426941a47d6e8b7571d3b98c72253275d8c449a5f216e75a5"
]

const fetch = async (timestamp: number): Promise<FetchResult> => {
const fetch = async (timestamp: number, _: ChainBlocks, { createBalances }: FetchOptions): Promise<FetchResult> => {
const dayTimestamp = getUniqStartOfTodayTimestamp(new Date(timestamp * 1000));
const dayID = (dayTimestamp / 86400);
const query = gql`
Expand All @@ -36,11 +36,12 @@ const fetch = async (timestamp: number): Promise<FetchResult> => {
.filter((e: IGraph) => e.dayId === dayID)
.sort((a: IGraph, b: IGraph) => Number(b.dailyVolumeUSD) - Number(a.dailyVolumeUSD))
.filter((e: IGraph) => !blackList.includes(e.pairId))
.filter((e: IGraph) => Number(e.dailyVolumeUSD) < 10_000_000)
.reduce((acc: number, e: IGraph) => e.dailyVolumeUSD ? acc + Number(e.dailyVolumeUSD) : acc, 0);

const dailyVolume = createBalances();
dailyVolume.addCGToken('tether', volume);
return {
dailyVolume: volume ? `${volume}` : undefined,
// totalVolume: volume?.totalVolumeUSD ? `${volume.totalVolumeUSD}` : undefined,
dailyVolume: dailyVolume,
timestamp: dayTimestamp,
};
}
Expand Down

0 comments on commit 566a60e

Please sign in to comment.