financial.js

"use strict";
/***************************************************
* Licensed Materials - Property of HCL.
* (c)Copyright HCL America, Inc. 2023-2024
****************************************************/
Object.defineProperty(exports, "__esModule", { value: true });
exports.tbillYield = exports.tbillPrice = exports.tbillEq = exports.syd = exports.sln = exports.rri = exports.received = exports.rate = exports.pv = exports.priceMat = exports.priceDisc = exports.price = exports.pPmt = exports.pmt = exports.pDuration = exports.oddLYield = exports.oddLPrice = exports.oddFYield = exports.oddFPrice = exports.npv = exports.nPer = exports.nominal = exports.mirr = exports.mDuration = exports.isPmt = exports.irr = exports.iPmt = exports.intRate = exports.fvSchedule = exports.fv = exports.effect = exports.duration = exports.dollarFr = exports.dollarDe = exports.disc = exports.ddb = exports.db = exports.cumPrinc = exports.cumIPmt = exports.coupPCD = exports.coupNum = exports.coupNCD = exports.coupDaySnc = exports.coupDays = exports.coupDayBS = exports.amorLinc = exports.amorDegrc = exports.accrIntM = exports.accrInt = exports._openFormula = void 0;
exports.yieldMat = exports.yieldDisc = exports.Yield = exports.xnpv = exports.xirr = exports.vdb = void 0;
const tslib_1 = require("tslib");
/**
 * @file Financial
 * @module financial
 * @category Financial
 */
const openf = tslib_1.__importStar(require("../openformula/financial"));
exports._openFormula = openf;
//-----------------------------
// Open Formula financial
/**
 * Returns the accrued interest for a security that pays periodic interest.
 *
 * @param {string|number|Date} issue The security's issue date.
 * @param {string|number|Date} first_interest The security's first interest date.
 * @param {string|number|Date} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {number} rate The security's annual coupon rate.
 * @param {number} par The security's par value. If you omit par, ACCRINT uses $1,000.
 * @param {number} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
 * @param {number} [basis] Optional. The type of day count basis to use. The default is 0.
 * @returns {number} The accrued interest.
 * @example
 * rosettajs.Financial.accrInt('2/2/2012', '12/4/2013', '3/30/2012', 0.1, 1000, 4, 1); // Returns 15.57377
 */
function accrInt(issue, first_interest, settlement, rate, par, frequency, basis) {
    return openf.ACCRINT(issue, first_interest, settlement, rate, par, frequency, basis);
}
exports.accrInt = accrInt;
/**
 *
 * Returns the accrued interest for a security that pays interest at maturity.
 *
 * Category: Financial
 *
 * @param {*} issue The security's issue date.
 * @param {*} settlement The security's maturity date.
 * @param {*} rate The security's annual coupon rate.
 * @param {*} par The security's par value. If you omit par, ACCRINTM uses $1,000.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function accrIntM() {
    return openf.ACCRINTM();
}
exports.accrIntM = accrIntM;
/**
 * Returns the depreciation for each accounting period by using a depreciation coefficient.
 *
 * Category: Financial
 *
 * @param {*} cost The cost of the asset.
 * @param {*} date_purchased The date of the purchase of the asset.
 * @param {*} first_period The date of the end of the first period.
 * @param {*} salvage The salvage value at the end of the life of the asset.
 * @param {*} period The period.
 * @param {*} rate The rate of depreciation.
 * @param {*} basis Optional. The year basis to be used.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function amorDegrc() {
    return openf.AMORDEGRC();
}
exports.amorDegrc = amorDegrc;
/**
 * Returns the depreciation for each accounting period.
 *
 * Category: Financial
 *
 * @param {*} cost The cost of the asset.
 * @param {*} date_purchased The date of the purchase of the asset.
 * @param {*} first_period The date of the end of the first period.
 * @param {*} salvage The salvage value at the end of the life of the asset.
 * @param {*} period The period.
 * @param {*} rate The rate of depreciation.
 * @param {*} basis Optional. The year basis to be used.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function amorLinc() {
    return openf.AMORLINC();
}
exports.amorLinc = amorLinc;
/**
 * Returns the number of days from the beginning of the coupon period to the settlement date.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function coupDayBS() {
    return openf.COUPDAYBS();
}
exports.coupDayBS = coupDayBS;
/**
 *
 * Returns the number of days in the coupon period that contains the settlement date.
 *
 * @param {string|number|Date} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {string|number|Date} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {number} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
 * @param {number} [basis] Optional. The type of day count basis to use. Default is 0.
 * @returns {number} The number of days in the coupon period containing the settlement date
 * @example
 * rosettajs.Financial.coupDays("01/25/2021","11/15/2021", 2, 1); // Returns 181
 */
