finance-calculator-pro 1.1.0 → 1.2.0

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.
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  ![finance-calculator-pro banner](https://raw.githubusercontent.com/boffincoders/finance-calculator/refs/heads/master/.github/assets/finance-calculator-pro.png)
12
12
 
13
13
  > **Zero-dependency financial analysis engine for JavaScript and TypeScript.**
14
- > Calculate 30+ fundamental analysis metrics — valuation ratios, profitability metrics, liquidity ratios, solvency indicators, efficiency metrics, earnings quality signals, and bankruptcy risk scores — from raw financial data. No API calls. No heavy dependencies. Works in Node.js, browsers, and edge runtimes.
14
+ > Calculate 60+ financial metrics — valuation ratios, profitability, liquidity, solvency, efficiency, intrinsic value, composite scoring, technical indicators (SMA, EMA, RSI, MACD, ATR, ADX, Bollinger Bands), and bankruptcy risk scores — from raw financial data. No API calls. No runtime dependencies. Works in Node.js, browsers, and edge runtimes.
15
15
 
16
16
  ---
17
17
 
@@ -50,7 +50,7 @@ Building a stock screener, neo-bank, or internal financial analysis tool? [Let's
50
50
 
51
51
  ---
52
52
 
53
- ## Metrics Reference — 30+ Fundamental Analysis Metrics
53
+ ## Metrics Reference — 60+ Functions Across 12 Categories
54
54
 
55
55
  ### Valuation Ratios
56
56
  | Metric | Function | Formula |
@@ -67,6 +67,7 @@ Building a stock screener, neo-bank, or internal financial analysis tool? [Let's
67
67
  | Dividend Yield | `dividendYield()` | `Annual Dividend / Price` |
68
68
  | Discounted Cash Flow (DCF) | `calculateDCF()` | Terminal value + discounted FCF streams |
69
69
  | Graham Number | `grahamNumber()` | `√(22.5 × EPS × Book Value)` |
70
+ | Market Cap to Total Capital | `marketCapToDebtCap()` | `Market Cap / (Market Cap + Total Debt)` |
70
71
 
71
72
  ### Profitability Metrics
72
73
  | Metric | Function | Formula |
@@ -101,6 +102,9 @@ Building a stock screener, neo-bank, or internal financial analysis tool? [Let's
101
102
  | Inventory Turnover | `inventoryTurnover()` | `COGS / Average Inventory` |
102
103
  | Receivables Turnover | `receivablesTurnover()` | `Revenue / Trade Receivables` |
103
104
  | Days Sales Outstanding (DSO) | `daysSalesOutstanding()` | `365 / Receivables Turnover` |
105
+ | Payable Days (DPO) | `payableDays()` | `(Trade Payables / COGS) × 365` |
106
+ | Working Capital Days | `workingCapitalDays()` | `(Working Capital / Revenue) × 365` |
107
+ | Cash Conversion Cycle | `cashConversionCycle()` | `DSO + DIO − DPO` |
104
108
 
105
109
  ### Earnings Quality Metrics
106
110
  | Metric | Function | Formula |
@@ -116,11 +120,51 @@ Building a stock screener, neo-bank, or internal financial analysis tool? [Let's
116
120
  | Sharpe Ratio | `sharpe()` | Risk-adjusted return vs risk-free rate |
117
121
  | Target Upside | `targetUpside()` | % gap to analyst target price |
118
122
 
123
+ ### Intrinsic Valuation & Scoring
124
+ | Metric | Function | Notes |
125
+ |---|---|---|
126
+ | Graham Number | `grahamNumber()` | Benjamin Graham's defensive value ceiling |
127
+ | Net Current Value Per Share | `computeNCVPS()` | (Current Assets − Total Liabilities) / Shares |
128
+ | Intrinsic Value Estimate | `computeIntrinsicValue()` | Simple 5-yr EPS projection with margin of safety |
129
+ | G-Factor (Composite) | `computeGFactor()` | Quality×40% + Growth×35% + Momentum×25% |
130
+ | Quality Score | `computeQualityScore()` | Piotroski + ROE vs sector + margins + pledge + promoter |
131
+ | Growth Score | `computeGrowthScore()` | Revenue growth + profit growth + EPS growth + CFO |
132
+ | Value Score | `computeValueScore()` | P/E vs avg + P/B vs sector + PEG + historical percentile |
133
+ | Momentum Score | `computeMomentumScore()` | SMA200 + RSI + ADX + volume ratio + ROC-125 |
134
+
119
135
  ### Growth & Timeseries Analysis
120
- - **YoY Growth** Year-over-year revenue, net income, EPS growth rates
121
- - **QoQ Growth** — Quarter-over-quarter sequential growth
122
- - **CAGR** Compound Annual Growth Rate over any period
123
- - **Fundamental Trends** — Multi-period margin trends, FCF conversion tracking
136
+ | Function | Description |
137
+ |---|---|
138
+ | `calculateGrowthRate()` | Single-period % growth rate |
139
+ | `yoyGrowth()` | Year-over-year growth rates for a series |
140
+ | `qoqGrowth()` | Quarter-over-quarter growth rates |
141
+ | `cagr()` | Compound Annual Growth Rate |
142
+ | `medianGrowth()` | Median YoY growth rate (outlier-resistant) |
143
+
144
+ ### TTM & Historical Aggregation
145
+ | Function | Description |
146
+ |---|---|
147
+ | `computeTTM()` | Trailing Twelve Months sum (last 4 quarters) |
148
+ | `computeTTMAvg()` | Trailing Twelve Months average |
149
+ | `computeNYearAverage()` | Rolling N-year average of quarterly data |
150
+ | `computeNYearSum()` | Rolling N-year sum of quarterly data |
151
+ | `computeHistoricalPoint()` | Value at exactly N quarters back |
152
+
153
+ ### Technical Indicators *(native — zero dependencies)*
154
+ | Function | Description |
155
+ |---|---|
156
+ | `sma(prices, period)` | Simple Moving Average |
157
+ | `ema(prices, period)` | Exponential Moving Average |
158
+ | `rsi(prices, period?)` | Relative Strength Index (default 14) |
159
+ | `roc(prices, period?)` | Rate of Change (default 14) |
160
+ | `macd(prices, fast?, slow?, signal?)` | MACD line, signal line, histogram |
161
+ | `atr(highs, lows, closes, period?)` | Average True Range (default 14) |
162
+ | `bollingerBands(prices, period?, mult?)` | Upper, Middle, Lower bands + Bandwidth |
163
+ | `adx(highs, lows, closes, period?)` | ADX + +DI + −DI (default 14) |
164
+ | `mfi(highs, lows, closes, volumes, period?)` | Money Flow Index (default 14) |
165
+ | `vwap(highs, lows, closes, volumes)` | Volume-Weighted Average Price |
166
+ | `beta(stockReturns, benchmarkReturns)` | Beta vs benchmark |
167
+ | `pivotPoints(high, low, close)` | Classic Pivot Points (P, R1–R3, S1–S3) |
124
168
 
125
169
  ---
126
170
 
package/dist/index.d.mts CHANGED
@@ -711,6 +711,18 @@ declare const evRevenue: (enterpriseValue: number, totalRevenue: number) => numb
711
711
  */
712
712
  declare const evFcf: (enterpriseValue: number, freeCashFlow: number) => number | null;
713
713
 
714
+ /**
715
+ * Market Cap to Total Capitalization Ratio (Market Cap / (Market Cap + Debt))
716
+ * Also known as the equity-to-total-capital ratio.
717
+ * Formula: Market Cap / (Market Cap + Total Debt)
718
+ * Interpretation:
719
+ * - Ranges from 0 to 1.
720
+ * - Higher ratio → company is predominantly equity-financed (lower financial risk).
721
+ * - Lower ratio → company is more debt-heavy relative to its total capital.
722
+ * - Useful for comparing capital structure across companies.
723
+ */
724
+ declare const marketCapToDebtCap: (marketCap: number, totalDebt: number) => number | null;
725
+
714
726
  /**
715
727
  * Return on Equity (ROE)
716
728
  * Formula: Net Income / Equity
@@ -870,6 +882,38 @@ declare const receivablesTurnover: (totalRevenue: number, tradeReceivables: numb
870
882
  */
871
883
  declare const daysSalesOutstanding: (totalRevenue: number, tradeReceivables: number) => number | null;
872
884
 
885
+ /**
886
+ * Payable Days (Days Payable Outstanding — DPO)
887
+ * Formula: (Trade Payables / COGS) × 365
888
+ * Interpretation:
889
+ * - How many days on average it takes the company to pay its suppliers.
890
+ * - Higher DPO can indicate strong bargaining power, but excessively high values
891
+ * may signal liquidity stress or strained supplier relationships.
892
+ */
893
+ declare const payableDays: (tradePayables: number, cogs: number) => number | null;
894
+
895
+ /**
896
+ * Working Capital Days
897
+ * Formula: (Working Capital / Revenue) × 365
898
+ * Where Working Capital = Current Assets - Current Liabilities
899
+ * Interpretation:
900
+ * - Measures how many days of revenue are tied up in working capital.
901
+ * - Lower is generally better (capital is not locked in operations).
902
+ * - Negative values indicate current liabilities exceed current assets.
903
+ */
904
+ declare const workingCapitalDays: (workingCapital: number, revenue: number) => number | null;
905
+
906
+ /**
907
+ * Cash Conversion Cycle (CCC)
908
+ * Formula: Debtor Days + Inventory Days - Payable Days
909
+ * Interpretation:
910
+ * - Measures the number of days it takes to convert inventory/payables into cash.
911
+ * - Lower (or negative) is better — negative CCC means the company collects cash
912
+ * before it pays its suppliers (e.g. e-commerce, supermarkets).
913
+ * - High positive CCC indicates capital is tied up in operations for longer.
914
+ */
915
+ declare const cashConversionCycle: (debtorDays: number, inventoryDays: number, payableDays: number) => number;
916
+
873
917
  /**
874
918
  * Dividend Payout Ratio
875
919
  * The proportion of earnings paid to shareholders as dividends.
@@ -930,6 +974,56 @@ declare const altmanZScore: (workingCapital: number, retainedEarnings: number, e
930
974
  */
931
975
  declare const grahamNumber: (eps: number, book: number) => number | null;
932
976
 
977
+ /**
978
+ * Net Current Value Per Share (NCVPS)
979
+ * Formula: (Current Assets - Total Liabilities) / Shares Outstanding
980
+ * Interpretation:
981
+ * - A conservative "liquidation value" per share, inspired by Benjamin Graham's
982
+ * net-net working capital criterion.
983
+ * - If NCVPS > market price, the stock may be trading below liquidation value —
984
+ * a deep value signal (but also common in distressed or declining businesses).
985
+ * - Positive NCVPS means current assets alone cover all liabilities.
986
+ */
987
+ declare const computeNCVPS: (currentAssets: number, totalLiabilities: number, sharesOutstanding: number) => number | null;
988
+
989
+ /**
990
+ * G-Factor (Composite Fundamental Score)
991
+ * Formula: (Quality × 0.40) + (Growth × 0.35) + (Momentum × 0.25)
992
+ * Inputs should be scores in the range [0, 100].
993
+ * Output is a weighted composite in the range [0, 100].
994
+ *
995
+ * Interpretation:
996
+ * - G-Factor > 70 → Strong composite fundamentals
997
+ * - G-Factor 40–70 → Average
998
+ * - G-Factor < 40 → Weak
999
+ *
1000
+ * Weights are based on typical quantitative equity-factor research priorities:
1001
+ * Quality is the most predictive of long-term returns; Growth drives near-term
1002
+ * re-rating; Momentum captures market confirmation of the thesis.
1003
+ */
1004
+ declare const computeGFactor: (qualityScore: number, growthScore: number, momentumScore: number) => number;
1005
+
1006
+ /**
1007
+ * Simplified Intrinsic Value Estimate
1008
+ * Formula: EPS × (1 + growthRate) ^ years / (1 + discountRate) ^ years
1009
+ * applied over a default 5-year horizon, then divided by (1 - safetyMargin)
1010
+ *
1011
+ * A lightweight DCF approximation for quick screening:
1012
+ * intrinsicValue = (EPS × (1 + growthRate)^5) / (1 - safetyMargin)
1013
+ *
1014
+ * Parameters:
1015
+ * @param eps Earnings Per Share (current or TTM)
1016
+ * @param growthRate Expected annual EPS growth rate as a decimal (e.g. 0.15 for 15%)
1017
+ * @param safetyMargin Margin of safety as a decimal (e.g. 0.25 for 25% discount)
1018
+ *
1019
+ * Interpretation:
1020
+ * - If market price < intrinsicValue → potential undervaluation
1021
+ * - safetyMargin of 0.25–0.35 is conventional for conservative investing
1022
+ *
1023
+ * Returns null for non-positive EPS or invalid inputs.
1024
+ */
1025
+ declare const computeIntrinsicValue: (eps: number, growthRate: number, safetyMargin: number) => number | null;
1026
+
933
1027
  /**
934
1028
  * Calculate basic growth rate given current and previous values.
935
1029
  * Useful for building out mapping functions natively in the analyzer.
@@ -950,6 +1044,16 @@ declare const qoqGrowth: (dataPoints: number[]) => number[];
950
1044
  * Formula: (Ending Value / Beginning Value) ^ (1 / Years) - 1
951
1045
  */
952
1046
  declare const cagr: (beginningValue: number, endingValue: number, periods: number) => number | null;
1047
+ /**
1048
+ * Median Growth Rate
1049
+ * Calculates the YoY growth rates for a series of annual values (oldest first),
1050
+ * then returns the median of those rates.
1051
+ * Interpretation:
1052
+ * - More robust than mean growth because it is not skewed by outlier years.
1053
+ * - Useful for evaluating the "typical" annual growth of earnings, revenue, etc.
1054
+ * Returns null if fewer than 2 data points are provided.
1055
+ */
1056
+ declare const medianGrowth: (annualValues: number[]) => number | null;
953
1057
 
954
1058
  /**
955
1059
  * Analyst Target Upside / Downside
@@ -960,4 +1064,330 @@ declare const cagr: (beginningValue: number, endingValue: number, periods: numbe
960
1064
  */
961
1065
  declare const targetUpside: (currentPrice: number, targetPrice: number) => number | null;
962
1066
 
963
- export { type CompanySnapshotInput, type EvaluatedMetric, type FundamentalTimeseriesInput, type MetricStatus, type PiotroskiInput, type PiotroskiResult, type PiotroskiSignals, altmanZScore, analyzeBatch, analyzeCompany, analyzeEfficiency, analyzeFundamentalTrends, analyzeLiquidity, analyzeProfitability, analyzeQuality, analyzeRisk, analyzeSolvency, analyzeValuation, assetTurnover, cagr, calculateDCF, calculateEnterpriseValue, calculateGrowthRate, cashConversionRatio, currentRatio, daysSalesOutstanding, debtToAssets, debtToEquity, dividendYield, earningsYield, evEbitda, evFcf, evRevenue, evaluate, fcfMargin, grahamNumber, grossMargin, impliedSharePrice, interestCoverage, inventoryTurnover, netDebt, netDebtToEbitda, netProfitMargin, operatingMargin, payoutRatio, pb, pbFromMarketCap, pe, peg, piotroski, priceToCashFlow, priceToCashFlowPerShare, ps, psFromMarketCap, qoqGrowth, quickRatio, receivablesTurnover, roa, roe, roic, safeDivide, sharpe, targetUpside, yoyGrowth };
1067
+ /**
1068
+ * Trailing Twelve Months (TTM) Utilities
1069
+ *
1070
+ * TTM aggregates the most recent four quarters of data to produce
1071
+ * an annualised figure without waiting for a full fiscal year.
1072
+ */
1073
+ /**
1074
+ * Trailing Twelve Months Sum
1075
+ * Returns the sum of the last 4 quarterly values (or fewer if < 4 available).
1076
+ * Expects values in chronological order: oldest first, most recent last.
1077
+ * e.g. [Q1, Q2, Q3, Q4, Q1_next, Q2_next] → sums last 4
1078
+ */
1079
+ declare const computeTTM: (quarterlyValues: number[]) => number | null;
1080
+ /**
1081
+ * Trailing Twelve Months Average
1082
+ * Returns the average of the last 4 quarterly values (or fewer if < 4 available).
1083
+ * Handles arrays shorter than 4 gracefully by averaging whatever is available.
1084
+ * Expects chronological order: oldest first, most recent last.
1085
+ */
1086
+ declare const computeTTMAvg: (quarterlyValues: number[]) => number | null;
1087
+
1088
+ /**
1089
+ * Historical Aggregation Utilities
1090
+ *
1091
+ * Functions for computing averages, sums, and point lookups over
1092
+ * rolling windows of quarterly (or annual) data.
1093
+ * All functions expect chronological order: oldest first, most recent last.
1094
+ */
1095
+ /**
1096
+ * N-Year Average
1097
+ * Returns the average of the last (years × 4) quarterly values.
1098
+ * e.g. computeNYearAverage(data, 3) → average of last 12 quarters.
1099
+ * If fewer values are available than requested, averages all available values.
1100
+ */
1101
+ declare const computeNYearAverage: (quarterlyValues: number[], years: number) => number | null;
1102
+ /**
1103
+ * N-Year Sum
1104
+ * Returns the sum of the last (years × 4) quarterly values.
1105
+ * If fewer values are available, sums all available values.
1106
+ */
1107
+ declare const computeNYearSum: (quarterlyValues: number[], years: number) => number | null;
1108
+ /**
1109
+ * Historical Point Lookup
1110
+ * Returns the value at exactly `quartersBack` quarters from the most recent value.
1111
+ * quartersBack = 0 → most recent value
1112
+ * quartersBack = 4 → value from 1 year ago (same quarter last year)
1113
+ * Returns null if the index is out of bounds.
1114
+ */
1115
+ declare const computeHistoricalPoint: (quarterlyValues: number[], quartersBack: number) => number | null;
1116
+
1117
+ /**
1118
+ * Composite Scoring Engine
1119
+ *
1120
+ * Four domain scores — Quality, Growth, Value, Momentum — each in range [0, 100].
1121
+ * Each score is a weighted sum of normalised sub-signals (also 0-100 or boolean).
1122
+ *
1123
+ * These scores feed into computeGFactor for the overall composite.
1124
+ */
1125
+ interface QualityScoreInput {
1126
+ /** Piotroski F-Score (0–9) */
1127
+ piotroskiScore: number;
1128
+ /**
1129
+ * ROE vs. sector median — percentage of sector ROE this company achieves.
1130
+ * e.g. if company ROE is 18% and sector median is 15%, pass 18/15 = 1.2.
1131
+ * Capped at 1.0 (100 points if >= sector median).
1132
+ */
1133
+ roeVsSector: number;
1134
+ /** Whether operating margins are improving YoY (boolean) */
1135
+ marginsImproving: boolean;
1136
+ /** Promoter pledge percentage is 0 or negligible (boolean) */
1137
+ pledgeFree: boolean;
1138
+ /** Promoter holding is stable or increasing YoY (boolean) */
1139
+ promoterStable: boolean;
1140
+ }
1141
+ /**
1142
+ * Quality Score (0–100)
1143
+ * Weights:
1144
+ * Piotroski (0–9 → 0–100): 30 %
1145
+ * ROE vs Sector (capped at 1.0 multiplier): 20 %
1146
+ * Margins improving: 20 %
1147
+ * Pledge-free: 15 %
1148
+ * Promoter stable: 15 %
1149
+ */
1150
+ declare const computeQualityScore: (input: QualityScoreInput) => number;
1151
+ interface GrowthScoreInput {
1152
+ /**
1153
+ * Revenue growth rate relative to sector.
1154
+ * e.g. if company revenue grew 20% and sector average is 12%, pass 20/12 = 1.67.
1155
+ * Capped at 1.0 (100 points if >= sector growth).
1156
+ */
1157
+ revenueGrowthVsSector: number;
1158
+ /**
1159
+ * Profit (net income) growth rate as decimal (e.g. 0.20 for 20% growth).
1160
+ * Capped at 30% for full score (0.30 → 100).
1161
+ */
1162
+ profitGrowthRate: number;
1163
+ /**
1164
+ * EPS growth rate as decimal. Capped at 25% for full score (0.25 → 100).
1165
+ */
1166
+ epsGrowthRate: number;
1167
+ /** Operating cash flow is positive this period (boolean) */
1168
+ cfoPositive: boolean;
1169
+ /** Revenue acceleration: current year growth > prior year growth (boolean) */
1170
+ revenueAccelerating: boolean;
1171
+ }
1172
+ /**
1173
+ * Growth Score (0–100)
1174
+ * Weights:
1175
+ * Revenue growth vs sector: 25 %
1176
+ * Profit growth rate: 25 %
1177
+ * EPS growth rate: 20 %
1178
+ * CFO positive: 15 %
1179
+ * Revenue accelerating: 15 %
1180
+ */
1181
+ declare const computeGrowthScore: (input: GrowthScoreInput) => number;
1182
+ interface ValueScoreInput {
1183
+ /**
1184
+ * Current P/E divided by the stock's own 3-year average P/E.
1185
+ * e.g. currentPE = 15, avgPE = 20 → ratio = 15/20 = 0.75 (trading below avg → higher score).
1186
+ * Score is higher when ratio < 1 (currently cheaper than historical average).
1187
+ */
1188
+ peVs3yrAvg: number;
1189
+ /**
1190
+ * Current P/B vs sector median P/B. Score is higher when < 1.
1191
+ * e.g. company PB = 2, sector median PB = 3 → ratio = 2/3 ≈ 0.67
1192
+ */
1193
+ pbVsSector: number;
1194
+ /**
1195
+ * PEG ratio (P/E ÷ Growth Rate). Lower is better; 1.0 = fair, < 1 = undervalued.
1196
+ * Capped at 0 for negative PEG; capped at full score for PEG ≤ 0.5.
1197
+ */
1198
+ peg: number;
1199
+ /**
1200
+ * Current P/E percentile over the stock's own 5-year history (0–100).
1201
+ * Lower percentile = cheaper vs history = higher score.
1202
+ * Pass 0–100 directly.
1203
+ */
1204
+ historicalPePercentile: number;
1205
+ }
1206
+ /**
1207
+ * Value Score (0–100)
1208
+ * Weights:
1209
+ * P/E vs 3yr avg: 30 %
1210
+ * P/B vs sector: 25 %
1211
+ * PEG: 25 %
1212
+ * Historical P/E percentile: 20 %
1213
+ */
1214
+ declare const computeValueScore: (input: ValueScoreInput) => number;
1215
+ interface MomentumScoreInput {
1216
+ /**
1217
+ * Current price vs its 200-day SMA ratio.
1218
+ * e.g. price = 105, SMA200 = 100 → ratio = 1.05 (above SMA → bullish).
1219
+ * Score peaks at ratio ≥ 1.10 (10% above SMA).
1220
+ */
1221
+ priceVsSma200: number;
1222
+ /**
1223
+ * RSI (14-period). Range 0–100.
1224
+ * Score peaks at RSI 50–65 (trending without being overbought).
1225
+ */
1226
+ rsi: number;
1227
+ /**
1228
+ * ADX (Average Directional Index). Range 0–100.
1229
+ * ADX > 25 indicates a strong trend; ADX < 20 is trendless.
1230
+ * Score peaks at ADX ≥ 30.
1231
+ */
1232
+ adx: number;
1233
+ /**
1234
+ * Volume ratio: current 20-day avg volume / 90-day avg volume.
1235
+ * > 1.0 = rising volume (confirming move). Score caps at 1.5x.
1236
+ */
1237
+ volumeRatio: number;
1238
+ /**
1239
+ * Rate of Change over 125 trading days (6 months), as a decimal.
1240
+ * e.g. 0.20 = 20% return over 6 months. Capped at 40% for full score.
1241
+ */
1242
+ roc125: number;
1243
+ }
1244
+ /**
1245
+ * Momentum Score (0–100)
1246
+ * Weights:
1247
+ * Price vs SMA200: 25 %
1248
+ * RSI: 20 %
1249
+ * ADX: 20 %
1250
+ * Volume ratio: 20 %
1251
+ * ROC-125: 15 %
1252
+ */
1253
+ declare const computeMomentumScore: (input: MomentumScoreInput) => number;
1254
+
1255
+ /**
1256
+ * Technical Indicators
1257
+ *
1258
+ * All indicators are implemented natively with zero external dependencies.
1259
+ * Input arrays are expected in chronological order: oldest first, most recent last.
1260
+ * Functions return null when insufficient data is provided.
1261
+ */
1262
+ /**
1263
+ * Simple Moving Average (SMA)
1264
+ * Returns the average of the last `period` values.
1265
+ * Returns null if fewer values than `period` are provided.
1266
+ */
1267
+ declare const sma: (prices: number[], period: number) => number | null;
1268
+ /**
1269
+ * Exponential Moving Average (EMA)
1270
+ * Uses the standard smoothing factor k = 2 / (period + 1).
1271
+ * Seed: SMA of first `period` values, then EMA forward.
1272
+ * Returns null if fewer values than `period` are provided.
1273
+ */
1274
+ declare const ema: (prices: number[], period: number) => number | null;
1275
+ /**
1276
+ * Relative Strength Index (RSI)
1277
+ * Uses Wilder's Smoothed Moving Average (SMMA) — standard RSI formula.
1278
+ * Requires at least `period + 1` data points.
1279
+ * @param prices Closing prices, oldest first.
1280
+ * @param period Default 14.
1281
+ * Returns null if insufficient data.
1282
+ */
1283
+ declare const rsi: (prices: number[], period?: number) => number | null;
1284
+ /**
1285
+ * Rate of Change (ROC)
1286
+ * Formula: ((current - priorN) / priorN) × 100
1287
+ * Returns the percentage change over `period` bars.
1288
+ * Returns null if fewer than `period + 1` values are provided.
1289
+ */
1290
+ declare const roc: (prices: number[], period?: number) => number | null;
1291
+ interface MACDResult {
1292
+ /** MACD line = EMA(fast) - EMA(slow) */
1293
+ macdLine: number;
1294
+ /** Signal line = EMA(macdLine, signal) */
1295
+ signalLine: number;
1296
+ /** Histogram = macdLine - signalLine */
1297
+ histogram: number;
1298
+ }
1299
+ /**
1300
+ * MACD (Moving Average Convergence/Divergence)
1301
+ * Default: fast=12, slow=26, signal=9
1302
+ * Returns null if insufficient data.
1303
+ */
1304
+ declare const macd: (prices: number[], fastPeriod?: number, slowPeriod?: number, signalPeriod?: number) => MACDResult | null;
1305
+ /**
1306
+ * Average True Range (ATR)
1307
+ * Measures volatility by averaging the True Range over `period` bars.
1308
+ * True Range = max(high-low, |high-prevClose|, |low-prevClose|)
1309
+ * Uses Wilder's smoothing (same as RSI).
1310
+ * @param highs Array of high prices, chronological.
1311
+ * @param lows Array of low prices, chronological.
1312
+ * @param closes Array of close prices, chronological.
1313
+ * @param period Default 14.
1314
+ */
1315
+ declare const atr: (highs: number[], lows: number[], closes: number[], period?: number) => number | null;
1316
+ interface BollingerBandsResult {
1317
+ upper: number;
1318
+ middle: number;
1319
+ lower: number;
1320
+ /** Bandwidth: (upper - lower) / middle */
1321
+ bandwidth: number;
1322
+ }
1323
+ /**
1324
+ * Bollinger Bands
1325
+ * Middle = SMA(period), Upper = SMA + (stdDev × multiplier), Lower = SMA - (stdDev × multiplier)
1326
+ * @param prices Closing prices, chronological.
1327
+ * @param period Default 20.
1328
+ * @param multiplier Default 2.
1329
+ */
1330
+ declare const bollingerBands: (prices: number[], period?: number, multiplier?: number) => BollingerBandsResult | null;
1331
+ interface ADXResult {
1332
+ /** ADX: trend strength 0–100. > 25 = trending, < 20 = ranging */
1333
+ adx: number;
1334
+ /** +DI: positive directional indicator */
1335
+ plusDI: number;
1336
+ /** -DI: negative directional indicator */
1337
+ minusDI: number;
1338
+ }
1339
+ /**
1340
+ * ADX (Average Directional Index) with +DI and -DI
1341
+ * Uses Wilder's smoothing (same period as ATR).
1342
+ * @param period Default 14.
1343
+ */
1344
+ declare const adx: (highs: number[], lows: number[], closes: number[], period?: number) => ADXResult | null;
1345
+ /**
1346
+ * Money Flow Index (MFI)
1347
+ * Volume-weighted RSI. Uses typical price = (high + low + close) / 3.
1348
+ * @param period Default 14.
1349
+ */
1350
+ declare const mfi: (highs: number[], lows: number[], closes: number[], volumes: number[], period?: number) => number | null;
1351
+ /**
1352
+ * VWAP (Volume-Weighted Average Price)
1353
+ * Typically computed intraday (resets each session), but useful as a rolling
1354
+ * VWAP over the provided data window.
1355
+ * Formula: sum(typicalPrice × volume) / sum(volume)
1356
+ */
1357
+ declare const vwap: (highs: number[], lows: number[], closes: number[], volumes: number[]) => number | null;
1358
+ /**
1359
+ * Beta
1360
+ * Measures the stock's return volatility relative to a benchmark (e.g. index).
1361
+ * Beta = Covariance(stock, benchmark) / Variance(benchmark)
1362
+ * @param stockReturns Array of periodic returns for the stock.
1363
+ * @param benchmarkReturns Array of periodic returns for the benchmark.
1364
+ * Must be the same length as stockReturns.
1365
+ * Returns null if inputs are invalid or benchmark has zero variance.
1366
+ */
1367
+ declare const beta: (stockReturns: number[], benchmarkReturns: number[]) => number | null;
1368
+ interface PivotPointsResult {
1369
+ /** Central pivot point */
1370
+ pivot: number;
1371
+ /** Resistance levels */
1372
+ r1: number;
1373
+ r2: number;
1374
+ r3: number;
1375
+ /** Support levels */
1376
+ s1: number;
1377
+ s2: number;
1378
+ s3: number;
1379
+ }
1380
+ /**
1381
+ * Classic Pivot Points
1382
+ * Computed from the prior session's high, low, and close.
1383
+ * Pivot = (high + low + close) / 3
1384
+ * R1 = 2×Pivot − low
1385
+ * S1 = 2×Pivot − high
1386
+ * R2 = Pivot + (high − low)
1387
+ * S2 = Pivot − (high − low)
1388
+ * R3 = high + 2×(Pivot − low)
1389
+ * S3 = low − 2×(high − Pivot)
1390
+ */
1391
+ declare const pivotPoints: (high: number, low: number, close: number) => PivotPointsResult;
1392
+
1393
+ export { type ADXResult, type BollingerBandsResult, type CompanySnapshotInput, type EvaluatedMetric, type FundamentalTimeseriesInput, type GrowthScoreInput, type MACDResult, type MetricStatus, type MomentumScoreInput, type PiotroskiInput, type PiotroskiResult, type PiotroskiSignals, type PivotPointsResult, type QualityScoreInput, type ValueScoreInput, adx, altmanZScore, analyzeBatch, analyzeCompany, analyzeEfficiency, analyzeFundamentalTrends, analyzeLiquidity, analyzeProfitability, analyzeQuality, analyzeRisk, analyzeSolvency, analyzeValuation, assetTurnover, atr, beta, bollingerBands, cagr, calculateDCF, calculateEnterpriseValue, calculateGrowthRate, cashConversionCycle, cashConversionRatio, computeGFactor, computeGrowthScore, computeHistoricalPoint, computeIntrinsicValue, computeMomentumScore, computeNCVPS, computeNYearAverage, computeNYearSum, computeQualityScore, computeTTM, computeTTMAvg, computeValueScore, currentRatio, daysSalesOutstanding, debtToAssets, debtToEquity, dividendYield, earningsYield, ema, evEbitda, evFcf, evRevenue, evaluate, fcfMargin, grahamNumber, grossMargin, impliedSharePrice, interestCoverage, inventoryTurnover, macd, marketCapToDebtCap, medianGrowth, mfi, netDebt, netDebtToEbitda, netProfitMargin, operatingMargin, payableDays, payoutRatio, pb, pbFromMarketCap, pe, peg, piotroski, pivotPoints, priceToCashFlow, priceToCashFlowPerShare, ps, psFromMarketCap, qoqGrowth, quickRatio, receivablesTurnover, roa, roc, roe, roic, rsi, safeDivide, sharpe, sma, targetUpside, vwap, workingCapitalDays, yoyGrowth };