risk: disable for now

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2023-11-16 08:42:18 +01:00
parent c0c96abbec
commit 21b8c0dbfa
1 changed files with 16 additions and 11 deletions

View File

@ -461,20 +461,25 @@ export async function getRiskStats(
.map((bank) => bank.mint.toString()),
),
];
const prices = await getOnChainPriceForMints([
...new Set(
Array.from(group.banksMapByTokenIndex.values())
.flat()
.map((bank) => bank.mint.toString()),
),
]);
const onChainPrices = Object.fromEntries(
prices.map((price, i) => [mints[i], price]),
);
// Note:
// Disable for now
// Getting rate limited
// const prices = await getOnChainPriceForMints([
// ...new Set(
// Array.from(group.banksMapByTokenIndex.values())
// .flat()
// .map((bank) => bank.mint.toString()),
// ),
// ]);
// const onChainPrices = Object.fromEntries(
// prices.map((price, i) => [mints[i], price]),
// );
Array.from(group.banksMapByTokenIndex.values())
.flat()
.forEach((b) => {
b['onChainPrice'] = onChainPrices[b.mint.toBase58()];
b['onChainPrice'] = b.uiPrice;
});
// Clone group, and simulate change % price drop for all assets except stables