function coupDays(settlement, maturity, frequency, basis) {
    return openf.COUPDAYS(settlement, maturity, frequency, basis);
}
exports.coupDays = coupDays;
/**
 * Returns the number of days from the settlement date to the next coupon date.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function coupDaySnc() {
    return openf.COUPDAYSNC();
}
exports.coupDaySnc = coupDaySnc;
/**
 * Returns the next coupon date after the settlement date.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function coupNCD() {
    return openf.COUPNCD();
}
exports.coupNCD = coupNCD;
/**
 * Returns the number of coupons payable between the settlement date and maturity date.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented
 */
function coupNum() {
    return openf.COUPNUM();
}
exports.coupNum = coupNum;
/**
 * Returns the previous coupon date before the settlement date.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented
 */
function coupPCD() {
    return openf.COUPPCD();
}
exports.coupPCD = coupPCD;
/**
 * Returns the cumulative interest paid between two periods.
 *
 * Category: Financial
 *
 * @param {number} intrate The interest rate.
 * @param {number} numper The total number of payment periods.
 * @param {number} pvalue The present value.
 * @param {number} start_period The first period in the calculation. Payment periods are numbered beginning with 1.
 * @param {number} end_period The last period in the calculation.
 * @param {number} type The timing of the payment.
 * @returns {number} the cumulative interest paid between two periods or an error if the arguments are incorrect.
 */
function cumIPmt(intrate, numper, pvalue, start_period, end_period, type) {
    return openf.CUMIPMT(intrate, numper, pvalue, start_period, end_period, type);
}
exports.cumIPmt = cumIPmt;
/**
 * Returns the cumulative principal paid on a loan between two periods.
 *
 * Category: Financial
 *
 * @param {number} intrate The interest rate.
 * @param {number} numper The total number of payment periods.
 * @param {number} pvalue The present value.
 * @param {number} start_period The first period in the calculation. Payment periods are numbered beginning with 1.
 * @param {number} end_period The last period in the calculation.
 * @param {number} type The timing of the payment.
 * @returns {number} returns an error if input is wrong, otherwise returns cumulative principle as a number
 */
function cumPrinc(intrate, numper, pvalue, start_period, end_period, type) {
    return openf.CUMPRINC(intrate, numper, pvalue, start_period, end_period, type);
}
exports.cumPrinc = cumPrinc;
/**
 * Returns the depreciation of an asset for a specified period by using the fixed-declining balance method.
 *
 * Category: Financial
 *
 * @param {number} initcost The initial cost of the asset.
 * @param {number} salvageval The value at the end of the depreciation (sometimes called the salvage value of the asset).
 * @param {number} uselife The number of periods over which the asset is being depreciated (sometimes called the useful life of the asset).
 * @param {number} depperiod The period for which you want to calculate the depreciation. Period must use the same units as life.
 * @param {number} [months] Optional. The number of months in the first year. If month is omitted, it is assumed to be 12.
 * @returns {number} returns the depreciation as a number or an error if the arguments are incorrect.
 */
function db(initcost, salvageval, uselife, depperiod, months = 12) {
    return openf.DB(initcost, salvageval, uselife, depperiod, months);
}
exports.db = db;
/**
 * Returns the depreciation of an asset for a specified period by using the double-declining balance method or some other method that you specify.
 *
 * Category: Financial
 *
 * @param {number} initcost The initial cost of the asset.
 * @param {number} salvageval The value at the end of the depreciation (sometimes called the salvage value of the asset). This value can be 0.
 * @param {number} uselife The number of periods over which the asset is being depreciated (sometimes called the useful life of the asset).
 * @param {number} depperiod The period for which you want to calculate the depreciation. Period must use the same units as life.
 * @param {number} [decfactor] Optional. The rate at which the balance declines. If factor is omitted, it is assumed to be 2 (the double-declining balance method).
 * @returns {number} the depreciation of an asset for a specified period using fixed double declining balance or an error if the arguments are not formatted properly.
 */
function ddb(initcost, salvageval, uselife, depperiod, decfactor) {
    return openf.DDB(initcost, salvageval, uselife, depperiod, decfactor);
}
exports.ddb = ddb;
/**
 * Returns the discount rate for a security.
 *
 * @param {string|number|Date} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {string|number|Date} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {number} pr The security's price per $100 face value.
 * @param {number} redemption The security's redemption value per $100 face value.
 * @param {number} [basis] Optional. The type of day count basis to use. Default is 0.
 * @returns {number} The discount rate of the security.
 * @example
 * rosettajs.Financial.disc("01/04/2023", "12/28/2023", 95.6145, 100, 2); // returns 0.0441
 */
