UNPKG

@kamino-finance/kliquidity-sdk

Version:

Typescript SDK for interacting with the Kamino Liquidity (kliquidity) protocol

16 lines 670 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ZERO = void 0; exports.aprToApy = aprToApy; const decimal_js_1 = __importDefault(require("decimal.js")); function aprToApy(apr, compoundPeriods) { // if periods = 365 => daily compound // periods = 1 => yearly compound // (1 + apr / periods) ** periods - 1; return new decimal_js_1.default(1).add(apr.div(compoundPeriods)).pow(compoundPeriods).sub(1); } exports.ZERO = new decimal_js_1.default(0); //# sourceMappingURL=math.js.map