Skip to content

Commit

Permalink
fix: normalize coingecko results
Browse files Browse the repository at this point in the history
  • Loading branch information
aramalipoor committed Dec 29, 2022
1 parent 67e8690 commit 4e4595f
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,17 @@ export const CoinGeckoProvider = ({
const data: PricesDictionariesBySymbol = {} as PricesDictionariesBySymbol;

for (const coinGeckoSymbol in coinGeckoResult) {
const pairs = Object.entries(coinGeckoResult[coinGeckoSymbol]);
const convertedPairs = pairs.map(([key, value]) => [
key.toUpperCase(),
value,
]);
data[convertCoinGeckoSymbol(coinGeckoSymbol)] =
coinGeckoResult[coinGeckoSymbol];
Object.fromEntries(convertedPairs);
}

// Override for USD symbols
for (const sym in DOLLAR_STABLECOIN_SYMBOLS) {
for (const sym of DOLLAR_STABLECOIN_SYMBOLS) {
data[sym.toUpperCase()] = {
USD: 1,
};
Expand Down

0 comments on commit 4e4595f

Please sign in to comment.