function disc(settlement, maturity, pr, redemption, basis) {
    return openf.DISC(settlement, maturity, pr, redemption, basis);
}
exports.disc = disc;
/**
 * Converts a dollar price, expressed as a fraction, into a dollar price, expressed as a decimal number.
 *
 * Category: Financial
 *
 * @param {number} fractional_dollar A number expressed as an integer part and a fraction part, separated by a decimal symbol.
 * @param {number} fraction The integer to use in the denominator of the fraction.
 * @returns {number} a decimal number that results from converting a dollar price, expressed as a fraction, into a dollar price, expressed as a decimal number. Or an error if the arguments are not formatted properly.
 */
function dollarDe(fractional_dollar, fraction) {
    return openf.DOLLARDE(fractional_dollar, fraction);
}
exports.dollarDe = dollarDe;
/**
 * Converts a dollar price, expressed as a decimal number, into a dollar price, expressed as a fraction.
 *
 * Category: Financial
 *
 * @param {number} decimal_dollar A decimal number.
 * @param {number} fraction The integer to use in the denominator of a fraction.
 * @returns {number} a fraction that results from converting  dollar price, expressed as a decimal number, into a dollar price, expressed as a fraction. Or an error if he arguments arent formatted properly.
 */
function dollarFr(decimal_dollar, fraction) {
    return openf.DOLLARFR(decimal_dollar, fraction);
}
exports.dollarFr = dollarFr;
/**
 * Returns the annual duration of a security with periodic interest payments.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} coupon The security's annual coupon rate.
 * @param {*} yld The security's annual yield.
 * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented
 */
function duration() {
    return openf.DURATION();
}
exports.duration = duration;
/**
 * Returns the effective annual interest rate.
 *
 * Category: Financial
 *
 * @param {number} nominal_intrate The nominal interest rate.
 * @param {number} nperyr The number of compounding periods per year.
 * @returns {number} effective annual interest rate or an error if the arguments are not formated properly.
 */
function effect(nominal_intrate, nperyr) {
    return openf.EFFECT(nominal_intrate, nperyr);
}
exports.effect = effect;
/**
 * Returns the future value of an investment.
 *
 * Category: Financial
 *
 * @param {number} intrate The interest rate per period.
 * @param {number} numper The total number of payment periods in an annuity.
 * @param {number} pmt The payment made each period; it cannot change over the life of the annuity. Typically, pmt contains principal and interest but no other fees or taxes. If pmt is omitted, you must include the pv argument.
 * @param {number} [pv] Optional. The present value, or the lump-sum amount that a series of future payments is worth right now. If pv is omitted, it is assumed to be 0 (zero), and you must include the pmt argument.
 * @param {number} [type] Optional. The number 0 or 1 and indicates when payments are due. If type is omitted, it is assumed to be 0.
 * @returns {number} the future value of an investment or an error if the arguments are not formatted properly.
 */
function fv(intrate, numper, pmt, pv = 0, type = 0) {
    return openf.FV(intrate, numper, pmt, pv, type);
}
exports.fv = fv;
/**
 * Returns the future value of an initial principal after applying a series of compound interest rates.
 *
 * Category: Financial
 *
 * @param {number} principal The present value.
 * @param {number} schedule An array of interest rates to apply.
 * @returns {number}  the future value of an initial principal after applying a series of compound interest rates or an error if arguments are formatted improperly.
 */
function fvSchedule(principal, schedule) {
    return openf.FVSCHEDULE(principal, schedule);
}
exports.fvSchedule = fvSchedule;
/**
 * Returns the interest rate for a fully invested security.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} investment The amount invested in the security.
 * @param {*} redemption The amount to be received at maturity.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function intRate() {
    return openf.INTRATE();
}
exports.intRate = intRate;
/**
 * Returns the interest payment for an investment for a given period.
 *
 * Category: Financial
 *
 * @param {number} intrate The interest rate per period.
 * @param {number} period The period for which you want to find the interest and must be in the range 1 to nper.
 * @param {number} numper The total number of payment periods in an annuity.
 * @param {number} pvalue The present value, or the lump-sum amount that a series of future payments is worth right now.
 * @param {number} [fvalue] Optional. The future value, or a cash balance you want to attain after the last payment is made. If fv is omitted, it is assumed to be 0 (the future value of a loan, for example, is 0).
 * @param {number} [type] Optional. The number 0 or 1 and indicates when payments are due. If type is omitted, it is assumed to be 0.
 * @returns {number} the interest payment for an investment for a given period or an error if the arguments are not formatted properly.
 */
