@sheetxl/formulas-extended 0.7.23-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/LICENSE.md +11 -0
  2. package/README.md +59 -0
  3. package/browser/cjs/B4JJfKSI4ppwU855.cjs +1 -0
  4. package/browser/cjs/BWDfauDHqB6U_2ka.cjs +1 -0
  5. package/browser/cjs/BwLx9ix5Sq7suAYP.cjs +1 -0
  6. package/browser/cjs/C2uDl8VIJqh58YF_.cjs +1 -0
  7. package/browser/cjs/CW-b31_-r-_raT8Y.cjs +1 -0
  8. package/browser/cjs/Clu7XiAsCB48GDXN.cjs +1 -0
  9. package/browser/cjs/CnZfa45XxA-9Jhmp.cjs +1 -0
  10. package/browser/cjs/DsFZgtSQpC75d1M0.cjs +1 -0
  11. package/browser/cjs/JfM6P_qoQQTWakZf.cjs +1 -0
  12. package/browser/cjs/bM25C5avKgBAJVfk.cjs +1 -0
  13. package/browser/cjs/fqTQ_p3ehzUvc1tF.cjs +1 -0
  14. package/browser/cjs/h3dw1jAp2J5Pu4p3.cjs +1 -0
  15. package/browser/cjs/index.cjs +1 -0
  16. package/browser/cjs/jev6VGWTdgEgm4Yk.cjs +1 -0
  17. package/browser/cjs/lEQC21-Sk4lwHy2r.cjs +1 -0
  18. package/browser/esm/-9SircqlVS-6jMNw.mjs +304 -0
  19. package/browser/esm/BCWg0NNa-nGjBMYM.mjs +19 -0
  20. package/browser/esm/BSWSZ6lA8jcSqHmz.mjs +19 -0
  21. package/browser/esm/BUYVOSf4JEFM5iRs.mjs +45 -0
  22. package/browser/esm/BWbYcyqeI2q9zobt.mjs +63 -0
  23. package/browser/esm/BatWJFRiqJI5wALH.mjs +52 -0
  24. package/browser/esm/CRT-M9ZISwPJluM8.mjs +71 -0
  25. package/browser/esm/Ck9zOHAyQJLQF_j_.mjs +83 -0
  26. package/browser/esm/CmXZZdy6rEOCrUnH.mjs +63 -0
  27. package/browser/esm/DAxAXOJZXvqvlnoT.mjs +28 -0
  28. package/browser/esm/DHrrLoyQ_KZ3yWWr.mjs +55 -0
  29. package/browser/esm/DboajdAr6s1IjcXM.mjs +45 -0
  30. package/browser/esm/Dtof6I8zPa8LIz89.mjs +35 -0
  31. package/browser/esm/XphbS4usCLMa2WZ2.mjs +20 -0
  32. package/browser/esm/index.mjs +2978 -0
  33. package/licenses/dependencies.txt +1 -0
  34. package/node/esm/-9SircqlVS-6jMNw.mjs +304 -0
  35. package/node/esm/BBREUOtt4cAHs88k.mjs +45 -0
  36. package/node/esm/BCWg0NNa-nGjBMYM.mjs +19 -0
  37. package/node/esm/BSWSZ6lA8jcSqHmz.mjs +19 -0
  38. package/node/esm/BUYVOSf4JEFM5iRs.mjs +45 -0
  39. package/node/esm/BWbYcyqeI2q9zobt.mjs +63 -0
  40. package/node/esm/BatWJFRiqJI5wALH.mjs +52 -0
  41. package/node/esm/CRT-M9ZISwPJluM8.mjs +71 -0
  42. package/node/esm/Ck9zOHAyQJLQF_j_.mjs +83 -0
  43. package/node/esm/CmXZZdy6rEOCrUnH.mjs +63 -0
  44. package/node/esm/DHrrLoyQ_KZ3yWWr.mjs +55 -0
  45. package/node/esm/Dp0K0CPOWr5We6lS.mjs +28 -0
  46. package/node/esm/Dtof6I8zPa8LIz89.mjs +35 -0
  47. package/node/esm/XphbS4usCLMa2WZ2.mjs +20 -0
  48. package/node/esm/index.mjs +3047 -0
  49. package/package.json +43 -0
  50. package/resources/contents.json +14 -0
  51. package/resources/locales/contents.json +9 -0
  52. package/resources/locales/de/functions.json +59 -0
  53. package/types/index.d.ts +4 -0
  54. package/types/src/.generated/decl/cube/Cube.decl.d.ts +4 -0
  55. package/types/src/.generated/decl/cube/Cube.decl.d.ts.map +1 -0
  56. package/types/src/.generated/decl/financial/ACCRINT.decl.d.ts +4 -0
  57. package/types/src/.generated/decl/financial/ACCRINT.decl.d.ts.map +1 -0
  58. package/types/src/.generated/decl/financial/AMORDEGRC.decl.d.ts +4 -0
  59. package/types/src/.generated/decl/financial/AMORDEGRC.decl.d.ts.map +1 -0
  60. package/types/src/.generated/decl/financial/Date.decl.d.ts +4 -0
  61. package/types/src/.generated/decl/financial/Date.decl.d.ts.map +1 -0
  62. package/types/src/.generated/decl/financial/Financial.decl.d.ts +4 -0
  63. package/types/src/.generated/decl/financial/Financial.decl.d.ts.map +1 -0
  64. package/types/src/.generated/decl/financial/Financial2.decl.d.ts +4 -0
  65. package/types/src/.generated/decl/financial/Financial2.decl.d.ts.map +1 -0
  66. package/types/src/.generated/decl/financial/Financial3.decl.d.ts +4 -0
  67. package/types/src/.generated/decl/financial/Financial3.decl.d.ts.map +1 -0
  68. package/types/src/.generated/decl/financial/Financial4.decl.d.ts +4 -0
  69. package/types/src/.generated/decl/financial/Financial4.decl.d.ts.map +1 -0
  70. package/types/src/.generated/decl/financial/ODD.decl.d.ts +4 -0
  71. package/types/src/.generated/decl/financial/ODD.decl.d.ts.map +1 -0
  72. package/types/src/.generated/decl/financial/VDB.decl.d.ts +4 -0
  73. package/types/src/.generated/decl/financial/VDB.decl.d.ts.map +1 -0
  74. package/types/src/.generated/decl/statistical/ETS.decl.d.ts +4 -0
  75. package/types/src/.generated/decl/statistical/ETS.decl.d.ts.map +1 -0
  76. package/types/src/.generated/decl/statistical/Regression.decl.d.ts +4 -0
  77. package/types/src/.generated/decl/statistical/Regression.decl.d.ts.map +1 -0
  78. package/types/src/.generated/decl/statistical/TTEST.decl.d.ts +4 -0
  79. package/types/src/.generated/decl/statistical/TTEST.decl.d.ts.map +1 -0
  80. package/types/src/.generated/decl/text/RegEx.decl.d.ts +4 -0
  81. package/types/src/.generated/decl/text/RegEx.decl.d.ts.map +1 -0
  82. package/types/src/.generated/desc/cube/Cube.desc.d.ts +4 -0
  83. package/types/src/.generated/desc/cube/Cube.desc.d.ts.map +1 -0
  84. package/types/src/.generated/desc/financial/ACCRINT.desc.d.ts +4 -0
  85. package/types/src/.generated/desc/financial/ACCRINT.desc.d.ts.map +1 -0
  86. package/types/src/.generated/desc/financial/AMORDEGRC.desc.d.ts +4 -0
  87. package/types/src/.generated/desc/financial/AMORDEGRC.desc.d.ts.map +1 -0
  88. package/types/src/.generated/desc/financial/Date.desc.d.ts +4 -0
  89. package/types/src/.generated/desc/financial/Date.desc.d.ts.map +1 -0
  90. package/types/src/.generated/desc/financial/Financial.desc.d.ts +4 -0
  91. package/types/src/.generated/desc/financial/Financial.desc.d.ts.map +1 -0
  92. package/types/src/.generated/desc/financial/Financial2.desc.d.ts +4 -0
  93. package/types/src/.generated/desc/financial/Financial2.desc.d.ts.map +1 -0
  94. package/types/src/.generated/desc/financial/Financial3.desc.d.ts +4 -0
  95. package/types/src/.generated/desc/financial/Financial3.desc.d.ts.map +1 -0
  96. package/types/src/.generated/desc/financial/Financial4.desc.d.ts +4 -0
  97. package/types/src/.generated/desc/financial/Financial4.desc.d.ts.map +1 -0
  98. package/types/src/.generated/desc/financial/ODD.desc.d.ts +4 -0
  99. package/types/src/.generated/desc/financial/ODD.desc.d.ts.map +1 -0
  100. package/types/src/.generated/desc/financial/VDB.desc.d.ts +4 -0
  101. package/types/src/.generated/desc/financial/VDB.desc.d.ts.map +1 -0
  102. package/types/src/.generated/desc/statistical/ETS.desc.d.ts +4 -0
  103. package/types/src/.generated/desc/statistical/ETS.desc.d.ts.map +1 -0
  104. package/types/src/.generated/desc/statistical/Regression.desc.d.ts +4 -0
  105. package/types/src/.generated/desc/statistical/Regression.desc.d.ts.map +1 -0
  106. package/types/src/.generated/desc/statistical/TTEST.desc.d.ts +4 -0
  107. package/types/src/.generated/desc/statistical/TTEST.desc.d.ts.map +1 -0
  108. package/types/src/.generated/desc/text/RegEx.desc.d.ts +4 -0
  109. package/types/src/.generated/desc/text/RegEx.desc.d.ts.map +1 -0
  110. package/types/src/.generated/index.d.ts +7 -0
  111. package/types/src/.generated/index.d.ts.map +1 -0
  112. package/types/src/_utils/AnyArgs.d.ts +38 -0
  113. package/types/src/_utils/AnyArgs.d.ts.map +1 -0
  114. package/types/src/_utils/Consts.d.ts +14 -0
  115. package/types/src/_utils/Consts.d.ts.map +1 -0
  116. package/types/src/_utils/Date.d.ts +33 -0
  117. package/types/src/_utils/Date.d.ts.map +1 -0
  118. package/types/src/_utils/FinanaceSolver.d.ts +19 -0
  119. package/types/src/_utils/FinanaceSolver.d.ts.map +1 -0
  120. package/types/src/_utils/FinanceCoupon.d.ts +141 -0
  121. package/types/src/_utils/FinanceCoupon.d.ts.map +1 -0
  122. package/types/src/_utils/FinanceDate.d.ts +26 -0
  123. package/types/src/_utils/FinanceDate.d.ts.map +1 -0
  124. package/types/src/_utils/FinanceDayCount.d.ts +80 -0
  125. package/types/src/_utils/FinanceDayCount.d.ts.map +1 -0
  126. package/types/src/_utils/FinanceUtils.d.ts +3 -0
  127. package/types/src/_utils/FinanceUtils.d.ts.map +1 -0
  128. package/types/src/_utils/LeastSquares.d.ts +131 -0
  129. package/types/src/_utils/LeastSquares.d.ts.map +1 -0
  130. package/types/src/cube/Cube.d.ts +64 -0
  131. package/types/src/cube/Cube.d.ts.map +1 -0
  132. package/types/src/financial/ACCRINT.d.ts +19 -0
  133. package/types/src/financial/ACCRINT.d.ts.map +1 -0
  134. package/types/src/financial/AMORDEGRC.d.ts +53 -0
  135. package/types/src/financial/AMORDEGRC.d.ts.map +1 -0
  136. package/types/src/financial/Date.d.ts +29 -0
  137. package/types/src/financial/Date.d.ts.map +1 -0
  138. package/types/src/financial/Financial.d.ts +287 -0
  139. package/types/src/financial/Financial.d.ts.map +1 -0
  140. package/types/src/financial/Financial2.d.ts +99 -0
  141. package/types/src/financial/Financial2.d.ts.map +1 -0
  142. package/types/src/financial/Financial3.d.ts +95 -0
  143. package/types/src/financial/Financial3.d.ts.map +1 -0
  144. package/types/src/financial/Financial4.d.ts +82 -0
  145. package/types/src/financial/Financial4.d.ts.map +1 -0
  146. package/types/src/financial/ODD.d.ts +106 -0
  147. package/types/src/financial/ODD.d.ts.map +1 -0
  148. package/types/src/financial/VDB.d.ts +27 -0
  149. package/types/src/financial/VDB.d.ts.map +1 -0
  150. package/types/src/statistical/ETS.d.ts +45 -0
  151. package/types/src/statistical/ETS.d.ts.map +1 -0
  152. package/types/src/statistical/Regression.d.ts +49 -0
  153. package/types/src/statistical/Regression.d.ts.map +1 -0
  154. package/types/src/statistical/TTEST.d.ts +27 -0
  155. package/types/src/statistical/TTEST.d.ts.map +1 -0
  156. package/types/src/text/RegEx.d.ts +34 -0
  157. package/types/src/text/RegEx.d.ts.map +1 -0
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Shared pure-math helpers for bond pricing and coupon date functions.
3
+ *
4
+ * All formulas follow the Excel spec:
5
+ * https://support.microsoft.com/en-us/office/financial-functions-reference
6
+ *
7
+ * Date arithmetic delegates to SheetXL's existing date utilities
8
+ * (dateAddMonths, getDaysInMonth, isLastDayOfMonth, getDayCount), and serial
9
+ * <-> Date conversion to FormulaContext's `dateOnly` flavors — same interface
10
+ * SheetXL uses throughout the financial module.
11
+ *
12
+ * Basis codes (used throughout):
13
+ * 0 US 30/360 (NASD)
14
+ * 1 Actual/actual
15
+ * 2 Actual/360
16
+ * 3 Actual/365
17
+ * 4 European 30/360
18
+ *
19
+ * These are plain number-in / number-out helpers that the formula wrappers
20
+ * call after doing all parameter validation and coercion — they touch
21
+ * FormulaContext only for serial<->Date conversion, never IRange or
22
+ * FormulaError.
23
+ */
24
+ /**
25
+ * Returns the signed day count between two Excel serial dates using the given
26
+ * day-count basis. The result is always positive (or zero) — we clamp
27
+ * negative to 0 because every caller wants a "days elapsed since" count and
28
+ * none of them need signed deltas. Keeping a dedicated helper here makes the
29
+ * direction contract explicit at every call site.
30
+ *
31
+ * This is used internally by the coupon helpers and the ODD* price functions.
32
+ */
33
+ export declare function daysBetween(startSerial: number, endSerial: number, basis: number): number;
34
+ /**
35
+ * Previous coupon date (COUPPCD):
36
+ * Returns the Excel serial number of the last coupon date before or on the
37
+ * settlement date.
38
+ *
39
+ * Used by: COUPPCD, COUPDAYBS, COUPDAYS (basis=1), PRICE, YIELD, DURATION…
40
+ */
41
+ export declare function calculateCouppcd(settlementSerial: number, maturitySerial: number, frequency: number): number;
42
+ /**
43
+ * Next coupon date (COUPNCD):
44
+ * Returns the Excel serial number of the first coupon date after settlement.
45
+ *
46
+ * Used by: COUPNCD, COUPDAYSNC, ODDLPRICE (basis 2 / 3 branch).
47
+ */
48
+ export declare function calculateCoupncd(settlementSerial: number, maturitySerial: number, frequency: number): number;
49
+ /**
50
+ * Days from previous coupon to settlement (COUPDAYBS):
51
+ * The "accrued days" — how many days of the current coupon period have elapsed
52
+ * by the settlement date.
53
+ *
54
+ * Used by: COUPDAYBS, PRICE, YIELD, DURATION, MDURATION.
55
+ */
56
+ export declare function calculateCoupdaybs(settlementSerial: number, maturitySerial: number, frequency: number, basis: number): number;
57
+ /**
58
+ * Days in the coupon period that contains settlement (COUPDAYS):
59
+ * Basis 1 (actual/actual) counts actual calendar days from PCD to NCD.
60
+ * Basis 3 is always 365/frequency.
61
+ * All 30/360 bases divide 360 by frequency.
62
+ *
63
+ * Used by: COUPDAYS, PRICE, YIELD, DURATION, MDURATION, ODDLPRICE, ODDLYIELD.
64
+ */
65
+ export declare function calculateCoupdays(settlementSerial: number, maturitySerial: number, frequency: number, basis: number): number;
66
+ /**
67
+ * Number of remaining coupons from settlement to maturity (COUPNUM):
68
+ * Counts how many (12/frequency)-month backward steps from maturity are needed
69
+ * to pass settlement.
70
+ *
71
+ * Used by: COUPNUM, PRICE, YIELD, DURATION, MDURATION, ODDFPRICE, ODDFYIELD.
72
+ */
73
+ export declare function calculateCoupnum(settlementSerial: number, maturitySerial: number, frequency: number): number;
74
+ /**
75
+ * ODDFPRICE core:
76
+ * Prices a bond with an irregular (short or long) first coupon period.
77
+ *
78
+ * Dispatches to the short-coupon or long-coupon sub-function depending on
79
+ * whether DFC < E (short first period) or DFC >= E (long first period).
80
+ *
81
+ * All arguments are already validated scalars. Returns NaN on degenerate
82
+ * inputs (the formula wrapper turns NaN → #NUM!).
83
+ *
84
+ * Reference:
85
+ * https://support.microsoft.com/en-us/office/oddfprice-function-d7d664a8-34df-4233-8d2b-922bcf6a69e1
86
+ */
87
+ export declare function calculateOddFPrice(settlementSerial: number, maturitySerial: number, issueSerial: number, firstCouponSerial: number, rate: number, yld: number, redemption: number, frequency: number, basis: number): number;
88
+ /**
89
+ * Standard coupon bond price.
90
+ *
91
+ * The closed-form formula per $100 face value from the Excel spec:
92
+ * https://support.microsoft.com/en-us/office/price-function-3ea9deac-8dfa-436f-a7c8-17ea02c21b0a
93
+ *
94
+ * Special-cased for N=1 (single remaining coupon period) where the standard
95
+ * summation degenerates and the spec provides a simpler formula.
96
+ *
97
+ * Used by: PRICE, YIELD (via Newton inversion).
98
+ */
99
+ export declare function calculatePrice(settlementSerial: number, maturitySerial: number, rate: number, yld: number, redemption: number, frequency: number, basis: number): number;
100
+ /**
101
+ * Macaulay duration of a coupon bond.
102
+ *
103
+ * Duration is the weighted average time to cash flow, where weights are
104
+ * present values of each cash flow as a fraction of total price.
105
+ *
106
+ * DURATION returns the Macaulay duration.
107
+ * MDURATION returns duration / (1 + yld/frequency) — the modified duration.
108
+ *
109
+ * Used by: DURATION, MDURATION.
110
+ */
111
+ export declare function calculateDuration(settlementSerial: number, maturitySerial: number, coupon: number, yld: number, frequency: number, basis: number): number;
112
+ /**
113
+ * Double-declining-balance depreciation for a single period.
114
+ *
115
+ * `factor` is the rate-of-decline multiplier (2 = double-declining, etc.).
116
+ * Switches to straight-line when SL depreciation exceeds DDB, unless the
117
+ * caller has requested noSwitch.
118
+ *
119
+ * This function computes one (startPeriod, endPeriod) slice; VDB sums slices
120
+ * across fractional periods.
121
+ *
122
+ * Used by: VDB.
123
+ */
124
+ export declare function calculateDDB(cost: number, salvage: number, life: number, period: number, // 1-based period number
125
+ factor: number): number;
126
+ /**
127
+ * Returns true if the settlement and maturity dates are aligned to coupon
128
+ * dates — i.e., the day-of-month matches and the month difference is an exact
129
+ * multiple of (12/frequency).
130
+ *
131
+ * Used by ODDFPRICE / ODDFYIELD / ODDLPRICE / ODDLYIELD validators.
132
+ */
133
+ export declare function isDatesAreAlignedToCoupon(date1Serial: number, date2Serial: number, frequency: number): boolean;
134
+ /**
135
+ * Returns true if calculateCouppcd(d1, d2, frequency) >= 0.
136
+ *
137
+ * Used by ODDFPRICE / ODDFYIELD validators.
138
+ */
139
+ export declare function isCouppcdIsNonNegative(date1Serial: number, date2Serial: number, frequency: number): boolean;
140
+ export declare function isValidFrequency(frequency: number): boolean;
141
+ //# sourceMappingURL=FinanceCoupon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FinanceCoupon.d.ts","sourceRoot":"","sources":["../../../../src/_utils/FinanceCoupon.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AASH;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,MAAM,CAIR;AA8DD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,gBAAgB,EAAE,MAAM,EACxB,cAAc,EAAE,MAAM,EACtB,SAAS,EAAE,MAAM,GAChB,MAAM,CAER;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,gBAAgB,EAAE,MAAM,EACxB,cAAc,EAAE,MAAM,EACtB,SAAS,EAAE,MAAM,GAChB,MAAM,CAKR;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,gBAAgB,EAAE,MAAM,EACxB,cAAc,EAAE,MAAM,EACtB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,MAAM,CAGR;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,gBAAgB,EAAE,MAAM,EACxB,cAAc,EAAE,MAAM,EACtB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,MAAM,CAsBR;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,gBAAgB,EAAE,MAAM,EACxB,cAAc,EAAE,MAAM,EACtB,SAAS,EAAE,MAAM,GAChB,MAAM,CAaR;AA8ED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,gBAAgB,EAAE,MAAM,EACxB,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM,EACnB,iBAAiB,EAAE,MAAM,EACzB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,MAAM,CAkBR;AAyJD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,gBAAgB,EAAE,MAAM,EACxB,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,MAAM,CA8BR;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,gBAAgB,EAAE,MAAM,EACxB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,MAAM,CA+BR;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EAAI,wBAAwB;AAC1C,MAAM,EAAE,MAAM,GACb,MAAM,CAaR;AAMD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAkBT;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAET;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAM3D"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * This is a duplicate of DAYS in @sheetxl/formulas.
3
+ */
4
+ export declare function daysBetween(endDate: number, // date
5
+ startDate: number): number;
6
+ /**
7
+ * Returns true if endSerial is strictly more than one year after startSerial.
8
+ * "More than one year" means the anniversary date has been passed —
9
+ * e.g. Jan 1 2008 → Jan 1 2009 is exactly one year (returns false),
10
+ * but Jan 1 2008 → Jan 2 2009 returns true.
11
+ */
12
+ export declare function isMoreThanOneYearAfter(startSerial: number, endSerial: number): boolean;
13
+ /**
14
+ * Add `months` calendar months to a UTC Date, mutating and returning it.
15
+ *
16
+ * End-of-month snapping: if the input date is the last day of its month, the
17
+ * result is also snapped to the last day of the destination month. This
18
+ * matches Excel's coupon-date rolling convention — e.g. 31 Jan + 1 month =
19
+ * 28 Feb (not 3 Mar).
20
+ *
21
+ * `months` may be fractional but only the integer portion is meaningful for
22
+ * calendar arithmetic; the function passes the value straight to
23
+ * `setMonth` which truncates automatically.
24
+ */
25
+ export declare function dateAddMonths(date: Date, months: number): Date;
26
+ //# sourceMappingURL=FinanceDate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FinanceDate.d.ts","sourceRoot":"","sources":["../../../../src/_utils/FinanceDate.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EAAE,OAAO;AACxB,SAAS,EAAE,MAAM,GAChB,MAAM,CAER;AAGD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAcT;AAGD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAiB9D"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Returns true if `basis` is a valid day-count basis code (0..4).
3
+ */
4
+ export declare function isValidBasis(basis: number): boolean;
5
+ /**
6
+ * Result type returned by `getDayCount`.
7
+ *
8
+ * `days` — the numerator: actual or 30/360 adjusted day count.
9
+ * `yearDays` — the denominator: 360, 365, or the actual/actual year length.
10
+ *
11
+ * The year fraction (used in accrued interest and yield calculations) is
12
+ * simply `days / yearDays`.
13
+ */
14
+ export interface DayCount {
15
+ days: number;
16
+ yearDays: number;
17
+ }
18
+ /**
19
+ * Compute the day count between two Excel serial dates under any of the five
20
+ * standard ISDA/Excel day-count conventions (the `basis` parameter).
21
+ *
22
+ * Basis codes:
23
+ * 0 US 30/360 (NASD) — adjust both ends to 30-day months
24
+ * 1 Actual/Actual — real calendar days; yearDays = weighted avg
25
+ * 2 Actual/360 — real calendar days; yearDays = 360
26
+ * 3 Actual/365 — real calendar days; yearDays = 365
27
+ * 4 European 30/360 — like basis 0, different EOM rule
28
+ *
29
+ * The result `days` is always the absolute value of the difference; the
30
+ * calling function is responsible for sign semantics if needed.
31
+ *
32
+ * @param startSerial The Excel serial date representing the start date.
33
+ * @param endSerial The Excel serial date representing the end date.
34
+ * @param basis The integer code representing the day-count basis (0-4).
35
+ * @returns An object containing the calculated `days` and `yearDays`.
36
+ *
37
+ * @remarks
38
+ * **Implementation Note:** Basis 0 (`_getNasd30_360`) uses a strictly different
39
+ * February End-of-Month rule than the standalone `DAYS360` formula. Basis 0 blocks
40
+ * the start-of-month Feb EOM adjustment from cascading into the end-day calculation,
41
+ * which is required for functions like `YEARFRAC`, `ACCRINT`, and `PRICE` to match Excel.
42
+ *
43
+ */
44
+ export declare function getDayCount(startSerial: number, endSerial: number, basis: number): DayCount;
45
+ /**
46
+ * Calculates the DAYS360 US method — signed integer day count.
47
+ *
48
+ * @see {@link getDayCount} (specifically `_getNasd30_360`) for the correct basis 0
49
+ * implementation used by financial formulas.
50
+ *
51
+ * @param startSerial The Excel serial date representing the start date.
52
+ * @param endSerial The Excel serial date representing the end date.
53
+ * @returns The signed number of days between the dates (negative if endSerial < startSerial).
54
+ *
55
+ * @remarks
56
+ * **Implementation Note:** This function is strictly for the `DAYS360` formula.
57
+ * It must NOT be used for standard financial functions like `YEARFRAC`, `ACCRINT`, or `PRICE`.
58
+ *
59
+ * It deliberately differs from the standard NASD 30/360 convention (basis 0) on two points,
60
+ * both measured against Excel:
61
+ *
62
+ * 1. The February End-of-Month conversion (startDay → 30) CASCADES into the end-day rule.
63
+ * Feb 28 to Mar 31 in 2011 is 30 days here and 31 days under basis 0.
64
+ * 2. End-of-February is decided on the LEGACY calendar — the day after the start falls in
65
+ * March — where basis 0 asks the REAL calendar. The two disagree only across the phantom
66
+ * `1900-02-29`: `DAYS360(59,91)` is 33 and `DAYS360(60,91)` is 30, while the same pairs
67
+ * under basis 0 are 31/360 and 32/360.
68
+ *
69
+ * The arguments are NOT swapped into order first. `DAYS360` is not antisymmetric — the rules
70
+ * apply to (start, end) as given, so `DAYS360(3/15, 3/31)` is 16 but `DAYS360(3/31, 3/15)`
71
+ * is −15, and `DAYS360(43496, 0)` is −42870 against `DAYS360(0, 43496)` = 42871.
72
+ *
73
+ * We replicate Excel's exact behavior, which utilizes different 30/360 rulesets
74
+ * for DAYS360 vs. NASD-based functions.
75
+ *
76
+ * https://en.wikipedia.org/wiki/Day_count_convention
77
+ *
78
+ */
79
+ export declare function getDays360US(startSerial: number, endSerial: number): number;
80
+ //# sourceMappingURL=FinanceDayCount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FinanceDayCount.d.ts","sourceRoot":"","sources":["../../../../src/_utils/FinanceDayCount.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAKnD;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AA8BD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CACzB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,QAAQ,CASV;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAoC3E"}
@@ -0,0 +1,3 @@
1
+ import { IRuntime } from '@sheetxl/primitives';
2
+ export declare const defaultCurrencyFormat: (runtime: IRuntime) => string;
3
+ //# sourceMappingURL=FinanceUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FinanceUtils.d.ts","sourceRoot":"","sources":["../../../../src/_utils/FinanceUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,eAAO,MAAM,qBAAqB,GAAI,SAAS,QAAQ,WAItD,CAAA"}
@@ -0,0 +1,131 @@
1
+ import { FormulaError, IRange } from '@sheetxl/primitives';
2
+ /**
3
+ * How Excel reads `known_y` / `known_x` into (observations x predictors).
4
+ *
5
+ * `known_y`'s SHAPE picks the axis, and nothing else does — a transposed `known_x` is an error,
6
+ * not something Excel silently rotates (`LINEST(D1:D6, A25:F26)` is `#REF!`):
7
+ *
8
+ * * `known_y` a single ROW (1 x p, p > 1) — each COLUMN is an observation, so each ROW of
9
+ * `known_x` is one predictor.
10
+ * * anything else — each ROW is an observation, so each COLUMN of `known_x` is one predictor.
11
+ *
12
+ * A RECTANGULAR `known_y` (rows > 1 and columns > 1) is not an error. Excel's documented rule is
13
+ * "if only one variable is used, `known_y` and `known_x` may be any shape as long as the
14
+ * dimensions are equal", so a rectangular `known_y` is always a SINGLE-predictor fit: both sides
15
+ * are flattened row-major and `known_x` must match the shape exactly.
16
+ * (`LINEST(E1:F6)` fits over x = 1..12; `LINEST(E1:F6, A1:A6)` is `#REF!`.)
17
+ */
18
+ export interface RegressionData {
19
+ /** p observations, flattened row-major. */
20
+ ys: number[];
21
+ /** p x k design, WITHOUT the intercept column. */
22
+ xs: number[][];
23
+ /** Number of predictors — `xs[i].length`. */
24
+ k: number;
25
+ /** `known_y` was a single row, so predictions spill as a row and new_x's predictors are rows. */
26
+ isRowOriented: boolean;
27
+ /** `known_y` was rectangular, which forces k = 1 and makes new_x element-wise. */
28
+ isRectangularY: boolean;
29
+ /** `known_y`'s shape, for shaping fitted values. */
30
+ yRows: number;
31
+ yCols: number;
32
+ }
33
+ /**
34
+ * Reads `known_y` / `known_x` the way the whole LINEST family does.
35
+ *
36
+ * STRICT membership: any non-numeric member of either range — text, boolean, or BLANK — is
37
+ * `#VALUE!`. There is no skipping and no coercion here (`LINEST({2;TRUE;5;4}, …)` and
38
+ * `LINEST({2;"3";5;4}, …)` are both `#VALUE!`), which is the opposite of the paired statistics
39
+ * (CORREL/SLOPE/…) where a non-numeric member drops its pair. Dropping a member here would shift
40
+ * every later observation against its x and silently return a different fit.
41
+ *
42
+ * @throws #VALUE! on a non-numeric member, #REF! on a dimension mismatch.
43
+ */
44
+ export declare const readRegressionData: (knownYs: IRange, knownXs: IRange | undefined) => RegressionData;
45
+ /**
46
+ * Reads a `new_x` range into (observations x k), and reports the shape its predictions spill into.
47
+ *
48
+ * With a SINGLE predictor `new_x` is element-wise and keeps its own shape whatever that is —
49
+ * `GROWTH(Q1:Q6, B1:B6, A14:B15)` over a 2x2 `new_x` spills 2x2, one prediction per member. With
50
+ * more than one predictor the predictor axis is pinned instead: `k` columns (or `k` rows when
51
+ * `known_y` was a row), and a `new_x` of the wrong width is `#REF!`.
52
+ *
53
+ * @throws #VALUE! on a non-numeric member, #REF! when the predictor axis does not match k.
54
+ */
55
+ export declare const readNewX: (newXs: IRange, data: RegressionData) => {
56
+ xs: number[][];
57
+ rows: number;
58
+ cols: number;
59
+ };
60
+ /**
61
+ * `ln(y)` for the log-space members of the family (LOGEST / GROWTH).
62
+ *
63
+ * A y at or below zero has no logarithm, and Excel reports that as #NUM! — a distinct outcome from
64
+ * the #VALUE! a non-numeric member gets, so the two checks stay separate.
65
+ *
66
+ * @throws #NUM! when any y is <= 0.
67
+ */
68
+ export declare const toLogYs: (ys: number[]) => number[];
69
+ /**
70
+ * Evaluates a fit over `new_x`, in the shape Excel spills.
71
+ *
72
+ * With `new_x` omitted the fit is evaluated over the known xs and takes `known_y`'s OWN shape —
73
+ * the fitted values, so a 6x2 `known_y` spills 6x2. Otherwise the shape comes from `new_x`
74
+ * ({@link readNewX} decides whether that is element-wise or one row/column per observation).
75
+ */
76
+ export declare const predictInShape: (data: RegressionData, newXs: IRange | undefined, predict: (x: number[]) => number) => number[][];
77
+ /** A fitted model — coefficients in Excel's slot order plus everything the stats grid needs. */
78
+ export interface RegressionFit {
79
+ /**
80
+ * k + 1 coefficients in EXCEL'S SLOT ORDER: `[m_k, m_(k-1), …, m_1, b]` — reversed, so slot 0
81
+ * belongs to the LAST column of `known_x`.
82
+ */
83
+ coefficients: number[];
84
+ /** Standard errors in the same slot order. `se[k]` is meaningless when `!useConst` (Excel: #N/A). */
85
+ standardErrors: number[];
86
+ /** Number of predictors actually used — a column dropped for rank deficiency does not count. */
87
+ kEffective: number;
88
+ /** `n - kEffective - (useConst ? 1 : 0)`. */
89
+ df: number;
90
+ /** Standard error of the y estimate. 0 when `df <= 0`, which is what Excel returns. */
91
+ sey: number;
92
+ /** `ssReg / ssTotal`, and 1 when `ssTotal` is 0. */
93
+ r2: number;
94
+ /** `(ssReg / kEffective) / (ssResid / df)`. `null` when `df <= 0` — Excel puts #NUM! there. */
95
+ f: number | null;
96
+ ssReg: number;
97
+ ssResid: number;
98
+ /** Predicts at one observation's predictor vector, in ORIGINAL column order. */
99
+ predict: (x: number[]) => number;
100
+ }
101
+ /**
102
+ * Ordinary least squares, with Excel's rank-deficiency behavior.
103
+ *
104
+ * Excel does NOT fail on collinear predictors. It drops the redundant column — coefficient 0,
105
+ * standard error 0 — and reduces the effective k, so `df` and `F` are computed against the
106
+ * columns that survived (`LINEST(M1:M4, N1:O4)` with x2 = 2*x1 returns `0.65, 0, -0.5` and df 2,
107
+ * not #NUM!). WHICH column is dropped is observable: the intercept is always kept, then columns
108
+ * are accepted from the LAST toward the first, so it is the earlier column that goes. That
109
+ * matches the reversed output order — Excel is eliminating in the order it reports.
110
+ *
111
+ * The same path covers "not enough observations": with n = 2 and 2 predictors the second column
112
+ * has no residual left and is dropped, which is exactly what Excel returns.
113
+ */
114
+ export declare const fitLeastSquares: (ys: number[], xs: number[][], useConst: boolean) => RegressionFit;
115
+ /**
116
+ * The `stats = TRUE` grid: 5 rows x (k + 1) columns.
117
+ *
118
+ * ```text
119
+ * m_k m_(k-1) … m_1 b
120
+ * se(m_k) se(…) … se(m_1) se(b)
121
+ * r2 sey #N/A #N/A
122
+ * F df #N/A #N/A
123
+ * ssreg ssresid #N/A #N/A
124
+ * ```
125
+ *
126
+ * Rows 3-5 hold two values each however wide the grid is, and every remaining slot is #N/A. So is
127
+ * `se(b)` when the intercept was not fitted — the b slot itself still carries a value (0 for
128
+ * LINEST, 1 for LOGEST), it is only its error that is #N/A.
129
+ */
130
+ export declare const buildStatsGrid: (fit: RegressionFit, coefficients: number[], useConst: boolean) => (number | FormulaError.Known)[][];
131
+ //# sourceMappingURL=LeastSquares.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LeastSquares.d.ts","sourceRoot":"","sources":["../../../../src/_utils/LeastSquares.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAgBhE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,kDAAkD;IAClD,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC;IACf,6CAA6C;IAC7C,CAAC,EAAE,MAAM,CAAC;IACV,iGAAiG;IACjG,aAAa,EAAE,OAAO,CAAC;IACvB,kFAAkF;IAClF,cAAc,EAAE,OAAO,CAAC;IACxB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,GAC7B,SAAS,MAAM,EACf,SAAS,MAAM,GAAG,SAAS,KAC1B,cAoCF,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,GACnB,OAAO,MAAM,EACb,MAAM,cAAc,KACnB;IAAE,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAoB9C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,GAAI,IAAI,MAAM,EAAE,KAAG,MAAM,EAO5C,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GACzB,MAAM,cAAc,EACpB,OAAO,MAAM,GAAG,SAAS,EACzB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,MAAM,KAC/B,MAAM,EAAE,EAuBV,CAAC;AAEF,gGAAgG;AAChG,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,qGAAqG;IACrG,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,gGAAgG;IAChG,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,uFAAuF;IACvF,GAAG,EAAE,MAAM,CAAC;IACZ,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,+FAA+F;IAC/F,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,MAAM,CAAC;CAClC;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,GAC1B,IAAI,MAAM,EAAE,EACZ,IAAI,MAAM,EAAE,EAAE,EACd,UAAU,OAAO,KAChB,aA+IF,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,GACzB,KAAK,aAAa,EAClB,cAAc,MAAM,EAAE,EACtB,UAAU,OAAO,KAChB,CAAC,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,EAAE,EAsBjC,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @hidden Unimplemented Cube
3
+ * @summary Returns a key performance indicator (KPI) property and displays the KPI name in the cell.
4
+ * @param connection is the name of a connection to an OLAP cube.
5
+ * @param kpiName is the KPI name.
6
+ * @param kpiProperty is the KPI property.
7
+ * @param caption is the caption to be displayed in the cell.
8
+ */
9
+ export declare function CUBEKPIMEMBER(connection: string, kpiName: string, kpiProperty: number, // option 1-6
10
+ caption?: string): Promise<string>;
11
+ /**
12
+ * @hidden Unimplemented Cube
13
+ * @summary Returns a member or tuple from the cube.
14
+ * @param connection is the name of a connection to an OLAP cube.
15
+ * @param memberExpression is the expression representing the name of a member or tuple in the OLAP cube.
16
+ * @param caption is the caption to be displayed in the cell.
17
+ */
18
+ export declare function CUBEMEMBER(connection: string, memberExpression: string, caption?: string): Promise<string>;
19
+ /**
20
+ * @hidden Unimplemented Cube
21
+ * @summary Returns the value of a member property from the cube.
22
+ * @param connection is the name of a connection to an OLAP cube.
23
+ * @param memberExpression is the expression representing the name of a member in the OLAP cube.
24
+ * @param kpiProperty is the property name.
25
+ */
26
+ export declare function CUBEMEMBERPROPERTY(connection: string, memberExpression: string, kpiProperty: number): Promise<string>;
27
+ /**
28
+ * @hidden Unimplemented Cube
29
+ * @summary Returns the nth, or ranked, member in a set.
30
+ * @param connection is the name of a connection to an OLAP cube.
31
+ * @param setExpression is the set from which the element is to be retrieved.
32
+ * @param rank is the rank of the element to be retrieved.
33
+ * @param caption is the caption to be displayed in the cell.
34
+ */
35
+ export declare function CUBERANKEDMEMBER(connection: string, setExpression: string, rank: number, // 1 - 5
36
+ caption?: string): Promise<string>;
37
+ /**
38
+ * @hidden Unimplemented Cube
39
+ * @summary Defines a calculated set of members or tuples by sending a set expression to the cube on the server, which creates the set, and then returns that set to Microsoft Excel.
40
+ * @param connection is the name of a connection to an OLAP cube.
41
+ * @param setExpression is the expression for the set.
42
+ * @param caption is the caption to be displayed in the cell.
43
+ * @param sortOrder is the sort order.
44
+ * @param sortBy is the sort by.
45
+ *
46
+ * @remarks
47
+ * https://support.office.com/client/results?authtype=unknown&lcid=1033&locale=en-us&microsoftapplicationstelemetrydeviceid=70192ff8-de17-4a6b-8e59-35903120b479&ns=EXCEL&syslcid=1033&uilcid=1033&version=90&helpid=xlmain11.chm60526
48
+ */
49
+ export declare function CUBESET(connection: string, setExpression: string, caption?: string, sortOrder?: number, // 1 - 6
50
+ sortBy?: string): Promise<string>;
51
+ /**
52
+ * @hidden Unimplemented Cube
53
+ * @summary Returns the number of items in a set.
54
+ * @param set is the set whose elements are to be counted.
55
+ */
56
+ export declare function CUBESETCOUNT(set: string): Promise<number>;
57
+ /**
58
+ * @hidden Unimplemented Cube
59
+ * @summary Returns an aggregated value from the cube.
60
+ * @param connection is the name of a connection to an OLAP cube.
61
+ * @param memberExpression is a slicer that determines the portion of the OLAP cube for which the aggregation value is to be retrieved.
62
+ */
63
+ export declare function CUBEVALUE(connection: string, ...memberExpression: string[]): Promise<string>;
64
+ //# sourceMappingURL=Cube.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cube.d.ts","sourceRoot":"","sources":["../../../../src/cube/Cube.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EAAE,aAAa;AAClC,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,UAAU,EAAE,MAAM,EAClB,gBAAgB,EAAE,MAAM,EACxB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAClB,gBAAgB,EAAE,MAAM,EACxB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,EAAE,QAAQ;AACtB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CACrB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ;AAC5B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEzD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,UAAU,EAAE,MAAM,EAClB,GAAG,gBAAgB,EAAE,MAAM,EAAE,GAC5B,OAAO,CAAC,MAAM,CAAC,CAEjB"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @summary Returns the accrued interest for a security that pays periodic interest.
3
+ * @param issue is the security's issue date, expressed as a serial date number.
4
+ * @param firstInterest is the security's first interest date, expressed as a serial date number.
5
+ * @param settlement is the security's settlement date, expressed as a serial date number.
6
+ * @param rate is the security's annual coupon rate.
7
+ * @param par is the security's par value.
8
+ * @param frequency is the number of coupon payments per year.
9
+ * @param basis is the type of day count basis to use.
10
+ * @param calcMethod is a logical value: to accrued interest from issue date = TRUE; to calculate from last coupon payment date = FALSE.
11
+ *
12
+ * @remarks
13
+ * {@link https://support.microsoft.com/en-us/office/accrint-function-fe45d089-6722-4fb3-9379-e1f911d8dc74|Docs}
14
+ */
15
+ export declare function ACCRINT(issue: number, // date
16
+ firstInterest: number, //date
17
+ settlement: number, //date
18
+ rate: number, par: number, frequency: number, basis?: number, calcMethod?: boolean): number;
19
+ //# sourceMappingURL=ACCRINT.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ACCRINT.d.ts","sourceRoot":"","sources":["../../../../src/financial/ACCRINT.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,MAAM,EAAE,OAAO;AACtB,aAAa,EAAE,MAAM,EAAE,MAAM;AAC7B,UAAU,EAAE,MAAM,EAAE,MAAM;AAC1B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,KAAK,GAAE,MAAQ,EACf,UAAU,GAAE,OAAY,GACvB,MAAM,CA+BR"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @summary Returns the depreciation for each accounting period using a
3
+ * depreciation coefficient (French degressive / accelerated depreciation).
4
+ * @param cost is the cost of the asset.
5
+ * @param datePurchased is the date the asset is purchased.
6
+ * @param firstPeriod is the date of the end of the first period.
7
+ * @param salvage is the salvage value at the end of life of the asset.
8
+ * @param period is the period.
9
+ * @param rate is the depreciation rate.
10
+ * @param basis is the type of day count basis to use.
11
+ *
12
+ * @remarks
13
+ * AMORDEGRC is the accelerated counterpart to AMORLINC. The depreciation
14
+ * rate is multiplied by a coefficient that depends on the asset's useful life
15
+ * (computed as `1 / rate`):
16
+ *
17
+ * life (1/rate) │ coefficient
18
+ * ───────────────┼────────────
19
+ * < 3 years │ 1.5 (special algorithm — see below)
20
+ * 3–4 years │ 1.5
21
+ * 5–6 years │ 2.0
22
+ * > 6 years │ 2.5
23
+ *
24
+ * The accelerated rate = rate × coefficient.
25
+ *
26
+ * Normal algorithm (life >= 3, per Excel spec):
27
+ * Period 0: FLOOR(cost × rateAccel × (days / 365)) [basis=1 always uses 365]
28
+ * bv carry-forward uses actual yearDays (366 for leap years)
29
+ * Period N: FLOOR(max(DDB, SL)) where:
30
+ * DDB = bv × rateAccel
31
+ * SL = bv / (ceil(1/rate) − period) [no salvage subtraction]
32
+ * No clamping to (bv − salvage) — Excel deprecates past salvage.
33
+ * Returns 0 when bv ≤ salvage at start of period.
34
+ *
35
+ * Special algorithm (life < 3):
36
+ * Period 0: FLOOR(cost × rateAccel × (days / actualYearDays))
37
+ * Period N: CEIL(bv / (ceil(1/rate) − 1)) — same value for all remaining periods
38
+ * Returns 0 once all remaining periods are exhausted.
39
+ *
40
+ * Excel-verified behaviors:
41
+ * - basis=2 and basis=4 return #NUM! (unlike AMORLINC which rejects basis=2
42
+ * only; AMORDEGRC rejects both)
43
+ * - life < 3 does NOT return #NUM! despite documentation — Excel computes
44
+ * using coeff=1.5 with the simplified equal-split algorithm above
45
+ * - period 0 for basis=1 with life >= 3: return value uses yearDays=365,
46
+ * but the bv carried into period 1 uses the actual yearDays (366 for leap).
47
+ * This means total depreciation across all periods can exceed cost by 1
48
+ * for the life < 3 case — this matches Excel's behavior exactly.
49
+ */
50
+ export declare function AMORDEGRC(cost: number, datePurchased: number, // date serial
51
+ firstPeriod: number, // date serial
52
+ salvage: number, period: number, rate: number, basis?: number): number;
53
+ //# sourceMappingURL=AMORDEGRC.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AMORDEGRC.d.ts","sourceRoot":"","sources":["../../../../src/financial/AMORDEGRC.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,EAAE,cAAc;AACrC,WAAW,EAAE,MAAM,EAAI,cAAc;AACrC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,MAAU,GAChB,MAAM,CAoCR"}
@@ -0,0 +1,29 @@
1
+ import { Scalar } from '@sheetxl/primitives';
2
+ /**
3
+ * @hidden Legacy
4
+ * @summary Returns the number of days between two dates.
5
+ * @param startDate is a serial date number that represents the start date.
6
+ * @param endDate is a serial date number that represents the end date.
7
+ * @param unit is a string that specifies the unit of time to use.
8
+ */
9
+ export declare function DATEDIF(startDate: number, // Date
10
+ endDate: number, // Date
11
+ unit: string): number;
12
+ /**
13
+ * @summary Returns the year fraction representing the number of whole days between start_date and end_date.
14
+ * @param startDate is a serial date number that represents the start date.
15
+ * @param endDate is a serial date number that represents the end date.
16
+ * @param basis is the type of day count basis to use.
17
+ * @category Date & Time
18
+ */
19
+ export declare function YEARFRAC(startDate: Scalar, endDate: Scalar, basis?: Scalar): number;
20
+ /**
21
+ * @summary Returns the number of days between two dates based on a 360-day year (twelve 30-day months).
22
+ * @param endDate startDate and endDate are the two dates between which you want to know the number of days.
23
+ * @param startDate startDate and endDate are the two dates between which you want to know the number of days.
24
+ * @param method is a logical value specifying the calculation method: U.S. (NASD) = FALSE; European = TRUE.
25
+ */
26
+ export declare function DAYS360(startDate: number, // date
27
+ endDate: number, // date
28
+ method?: boolean): number;
29
+ //# sourceMappingURL=Date.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Date.d.ts","sourceRoot":"","sources":["../../../../src/financial/Date.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAKlE;;;;;;GAMG;AACH,wBAAgB,OAAO,CACrB,SAAS,EAAE,MAAM,EAAE,OAAO;AAC1B,OAAO,EAAE,MAAM,EAAE,OAAO;AACxB,IAAI,EAAE,MAAM,GACX,MAAM,CAsCR;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,MAAQ,GACd,MAAM,CAwBR;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,SAAS,EAAE,MAAM,EAAE,OAAO;AAC1B,OAAO,EAAE,MAAM,EAAE,OAAO;AACxB,MAAM,GAAE,OAAa,GACpB,MAAM,CAMR"}