Currency-aware monetary values with parsing, arithmetic, and real-time exchange rates
Maintainer(s):
onnimonni
Compatibility Matrix
This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.4.4 | 1.4.5 | 1.5.5 | 1.5.6 | 2.0.0 |
|---|---|---|---|---|---|
| Linux AMD64 | |||||
| Linux ARM64 | |||||
| macOS AMD64 | |||||
| macOS ARM64 | |||||
| Windows AMD64 | |||||
| Windows ARM64 | |||||
| WebAssembly |
Installing and Loading
INSTALL monetary FROM community;
LOAD monetary;
Example
-- Parse monetary values
SELECT '100 EUR'::monetary;
SELECT '$50.25'::monetary;
-- Arithmetic with currency validation
SELECT '100 EUR'::monetary + '50 EUR'::monetary;
-- Fetch real-time exchange rates (requires http_request extension)
SELECT * FROM ecb_exchange_rates();
SELECT * FROM freegold_exchange_rates() WHERE data_source = 'yahoo_finance';
About monetary
The monetary extension provides:
- Currency-aware monetary type with 70+ currencies (ISO 4217)
- Safe arithmetic with currency mismatch detection
- 10 exchange rate sources (ECB, BOC, RBA, CNB, SNB, Norges Bank, TwelveData, OXR, GoldAPI, FreeGold)
- Precious metals (XAU, XAG, XPT, XPD) with weight unit conversion
- Cryptocurrencies (BTC, ETH)
For more information, see the repository.
Added Functions
This extension does not add any functions.
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
This extension does not add any settings.