Skip to content

Commit

Permalink
Hotfix: Update total volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
devflowx committed Jul 4, 2023
1 parent a823b33 commit e2149ed
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions dexs/flowx-finance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ const getDailyVolume = () => {
volume7D
totalLiquidityInUSD
}
exchangeTotalVolume {
totalVolume
}
}
`;
};

const graphQLClient = new GraphQLClient(
"https://api.flowx.finance/flowx-be/graphql"
);

const getGQLClient = () => {
return graphQLClient;
};
Expand All @@ -29,19 +33,23 @@ export interface IExchangeStats {
fee24H: string;
totalLiquidity: string;
totalLiquidityInUSD: string;
transaction24H: number;
transaction24H: string;
volume24H: string;
volume7D: string;
}

export interface IExchangeTotalVolume {
totalVolume: string;
}

const fetch = async (timestamp: number) => {
const dayTimestamp = getUniqStartOfTodayTimestamp(new Date(timestamp * 1000));
const historicalVolume: IExchangeStats = (
await getGQLClient().request(getDailyVolume())
).exchangeStats;
const statsRes = await getGQLClient().request(getDailyVolume());
const historicalVolume: IExchangeStats = statsRes.exchangeStats;
const cumulativeVolume: IExchangeTotalVolume = statsRes.exchangeTotalVolume;
return {
totalVolume: historicalVolume.totalLiquidityInUSD
? historicalVolume.totalLiquidityInUSD
totalVolume: cumulativeVolume.totalVolume
? cumulativeVolume.totalVolume
: undefined,
dailyVolume: historicalVolume.volume24H
? `${historicalVolume.volume24H}`
Expand Down

0 comments on commit e2149ed

Please sign in to comment.