Skip to content

This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.

FINANCE_PACKAGE

const FINANCE_PACKAGE: IEnginePackage;

Defined in: packages/engine/src/packages/finance/FinancePackage.ts:94

Money & finance phrase grammar: compound interest / investment growth, mortgage/loan repayment (standard amortization formula), sales tax/VAT add-and-remove, and CPI-based inflation-adjusted value. SoulverCore- inspired syntax where it could be confirmed (see each parselet’s doc comment for exact worked examples and any deliberate deviations); function-call forms (compoundInterest(...), monthlyPayment(...), taxAdd(...), inflationAdjust(...), …) are registered separately, in FUNCTION_PACKAGE’s shared FUNC dispatch (see packages/function/parselets/FunctionCallParselet.ts’s builtinNameToIndex map) rather than here.

TRIGGER-WORD COLLISION DESIGN NOTE (same regression class documented in MathPhrasesPackage.ts, and explicitly called out for this package up-front): “interest”, “tax”, “principal”, “payment”, “rate”, “balance”, “what”, “worth”, “value” are all common, plausible variable names, a shipped playground example already uses :tax (:total = :subtotal + :tax, see MathPhrasesPackage.ts’s doc comment). None of those words are bare keywords anywhere in this package. Every trigger is either:

  • a full phrase fused via phrases below (“interest on”, “tax on”, “monthly repayment on”, “what is”, “what was”, “value of”, “worth in”, …), so the leading word alone never becomes its own token type and stays usable as :interest/:tax/:what/:value/etc., or
  • a genuine preposition (“over”, “at”) with near-zero plausibility as a variable name, the same accepted-risk category as this codebase’s existing bare “between”/“from”/“next”/“last”/“best” keywords (see Token.ts’s OVER/RATE_AT doc comment).

“split”, “ways” and “people” (the bill-split grammar) are likewise ordinary words and never bare keywords: BillSplitNormalizerRule claims them contextually, retyping to SPLIT/WAYS/PEOPLE only inside the full split shape, so :split, a variable named split, and prose are untouched. “between” reuses the pre-existing bare BETWEEN token (the accepted-risk category above).

“how”, “much”, “save” and “reach” (the savings-goal phrases) are fused whole, “how long to save” and “how much per month to save”/“to reach”, so none of those words becomes a bare keyword and :save/:reach/:how stay usable.

Inflation-adjusted value (extends this package, see parselets/InflationQueryParselet.ts/InflationFutureValueParselet.ts/ InYearMoneyParselet.ts, and data/PriceIndices.ts for the bundled indices, one per currency: the CPI-U table generated from the BLS series (#700), the ONS CDKO and euro-area HICP tables (#756), each with its doc comment on source and method) was the one topic explicitly deferred from this package’s original scope, now implemented.

Cash-flow appraisal (npv of, irr of, payback of, see parselets/CashFlowParselets.ts and CashFlowMath.ts) appraises a series of flows rather than one sum. Its triggers are fused phrases too: npv, irr and payback alone stay names, and IRR in particular is also the Iranian rial’s ISO code. The forms run as collision-safe pluginFunctions, not builtin indices, and deliberately have no npv(...) call spelling: a spreadsheet’s NPV() discounts the first flow as well, and a call spelled the same way that answered differently would be a trap.