function iPmt(intrate, period, numper, pvalue, fvalue = 0, type = 0) {
    return openf.IPMT(intrate, period, numper, pvalue, fvalue, type);
}
exports.iPmt = iPmt;
/**
 * Returns the internal rate of return for a series of cash flows.
 *
 * Category: Financial
 *
 * @param {Array} values An array or a reference to values that contain numbers for which you want to calculate the internal rate of return.
 - Values must contain at least one positive value and one negative value to calculate the internal rate of return.
 - IRR uses the order of values to interpret the order of cash flows. Be sure to enter your payment and income values in the sequence you want.
 - If an array or reference argument contains text, logical values, or empty values, those values are ignored.
 * @param {number} [guess] Optional. A number that you guess is close to the result of IRR.
 - Microsoft Excel uses an iterative technique for calculating IRR. Starting with guess, IRR cycles through the calculation until the result is accurate within 0.00001 percent. If IRR can't find a result that works after 20 tries, the #NUM! error value is returned.
 - In most cases you do not need to provide guess for the IRR calculation. If guess is omitted, it is assumed to be 0.1 (10 percent).
 - If IRR gives the #NUM! error value, or if the result is not close to what you expected, try again with a different value for guess.
 * @returns {number} the internal rate of return for a series of cash flows or an error if the arguments are incorrect.
 */
function irr(values, guess = 0.1) {
    return openf.IRR(values, guess);
}
exports.irr = irr;
/**
 * Calculates the interest paid during a specific period of an investment.
 *
 * Category: Financial
 *
 * @param {number} intrate The interest rate for the investment.
 * @param {number} period The period for which you want to find the interest, and must be between 1 and Nper.
 * @param {number} numper The total number of payment periods for the investment.
 * @param {number} pvalue The present value of the investment. For a loan, Pv is the loan amount.
 *
 * @returns {number} the interest paid during a specific period of an investment or an error if the arguments are incorrect.
 */
function isPmt(intrate, period, numper, pvalue) {
    return openf.ISPMT(intrate, period, numper, pvalue);
}
exports.isPmt = isPmt;
/**
 * Returns the Macauley modified duration for a security with an assumed par value of $100.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} coupon The security's annual coupon rate.
 * @param {*} yld The security's annual yield.
 * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function mDuration() {
    return openf.MDURATION();
}
exports.mDuration = mDuration;
/**
 * Returns the internal rate of return where positive and negative cash flows are financed at different rates.
 *
 * Category: Financial
 *
 * @param {Array} values An array or a reference to values that contain numbers. These numbers represent a series of payments (negative values) and income (positive values) occurring at regular periods.
 - Values must contain at least one positive value and one negative value to calculate the modified internal rate of return. Otherwise, MIRR returns the #DIV/0! error value.
 - If an array or reference argument contains text, logical values, or empty values, those values are ignored; however, values with the value zero are included.
 * @param {number} finance_intrate The interest rate you pay on the money used in the cash flows.
 * @param {number} reinvest_intrate The interest rate you receive on the cash flows as you reinvest them.
 * @returns {number} the internal rate of return where positive and negative cash flows are financed at different rates or an error when the arguments arent formatted properly.
 */
function mirr(values, finance_intrate, reinvest_intrate) {
    return openf.MIRR(values, finance_intrate, reinvest_intrate);
}
exports.mirr = mirr;
/**
 * Returns the annual nominal interest rate.
 *
 * Category: Financial
 *
 * @param {number} effect_intrate The effective interest rate.
 * @param {number} numpery The number of compounding periods per year.
 * @returns {number} the annual nominal interest rate or an error if the arguments arent formatted properly
 */
function nominal(effect_intrate, numpery) {
    return openf.NOMINAL(effect_intrate, numpery);
}
exports.nominal = nominal;
/**
 * Returns the number of periods for an investment.
 *
 * Category: Financial
 *
 * @param {number} intrate The interest rate per period.
 * @param {number} payment The payment made each period; it cannot change over the life of the annuity. Typically, pmt contains principal and interest but no other fees or taxes.
 * @param {number} pvalue The present value, or the lump-sum amount that a series of future payments is worth right now.
 * @param {number} [fvalue] Optional. The future value, or a cash balance you want to attain after the last payment is made. If fv is omitted, it is assumed to be 0 (the future value of a loan, for example, is 0).
 * @param {number} [type] Optional. The number 0 or 1 and indicates when payments are due.
 * @returns {number} the number of periods for an invesment or an error if the arguments are not formatted properly.
 */
