This site describes solve-engine 2.44.0, the version npm installs.
createCurrencyPackage
function createCurrencyPackage(config?): IEnginePackage;Defined in: packages/engine/src/packages/currency/CurrencyPackage.ts:36
Currency: $10, £10, €10, ¥10, ₽10, ₩10, ₹10, ₺10, ₴10,
₪10, ₫10, ₦10, ₱10, 10 USD in GBP, 100 USD in GBP on 2024-01-15,
and word forms like 10 euros/10 dollars (see uom/CurrencyAliases.ts for
the full symbol/word alias tables and the ambiguity decisions behind them).
Live rates are fetched asynchronously (via CurrencyAsyncResolver) and
the expression shows Pending until they resolve. The dated on <date> form
resolves through CurrencyPackageConfig.historicalRateProvider: the
built-in Frankfurter provider by default (the same endpoint as the live
rate, asked for a date; see uom/FrankfurterHistoricalRates.ts), the host’s
own when it supplies one, and none when it passes null, which reports
HISTORICAL_RATES_NOT_CONFIGURED plainly rather than drifting to today’s
rate (see uom/HistoricalCurrency.ts).
A factory, but still a default builtin. Unlike stocks (no free provider,
so excluded from BUILTIN_PACKAGES), currency needs no configuration, so
CURRENCY_PACKAGE = createCurrencyPackage() ships as a default. A
host with its own historical source calls createCurrencyPackage({ historicalRateProvider })
and swaps the result in for the default in its packages array.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
config? | CurrencyPackageConfig |