lib-base.fees.borrowingrate

Home > @mosaic/lib-base > Fees > borrowingRate

Fees.borrowingRate() method

Calculate the current borrowing rate.

Signature:

borrowingRate(when?: Date): Decimal;

Parameters

Parameter
Type
Description

when

Date

Optional timestamp that can be used to calculate what the borrowing rate would decay to at a point of time in the future.

Returns:

Decimal

Remarks

By default, the fee is calculated at the time of the latest block. This can be overridden using the when parameter.

To calculate the borrowing fee in MoUSD, multiply the borrowed MoUSD amount by the borrowing rate.

Example

const fees = await mosaic.getFees();

const borrowedMoUSDAmount = 100;
const borrowingRate = fees.borrowingRate();
const borrowingFeeMoUSD = borrowingRate.mul(borrowedMoUSDAmount);

Last updated