function nPer(intrate, payment, pvalue, fvalue = 0, type = 0) {
    return openf.NPER(intrate, payment, pvalue, fvalue, type);
}
exports.nPer = nPer;
/**
 * Returns the net present value of an investment based on a series of periodic cash flows and a discount rate.
 *
 * Category: Financial
 *
 * @param {number} drate The rate of discount over the length of one period.
 * @param {number[]} values value1, value2, ... Value1 is required, subsequent values are optional. 1 to 254 arguments representing the payments and income.
 - value1, value2, ... must be equally spaced in time and occur at the end of each period.
 - NPV uses the order of value1, value2, ... to interpret the order of cash flows. Be sure to enter your payment and income values in the correct sequence.
 - Arguments that are empty values, logical values, or text representations of numbers, error values, or text that cannot be translated into numbers are ignored.
 - If an argument is an array or reference, only numbers in that array or reference are counted. Empty values, logical values, text, or error values in the array or reference are ignored.
 * @returns {number} net present value as a number or an error if the arguments dont match requirements.
 */
function npv(drate, ...values) {
    return openf.NPV(drate, ...values);
}
exports.npv = npv;
/**
 * Returns the price per $100 face value of a security with an odd first period.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} issue The security's issue date.
 * @param {*} first_coupon The security's first coupon date.
 * @param {*} rate The security's interest rate.
 * @param {*} yld The security's annual yield.
 * @param {*} redemption The security's redemption value per $100 face value.
 * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function oddFPrice() {
    return openf.ODDFPRICE();
}
exports.oddFPrice = oddFPrice;
/**
 * Returns the yield of a security with an odd first period.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} issue The security's issue date.
 * @param {*} first_coupon The security's first coupon date.
 * @param {*} rate The security's interest rate.
 * @param {*} pr The security's price.
 * @param {*} redemption The security's redemption value per $100 face value.
 * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function oddFYield() {
    return openf.ODDFYIELD();
}
exports.oddFYield = oddFYield;
/**
 * Returns the price per $100 face value of a security with an odd last period.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} last_interest The security's last coupon date.
 * @param {*} rate The security's interest rate.
 * @param {*} yld The security's annual yield.
 * @param {*} redemption The security's redemption value per $100 face value.
 * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function oddLPrice() {
    return openf.ODDLPRICE();
}
exports.oddLPrice = oddLPrice;
/**
 * Returns the yield of a security with an odd last period.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} last_interest The security's last coupon date.
 * @param {*} rate The security's interest rate
 * @param {*} pr The security's price.
 * @param {*} redemption The security's redemption value per $100 face value.
 * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function oddLYield() {
    return openf.ODDLYIELD();
}
exports.oddLYield = oddLYield;
/**
 * Returns the number of periods required by an investment to reach a specified value.
 *
 * Category: Financial
 *
 * @param {number} intrate Rate is the interest rate per period.
 * @param {number} pvalue Pv is the present value of the investment.
 * @param {number} fvalue Fv is the desired future value of the investment.
 * @returns {number} the number of periods required as a number or an error if arguments are not formatted properly.
 */
function pDuration(intrate, pvalue, fvalue) {
    return openf.PDURATION(intrate, pvalue, fvalue);
}
exports.pDuration = pDuration;
/**
 * Returns the periodic payment for an annuity.
 *
 * Category: Financial
 *
 * @param {number} intrate The interest rate for the loan.
 * @param {number} numper The total number of payments for the loan.
 * @param {number} pvalue The present value, or the total amount that a series of future payments is worth now; also known as the principal.
 * @param {number} [fvalue] Optional. The future value, or a cash balance you want to attain after the last payment is made. If fv is omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0.
 * @param {number} [type] Optional. The number 0 (zero) or 1 and indicates when payments are due.
 * @returns {number} the periodic payment for an annuity as a number or error if the arguments are not formatted properly.

 */
function pmt(intrate, numper, pvalue, fvalue = 0, type = 0) {
    return openf.PMT(intrate, numper, pvalue, fvalue, type);
}
exports.pmt = pmt;
/**
 * Returns the payment on the principal for an investment for a given period.
 *
 * Category: Financial
 *
 * @param {number} intrate The interest rate per period.
 * @param {number} period Specifies the period and must be in the range 1 to nper.
 * @param {number} numper The total number of payment periods in an annuity.
 * @param {number} pvalue The present value — the total amount that a series of future payments is worth now.
 * @param {number} [fvalue] Optional. The future value, or a cash balance you want to attain after the last payment is made. If fv is omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0.
 * @param {number} [type] Optional. The number 0 or 1 and indicates when payments are due.
 * @returns {number} principal payment for investment over a specific period as a number, or an error if the arguments are not formated properly.
 */
