← ceesaxp.github.io
💱

xe.com

Fetch xe.com exchange rates from your terminal. Any currency pair, any date. Shell-scriptable.

Go ISO-4217

🖥️ In Action

Terminal — zsh
# Full form — USD to GBP on a specific date $ xe.com -f USD -t GBP -d 2024-03-17 1 USD = 0.7891 GBP (17 Mar 2024) # Short form — same thing, less typing $ xe.com usd gbp 2024-03-17 1 USD = 0.7891 GBP (17 Mar 2024) # Convert an amount $ xe.com eur usd 2024-01-15 1500 1500 EUR = 1639.50 USD (15 Jan 2024) # Strip output for shell scripting $ echo "$(xe.com -s rub eur 2024-05-10) * 1234.56" | bc 11.85 # Math expressions for the amount $ xe.com -f USD -t EUR -d 2024-06-01 -m "1500+2300+750" 4550 USD = 4186.00 EUR (01 Jun 2024)

⚙️ Options

FlagDescriptionDefault
-f, --from-ccy Source currency (ISO-4217 code) RUB
-t, --to-ccy Target currency (ISO-4217 code) USD
-d, --date Date for the rate (YYYY-MM-DD)
-a, --amount Amount to convert
-m, --math Calculate amount from expression, then convert
-s, --strip-extra Output rate only — perfect for piping to bc off
-R, --show-rate Always display the exchange rate off
-v, --version Print version and exit

Short forms are also supported for quick use:

xe.com <DATE> — uses default currency pair
xe.com <FROM> <TO> <DATE> — explicit pair
xe.com <FROM> <TO> <DATE> <AMOUNT> — with conversion

🌍 Environment Variables

Set default currency pair via environment variables so you don't have to type them every time. Add these to your .bashrc or .zshrc:

# Default pair: EUR/USD export XE_CCY_FROM=EUR export XE_CCY_TO=USD # Now just specify the date xe.com 2024-03-17

📦 Installation

Built with Go. Clone and build:

git clone https://github.com/Ceesaxp/xe.com.git cd xe.com go build -o xe.com . cp xe.com ~/bin/ # or wherever you keep your tools