fin-ratios 0.7.3 → 1.0.2

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/dist/index.d.cts CHANGED
@@ -1333,4 +1333,292 @@ interface PortfolioOptions {
1333
1333
  */
1334
1334
  declare function portfolioQuality(holdings: HoldingInput[], options?: PortfolioOptions): PortfolioQualityResult;
1335
1335
 
1336
- export { AnnualQualityData, type CacheOptions, type DuPont3Factor, type FairValueOptions, type FairValueRange, type HoldingInput, type HoldingResult, type PortfolioOptions, type PortfolioQualityResult, QualityFactorResult, type RatioFn, affo, annualizeReturn, arrPerFte, assetTurnover, beta, burnMultiple, bvpsGrowth, cacPaybackPeriod, cacheStats, cached, cagr, calmarRatio, capRate, capexToDepreciation, capexToRevenue, capitalTurnover, cashConversionCycle, cashRatio, cashReturnOnAssets, cet1Ratio, clearCache, combinedRatio, conditionalVaR, currentRatio, customerAcquisitionCost, customerLifetimeValue, dcf2Stage, debtServiceCoverageRatio, debtToAssets, debtToCapital, debtToEquity, defensiveIntervalRatio, dio, dividendGrowthRate, downsideCaptureRatio, dpo, dso, duPont3, earningsPowerValue, ebitdaCoverageRatio, ebitdaGrowth, ebitdaMargin, efficiencyRatio, enterpriseValue, epsGrowth, equityMultiplier, evEbit, evEbitda, evFcf, evInvestedCapital, evRevenue, expenseRatio, fairValueRange, fcfConversion, fcfGrowth, fcfMargin, fcfYield, ffo, fixedAssetTurnover, fixedChargeCoverageRatio, forwardPe, freeCashFlow, gordonGrowthModel, grahamIntrinsicValue, grahamNumber, grossMargin, grossRevenueRetention, historicalVaR, informationRatio, interestCoverageRatio, invalidate as invalidateCache, inventoryTurnover, investedCapital, jensensAlpha, leveredFcf, loanToDepositRatio, lossRatio, ltvCacRatio, magicNumber, maxDrawdown, maximumDrawdown, mean, netDebtToEbitda, netDebtToEquity, netInterestMargin, netOperatingIncome, netProfitMargin, netRevenueRetention, nopat, nopatMargin, nplRatio, occupancyRate, ocfToSales, omegaRatio, operatingCashFlowRatio, operatingLeverage, operatingMargin, ownerEarnings, pAffo, pFcf, pFfo, parametricVaR, payablesTurnover, pb, pe, peg, percentile, portfolioQuality, premiumsToSurplus, pricesToReturns, profitPerEmployee, provisionCoverageRatio, ps, quickRatio, receivablesTurnover, revenueCAGR, revenueGrowth, revenuePerEmployee, reverseDcf, roa, roce, roe, roic, rote, ruleOf40, saasQuickRatio, safeDivide, setCache, sharpeRatio, sortinoRatio, stdDev, tangibleBookValuePerShare, tier1CapitalRatio, tobinsQ, trackingError, treynorRatio, ulcerIndex, underwritingProfitMargin, unleveredFcf, upsideCaptureRatio, workingCapitalTurnover };
1336
+ /**
1337
+ * Valuation Attractiveness Score.
1338
+ *
1339
+ * Provides a point-in-time assessment of how attractively a security is priced
1340
+ * relative to its earnings power, free cash flow generation, asset value, and
1341
+ * intrinsic value estimate. Higher scores indicate greater margin of safety.
1342
+ *
1343
+ * Signals
1344
+ * -------
1345
+ * 1. Earnings Yield Spread (25%) — excess earnings yield over risk-free rate
1346
+ * 2. FCF Yield (25%) — free cash flow yield on market price
1347
+ * 3. EV/EBITDA (20%) — enterprise multiple vs historical norms
1348
+ * 4. P/B Ratio (15%) — price-to-book premium or discount
1349
+ * 5. DCF Upside (15%) — percentage gap to intrinsic value estimate
1350
+ *
1351
+ * Score: 0–100
1352
+ * Rating: 'attractive' (≥65), 'fair' (40–64), 'expensive' (20–39), 'overvalued' (<20)
1353
+ */
1354
+ interface ValuationComponents {
1355
+ earningsYield: number;
1356
+ fcfYield: number;
1357
+ evEbitda: number;
1358
+ pbRatio: number;
1359
+ dcfUpside: number;
1360
+ }
1361
+ interface ValuationScore {
1362
+ score: number;
1363
+ rating: 'attractive' | 'fair' | 'expensive' | 'overvalued';
1364
+ components: ValuationComponents;
1365
+ riskFreeRate: number;
1366
+ evidence: string[];
1367
+ interpretation: string;
1368
+ }
1369
+ interface ValuationParams {
1370
+ peRatio?: number;
1371
+ evEbitda?: number;
1372
+ pFcf?: number;
1373
+ pbRatio?: number;
1374
+ fcfYieldPct?: number;
1375
+ earningsYieldPct?: number;
1376
+ dcfUpsidePct?: number;
1377
+ riskFreeRate?: number;
1378
+ }
1379
+ /**
1380
+ * Compute a point-in-time Valuation Attractiveness Score.
1381
+ *
1382
+ * @param params - Valuation multiples and optional risk-free rate override.
1383
+ * At least one input is required; missing signals default to 0.5.
1384
+ * @returns ValuationScore with score (0–100), rating, components, and evidence.
1385
+ *
1386
+ * @example
1387
+ * const result = valuationAttractivenessScore({
1388
+ * peRatio: 18,
1389
+ * evEbitda: 11,
1390
+ * pFcf: 22,
1391
+ * pbRatio: 3.2,
1392
+ * dcfUpsidePct: 25,
1393
+ * })
1394
+ * console.log(result.score) // e.g. 62
1395
+ * console.log(result.rating) // 'fair'
1396
+ */
1397
+ declare function valuationAttractivenessScore(params: ValuationParams): ValuationScore;
1398
+
1399
+ /**
1400
+ * Management Quality Score.
1401
+ *
1402
+ * Evaluates management's operational effectiveness using multi-year financial
1403
+ * series. A high-scoring management team consistently earns strong returns on
1404
+ * invested capital, expands or defends operating margins, treats shareholders
1405
+ * with respect by avoiding dilution, and delivers reliable revenue growth.
1406
+ *
1407
+ * Signals
1408
+ * -------
1409
+ * 1. ROIC Excellence (35%) — level, trend, and consistency of ROIC
1410
+ * 2. Margin Stability (25%) — operating margin level, trend, and stability
1411
+ * 3. Shareholder Orientation(25%) — share count trajectory (buybacks vs dilution)
1412
+ * 4. Revenue Execution (15%) — revenue growth rate level and consistency
1413
+ *
1414
+ * Score: 0–100
1415
+ * Rating: 'excellent' (≥75), 'good' (50–74), 'fair' (25–49), 'poor' (<25)
1416
+ *
1417
+ * Minimum 3 years of data required.
1418
+ */
1419
+ /** One year of financial data for management quality analysis. */
1420
+ interface AnnualManagementData {
1421
+ revenue?: number;
1422
+ ebit?: number;
1423
+ totalAssets?: number;
1424
+ totalEquity?: number;
1425
+ totalDebt?: number;
1426
+ cash?: number;
1427
+ sharesOutstanding?: number;
1428
+ incomeTaxExpense?: number;
1429
+ ebt?: number;
1430
+ interestExpense?: number;
1431
+ year?: number | string;
1432
+ }
1433
+ interface ManagementComponents {
1434
+ roicExcellence: number;
1435
+ marginStability: number;
1436
+ shareholderOrientation: number;
1437
+ revenueExecution: number;
1438
+ }
1439
+ interface ManagementScore {
1440
+ score: number;
1441
+ rating: 'excellent' | 'good' | 'fair' | 'poor';
1442
+ components: ManagementComponents;
1443
+ hurdleRateUsed: number;
1444
+ yearsAnalyzed: number;
1445
+ evidence: string[];
1446
+ interpretation: string;
1447
+ }
1448
+ /**
1449
+ * Compute Management Quality Score from a sequence of annual financial records.
1450
+ *
1451
+ * @param annualData Array in chronological order (oldest first). Minimum 3 years.
1452
+ * @param hurdleRate Optional WACC override (e.g. 0.09 for 9%).
1453
+ * @returns ManagementScore with score (0–100), rating, components, evidence.
1454
+ *
1455
+ * @example
1456
+ * const result = managementQualityScoreFromSeries([
1457
+ * { year: 2020, revenue: 100e9, ebit: 22e9, totalEquity: 40e9, totalDebt: 10e9,
1458
+ * cash: 5e9, sharesOutstanding: 5e9 },
1459
+ * { year: 2021, revenue: 115e9, ebit: 26e9, totalEquity: 44e9, totalDebt: 10e9,
1460
+ * cash: 7e9, sharesOutstanding: 4.9e9 },
1461
+ * { year: 2022, revenue: 130e9, ebit: 30e9, totalEquity: 48e9, totalDebt: 9e9,
1462
+ * cash: 9e9, sharesOutstanding: 4.75e9 },
1463
+ * ])
1464
+ * console.log(result.score) // e.g. 78
1465
+ * console.log(result.rating) // 'excellent'
1466
+ */
1467
+ declare function managementQualityScoreFromSeries(annualData: AnnualManagementData[], hurdleRate?: number): ManagementScore;
1468
+
1469
+ /**
1470
+ * Dividend Safety Score.
1471
+ *
1472
+ * Assesses the probability that a company can maintain and grow its dividend
1473
+ * using multi-year financial data. The analysis covers free cash flow coverage,
1474
+ * earnings coverage, balance sheet capacity, and dividend growth track record.
1475
+ *
1476
+ * Non-payers receive a special rating rather than a scored assessment.
1477
+ *
1478
+ * Signals (dividend-payers only)
1479
+ * -------
1480
+ * 1. FCF Payout Ratio (35%) — dividends as fraction of free cash flow
1481
+ * 2. Earnings Payout Ratio (25%) — dividends as fraction of net income
1482
+ * 3. Balance Sheet Strength (25%) — net debt / EBITDA capacity headroom
1483
+ * 4. Dividend Growth Track (15%) — consecutive years of non-declining dividends
1484
+ *
1485
+ * Score: 0–100
1486
+ * Rating: 'safe' (≥70), 'adequate' (45–69), 'risky' (20–44), 'danger' (<20), 'non-payer'
1487
+ */
1488
+ interface DividendComponents {
1489
+ fcfPayoutRatio: number;
1490
+ earningsPayoutRatio: number;
1491
+ balanceSheetStrength: number;
1492
+ dividendGrowthTrack: number;
1493
+ }
1494
+ interface DividendSafetyScore {
1495
+ score: number;
1496
+ rating: 'safe' | 'adequate' | 'risky' | 'danger' | 'non-payer';
1497
+ components: DividendComponents;
1498
+ isDividendPayer: boolean;
1499
+ yearsAnalyzed: number;
1500
+ evidence: string[];
1501
+ interpretation: string;
1502
+ }
1503
+ /** One year of financial data for dividend safety analysis. */
1504
+ type AnnualDividendData = {
1505
+ dividendsPaid?: number;
1506
+ operatingCashFlow?: number;
1507
+ capex?: number;
1508
+ netIncome?: number;
1509
+ totalDebt?: number;
1510
+ cash?: number;
1511
+ ebit?: number;
1512
+ depreciation?: number;
1513
+ year?: number | string;
1514
+ };
1515
+ /**
1516
+ * Compute Dividend Safety Score from a sequence of annual financial records.
1517
+ *
1518
+ * @param annualData - Array in chronological order (oldest first). Min 2 years recommended.
1519
+ * @returns DividendSafetyScore with score (0–100), rating, components, and evidence.
1520
+ *
1521
+ * @example
1522
+ * const result = dividendSafetyScoreFromSeries([
1523
+ * { year: 2020, dividendsPaid: 1.2e9, operatingCashFlow: 8e9, capex: 2e9,
1524
+ * netIncome: 5e9, totalDebt: 10e9, cash: 3e9, ebit: 7e9, depreciation: 1e9 },
1525
+ * { year: 2021, dividendsPaid: 1.3e9, operatingCashFlow: 9e9, capex: 2.2e9,
1526
+ * netIncome: 5.5e9, totalDebt: 9e9, cash: 3.5e9, ebit: 7.8e9, depreciation: 1.1e9 },
1527
+ * ])
1528
+ * console.log(result.score) // e.g. 74
1529
+ * console.log(result.rating) // 'safe'
1530
+ */
1531
+ declare function dividendSafetyScoreFromSeries(annualData: AnnualDividendData[]): DividendSafetyScore;
1532
+
1533
+ /**
1534
+ * Investment Score — Grand Synthesis.
1535
+ *
1536
+ * Combines five complementary dimensions into a single conviction-weighted
1537
+ * investment score. The score is designed to surface the highest-quality,
1538
+ * best-priced businesses — the intersection of durable moat, disciplined
1539
+ * capital allocation, reliable earnings, strong management, and attractive
1540
+ * valuation.
1541
+ *
1542
+ * Weights (all five present):
1543
+ * Moat 25% — durability of competitive advantage
1544
+ * Capital Allocation 20% — effectiveness of management's capital use
1545
+ * Earnings Quality 20% — reliability and sustainability of reported earnings
1546
+ * Management 15% — operational execution and shareholder orientation
1547
+ * Valuation 20% — price attractiveness vs intrinsic value
1548
+ *
1549
+ * If valuation is omitted, its 20% weight is redistributed proportionally
1550
+ * across the remaining four factors.
1551
+ *
1552
+ * Score: 0–100
1553
+ * Grade: 'A+' (≥90), 'A' (80–89), 'B+' (70–79), 'B' (60–69),
1554
+ * 'C' (45–59), 'D' (25–44), 'F' (<25)
1555
+ * Conviction: 'strongBuy' | 'buy' | 'hold' | 'sell' | 'strongSell'
1556
+ */
1557
+
1558
+ interface InvestmentComponents {
1559
+ moat: number | null;
1560
+ capitalAllocation: number | null;
1561
+ earningsQuality: number | null;
1562
+ management: number | null;
1563
+ valuation: number | null;
1564
+ }
1565
+ interface InvestmentScore {
1566
+ score: number;
1567
+ grade: 'A+' | 'A' | 'B+' | 'B' | 'C' | 'D' | 'F';
1568
+ conviction: 'strongBuy' | 'buy' | 'hold' | 'sell' | 'strongSell';
1569
+ components: InvestmentComponents;
1570
+ evidence: string[];
1571
+ interpretation: string;
1572
+ }
1573
+ interface InvestmentScoreInputs {
1574
+ moatScore: number;
1575
+ capitalAllocationScore: number;
1576
+ earningsQualityScore: number;
1577
+ managementScore: number;
1578
+ valuationScore?: number;
1579
+ }
1580
+ /**
1581
+ * Combine pre-computed sub-scores into an Investment Score.
1582
+ *
1583
+ * @param inputs - Individual sub-scores (0–100 each). `valuationScore` is optional.
1584
+ * @returns InvestmentScore with grade, conviction, components, and evidence.
1585
+ *
1586
+ * @example
1587
+ * const result = investmentScoreFromScores({
1588
+ * moatScore: 78,
1589
+ * capitalAllocationScore: 65,
1590
+ * earningsQualityScore: 71,
1591
+ * managementScore: 80,
1592
+ * valuationScore: 62,
1593
+ * })
1594
+ * console.log(result.grade) // 'B+'
1595
+ * console.log(result.conviction) // 'buy'
1596
+ */
1597
+ declare function investmentScoreFromScores(inputs: InvestmentScoreInputs): InvestmentScore;
1598
+ /**
1599
+ * Compute all sub-scores from annual financial data, then combine into an
1600
+ * Investment Score. The management sub-score requires at least 3 years;
1601
+ * all other sub-scores require at least 2 years.
1602
+ *
1603
+ * @param annualData - Array in chronological order (oldest first). Min 3 years.
1604
+ * @param valuationParams - Optional point-in-time valuation multiples.
1605
+ * @param wacc - Optional WACC override applied to moat and capital allocation.
1606
+ * @returns InvestmentScore with grade, conviction, components, and evidence.
1607
+ *
1608
+ * @example
1609
+ * const result = investmentScoreFromSeries(
1610
+ * [
1611
+ * { year: 2020, revenue: 100e9, grossProfit: 60e9, ebit: 25e9,
1612
+ * netIncome: 20e9, operatingCashFlow: 24e9, totalAssets: 80e9,
1613
+ * totalEquity: 40e9, totalDebt: 12e9, cash: 6e9,
1614
+ * capex: 3e9, depreciation: 4e9, sharesOutstanding: 5e9 },
1615
+ * // ... more years
1616
+ * ],
1617
+ * { peRatio: 18, evEbitda: 11, pbRatio: 3.1, dcfUpsidePct: 22 },
1618
+ * )
1619
+ * console.log(result.grade) // e.g. 'B+'
1620
+ * console.log(result.conviction) // 'buy'
1621
+ */
1622
+ declare function investmentScoreFromSeries(annualData: AnnualQualityData[], valuationParams?: ValuationParams, wacc?: number): InvestmentScore;
1623
+
1624
+ export { type AnnualDividendData, type AnnualManagementData, AnnualQualityData, type CacheOptions, type DividendComponents, type DividendSafetyScore, type DuPont3Factor, type FairValueOptions, type FairValueRange, type HoldingInput, type HoldingResult, type InvestmentComponents, type InvestmentScore, type InvestmentScoreInputs, type ManagementComponents, type ManagementScore, type PortfolioOptions, type PortfolioQualityResult, QualityFactorResult, type RatioFn, type ValuationComponents, type ValuationParams, type ValuationScore, affo, annualizeReturn, arrPerFte, assetTurnover, beta, burnMultiple, bvpsGrowth, cacPaybackPeriod, cacheStats, cached, cagr, calmarRatio, capRate, capexToDepreciation, capexToRevenue, capitalTurnover, cashConversionCycle, cashRatio, cashReturnOnAssets, cet1Ratio, clearCache, combinedRatio, conditionalVaR, currentRatio, customerAcquisitionCost, customerLifetimeValue, dcf2Stage, debtServiceCoverageRatio, debtToAssets, debtToCapital, debtToEquity, defensiveIntervalRatio, dio, dividendGrowthRate, dividendSafetyScoreFromSeries, downsideCaptureRatio, dpo, dso, duPont3, earningsPowerValue, ebitdaCoverageRatio, ebitdaGrowth, ebitdaMargin, efficiencyRatio, enterpriseValue, epsGrowth, equityMultiplier, evEbit, evEbitda, evFcf, evInvestedCapital, evRevenue, expenseRatio, fairValueRange, fcfConversion, fcfGrowth, fcfMargin, fcfYield, ffo, fixedAssetTurnover, fixedChargeCoverageRatio, forwardPe, freeCashFlow, gordonGrowthModel, grahamIntrinsicValue, grahamNumber, grossMargin, grossRevenueRetention, historicalVaR, informationRatio, interestCoverageRatio, invalidate as invalidateCache, inventoryTurnover, investedCapital, investmentScoreFromScores, investmentScoreFromSeries, jensensAlpha, leveredFcf, loanToDepositRatio, lossRatio, ltvCacRatio, magicNumber, managementQualityScoreFromSeries, maxDrawdown, maximumDrawdown, mean, netDebtToEbitda, netDebtToEquity, netInterestMargin, netOperatingIncome, netProfitMargin, netRevenueRetention, nopat, nopatMargin, nplRatio, occupancyRate, ocfToSales, omegaRatio, operatingCashFlowRatio, operatingLeverage, operatingMargin, ownerEarnings, pAffo, pFcf, pFfo, parametricVaR, payablesTurnover, pb, pe, peg, percentile, portfolioQuality, premiumsToSurplus, pricesToReturns, profitPerEmployee, provisionCoverageRatio, ps, quickRatio, receivablesTurnover, revenueCAGR, revenueGrowth, revenuePerEmployee, reverseDcf, roa, roce, roe, roic, rote, ruleOf40, saasQuickRatio, safeDivide, setCache, sharpeRatio, sortinoRatio, stdDev, tangibleBookValuePerShare, tier1CapitalRatio, tobinsQ, trackingError, treynorRatio, ulcerIndex, underwritingProfitMargin, unleveredFcf, upsideCaptureRatio, valuationAttractivenessScore, workingCapitalTurnover };
package/dist/index.d.ts CHANGED
@@ -1333,4 +1333,292 @@ interface PortfolioOptions {
1333
1333
  */
1334
1334
  declare function portfolioQuality(holdings: HoldingInput[], options?: PortfolioOptions): PortfolioQualityResult;
1335
1335
 
1336
- export { AnnualQualityData, type CacheOptions, type DuPont3Factor, type FairValueOptions, type FairValueRange, type HoldingInput, type HoldingResult, type PortfolioOptions, type PortfolioQualityResult, QualityFactorResult, type RatioFn, affo, annualizeReturn, arrPerFte, assetTurnover, beta, burnMultiple, bvpsGrowth, cacPaybackPeriod, cacheStats, cached, cagr, calmarRatio, capRate, capexToDepreciation, capexToRevenue, capitalTurnover, cashConversionCycle, cashRatio, cashReturnOnAssets, cet1Ratio, clearCache, combinedRatio, conditionalVaR, currentRatio, customerAcquisitionCost, customerLifetimeValue, dcf2Stage, debtServiceCoverageRatio, debtToAssets, debtToCapital, debtToEquity, defensiveIntervalRatio, dio, dividendGrowthRate, downsideCaptureRatio, dpo, dso, duPont3, earningsPowerValue, ebitdaCoverageRatio, ebitdaGrowth, ebitdaMargin, efficiencyRatio, enterpriseValue, epsGrowth, equityMultiplier, evEbit, evEbitda, evFcf, evInvestedCapital, evRevenue, expenseRatio, fairValueRange, fcfConversion, fcfGrowth, fcfMargin, fcfYield, ffo, fixedAssetTurnover, fixedChargeCoverageRatio, forwardPe, freeCashFlow, gordonGrowthModel, grahamIntrinsicValue, grahamNumber, grossMargin, grossRevenueRetention, historicalVaR, informationRatio, interestCoverageRatio, invalidate as invalidateCache, inventoryTurnover, investedCapital, jensensAlpha, leveredFcf, loanToDepositRatio, lossRatio, ltvCacRatio, magicNumber, maxDrawdown, maximumDrawdown, mean, netDebtToEbitda, netDebtToEquity, netInterestMargin, netOperatingIncome, netProfitMargin, netRevenueRetention, nopat, nopatMargin, nplRatio, occupancyRate, ocfToSales, omegaRatio, operatingCashFlowRatio, operatingLeverage, operatingMargin, ownerEarnings, pAffo, pFcf, pFfo, parametricVaR, payablesTurnover, pb, pe, peg, percentile, portfolioQuality, premiumsToSurplus, pricesToReturns, profitPerEmployee, provisionCoverageRatio, ps, quickRatio, receivablesTurnover, revenueCAGR, revenueGrowth, revenuePerEmployee, reverseDcf, roa, roce, roe, roic, rote, ruleOf40, saasQuickRatio, safeDivide, setCache, sharpeRatio, sortinoRatio, stdDev, tangibleBookValuePerShare, tier1CapitalRatio, tobinsQ, trackingError, treynorRatio, ulcerIndex, underwritingProfitMargin, unleveredFcf, upsideCaptureRatio, workingCapitalTurnover };
1336
+ /**
1337
+ * Valuation Attractiveness Score.
1338
+ *
1339
+ * Provides a point-in-time assessment of how attractively a security is priced
1340
+ * relative to its earnings power, free cash flow generation, asset value, and
1341
+ * intrinsic value estimate. Higher scores indicate greater margin of safety.
1342
+ *
1343
+ * Signals
1344
+ * -------
1345
+ * 1. Earnings Yield Spread (25%) — excess earnings yield over risk-free rate
1346
+ * 2. FCF Yield (25%) — free cash flow yield on market price
1347
+ * 3. EV/EBITDA (20%) — enterprise multiple vs historical norms
1348
+ * 4. P/B Ratio (15%) — price-to-book premium or discount
1349
+ * 5. DCF Upside (15%) — percentage gap to intrinsic value estimate
1350
+ *
1351
+ * Score: 0–100
1352
+ * Rating: 'attractive' (≥65), 'fair' (40–64), 'expensive' (20–39), 'overvalued' (<20)
1353
+ */
1354
+ interface ValuationComponents {
1355
+ earningsYield: number;
1356
+ fcfYield: number;
1357
+ evEbitda: number;
1358
+ pbRatio: number;
1359
+ dcfUpside: number;
1360
+ }
1361
+ interface ValuationScore {
1362
+ score: number;
1363
+ rating: 'attractive' | 'fair' | 'expensive' | 'overvalued';
1364
+ components: ValuationComponents;
1365
+ riskFreeRate: number;
1366
+ evidence: string[];
1367
+ interpretation: string;
1368
+ }
1369
+ interface ValuationParams {
1370
+ peRatio?: number;
1371
+ evEbitda?: number;
1372
+ pFcf?: number;
1373
+ pbRatio?: number;
1374
+ fcfYieldPct?: number;
1375
+ earningsYieldPct?: number;
1376
+ dcfUpsidePct?: number;
1377
+ riskFreeRate?: number;
1378
+ }
1379
+ /**
1380
+ * Compute a point-in-time Valuation Attractiveness Score.
1381
+ *
1382
+ * @param params - Valuation multiples and optional risk-free rate override.
1383
+ * At least one input is required; missing signals default to 0.5.
1384
+ * @returns ValuationScore with score (0–100), rating, components, and evidence.
1385
+ *
1386
+ * @example
1387
+ * const result = valuationAttractivenessScore({
1388
+ * peRatio: 18,
1389
+ * evEbitda: 11,
1390
+ * pFcf: 22,
1391
+ * pbRatio: 3.2,
1392
+ * dcfUpsidePct: 25,
1393
+ * })
1394
+ * console.log(result.score) // e.g. 62
1395
+ * console.log(result.rating) // 'fair'
1396
+ */
1397
+ declare function valuationAttractivenessScore(params: ValuationParams): ValuationScore;
1398
+
1399
+ /**
1400
+ * Management Quality Score.
1401
+ *
1402
+ * Evaluates management's operational effectiveness using multi-year financial
1403
+ * series. A high-scoring management team consistently earns strong returns on
1404
+ * invested capital, expands or defends operating margins, treats shareholders
1405
+ * with respect by avoiding dilution, and delivers reliable revenue growth.
1406
+ *
1407
+ * Signals
1408
+ * -------
1409
+ * 1. ROIC Excellence (35%) — level, trend, and consistency of ROIC
1410
+ * 2. Margin Stability (25%) — operating margin level, trend, and stability
1411
+ * 3. Shareholder Orientation(25%) — share count trajectory (buybacks vs dilution)
1412
+ * 4. Revenue Execution (15%) — revenue growth rate level and consistency
1413
+ *
1414
+ * Score: 0–100
1415
+ * Rating: 'excellent' (≥75), 'good' (50–74), 'fair' (25–49), 'poor' (<25)
1416
+ *
1417
+ * Minimum 3 years of data required.
1418
+ */
1419
+ /** One year of financial data for management quality analysis. */
1420
+ interface AnnualManagementData {
1421
+ revenue?: number;
1422
+ ebit?: number;
1423
+ totalAssets?: number;
1424
+ totalEquity?: number;
1425
+ totalDebt?: number;
1426
+ cash?: number;
1427
+ sharesOutstanding?: number;
1428
+ incomeTaxExpense?: number;
1429
+ ebt?: number;
1430
+ interestExpense?: number;
1431
+ year?: number | string;
1432
+ }
1433
+ interface ManagementComponents {
1434
+ roicExcellence: number;
1435
+ marginStability: number;
1436
+ shareholderOrientation: number;
1437
+ revenueExecution: number;
1438
+ }
1439
+ interface ManagementScore {
1440
+ score: number;
1441
+ rating: 'excellent' | 'good' | 'fair' | 'poor';
1442
+ components: ManagementComponents;
1443
+ hurdleRateUsed: number;
1444
+ yearsAnalyzed: number;
1445
+ evidence: string[];
1446
+ interpretation: string;
1447
+ }
1448
+ /**
1449
+ * Compute Management Quality Score from a sequence of annual financial records.
1450
+ *
1451
+ * @param annualData Array in chronological order (oldest first). Minimum 3 years.
1452
+ * @param hurdleRate Optional WACC override (e.g. 0.09 for 9%).
1453
+ * @returns ManagementScore with score (0–100), rating, components, evidence.
1454
+ *
1455
+ * @example
1456
+ * const result = managementQualityScoreFromSeries([
1457
+ * { year: 2020, revenue: 100e9, ebit: 22e9, totalEquity: 40e9, totalDebt: 10e9,
1458
+ * cash: 5e9, sharesOutstanding: 5e9 },
1459
+ * { year: 2021, revenue: 115e9, ebit: 26e9, totalEquity: 44e9, totalDebt: 10e9,
1460
+ * cash: 7e9, sharesOutstanding: 4.9e9 },
1461
+ * { year: 2022, revenue: 130e9, ebit: 30e9, totalEquity: 48e9, totalDebt: 9e9,
1462
+ * cash: 9e9, sharesOutstanding: 4.75e9 },
1463
+ * ])
1464
+ * console.log(result.score) // e.g. 78
1465
+ * console.log(result.rating) // 'excellent'
1466
+ */
1467
+ declare function managementQualityScoreFromSeries(annualData: AnnualManagementData[], hurdleRate?: number): ManagementScore;
1468
+
1469
+ /**
1470
+ * Dividend Safety Score.
1471
+ *
1472
+ * Assesses the probability that a company can maintain and grow its dividend
1473
+ * using multi-year financial data. The analysis covers free cash flow coverage,
1474
+ * earnings coverage, balance sheet capacity, and dividend growth track record.
1475
+ *
1476
+ * Non-payers receive a special rating rather than a scored assessment.
1477
+ *
1478
+ * Signals (dividend-payers only)
1479
+ * -------
1480
+ * 1. FCF Payout Ratio (35%) — dividends as fraction of free cash flow
1481
+ * 2. Earnings Payout Ratio (25%) — dividends as fraction of net income
1482
+ * 3. Balance Sheet Strength (25%) — net debt / EBITDA capacity headroom
1483
+ * 4. Dividend Growth Track (15%) — consecutive years of non-declining dividends
1484
+ *
1485
+ * Score: 0–100
1486
+ * Rating: 'safe' (≥70), 'adequate' (45–69), 'risky' (20–44), 'danger' (<20), 'non-payer'
1487
+ */
1488
+ interface DividendComponents {
1489
+ fcfPayoutRatio: number;
1490
+ earningsPayoutRatio: number;
1491
+ balanceSheetStrength: number;
1492
+ dividendGrowthTrack: number;
1493
+ }
1494
+ interface DividendSafetyScore {
1495
+ score: number;
1496
+ rating: 'safe' | 'adequate' | 'risky' | 'danger' | 'non-payer';
1497
+ components: DividendComponents;
1498
+ isDividendPayer: boolean;
1499
+ yearsAnalyzed: number;
1500
+ evidence: string[];
1501
+ interpretation: string;
1502
+ }
1503
+ /** One year of financial data for dividend safety analysis. */
1504
+ type AnnualDividendData = {
1505
+ dividendsPaid?: number;
1506
+ operatingCashFlow?: number;
1507
+ capex?: number;
1508
+ netIncome?: number;
1509
+ totalDebt?: number;
1510
+ cash?: number;
1511
+ ebit?: number;
1512
+ depreciation?: number;
1513
+ year?: number | string;
1514
+ };
1515
+ /**
1516
+ * Compute Dividend Safety Score from a sequence of annual financial records.
1517
+ *
1518
+ * @param annualData - Array in chronological order (oldest first). Min 2 years recommended.
1519
+ * @returns DividendSafetyScore with score (0–100), rating, components, and evidence.
1520
+ *
1521
+ * @example
1522
+ * const result = dividendSafetyScoreFromSeries([
1523
+ * { year: 2020, dividendsPaid: 1.2e9, operatingCashFlow: 8e9, capex: 2e9,
1524
+ * netIncome: 5e9, totalDebt: 10e9, cash: 3e9, ebit: 7e9, depreciation: 1e9 },
1525
+ * { year: 2021, dividendsPaid: 1.3e9, operatingCashFlow: 9e9, capex: 2.2e9,
1526
+ * netIncome: 5.5e9, totalDebt: 9e9, cash: 3.5e9, ebit: 7.8e9, depreciation: 1.1e9 },
1527
+ * ])
1528
+ * console.log(result.score) // e.g. 74
1529
+ * console.log(result.rating) // 'safe'
1530
+ */
1531
+ declare function dividendSafetyScoreFromSeries(annualData: AnnualDividendData[]): DividendSafetyScore;
1532
+
1533
+ /**
1534
+ * Investment Score — Grand Synthesis.
1535
+ *
1536
+ * Combines five complementary dimensions into a single conviction-weighted
1537
+ * investment score. The score is designed to surface the highest-quality,
1538
+ * best-priced businesses — the intersection of durable moat, disciplined
1539
+ * capital allocation, reliable earnings, strong management, and attractive
1540
+ * valuation.
1541
+ *
1542
+ * Weights (all five present):
1543
+ * Moat 25% — durability of competitive advantage
1544
+ * Capital Allocation 20% — effectiveness of management's capital use
1545
+ * Earnings Quality 20% — reliability and sustainability of reported earnings
1546
+ * Management 15% — operational execution and shareholder orientation
1547
+ * Valuation 20% — price attractiveness vs intrinsic value
1548
+ *
1549
+ * If valuation is omitted, its 20% weight is redistributed proportionally
1550
+ * across the remaining four factors.
1551
+ *
1552
+ * Score: 0–100
1553
+ * Grade: 'A+' (≥90), 'A' (80–89), 'B+' (70–79), 'B' (60–69),
1554
+ * 'C' (45–59), 'D' (25–44), 'F' (<25)
1555
+ * Conviction: 'strongBuy' | 'buy' | 'hold' | 'sell' | 'strongSell'
1556
+ */
1557
+
1558
+ interface InvestmentComponents {
1559
+ moat: number | null;
1560
+ capitalAllocation: number | null;
1561
+ earningsQuality: number | null;
1562
+ management: number | null;
1563
+ valuation: number | null;
1564
+ }
1565
+ interface InvestmentScore {
1566
+ score: number;
1567
+ grade: 'A+' | 'A' | 'B+' | 'B' | 'C' | 'D' | 'F';
1568
+ conviction: 'strongBuy' | 'buy' | 'hold' | 'sell' | 'strongSell';
1569
+ components: InvestmentComponents;
1570
+ evidence: string[];
1571
+ interpretation: string;
1572
+ }
1573
+ interface InvestmentScoreInputs {
1574
+ moatScore: number;
1575
+ capitalAllocationScore: number;
1576
+ earningsQualityScore: number;
1577
+ managementScore: number;
1578
+ valuationScore?: number;
1579
+ }
1580
+ /**
1581
+ * Combine pre-computed sub-scores into an Investment Score.
1582
+ *
1583
+ * @param inputs - Individual sub-scores (0–100 each). `valuationScore` is optional.
1584
+ * @returns InvestmentScore with grade, conviction, components, and evidence.
1585
+ *
1586
+ * @example
1587
+ * const result = investmentScoreFromScores({
1588
+ * moatScore: 78,
1589
+ * capitalAllocationScore: 65,
1590
+ * earningsQualityScore: 71,
1591
+ * managementScore: 80,
1592
+ * valuationScore: 62,
1593
+ * })
1594
+ * console.log(result.grade) // 'B+'
1595
+ * console.log(result.conviction) // 'buy'
1596
+ */
1597
+ declare function investmentScoreFromScores(inputs: InvestmentScoreInputs): InvestmentScore;
1598
+ /**
1599
+ * Compute all sub-scores from annual financial data, then combine into an
1600
+ * Investment Score. The management sub-score requires at least 3 years;
1601
+ * all other sub-scores require at least 2 years.
1602
+ *
1603
+ * @param annualData - Array in chronological order (oldest first). Min 3 years.
1604
+ * @param valuationParams - Optional point-in-time valuation multiples.
1605
+ * @param wacc - Optional WACC override applied to moat and capital allocation.
1606
+ * @returns InvestmentScore with grade, conviction, components, and evidence.
1607
+ *
1608
+ * @example
1609
+ * const result = investmentScoreFromSeries(
1610
+ * [
1611
+ * { year: 2020, revenue: 100e9, grossProfit: 60e9, ebit: 25e9,
1612
+ * netIncome: 20e9, operatingCashFlow: 24e9, totalAssets: 80e9,
1613
+ * totalEquity: 40e9, totalDebt: 12e9, cash: 6e9,
1614
+ * capex: 3e9, depreciation: 4e9, sharesOutstanding: 5e9 },
1615
+ * // ... more years
1616
+ * ],
1617
+ * { peRatio: 18, evEbitda: 11, pbRatio: 3.1, dcfUpsidePct: 22 },
1618
+ * )
1619
+ * console.log(result.grade) // e.g. 'B+'
1620
+ * console.log(result.conviction) // 'buy'
1621
+ */
1622
+ declare function investmentScoreFromSeries(annualData: AnnualQualityData[], valuationParams?: ValuationParams, wacc?: number): InvestmentScore;
1623
+
1624
+ export { type AnnualDividendData, type AnnualManagementData, AnnualQualityData, type CacheOptions, type DividendComponents, type DividendSafetyScore, type DuPont3Factor, type FairValueOptions, type FairValueRange, type HoldingInput, type HoldingResult, type InvestmentComponents, type InvestmentScore, type InvestmentScoreInputs, type ManagementComponents, type ManagementScore, type PortfolioOptions, type PortfolioQualityResult, QualityFactorResult, type RatioFn, type ValuationComponents, type ValuationParams, type ValuationScore, affo, annualizeReturn, arrPerFte, assetTurnover, beta, burnMultiple, bvpsGrowth, cacPaybackPeriod, cacheStats, cached, cagr, calmarRatio, capRate, capexToDepreciation, capexToRevenue, capitalTurnover, cashConversionCycle, cashRatio, cashReturnOnAssets, cet1Ratio, clearCache, combinedRatio, conditionalVaR, currentRatio, customerAcquisitionCost, customerLifetimeValue, dcf2Stage, debtServiceCoverageRatio, debtToAssets, debtToCapital, debtToEquity, defensiveIntervalRatio, dio, dividendGrowthRate, dividendSafetyScoreFromSeries, downsideCaptureRatio, dpo, dso, duPont3, earningsPowerValue, ebitdaCoverageRatio, ebitdaGrowth, ebitdaMargin, efficiencyRatio, enterpriseValue, epsGrowth, equityMultiplier, evEbit, evEbitda, evFcf, evInvestedCapital, evRevenue, expenseRatio, fairValueRange, fcfConversion, fcfGrowth, fcfMargin, fcfYield, ffo, fixedAssetTurnover, fixedChargeCoverageRatio, forwardPe, freeCashFlow, gordonGrowthModel, grahamIntrinsicValue, grahamNumber, grossMargin, grossRevenueRetention, historicalVaR, informationRatio, interestCoverageRatio, invalidate as invalidateCache, inventoryTurnover, investedCapital, investmentScoreFromScores, investmentScoreFromSeries, jensensAlpha, leveredFcf, loanToDepositRatio, lossRatio, ltvCacRatio, magicNumber, managementQualityScoreFromSeries, maxDrawdown, maximumDrawdown, mean, netDebtToEbitda, netDebtToEquity, netInterestMargin, netOperatingIncome, netProfitMargin, netRevenueRetention, nopat, nopatMargin, nplRatio, occupancyRate, ocfToSales, omegaRatio, operatingCashFlowRatio, operatingLeverage, operatingMargin, ownerEarnings, pAffo, pFcf, pFfo, parametricVaR, payablesTurnover, pb, pe, peg, percentile, portfolioQuality, premiumsToSurplus, pricesToReturns, profitPerEmployee, provisionCoverageRatio, ps, quickRatio, receivablesTurnover, revenueCAGR, revenueGrowth, revenuePerEmployee, reverseDcf, roa, roce, roe, roic, rote, ruleOf40, saasQuickRatio, safeDivide, setCache, sharpeRatio, sortinoRatio, stdDev, tangibleBookValuePerShare, tier1CapitalRatio, tobinsQ, trackingError, treynorRatio, ulcerIndex, underwritingProfitMargin, unleveredFcf, upsideCaptureRatio, valuationAttractivenessScore, workingCapitalTurnover };