function pPmt(intrate, period, numper, pvalue, fvalue = 0, type = 0) {
    return openf.PPMT(intrate, period, numper, pvalue, fvalue, type);
}
exports.pPmt = pPmt;
/**
 * Returns the price per $100 face value of a security that pays periodic interest.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} rate The security's annual coupon rate.
 * @param {*} yld The security's annual yield.
 * @param {*} redemption The security's redemption value per $100 face value.
 * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function price() {
    return openf.PRICE();
}
exports.price = price;
/**
 * Returns the price per $100 face value of a discounted security.
 *
 * @param {string|number|Date} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {string|number|Date} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {number} discount The security's discount rate.
 * @param {number} redemption The security's redemption value per $100 face value.
 * @param {number} basis Optional. The type of day count basis to use. The default is 0.
 * @returns {number} Price per $100 face value of the discounted security.
 * @example
 * rosettajs.Financial.priceDisc("2/16/2020","3/1/2020",0.0524,100,2); // Returns 99.80
 */
function priceDisc(settlement, maturity, discount, redemption, basis) {
    return openf.PRICEDISC(settlement, maturity, discount, redemption, basis);
}
exports.priceDisc = priceDisc;
/**
 * Returns the price per $100 face value of a security that pays interest at maturity.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} issue The security's issue date, expressed as a serial date number.
 * @param {*} rate The security's interest rate at date of issue.
 * @param {*} yld The security's annual yield.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function priceMat() {
    return openf.PRICEMAT();
}
exports.priceMat = priceMat;
/**
 * Returns the present value of an investment.
 *
 * Category: Financial
 *
 * @param {number} intrate The interest rate per period. For example, if you obtain an automobile loan at a 10 percent annual interest rate and make monthly payments, your interest rate per month is 10%/12, or 0.83%. You would enter 10%/12, or 0.83%, or 0.0083, into the formula as the rate.
 * @param {number} periods The total number of payment periods in an annuity. For example, if you get a four-year car loan and make monthly payments, your loan has 4*12 (or 48) periods. You would enter 48 into the formula for nper.
 * @param {number} payment The payment made each period and cannot change over the life of the annuity. Typically, pmt includes principal and interest but no other fees or taxes. For example, the monthly payments on a $10,000, four-year car loan at 12 percent are $263.33. You would enter -263.33 into the formula as the pmt. If pmt is omitted, you must include the fv argument.
 * @param {number} fvalue Optional. The future value, or a cash balance you want to attain after the last payment is made. If fv is omitted, it is assumed to be 0 (the future value of a loan, for example, is 0). For example, if you want to save $50,000 to pay for a special project in 18 years, then $50,000 is the future value. You could then make a conservative guess at an interest rate and determine how much you must save each month. If fv is omitted, you must include the pmt argument.
 * @param {number} [type] Optional. The number 0 or 1 and indicates when payments are due.
 * @returns {number} present value of an investment or an error if arguments are not formatted properly.
 */
function pv(intrate, periods, payment, fvalue = 0, type = 0) {
    return openf.PV(intrate, periods, payment, fvalue, type);
}
exports.pv = pv;
/**
 * Returns the interest rate per period of an annuity.
 *
 * Category: Financial
 *
 * @param {number} periods The total number of payment periods in an annuity.
 * @param {number} payment The payment made each period and cannot change over the life of the annuity. Typically, pmt includes principal and interest but no other fees or taxes. If pmt is omitted, you must include the fv argument.
 * @param {number} pvalue The present value — the total amount that a series of future payments is worth now.
 * @param {number} [fvalue] Optional. The future value, or a cash balance you want to attain after the last payment is made. If fv is omitted, it is assumed to be 0 (the future value of a loan, for example, is 0). If fv is omitted, you must include the pmt argument.
 * @param {number} [type] Optional. The number 0 or 1 and indicates when payments are due.
 * @param {number} [guess] Optional. Your guess for what the rate will be. If you omit guess, it is assumed to be 10 percent. If RATE does not converge, try different values for guess. RATE usually converges if guess is between 0 and 1.
 - If you omit guess, it is assumed to be 10 percent.
 - If RATE does not converge, try different values for guess. RATE usually converges if guess is between 0 and 1.
 * @returns {number} the interest rate per period of an annuity or an error if the arguments arent formatted properly.
 */
