@finanzfluss/calculators

中文文档
2.1.0发布于 2026/11/04AGPL-3.0TypeScriptES Module零依赖构建来源已验证近 30 天下载 8795

Financial calculators for Finanzfluss

原始使用文档
文档目录12 节
  1. Installation
  2. Calculators
  3. Compound Interest Calculator
  4. Savings Calculator
  5. Gross-to-Net Calculator
  6. Net Policy Calculator
  7. Disability Insurance Calculator
  8. AV-Depot Calculator
  9. AV-Depot Simulator
  10. Riester or AV-Depot Calculator
  11. Testing
  12. License
Logo for @finanzfluss/calculators Repository

@finanzfluss/calculators

A selection of financial calculators used on the Finanzfluss Website: https://www.finanzfluss.de/rechner/

🎯 Type-safe: built with TypeScript and Zod validation

🔍 Real-world tested: used by millions of Finanzfluss users

🏛️ German tax system support: Correct tax and insurance calculation


Installation

# pnpm
pnpm add -D @finanzfluss/calculators

# npm
npm install -D @finanzfluss/calculators

# yarn
yarn add -D @finanzfluss/calculators

Calculators

Compound Interest Calculator

The Zinseszinsrechner (https://finanzfluss.de/rechner/zinseszinsrechner) demonstrates the power of compound interest for long-term wealth building. It calculates how investments grow over time when returns are reinvested, helping users visualize the compound effect on their savings.

Key Features:

  • Flexible starting capital support for both lump-sum investments and zero initial capital scenarios
  • Regular savings plans with configurable monthly payment amounts to model systematic investing
  • Multiple compounding intervals supporting monthly, quarterly, and yearly compounding periods
  • Long-term projections with duration support from short-term to multi-decade investment horizons
  • Interest rate sensitivity analysis showing how small changes in returns dramatically impact final wealth
  • Visual data output providing detailed breakdowns of capital growth vs. compound interest accumulation
  • Realistic return modeling with validation for reasonable interest rate ranges (-10000% to 10000%)
import { compoundInterest } from '@finanzfluss/calculators'

const input = {
  startCapital: 5000,
  monthlyPayment: 100,
  durationYears: 10,
  yearlyInterest: 7,
  type: 'monthly', // 'monthly', 'quarterly', or 'yearly'
}

// Validate input and calculate compound interest result
const result = compoundInterest.validateAndCalculate(input)

console.log(result.finalCapital) // Total capital after compound growth
console.log(result.totalPayments) // Sum of all payments made
console.log(result.totalInterest) // Total interest earned through compounding
console.log(result.diagramData) // Detailed growth data for visualization

Savings Calculator

The Sparrechner (https://finanzfluss.de/rechner/sparrechner) is a versatile financial planning tool that calculates any unknown variable in a savings plan when all other variables are provided. It helps users plan their savings goals by solving for end value, starting capital, interest rate, duration, or payment amount.

Key Features:

  • Flexible calculation modes solving for any of five variables: end value, start capital, interest rate, duration, or payment amount
  • Tax-optimized calculations supporting both distributing and accumulating investment types with capital gains tax considerations
  • Partial tax exemption modeling the German partial exemption (Teilfreistellung) for funds
  • Multiple saving intervals supporting both monthly and yearly payment schedules
  • Visual growth tracking providing detailed capital and interest accumulation data for charts
import { savings } from '@finanzfluss/calculators'

const input = {
  output: 'endValue', // What to calculate: 'endValue', 'startValue', 'yearlyInterest', 'monthlyDuration', or 'savingRate'
  startValue: 10000,
  savingRate: 200,
  saveIntervalType: 'monthly', // 'monthly' or 'yearly'
  savingType: 'inAdvance', // 'inAdvance' or 'inArrear'
  yearlyInterest: 7,
  interestIntervalType: 'monthly', // 'monthly', 'quarterly', or 'yearly'
  yearlyDuration: 20,
  considerCapitalGainsTax: true,
  capitalGainsTax: 26.375,
  distributionType: 'accumulating', // 'accumulating' or 'distributing'
  partialExemption: 30,
  useCompoundInterest: true,
}

// Validate input and calculate savings result
const result = savings.validateAndCalculate(input)

console.log(result.endValue) // Final portfolio value
console.log(result.deposits) // Total amount deposited
console.log(result.interestAfterTax) // Net interest earned after tax
console.log(result.yearlyDuration) // Duration in years
console.log(result.monthlyDuration) // Duration in months
console.log(result.diagramData) // Detailed capital and interest growth data

Gross-to-Net Calculator

The Brutto-Netto-Rechner (https://finanzfluss.de/rechner/brutto-netto-rechner) calculates a net salary from gross income, accounting for all German tax and social insurance deductions. It is based on the official pseudo code for tax calculation provided by the German ministry of finance: https://www.bmf-steuerrechner.de/interface/pseudocodes.xhtml.

Key Features:

  • All 6 German tax classes (I-VI) with specific calculations for single, married, and divorced individuals
  • State-specific calculations for all 16 German states including varying church tax rates (8% in Bavaria/Baden-Württemberg, 9% elsewhere)
  • Age-based adjustments including senior citizen tax relief (Altersentlastungsbetrag) for 64+ years
  • Child allowances with support for partial children (e.g., 0.5 children for blended families)
  • Flexible insurance options supporting both public (GKV) and private (PKV) health insurance
  • Comprehensive social insurance including pension, unemployment, and care insurance calculations
import { grossToNet } from '@finanzfluss/calculators'

const input = {
  inputAccountingYear: '2025',
  inputTaxClass: 1,
  inputTaxAllowance: 0,
  inputChurchTax: 0,
  inputState: 'Hamburg',
  inputYearOfBirth: 1990,
  inputChildren: 0,
  inputChildTaxAllowance: 0,
  inputPkvContribution: 0,
  inputPpvContribution: 0,
  inputEmployerSubsidy: 0,
  inputPensionInsurance: 0,
  inputLevyOne: 0,
  inputLevyTwo: 0,
  inputActivateLevy: 0,
  inputHealthInsurance: 0,
  inputAdditionalContribution: 1.7,
  inputGrossWage: 5000,
  inputPeriod: 2, // 2 = monthly, 1 = yearly
}

// Validate input and calculate gross to net result
const result = grossToNet.validateAndCalculate(input)

console.log(result.outputResNetWageMonth) // Net monthly wage
console.log(result.outputResNetWageYear) // Net yearly wage

Net Policy Calculator

The Rentenversicherung-Rechner (https://finanzfluss.de/rechner/rentenversicherung) compares ETF-based pension insurance policies (Nettopolice) with traditional ETF savings plans for retirement planning.

Key Features:

  • ETF pension insurance analysis comparing net policies vs. direct ETF investments
  • Tax optimization calculations including different taxation rules for insurance vs. investment gains
  • Cost structure analysis factoring in management fees, placement commissions, and ongoing charges
  • Long-term projections with realistic return assumptions (typically 7% for diversified equity portfolios)
  • Flexible withdrawal scenarios supporting both lump-sum and gradual withdrawal strategies
  • Real-world cost modeling using actual insurance product data and fee structures
import { netPolicy } from '@finanzfluss/calculators'

const input = {
  // General inputs
  savingRate: 250,
  duration: 35, // in years
  taxAllowance: 1000,
  additionalIncome: 0,
  capitalGainsTax: 26.375,

  // Policy inputs
  placementCommission: 299,
  savingRateCosts: 4,
  balanceCosts: 0.22,
  fixedCosts: 10,
  minimumCosts: 30,

  // ETF inputs
  ter: 0.2,
  expectedInterest: 7,
  partialExemption: 30,

  // Reallocation inputs
  reallocationOccurrence: 10,
  reallocationRate: 40,
}

// Validate input and calculate net policy result
const result = netPolicy.validateAndCalculate(input)

console.log(result.tableData.netWorth) // Projected net worth over time

Disability Insurance Calculator

The Berufsunfähigkeitsversicherung-Rechner (https://finanzfluss.de/rechner/berufsunfaehigkeitsversicherung) helps users determine how much disability insurance coverage they need. It compares three standard coverage levels against their current income and models the income gap during different stages of disability.

Key Features:

  • Three DIN 77230 coverage levels based on the German standard for private household financial analysis: securing basic existence (avoiding social welfare), maintaining your current standard of living, and enabling an improved standard of living that covers additional goals like property, family, or wealth building
  • Income timeline modeling showing actual take-home at each stage: working, short-term sick leave, prolonged illness (Krankengeld), and full disability (Erwerbsminderungsrente)
  • Custom coverage input supporting a user-defined target pension amount alongside the three standard levels
  • Visual data output providing both tabular level comparisons and interval-based coverage data for charts
import { disabilityInsurance } from '@finanzfluss/calculators'

const input = {
  grossIncome: 4000,
  netIncome: 2600,
  useCustomHalfDisabilityPension: false, // set to true to override the estimated value
  customHalfDisabilityPension: 0,
  numberOfChildren: 1, // affects care insurance contribution rate (0–4)
  useCustomPensionAmount: false,
  customPensionAmount: 0,
}

// Validate input and calculate disability insurance result
const result = disabilityInsurance.validateAndCalculate(input)

result.tableData.level1 // Level 1: basic existence security (DIN 77230 Stufe 1)
result.tableData.level2 // Level 2: maintaining current standard of living (DIN 77230 Stufe 2)
result.tableData.level3 // Level 3: improved standard of living (DIN 77230 Stufe 3)

AV-Depot Calculator

The Altersvorsorgedepot-Rechner (https://finanzfluss.de/rechner/altersvorsorgedepot) compares saving into a subsidized AV-Depot (Altersvorsorgedepot) against a regular ETF brokerage depot for retirement. It models the full savings and payout phases for both accounts, accounting for state subsidies (Grundzulage, Kinderzulage, Berufseinsteigerbonus), Vorabpauschale taxation, and the tax treatment of withdrawals (Günstigerprüfung, Halbeinkünfteverfahren).

Key Features:

  • Side-by-side depot comparison projecting year-by-year capital growth for both an AV-Depot and a normal depot under the same contributions and returns
  • State subsidies including Grundzulage, Kinderzulage per eligible child, and the Berufseinsteigerbonus for savers under 25
  • Configurable tax-savings handling letting the income-tax refund from AV contributions flow back into the AV-Depot, into a separate secondary depot, or be consumed
  • Payout-phase modeling covering the optional one-time lump-sum payout and the taxation of subsequent annual withdrawals for both depots
import { avDepot } from '@finanzfluss/calculators'

const input = {
  age: 35,
  retirementAge: 67,
  zveSavingsPhase: 50_000,
  zveRetirement: 20_000,
  savingsRate: 1_800,
  etfReturnRate: 6, // percent
  avDepotCosts: 0.2, // percent, annual AV-Depot cost drag
  exemptionOrder: 1_000,
  taxSavingsMode: 'avDepot', // 'avDepot' | 'secondaryDepot' | 'consume'
  baseRate: 0, // percent, Basiszins for Vorabpauschale
  oneTimePayout: 0, // percent taken as a lump sum at retirement
  payoutReturnRate: 3, // percent
  payoutUntilAge: 85,
  childBirthYears: [], // enables Kinderzulage while children are under 18
}

// Validate input and calculate AV-Depot result
const result = avDepot.validateAndCalculate(input)

result.finalCapital.avDepot // Capital in the AV-Depot at retirement
result.finalCapital.normalDepot // Capital in a comparable normal depot at retirement
result.payoutTotal.net.avDepot // Total net payout from the AV-Depot

AV-Depot Simulator

The AV-Depot calculation on its own, without the comparison to a normal depot. It is the core of the AV-Depot Calculator. It returns raw numbers instead of formatted strings.

Key Features:

  • Same inputs as the AV-Depot Calculator, plus two optional fields for transfers into an AV-Depot
  • Start capital (startCapital) treated as subsidized capital: it grows from the first year, is taxed like subsidized capital on payout, earns no Zulagen and doesn't count as own contribution
  • Optional Berufseinsteigerbonus (includeStarterBonus) to exclude the bonus when it was already received, e.g. in a transferred Riester contract
  • Subsidy and tax-saving totals for Grundzulage, Kinderzulage, Berufseinsteigerbonus and the income-tax saving
import { avDepotSimulator } from '@finanzfluss/calculators'

const result = avDepotSimulator.validateAndCalculate({
  ...input, // same input as for the AV-Depot Calculator
  startCapital: 25_000, // optional, defaults to 0
  includeStarterBonus: false, // optional, defaults to true
})

result.savings.finalCapital // Capital in the AV-Depot (incl. secondary depot) at retirement
result.savings.totalGrundzulage // Sum of all Grundzulagen
result.payout.totalNet // Total net payout

Riester or AV-Depot Calculator

Compares keeping an existing Riester contract with transferring its capital into an AV-Depot and continuing the contributions there. Both scenarios are projected through the savings and payout phases. The result includes a verdict on which option leads.

Key Features:

  • Contract transfer moving the current Riester contract value into the AV-Depot, minus switching costs if the contract is younger than five years
  • Riester return rate entered manually or derived from the contract's value, total contributions and allowances (falls back to a default rate if the contract is too young or inputs are missing)
  • Riester payout as a lifelong annuity based on the contract's annuity factor (Rentenfaktor per 10,000 €)
  • Verdict with the capital difference, the subsidy difference, the monthly net payout of both options and the survival probability to the end of the payout phase (Destatis Periodensterbetafel)
import { riesterOrAvDepot } from '@finanzfluss/calculators'

const input = {
  age: 42,
  retirementAge: 67,
  zveSavingsPhase: 30_000,
  zveRetirement: 20_000,
  riesterAnnualContribution: 1_200, // own contribution per year
  riesterContractValue: 18_500, // current value of the Riester contract
  riesterContractStart: 2012,
  riesterTotalContributions: 9_000, // optional, used to derive the return rate
  riesterTotalAllowances: 2_500, // optional, used to derive the return rate
  // riesterReturnRate: 2, // optional, percent, overrides the derived rate
  riesterAnnuityFactor: 32.5, // monthly annuity per 10,000 € capital
  riesterSwitchingCosts: 150,
  etfReturnRate: 6, // percent
  avDepotCosts: 0.2, // percent, annual AV-Depot cost drag
  oneTimePayout: 0, // percent taken as a lump sum at retirement
  payoutReturnRate: 3, // percent
  payoutUntilAge: 85,
  childBirthYears: [],
}

const result = riesterOrAvDepot.validateAndCalculate(input)

result.finalCapital.avDepot // Capital in the AV-Depot at retirement
result.finalCapital.riester // Capital in the Riester contract at retirement
result.riesterReturnRate.case // 'manual' | 'derived' | 'missingInputs' | 'tooShort' | 'tooHigh' | 'tooLow'
result.verdict.case // 'avDepotWins' | 'riesterWins' | 'mixed'

Testing

Run the test suite:

pnpm test

Run type checking:

pnpm test:types

Run tests with coverage report:

pnpm test:coverage

License

AGPL-3.0 License © 2025-PRESENT Finflow GmbH

版本与发布记录

@finanzfluss/calculators 共发布 28 个版本,首次发布于 2025/06/25;过去 12 个月发布了 17 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.1.0latest2026/11/0410 天前
2.0.02026/10/2124 天前
1.4.42026/10/121 个月前
1.4.32026/09/291 个月前
1.4.22026/08/312 个月前
1.4.12026/07/273 个月前

关于 @finanzfluss/calculators 的常见问题

@finanzfluss/calculators 是什么?

Financial calculators for Finanzfluss

如何安装 @finanzfluss/calculators?

在项目目录运行 npm install @finanzfluss/calculators,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:zod(^4.1.5)、dinero.js(^2.0.2)、bignumber.js(^9.3.1)、@formulajs/formulajs(^4.5.3)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@finanzfluss/calculators 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@finanzfluss/calculators 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@finanzfluss/calculators 可以商用吗?

@finanzfluss/calculators 使用 AGPL-3.0 许可。最严格的 Copyleft:除分发外,通过网络向用户提供基于它的服务也需要开源对应源码。闭源 SaaS 使用前务必评估。以上为概括,不构成法律意见,请以许可原文为准。

@finanzfluss/calculators 的下载量有多少?

根据 npm 官方下载统计,@finanzfluss/calculators 在 2026/10/15 – 2026/11/13 这 30 天内被下载 8,795 次,日均约 293 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@finanzfluss/calculators 还在维护吗?

最新版本 2.1.0 发布于 2026/11/04(10 天前);至今共发布 28 个版本,其中过去 12 个月发布了 17 个;首次发布于 2025/06/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。