Gets an asset's price from the Fortress Protocol open price feed. The price
of the asset can be returned in any other supported asset value, including
all fTokens and underlyings.
example
const fortress = new Fortress(window.ethereum);
let price;
(asyncfunction () {
price = await fortress.getPrice(Fortress.BNB);
console.log('BNB in USD', price);
price = await fortress.getPrice(Fortress.DAI, Fortress.USDC); // supports fTokens tooconsole.log('DAI in USDC', price);
})().catch(console.error);
Parameters
asset: string
A string of a supported asset in which to find the
current price.
Default value inAsset: string = constants.USDC
Returns Promise<number>
Returns a string of the numeric value of the asset.
Gets an asset's price from the Fortress Protocol open price feed. The price of the asset can be returned in any other supported asset value, including all fTokens and underlyings.
const fortress = new Fortress(window.ethereum); let price; (async function () { price = await fortress.getPrice(Fortress.BNB); console.log('BNB in USD', price); price = await fortress.getPrice(Fortress.DAI, Fortress.USDC); // supports fTokens too console.log('DAI in USDC', price); })().catch(console.error);