function rate(periods, payment, pvalue, fvalue = 0, paytype = 0, guess = 0.01) {
    return openf.RATE(periods, payment, pvalue, fvalue, paytype, guess);
}
exports.rate = rate;
/**
 * Returns the amount received at maturity for a fully invested security.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} investment The amount invested in the security.
 * @param {*} discount The security's discount rate.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function received() {
    return openf.RECEIVED();
}
exports.received = received;
/**
 * Returns an equivalent interest rate for the growth of an investment.
 *
 * Category: Financial
 *
 * @param {number} periods The number of periods for the investment.
 * @param {number} pvalue The present value of the investment.
 * @param {number} fvalue The future value of the investment.
 * @returns {number} an equivalent interestrate for growth of an investment or an error if arguments are not formatted properly.
 */
function rri(periods, pvalue, fvalue) {
    return openf.RRI(periods, pvalue, fvalue);
}
exports.rri = rri;
/**
 * Returns the straight-line depreciation of an asset for one period.
 *
 * Category: Financial
 *
 * @param {number} initcost The initial cost of the asset.
 * @param {number} salvageval The value at the end of the depreciation (sometimes called the salvage value of the asset).
 * @param {number} uselife The number of periods over which the asset is depreciated (sometimes called the useful life of the asset).
 * @returns {number} returns the straightline depreciation of an asset for 1 period or error if arguments are not formatted properly.
 */
function sln(initcost, salvageval, uselife) {
    return openf.SLN(initcost, salvageval, uselife);
}
exports.sln = sln;
/**
 * Returns the sum-of-years' digits depreciation of an asset for a specified period.
 *
 * Category: Financial
 *
 * @param {number} initcost The initial cost of the asset.
 * @param {number} salvageval The value at the end of the depreciation (sometimes called the salvage value of the asset).
 * @param {number} uselife The number of periods over which the asset is depreciated (sometimes called the useful life of the asset).
 * @param {number} periods The period and must use the same units as life.
 * @returns {number} the sum-of-years' digits depreciation of an asset for a specified period or an error if arguments are not formatted properly.
 */
function syd(initcost, salvageval, uselife, periods) {
    return openf.SYD(initcost, salvageval, uselife, periods);
}
exports.syd = syd;
/**
 * Returns the bond-equivalent yield for a Treasury bill.
 *
 * Category: Financial
 *
 * @param {Date|number|string} settlement_date The Treasury bill's settlement date. The security settlement date is the date after the issue date when the Treasury bill is traded to the buyer.
 * @param {Date|number|string} maturity_date The Treasury bill's maturity date. The maturity date is the date when the Treasury bill expires.
 * @param {number} discount_rate The Treasury bill's discount rate.
 * @returns {number} Returns the bond-equivalent yield for a Treasury bill or an error if the arguments are not formatted properly.
 */
function tbillEq(settlement_date, maturity_date, discount_rate) {
    return openf.TBILLEQ(settlement_date, maturity_date, discount_rate);
}
exports.tbillEq = tbillEq;
/**
 * Returns the price per $100 face value for a Treasury bill.
 *
 * Category: Financial
 *
 * @param {Date|number|string} settlement_date The Treasury bill's settlement date. The security settlement date is the date after the issue date when the Treasury bill is traded to the buyer.
 * @param {Date|number|string} maturity_date The Treasury bill's maturity date. The maturity date is the date when the Treasury bill expires.
 * @param {number} discount_rate The Treasury bill's discount rate.
 * @returns {number} returns the price per $100 facec value for a treasury bill or an error if the arguments arent formatted properly.
 */
function tbillPrice(settlement_date, maturity_date, discount_rate) {
    return openf.TBILLPRICE(settlement_date, maturity_date, discount_rate);
}
exports.tbillPrice = tbillPrice;
/**
 * Returns the yield for a Treasury bill.
 *
 * Category: Financial
 *
 * @param {Date|number|string} settlement_date The Treasury bill's settlement date. The security settlement date is the date after the issue date when the Treasury bill is traded to the buyer.
 * @param {Date|number|string} maturity_date The Treasury bill's maturity date. The maturity date is the date when the Treasury bill expires.
 * @param {number} price The Treasury bill's price per $100 face value.
 * @returns {number} the yield for a treasury bill or an error if the arguments are not formated properly
 */
