Skip to content

Commit

Permalink
add total fees for econia
Browse files Browse the repository at this point in the history
  • Loading branch information
CRBl69 committed Mar 24, 2024
1 parent 0b3dc4a commit a8e2144
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions dexs/econia/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,22 @@ const fetch = async (timestamp: number) => {

const feesPerMarket = await Promise.all(
markets.map(async m =>
await fetchURL(`${BASE_URL}/fees_24h?market_id=eq.${m.market_id}&day=eq.${dayISO}`)
await fetchURL(`${BASE_URL}/rpc/fees?market_id=${m.market_id}&time=${dayISO}`)
.then(res => (
{ daily: res[0].fees / 1000000 }
{ daily: res[0].daily / 1000000, total: res[0].total / 1000000 }
))
)
);

const fees = feesPerMarket.reduce((prev, curr) => {
return { daily: prev.daily + curr.daily };
}, { daily: 0 });
return { daily: prev.daily + curr.daily, total: prev.total + curr.total };
}, { daily: 0, total: 0 });

let res = {
totalVolume: `${volumes.total}`,
dailyVolume: `${volumes.daily}`,
dailyFees: `${fees.daily}`,
totalFees: `${fees.total}`,
timestamp: dayTimestamp,
};

Expand Down

0 comments on commit a8e2144

Please sign in to comment.