Skip to content

Commit

Permalink
add econia fees support
Browse files Browse the repository at this point in the history
  • Loading branch information
CRBl69 committed Mar 15, 2024
1 parent c61a969 commit 0b3dc4a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions dexs/econia/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,23 @@ const fetch = async (timestamp: number) => {
return { daily: prev.daily + curr.daily, total: prev.total + curr.total };
}, {daily: 0, total: 0});

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

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

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

Expand Down

0 comments on commit 0b3dc4a

Please sign in to comment.