function tbillYield(settlement_date, maturity_date, price) {
    return openf.TBILLYIELD(settlement_date, maturity_date, price);
}
exports.tbillYield = tbillYield;
/**
 * Returns the depreciation of an asset for a specified or partial period by using a declining balance method.
 *
 * Category: Financial
 *
 * @param {*} cost The initial cost of the asset.
 * @param {*} salvage The value at the end of the depreciation (sometimes called the salvage value of the asset). This value can be 0.
 * @param {*} life The number of periods over which the asset is depreciated (sometimes called the useful life of the asset).
 * @param {*} start_period The starting period for which you want to calculate the depreciation. Start_period must use the same units as life.
 * @param {*} end_period The ending period for which you want to calculate the depreciation. End_period must use the same units as life.
 * @param {*} factor Optional. The rate at which the balance declines. If factor is omitted, it is assumed to be 2 (the double-declining balance method). Change factor if you do not want to use the double-declining balance method. For a description of the double-declining balance method, see DDB.
 * @param {*} no_switch Optional. A logical value specifying whether to switch to straight-line depreciation when depreciation is greater than the declining balance calculation.
 - If no_switch is TRUE, Microsoft Excel does not switch to straight-line depreciation even when the depreciation is greater than the declining balance calculation.
 - If no_switch is FALSE or omitted, Excel switches to straight-line depreciation when depreciation is greater than the declining balance calculation.
 * @returns (TBD)
 */
function vdb() {
    return openf.VDB();
}
exports.vdb = vdb;
/**
 * Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic.
 *
 * Category: Financial
 *
 * @param {number[]} cash_flows A series of cash flows that corresponds to a schedule of payments in dates. The first payment is optional and corresponds to a cost or payment that occurs at the beginning of the investment. If the first value is a cost or payment, it must be a negative value. All succeeding payments are discounted based on a 365-day year. The series of values must contain at least one positive and one negative value.
 * @param {Date[]|number[]|string[]} paydates A schedule of payment dates that corresponds to the cash flow payments. Dates may occur in any order. Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text. .
 * @param {number} [guess] Optional. A number that you guess is close to the result of XIRR.
 * @returns {number} internal rate of return as a number or an error if the arguments are not formatted properly.
 */
function xirr(cash_flows, paydates, guess = 0.1) {
    return openf.XIRR(cash_flows, paydates, guess);
}
exports.xirr = xirr;
/**
 * Returns the net present value for a schedule of cash flows that is not necessarily periodic.
 *
 * Category: Financial
 *
 * @param {number} disrate The discount rate to apply to the cash flows.
 * @param {number[]} cash_flows A series of cash flows that corresponds to a schedule of payments in dates. The first payment is optional and corresponds to a cost or payment that occurs at the beginning of the investment. If the first value is a cost or payment, it must be a negative value. All succeeding payments are discounted based on a 365-day year. The series of values must contain at least one positive value and one negative value.
 * @param {Date[]|number[]|string[]} paydates A schedule of payment dates that corresponds to the cash flow payments. The first payment date indicates the beginning of the schedule of payments. All other dates must be later than this date, but they may occur in any order.
 * @returns {number} net present value for a schedule of cash flows or an error if the arguments are not formated properly.
 */
function xnpv(disrate, cash_flows, paydates) {
    return openf.XNPV(disrate, cash_flows, paydates);
}
exports.xnpv = xnpv;
/**
 * Returns the yield on a security that pays periodic interest.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} rate The security's annual coupon rate.
 * @param {*} pr The security's price per $100 face value.
 * @param {*} redemption The security's redemption value per $100 face value.
 * @param {*} frequency The number of coupon payments per year. For annual payments, frequency = 1; for semiannual, frequency = 2; for quarterly, frequency = 4.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function Yield() {
    return openf.YIELD();
}
exports.Yield = Yield;
/**
 * Returns the annual yield for a discounted security; for example, a Treasury bill.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} pr The security's price per $100 face value.
 * @param {*} redemption The security's redemption value per $100 face value.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function yieldDisc() {
    return openf.YIELDDISC();
}
exports.yieldDisc = yieldDisc;
/**
 * Returns the annual yield of a security that pays interest at maturity.
 *
 * Category: Financial
 *
 * @param {*} settlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
 * @param {*} maturity The security's maturity date. The maturity date is the date when the security expires.
 * @param {*} issue The security's issue date, expressed as a serial date number.
 * @param {*} rate The security's interest rate at date of issue.
 * @param {*} pr The security's price per $100 face value.
 * @param {*} basis Optional. The type of day count basis to use.
 * @returns (TBD)
 * @TODO this needs to be implemented.
 */
function yieldMat() {
    return openf.YIELDMAT();
}
exports.yieldMat = yieldMat;
//-----------------------------
// Notes @functions financial
//-----------------------------
// Notes @Commands financial
//# sourceMappingURL=financial.js.map