Skip to content

Commit

Permalink
equalizer fiz
Browse files Browse the repository at this point in the history
  • Loading branch information
slasher125 committed Nov 24, 2023
1 parent 816f2d2 commit 0385671
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/adaptors/equalizer-exchange/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,27 @@ const getApy = async () => {
.concat(EQUAL)
),
];
const priceKeys = tokens.map((i) => `fantom:${i}`).join(',');

const prices = (
await axios.get(`https://coins.llama.fi/prices/current/${priceKeys}`)
).data.coins;
const maxSize = 50;
const pages = Math.ceil(tokens.length / maxSize);
let pricesA = [];
let keys = '';
for (const p of [...Array(pages).keys()]) {
keys = tokens
.slice(p * maxSize, maxSize * (p + 1))
.map((i) => `fantom:${i}`)
.join(',')
.replaceAll('/', '');
pricesA = [
...pricesA,
(await axios.get(`https://coins.llama.fi/prices/current/${keys}`)).data
.coins,
];
}
let prices = {};
for (const p of pricesA) {
prices = { ...prices, ...p };
}

const pools = allPairs.map((p, i) => {
const poolMeta = metaData[i];
Expand Down

0 comments on commit 0385671

Please sign in to comment.