spreadsheet
typeScript/javascript spreadsheet parser, with formulas.
git clone https://git.vogt.world/spreadsheet.git
Log | Files | README.md
← All files
name: dist/Formulas/Financial.d.ts
-rw-r--r--
15159
  1/**
  2 * Calculates the depreciation of an asset for a specified period using the double-declining balance method.
  3 * @param cost - The initial cost of the asset.
  4 * @param salvage - The value of the asset at the end of depreciation.
  5 * @param life - The number of periods over which the asset is depreciated.
  6 * @param period - The single period within life for which to calculate depreciation.
  7 * @param factor - [ OPTIONAL - 2 by default ] - The factor by which depreciation decreases.
  8 * @returns {number} depreciation of an asset for a specified period
  9 * @constructor
 10 */
 11declare let DDB: (cost: any, salvage: any, life: any, period: any, factor?: any) => number;
 12/**
 13 * Calculates the depreciation of an asset for a specified period using the arithmetic declining balance method.
 14 * @param cost - The initial cost of the asset.
 15 * @param salvage - The value of the asset at the end of depreciation.
 16 * @param life - The number of periods over which the asset is depreciated.
 17 * @param period - The single period within life for which to calculate depreciation.
 18 * @param month - [ OPTIONAL - 12 by default ] - The number of months in the first year of depreciation.
 19 * @returns {number} depreciated value
 20 * @constructor
 21 */
 22declare let DB: (cost: any, salvage: any, life: any, period: any, month: any) => number;
 23/**
 24 * Formats a number into the locale-specific currency format. WARNING: Currently the equivalent of TRUNC, since this
 25 * returns numbers
 26 * @param number - The value to be formatted.
 27 * @param places - [ OPTIONAL - 2 by default ] - The number of decimal places to display.
 28 * @returns {number} dollars
 29 * @constructor
 30 */
 31declare let DOLLAR: (number: any, places?: any) => number;
 32/**
 33 * Converts a price quotation given as a decimal fraction into a decimal value.
 34 * @param fractionalPrice - The price quotation given using fractional decimal conventions.
 35 * @param unit - The units of the fraction, e.g. 8 for 1/8ths or 32 for 1/32nds.
 36 * @returns {number} decimal value.
 37 * @constructor
 38 */
 39declare let DOLLARDE: (fractionalPrice: any, unit: any) => number;
 40/**
 41 * Converts a price quotation given as a decimal value into a decimal fraction.
 42 * @param decimalPrice - The price quotation given as a decimal value.
 43 * @param unit - The units of the desired fraction, e.g. 8 for 1/8ths or 32 for 1/32nds
 44 * @returns {number} price quotation as decimal fraction.
 45 * @constructor
 46 */
 47declare let DOLLARFR: (decimalPrice: any, unit: any) => number;
 48/**
 49 * Calculates the annual effective interest rate given the nominal rate and number of compounding periods per year.
 50 * @param nominalRate - The nominal interest rate per year.
 51 * @param periodsPerYear - The number of compounding periods per year.
 52 * @returns {number} annual effective interest rate
 53 * @constructor
 54 */
 55declare let EFFECT: (nominalRate: any, periodsPerYear: any) => number;
 56/**
 57 * Calculates the periodic payment for an annuity investment based on constant-amount periodic payments and a constant
 58 * interest rate.
 59 * @param rate - The interest rate.
 60 * @param periods - The number of payments to be made.
 61 * @param presentValue - The current value of the annuity.
 62 * @param futureValue [ OPTIONAL ] - The future value remaining after the final payment has been made.
 63 * @param endOrBeginning [ OPTIONAL - 0 by default ] - Whether payments are due at the end (0) or beginning (1) of each
 64 * period.
 65 * @returns {number}
 66 * @constructor
 67 */
 68declare let PMT: (rate: any, periods: any, presentValue: any, futureValue?: any, endOrBeginning?: any) => number;
 69/**
 70 * Returns the future value of an investment based on periodic, constant payments and a constant interest rate.
 71 * @param rate - The rate of periodic interest.
 72 * @param periods - The total number of periods.
 73 * @param payment - The annuity paid regularly per period
 74 * @param value - [OPTIONAL] - The present cash value of an investment.
 75 * @param type - [OPTIONAL] - Defines whether the payment is due at the beginning (1) or the end (0) of a period.
 76 * @returns {number}
 77 * @constructor
 78 */
 79declare let FV: (rate: any, periods: any, payment: any, value?: any, type?: any) => number;
 80/**
 81 * Calculates the cumulative principal paid over a range of payment periods for an investment based on constant-amount
 82 * periodic payments and a constant interest rate.
 83 * @param rate - The interest rate.
 84 * @param numberOfPeriods - The number of payments to be made.
 85 * @param presentValue - The current value of the annuity.
 86 * @param firstPeriod - The number of the payment period to begin the cumulative calculation. must be greater
 87 * than or equal to 1.
 88 * @param lastPeriod - The number of the payment period to end the cumulative calculation, must be greater
 89 * than first_period.
 90 * @param endOrBeginning - Whether payments are due at the end (0) or beginning (1) of each period
 91 * @returns {number} cumulative principal
 92 * @constructor
 93 */
 94declare let CUMPRINC: (rate: any, numberOfPeriods: any, presentValue: any, firstPeriod: any, lastPeriod: any, endOrBeginning: any) => number;
 95/**
 96 * Calculates the cumulative interest over a range of payment periods for an investment based on constant-amount
 97 * periodic payments and a constant interest rate.
 98 * @param rate - The interest rate.
 99 * @param numberOfPeriods - The number of payments to be made.
100 * @param presentValue - The current value of the annuity.
101 * @param firstPeriod - The number of the payment period to begin the cumulative calculation, must be greater
102 * than or equal to 1.
103 * @param lastPeriod - The number of the payment period to end the cumulative calculation, must be greater
104 * than first_period.
105 * @param endOrBeginning - Whether payments are due at the end (0) or beginning (1) of each period.
106 * @returns {number} cumulative interest
107 * @constructor
108 */
109declare let CUMIPMT: (rate: any, numberOfPeriods: any, presentValue: any, firstPeriod: any, lastPeriod: any, endOrBeginning: any) => number;
110/**
111 * Calculates the accrued interest of a security that has periodic payments.
112 * WARNING: This function has been implemented to specifications as outlined in Google Spreadsheets, LibreOffice, and
113 * OpenOffice. It functions much the same as MSExcel's ACCRINT, but there are several key differences. Below are links
114 * to illustrate the differences. Please see the source code for more information on differences. Links: https://quant.stackexchange.com/questions/7040/whats-the-algorithm-behind-excels-accrint, https://support.office.com/en-us/article/ACCRINT-function-fe45d089-6722-4fb3-9379-e1f911d8dc74, https://quant.stackexchange.com/questions/7040/whats-the-algorithm-behind-excels-accrint, https://support.google.com/docs/answer/3093200 .
115 * @param issue - The date the security was initially issued.
116 * @param firstPayment - The first date interest will be paid.
117 * @param settlement - The settlement date of the security, the date after issuance when the security is
118 * delivered to the buyer. Is the maturity date of the security if it is held until maturity rather than sold.
119 * @param rate - The annualized rate of interest.
120 * @param redemption - The redemption amount per 100 face value, or par.
121 * @param frequency - The number of coupon payments per year. For annual payments, frequency = 1; for
122 * semiannual, frequency = 2; for quarterly, frequency = 4.
123 * @param dayCountConvention - [ OPTIONAL - 0 by default ] - An indicator of what day count method to use.
124 * 0 or omitted = US (NASD) 30/360, 1 = Actual/actual, 2 = Actual/360, 3 = Actual/365, 4 = European 30/360.
125 * @returns {number}
126 * @constructor
127 * TODO: This function is based off of the open-source versions I was able to dig up online. We should implement a
128 * TODO:     second version that is closer to what MSExcel does and is named something like `ACCRINT.MS`.
129 */
130declare let ACCRINT: (issue: any, firstPayment: any, settlement: any, rate: any, redemption: any, frequency: any, dayCountConvention?: any) => number;
131/**
132 * Returns the arithmetic-declining depreciation rate. Use this function to calculate the depreciation amount for one
133 * period of the total depreciation span of an object. Arithmetic declining depreciation reduces the depreciation amount
134 * from period to period by a fixed sum.
135 * @param cost - The initial cost of an asset.
136 * @param salvage - the value of an asset after depreciation.
137 * @param life - The period fixing the time span over which an asset is depreciated.
138 * @param period - The period for which the depreciation is to be calculated.
139 * @returns {number}
140 * @constructor
141 */
142declare let SYD: (cost: any, salvage: any, life: any, period: any) => number;
143/**
144 * Returns the straight-line depreciation of an asset for one period. The amount of the depreciation is constant during
145 * the depreciation period.
146 * @param cost - The initial cost of the asset.
147 * @param salvage - The value of an asset at the end of the depreciation.
148 * @param life - The depreciation period determining the number of periods in the deprecation of the asset.
149 * @returns {number}
150 * @constructor
151 */
152declare let SLN: (cost: any, salvage: any, life: any) => number;
153/**
154 * Returns the net present value of an investment based on a series of periodic cash flows and a discount rate.
155 * @param rate - The discount rate for a period.
156 * @param values - The values representing deposits or withdrawals.
157 * @returns {number}
158 * @constructor
159 * TODO: This function can return results that are prone to floating point precision errors.
160 */
161declare let NPV: (rate: any, ...values: any[]) => number;
162/**
163 * Returns the number of payment for an investment. Number is based on constant-amount payments made periodically and a
164 * constant interest rate.
165 * @param rate - The interest rate.
166 * @param payment - The amount of each payment.
167 * @param present - THe current value.
168 * @param future - [OPTIONAL] - The future value remaining after the final payment has been made.
169 * @param type [OPTIONAL 0 by default] - 1 indicates payments are due at the beginning of each period. 0 indicates
170 * payments are due at the end of each period.
171 * @returns {number}
172 * @constructor
173 */
174declare let NPER: (rate: any, payment: any, present: any, future?: any, type?: any) => number;
175/**
176 * Calculates the yearly nominal interest rate, given the effective rate and the number of compounding periods per year.
177 * @param rate - The effective interest rate.
178 * @param periods - The number of periodic interest payments per year.
179 * @returns {number}
180 * @constructor
181 */
182declare let NOMINAL: (rate: any, periods: any) => number;
183/**
184 * Calculates the modified internal rate of return of a series of investments.
185 * @param values - Range or values of payments. Ignores text values.
186 * @param financeRate - The rate of interest of the investments.
187 * @param reinvestRate - The rate of interest of the reinvestment.
188 * @returns {number}
189 * @constructor
190 * TODO: This relies on NPV and will therefore be prone to floating-point errors.
191 */
192declare let MIRR: (values: any, financeRate: any, reinvestRate: any) => number;
193/**
194 * Calculates the internal rate of return for an investment. The values represent cash flow values at regular intervals;
195 * at least one value must be negative (payments), and at least one value must be positive (income).
196 *
197 * Relevant StackOverflow discussion: https://stackoverflow.com/questions/15089151/javascript-irr-internal-rate-of-return-formula-accuracy
198 *
199 * @param values - Range containing values. Ignores text values.
200 * @param guess - [OPTIONAL] - The estimated value. Defaults to 0.01.
201 * @returns {number}
202 * @constructor
203 */
204declare let IRR: (values: any, guess?: any) => any;
205/**
206 * Calculates the periodic amortization for an investment with regular payments and a constant interest rate.
207 * @param rate - The periodic interest rate.
208 * @param period - The period for which the compound interest is calculated.
209 * @param periods - The total number of periods during which the annuity is paid.
210 * @param present - The present cash value in sequence of payments.
211 * @param future - [OPTIONAL] - The desired value (future value) at the end of the periods.
212 * @param type - [OPTIONAL] - Defines whether the payment is due at the beginning (1) or the end (0) of a period.
213 * @returns {number}
214 * @constructor
215 */
216declare let IPMT: (rate: any, period: any, periods: any, present: any, future?: any, type?: any) => number;
217/**
218 * Returns for a given period the payment on the principal for an investment that is based on periodic and constant
219 * payments and a constant interest rate.
220 * @param rate - The periodic interest rate.
221 * @param period - The amortization period.
222 * @param periods - The total number of periods during which the annuity is paid.
223 * @param present - The present value in the sequence of payments.
224 * @param future - [OPTIONAL] - The desired future value. Defaults to 0.
225 * @param type - [OPTIONAL] - Indicates how the year is to be calculated. 0 indicates payments are due at end of
226 * period, 1 indicates payments are due at beginning of period. Defaults to 0.
227 * @returns {number}
228 * @constructor
229 */
230declare let PPMT: (rate: any, period: any, periods: any, present: any, future?: any, type?: any) => number;
231/**
232 * Calculates the accumulated value of the starting capital for a series of periodically varying interest rates.
233 * @param principal - The starting capital.
234 * @param rateSchedule - Range or Array that is a series of interest rates.
235 * @returns {number}
236 * @constructor
237 */
238declare let FVSCHEDULE: (principal: any, rateSchedule: any) => number;
239/**
240 * Returns the present value of an investment resulting from a series of regular payments.
241 * @param rate - The interest rate per period.
242 * @param periods - The total number of payment periods
243 * @param paymentPerPeriod - The regular payment made per period.
244 * @param future - [OPTIONAL defaults to 0] The future value remaining after the final installment has been made
245 * @param type - [OPTIONAL defaults to 0] Defines whether the payment is due at the beginning (1) or the end (0) of a
246 * period.
247 * @constructor
248 */
249declare let PV: (rate: any, periods: any, paymentPerPeriod: any, future?: any, type?: any) => number;
250/**
251 * Returns the constant interest rate per period of an annuity.
252 * @param periods - The total number of periods, during which payments are made (payment period).
253 * @param paymentPerPeriod - The constant payment (annuity) paid during each period.
254 * @param presentValue - The cash value in the sequence of payments
255 * @param futureValue - [OPTIONAL defaults to 0] The future value, which is reached at the end of the periodic payments.
256 * @param beginningOrEnd - [OPTIONAL defaults to 0] Defines whether the payment is due at the beginning (1) or the end
257 * (0) of a period.
258 * @param guessRate - [OPTIONAL] - Determines the estimated value of the interest with iterative
259 * calculation.
260 * @constructor
261 */
262declare let RATE: (periods: any, paymentPerPeriod: any, presentValue: any, futureValue?: any, beginningOrEnd?: any, guessRate?: any) => any;
263export { ACCRINT, CUMPRINC, CUMIPMT, DB, DDB, DOLLAR, DOLLARDE, DOLLARFR, EFFECT, PMT, SYD, SLN, NPV, NPER, NOMINAL, MIRR, IRR, IPMT, FV, PPMT, FVSCHEDULE, PV, RATE };