xe.com

command module
v0.0.0-...-5a29f4f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2025 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

xe.com

Small utility to fetch xe.com rates for a given currency pair and date. In a strict form expects to be called as: xe.com --from CCY --to CCY --date YYYY-MM-DD. But a few short forms are also available. CCY is an ISO-4217 alphabetic code.

Usage

xe.com [OPTIONS]

Application Options

  -f, --from-ccy      Convert FROM, defaults to RUB (default: RUB)
  -t, --to-ccy        Convert TO, defaults to USD (default: USD)
  -d, --date          Date to get the rate for, must be in YYYY-MM-DD format
  -s, --strip-extra   Returns only the rate, good for use for shell scripting
  -a, --amount        Optionally, provide amount to convert
  -m, --math <expr>   Calculate the amount from the expression <expr>, then treat as -a
  -R, --show-rate     Always show rate
  -v, --version       Print version information and quit

Short form of xe.com <DATE> or xe.com <FROM> <TO> <DATE> are also supported.

Environment

You can set variables XE_CCY_FROM and XE_CCY_TO in order to define your default from/to pair. Add this to your .bashrc to have default pair EUR/USD:

export XE_CCY_FROM=EUR
export XE_CCY_TO=USD

Examples

xe.com -f USD -t GBP -d 2021-03-17

# will return the XE.COM close rate for USD/GBP pair on 17 Mar 2021

xe.com usd gbp 2021-03-17

# the same, but shorter

xe.com -d 2021-03-17

# the same, but for the default pair (RUB/USD)

xe.com 2021-03-17

# the same in the shortest form possible

xe.com 21.03.17

# you can do this too, but I am not guessing whether this is YY.MM.DD or DD.MM.YY -- use at your own risk

xe.com -s FROM TO DATE

# this form allows chaining with the likes of bc(1) to make calculations, e.g. echo "$(~/bin/xe.com -s rub eur 20220510)*1234.56" | bc

xe.com rub eur 20220510 1234.56

# will convert from RUB amount of 1234.56 to EUR with a rate as of 10 May 2022

Supported Currencies

The tool supports common ISO 4217 currency codes including:

  • USD (US Dollar)
  • EUR (Euro)
  • GBP (British Pound)
  • JPY (Japanese Yen)
  • AUD (Australian Dollar)
  • CAD (Canadian Dollar)
  • CHF (Swiss Franc)
  • CNY (Chinese Yuan)
  • RUB (Russian Ruble)
  • INR (Indian Rupee)

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL