Skip to content

Commit

Permalink
fix missing fees
Browse files Browse the repository at this point in the history
  • Loading branch information
dtmkeng committed Oct 1, 2024
1 parent c561353 commit d3e9c86
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions dexs/drift-protocol/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,23 @@ export async function fetchURLWithRetry(url: string, options: FetchOptions) {
const start = options.startOfDay;
const key = `${url}-${start}`;
if (!requests[key])
requests[key] = queryDune("4059377", {
requests[key] = queryDune("4117889", {
start: start,
end: start + 24 * 60 * 60,
})
return requests[key]
}

async function getPerpDimensions(options: FetchOptions): Promise<DimentionResult> {
const volumeResponse = await fetchURLWithRetry("4059377", options)
const volumeResponse = await fetchURLWithRetry("4117889", options)
const dailyVolume = volumeResponse[0].perpetual_volume;
return { dailyVolume };
const dailyFees = volumeResponse[0].total_taker_fee;
const dailyRevenue = volumeResponse[0].total_revenue;
return { dailyVolume, dailyFees, dailyRevenue };
}

async function getSpotDimensions(options: FetchOptions): Promise<DimentionResult> {
const volumeResponse = await fetchURLWithRetry("4059377", options)
const volumeResponse = await fetchURLWithRetry("4117889", options)
const dailyVolume = volumeResponse[0].spot_volume;
return { dailyVolume };
}
Expand Down

0 comments on commit d3e9c86

Please sign in to comment.