UNPKG

@marinade.finance/kamino-sdk

Version:
16 lines 689 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 = exports.aprToApy = void 0; 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.aprToApy = aprToApy; exports.ZERO = new decimal_js_1.default(0); //# sourceMappingURL=math.js.map