Repository navigation
Home
This PowerShell module provides PowerShell cmdlets that wrap the open APIs provided by ExchangeRate-API and (for Crypto currencies) CoinBase to allow you to perform currency conversion in a variety of ways. Because these APIs are open, you do not need to specify an API key to use them, which means you can install the module and immediately start converting currencies without needing to sign up on either website.
You can optionally provide an API key for ExchangeRate-API, which then enhances your access to the API (e.g by giving more recently refreshed exchange rates, or allowing you to query the API more frequently).
As well as basic currency conversion, the module provides a number of additional helper cmdlets built around the APIs to help with various common scenarios, such as adding a converted currency values to an existing set of data (having imported that data into PowerShell objects), monitoring an exchange rate for change, and converting a source currency into multiple target currencies.
See the links in the sidebar (to the right) to view the PowerShell Get-Help help pages for each of the cmdlets of this module.
If you have PowerShell 5.1+ this module can be installed from the PowerShell Gallery, via package management:
Install-Module CurrencyConverterOnce installed, use by calling the cmdlets listed below. See their help pages for a parameters and usage examples. PowerShell should auto-discover the module's cmdlets, but to manually load it you can execute:
Import-Module CurrencyConverterTo perform a simple currency conversion for a Fiat currency, enter:
Convert-Currency -Value 123 -From USD -To GBP91.977309
To perform a simple currency conversion for a Crypto currency, enter:
Convert-CryptoCurrency -Value 123 -From USD -To BTC0.0015330889199046
This module provides the following cmdlets:
| Cmdlet | Description |
|---|---|
| Add-CurrencyMember | Adds a new member to an object that is a currency conversion of one of its existing properties. Supports historical rates via -Date. |
| Convert-Currency | Converts a decimal value between two specified currencies using ExchangeRate-API. Supports historical rates via -Date. |
| Convert-CryptoCurrency | Converts a decimal value between two specified crypto/non-crypto currencies using CoinBase API. |
| ConvertTo-CurrencyTable | Converts a decimal value to several currencies at once, returning the results as a single object. Supports historical rates via -Date. |
| Format-Currency | Formats a value as a string with the currency symbol for a specified country or crypto currency (where supported). |
| Get-Currency | Returns the list of supported currency codes along with their currency name and country code. |
| Get-CryptoCurrency | Returns the list of supported crypto currency codes along with their currency name and type (crypto or fiat). |
| Get-ExchangeRate | Returns all exchange rates for a specified currency, or a specified exchange rate between two currencies. Supports historical rates via -Date. |
| Get-CryptoExchangeRate | Returns all exchange rates for a specified crypto currency, or a specified exchange rate between two crypto/non-crypto currencies. |
| Set-CurrencyDefault | Saves default values for -From, -To and -APIKey so you don't need to specify them on every call. |
| Get-CurrencyDefault | Returns the default values currently saved by Set-CurrencyDefault. |
| Watch-ExchangeRate | Polls an exchange rate on an interval, until it crosses a specified threshold. |
The following currencies are supported by this module:
| Name | Code | Country |
|---|---|---|
| UAE Dirham | AED | United Arab Emirates |
| Afghan Afghani | AFN | Afghanistan |
| Albanian Lek | ALL | Albania |
| Armenian Dram | AMD | Armenia |
| Netherlands Antillian Guilder | ANG | Netherlands Antilles |
| Angolan Kwanza | AOA | Angola |
| Argentine Peso | ARS | Argentina |
| Australian Dollar | AUD | Australia |
| Aruban Florin | AWG | Aruba |
| Azerbaijani Manat | AZN | Azerbaijan |
| Bosnia and Herzegovina Mark | BAM | Bosnia and Herzegovina |
| Barbados Dollar | BBD | Barbados |
| Bangladeshi Taka | BDT | Bangladesh |
| Bulgarian Lev | BGN | Bulgaria |
| Bahraini Dinar | BHD | Bahrain |
| Burundian Franc | BIF | Burundi |
| Bermudian Dollar | BMD | Bermuda |
| Brunei Dollar | BND | Brunei |
| Bolivian Boliviano | BOB | Bolivia |
| Brazilian Real | BRL | Brazil |
| Bahamian Dollar | BSD | Bahamas |
| Bhutanese Ngultrum | BTN | Bhutan |
| Botswana Pula | BWP | Botswana |
| Belarusian Ruble | BYN | Belarus |
| Belize Dollar | BZD | Belize |
| Canadian Dollar | CAD | Canada |
| Congolese Franc | CDF | Democratic Republic of the Congo |
| Swiss Franc | CHF | Switzerland |
| Chilean Peso | CLP | Chile |
| Chinese Renminbi | CNY | China |
| Colombian Peso | COP | Colombia |
| Costa Rican Colon | CRC | Costa Rica |
| Cuban Peso | CUP | Cuba |
| Cape Verdean Escudo | CVE | Cape Verde |
| Czech Koruna | CZK | Czech Republic |
| Djiboutian Franc | DJF | Djibouti |
| Danish Krone | DKK | Denmark |
| Dominican Peso | DOP | Dominican Republic |
| Algerian Dinar | DZD | Algeria |
| Egyptian Pound | EGP | Egypt |
| Eritrean Nakfa | ERN | Eritrea |
| Ethiopian Birr | ETB | Ethiopia |
| Euro | EUR | European Union |
| Fiji Dollar | FJD | Fiji |
| Falkland Islands Pound | FKP | Falkland Islands |
| Faroese Króna | FOK | Faroe Islands |
| Pound Sterling | GBP | United Kingdom |
| Georgian Lari | GEL | Georgia |
| Guernsey Pound | GGP | Guernsey |
| Ghanaian Cedi | GHS | Ghana |
| Gibraltar Pound | GIP | Gibraltar |
| Gambian Dalasi | GMD | The Gambia |
| Guinean Franc | GNF | Guinea |
| Guatemalan Quetzal | GTQ | Guatemala |
| Guyanese Dollar | GYD | Guyana |
| Hong Kong Dollar | HKD | Hong Kong |
| Honduran Lempira | HNL | Honduras |
| Croatian Kuna | HRK | Croatia |
| Haitian Gourde | HTG | Haiti |
| Hungarian Forint | HUF | Hungary |
| Indonesian Rupiah | IDR | Indonesia |
| Israeli New Shekel | ILS | Israel |
| Manx Pound | IMP | Isle of Man |
| Indian Rupee | INR | India |
| Iraqi Dinar | IQD | Iraq |
| Iranian Rial | IRR | Iran |
| Icelandic Króna | ISK | Iceland |
| Jersey Pound | JEP | Jersey |
| Jamaican Dollar | JMD | Jamaica |
| Jordanian Dinar | JOD | Jordan |
| Japanese Yen | JPY | Japan |
| Kenyan Shilling | KES | Kenya |
| Kyrgyzstani Som | KGS | Kyrgyzstan |
| Cambodian Riel | KHR | Cambodia |
| Kiribati Dollar | KID | Kiribati |
| Comorian Franc | KMF | Comoros |
| South Korean Won | KRW | South Korea |
| Kuwaiti Dinar | KWD | Kuwait |
| Cayman Islands Dollar | KYD | Cayman Islands |
| Kazakhstani Tenge | KZT | Kazakhstan |
| Lao Kip | LAK | Laos |
| Lebanese Pound | LBP | Lebanon |
| Sri Lanka Rupee | LKR | Sri Lanka |
| Liberian Dollar | LRD | Liberia |
| Lesotho Loti | LSL | Lesotho |
| Libyan Dinar | LYD | Libya |
| Moroccan Dirham | MAD | Morocco |
| Moldovan Leu | MDL | Moldova |
| Malagasy Ariary | MGA | Madagascar |
| Macedonian Denar | MKD | North Macedonia |
| Burmese Kyat | MMK | Myanmar |
| Mongolian Tögrög | MNT | Mongolia |
| Macanese Pataca | MOP | Macau |
| Mauritanian Ouguiya | MRU | Mauritania |
| Mauritian Rupee | MUR | Mauritius |
| Maldivian Rufiyaa | MVR | Maldives |
| Malawian Kwacha | MWK | Malawi |
| Mexican Peso | MXN | Mexico |
| Malaysian Ringgit | MYR | Malaysia |
| Mozambican Metical | MZN | Mozambique |
| Namibian Dollar | NAD | Namibia |
| Nigerian Naira | NGN | Nigeria |
| Nicaraguan Córdoba | NIO | Nicaragua |
| Norwegian Krone | NOK | Norway |
| Nepalese Rupee | NPR | Nepal |
| New Zealand Dollar | NZD | New Zealand |
| Omani Rial | OMR | Oman |
| Panamanian Balboa | PAB | Panama |
| Peruvian Sol | PEN | Peru |
| Papua New Guinean Kina | PGK | Papua New Guinea |
| Philippine Peso | PHP | Philippines |
| Pakistani Rupee | PKR | Pakistan |
| Polish Złoty | PLN | Poland |
| Paraguayan Guaraní | PYG | Paraguay |
| Qatari Riyal | QAR | Qatar |
| Romanian Leu | RON | Romania |
| Serbian Dinar | RSD | Serbia |
| Russian Ruble | RUB | Russia |
| Rwandan Franc | RWF | Rwanda |
| Saudi Riyal | SAR | Saudi Arabia |
| Solomon Islands Dollar | SBD | Solomon Islands |
| Seychellois Rupee | SCR | Seychelles |
| Sudanese Pound | SDG | Sudan |
| Swedish Krona | SEK | Sweden |
| Singapore Dollar | SGD | Singapore |
| Saint Helena Pound | SHP | Saint Helena |
| Sierra Leonean Leone | SLE | Sierra Leone |
| Somali Shilling | SOS | Somalia |
| Surinamese Dollar | SRD | Suriname |
| South Sudanese Pound | SSP | South Sudan |
| São Tomã and Príncipe Dobra | STN | São Tomé and Príncipe |
| Syrian Pound | SYP | Syria |
| Eswatini Lilangeni | SZL | Eswatini |
| Thai Baht | THB | Thailand |
| Tajikistani Somoni | TJS | Tajikistan |
| Turkmenistan Manat | TMT | Turkmenistan |
| Tunisian Dinar | TND | Tunisia |
| Tongan Paʻanga | TOP | Tonga |
| Turkish Lira | TRY | Turkey |
| Trinidad and Tobago Dollar | TTD | Trinidad and Tobago |
| Tuvaluan Dollar | TVD | Tuvalu |
| New Taiwan Dollar | TWD | Taiwan |
| Tanzanian Shilling | TZS | Tanzania |
| Ukrainian Hryvnia | UAH | Ukraine |
| Ugandan Shilling | UGX | Uganda |
| United States Dollar | USD | United States |
| Uruguayan Peso | UYU | Uruguay |
| Uzbekistani So'm | UZS | Uzbekistan |
| Venezuelan Bolívar Soberano | VES | Venezuela |
| Vietnamese đồng | VND | Vietnam |
| Vanuatu Vatu | VUV | Vanuatu |
| Samoan Tālā | WST | Samoa |
| Central African CFA Franc | XAF | CEMAC |
| East Caribbean Dollar | XCD | Organisation of Eastern Caribbean States |
| Special Drawing Rights | XDR | International Monetary Fund |
| West African CFA franc | XOF | CFA |
| CFP Franc | XPF | Collectivités d'Outre-Mer |
| Yemeni Rial | YER | Yemen |
| South African Rand | ZAR | South Africa |
| Zambian Kwacha | ZMW | Zambia |
| Zimbabwean Dollar | ZWL | Zimbabwe |
| name | code | type |
|---|---|---|
| 00 Token | 00 | crypto |
| 1Inch | 1INCH | crypto |
| Aave | AAVE | crypto |
| Arcblock | ABT | crypto |
| Alchemy Pay | ACH | crypto |
| Access Protocol | ACS | crypto |
| Cardano | ADA | crypto |
| Aergo | AERGO | crypto |
| Aerodrome Finance | AERO | crypto |
| Adventure Gold | AGLD | crypto |
| Aioz Network | AIOZ | crypto |
| Akash | AKT | crypto |
| Alchemix | ALCX | crypto |
| Aleph.im v2 | ALEPH | crypto |
| Algorand | ALGO | crypto |
| My Neighbor Alice | ALICE | crypto |
| Amp | AMP | crypto |
| Ankr | ANKR | crypto |
| Aragon | ANT | crypto |
| ApeCoin | APE | crypto |
| API3 | API3 | crypto |
| Aptos | APT | crypto |
| Arbitrum | ARB | crypto |
| Arkham | ARKM | crypto |
| ARPA | ARPA | crypto |
| Assemble Protocol | ASM | crypto |
| AirSwap | AST | crypto |
| Automata Network | ATA | crypto |
| Cosmos | ATOM | crypto |
| Bounce Token | AUCTION | crypto |
| Audius | AUDIO | crypto |
| Aurora | AURORA | crypto |
| Avalanche | AVAX | crypto |
| Aventus | AVT | crypto |
| Axelar | AXL | crypto |
| Axie Infinity | AXS | crypto |
| Badger DAO | BADGER | crypto |
| Balancer | BAL | crypto |
| Band Protocol | BAND | crypto |
| Basic Attention Token | BAT | crypto |
| Bitcoin Cash | BCH | crypto |
| Biconomy | BICO | crypto |
| Big Time | BIGTIME | crypto |
| BitDAO | BIT | crypto |
| Blur | BLUR | crypto |
| Bluzelle | BLZ | crypto |
| Bancor | BNT | crypto |
| Boba Network | BOBA | crypto |
| BarnBridge | BOND | crypto |
| Bonk | BONK | crypto |
| Bitcoin | BTC | crypto |
| Braintrust | BTRST | crypto |
| Binance USD | BUSD | crypto |
| Coin98 | C98 | crypto |
| Coinbase Wrapped Staked ETH | CBETH | crypto |
| Celer Network | CELR | crypto |
| Celo | CGLD | crypto |
| Chiliz | CHZ | crypto |
| Clover Finance | CLV | crypto |
| Compound | COMP | crypto |
| COTI | COTI | crypto |
| Circuits of Value | COVAL | crypto |
| Crypto.com Coin | CRO | crypto |
| Crypterium | CRPT | crypto |
| Curve DAO Token | CRV | crypto |
| Cartesi | CTSI | crypto |
| Cryptex Finance | CTX | crypto |
| Civic | CVC | crypto |
| Convex Finance | CVX | crypto |
| Dai | DAI | crypto |
| Mines of Dalarnia | DAR | crypto |
| Dash | DASH | crypto |
| DerivaDAO | DDX | crypto |
| Decentralized Social | DESO | crypto |
| DEXTools | DEXT | crypto |
| DIA | DIA | crypto |
| Dimo | DIMO | crypto |
| district0x | DNT | crypto |
| Dogecoin | DOGE | crypto |
| Polkadot | DOT | crypto |
| Drep | DREP | crypto |
| Drift Protocol | DRIFT | crypto |
| DeFi Yield Protocol | DYP | crypto |
| MultiversX | EGLD | crypto |
| Elastos | ELA | crypto |
| Enjin Coin | ENJ | crypto |
| Ethereum Name Service | ENS | crypto |
| EOS | EOS | crypto |
| Ethernity Chain | ERN | crypto |
| Ether Classic | ETC | crypto |
| Ether | ETH | crypto |
| Euro | EUR | fiat |
| Euro Coin | EUROC | crypto |
| Harvest Finance | FARM | crypto |
| Fetch.ai | FET | crypto |
| Bonfida | FIDA | crypto |
| Filecoin | FIL | crypto |
| Stafi | FIS | crypto |
| Flow | FLOW | crypto |
| Flare | FLR | crypto |
| Forta | FORT | crypto |
| Ampleforth Governance Token | FORTH | crypto |
| ShapeShift FOX Token | FOX | crypto |
| Function X | FX | crypto |
| Project Galaxy | GAL | crypto |
| Gala V1 | GALA | crypto |
| British Pound | GBP | fiat |
| Goldfinch | GFI | crypto |
| Aavegotchi | GHST | crypto |
| Golem Network | GLM | crypto |
| STEPN | GMT | crypto |
| Gnosis | GNO | crypto |
| Golem | GNT | crypto |
| Gods Unchained | GODS | crypto |
| The Graph | GRT | crypto |
| Green Satoshi Token | GST | crypto |
| Gitcoin | GTC | crypto |
| Gemini Dollar | GUSD | crypto |
| GYEN | GYEN | crypto |
| Hedera | HBAR | crypto |
| Hashflow | HFT | crypto |
| Highstreet | HIGH | crypto |
| Helium | HNT | crypto |
| Hivemapper | HONEY | crypto |
| Hopr Token | HOPR | crypto |
| Internet Computer | ICP | crypto |
| IDEX | IDEX | crypto |
| Illuvium | ILV | crypto |
| ImmutableX | IMX | crypto |
| Index Cooperative | INDEX | crypto |
| Injective Protocol | INJ | crypto |
| Inverse Finance | INV | crypto |
| IoTeX (ERC-20) | IOTX | crypto |
| JasmyCoin | JASMY | crypto |
| Jito | JTO | crypto |
| Jupiter | JUP | crypto |
| Karrat | KARRAT | crypto |
| Kava | KAVA | crypto |
| Keep Network | KEEP | crypto |
| Kyber Network | KNC | crypto |
| kryll | KRL | crypto |
| Kusama | KSM | crypto |
| LCX Token | LCX | crypto |
| Lido DAO | LDO | crypto |
| Chainlink | LINK | crypto |
| Litentry | LIT | crypto |
| League of Kingdoms Arena | LOKA | crypto |
| Loom Network | LOOM | crypto |
| Livepeer | LPT | crypto |
| Liquity | LQTY | crypto |
| Loopring | LRC | crypto |
| Liquid Staked ETH | LSETH | crypto |
| Litecoin | LTC | crypto |
| Magic | MAGIC | crypto |
| Decentraland | MANA | crypto |
| Mask Network | MASK | crypto |
| MATH | MATH | crypto |
| Polygon | MATIC | crypto |
| Moss Carbon Credit | MCO2 | crypto |
| Measurable Data Token | MDT | crypto |
| Media Network | MEDIA | crypto |
| MetisDAO | METIS | crypto |
| Mina | MINA | crypto |
| Mirror Protocol | MIR | crypto |
| Maker | MKR | crypto |
| Enzyme | MLN | crypto |
| Marinade | MNDE | crypto |
| Helium Mobile | MOBILE | crypto |
| Monavale | MONA | crypto |
| Maple | MPL | crypto |
| Marinade staked SOL | MSOL | crypto |
| Metal | MTL | crypto |
| Multichain | MULTI | crypto |
| mStable USD | MUSD | crypto |
| Muse Dao | MUSE | crypto |
| MXC | MXC | crypto |
| Polyswarm | NCT | crypto |
| Near Protocol | NEAR | crypto |
| Neon | NEON | crypto |
| Nest Protocol | NEST | crypto |
| NKN | NKN | crypto |
| Numeraire | NMR | crypto |
| NuCypher | NU | crypto |
| Ocean Protocol | OCEAN | crypto |
| Origin Token | OGN | crypto |
| OMG Network | OMG | crypto |
| Omni Network | OMNI | crypto |
| Ondo Finance | ONDO | crypto |
| Ooki Protocol | OOKI | crypto |
| Optimism | OP | crypto |
| Orca | ORCA | crypto |
| Orion Protocol | ORN | crypto |
| Osmosis | OSMO | crypto |
| Orchid | OXT | crypto |
| Paxos Standard | PAX | crypto |
| Perpetual Protocol | PERP | crypto |
| PlayDapp | PLA | crypto |
| Pluton | PLU | crypto |
| Pangolin | PNG | crypto |
| Polkastarter | POLS | crypto |
| Polymath Network | POLY | crypto |
| Marlin | POND | crypto |
| Power Ledger | POWR | crypto |
| Prime | PRIME | crypto |
| Propy | PRO | crypto |
| PARSIQ | PRQ | crypto |
| Pundi X | PUNDIX | crypto |
| Vulcan Forged | PYR | crypto |
| Paypal Usd | PYUSD | crypto |
| Benqi | QI | crypto |
| Quant | QNT | crypto |
| Quantstamp | QSP | crypto |
| QuickSwap | QUICK | crypto |
| Radicle | RAD | crypto |
| Rai Reflex Index | RAI | crypto |
| SuperRare | RARE | crypto |
| Rarible | RARI | crypto |
| Ribbon Finance | RBN | crypto |
| Ren | REN | crypto |
| Render Network | RENDER | crypto |
| Augur | REP | crypto |
| Request | REQ | crypto |
| Rari Governance Token | RGT | crypto |
| iExec RLC | RLC | crypto |
| Rally | RLY | crypto |
| Render Token | RNDR | crypto |
| Ronin | RONIN | crypto |
| Oasis Network | ROSE | crypto |
| Rocket Pool | RPL | crypto |
| Safe | SAFE | crypto |
| The Sandbox | SAND | crypto |
| Seamless | SEAM | crypto |
| Sei | SEI | crypto |
| Shadow | SHDW | crypto |
| Shiba Inu | SHIB | crypto |
| Shping | SHPING | crypto |
| SKALE | SKL | crypto |
| Status | SNT | crypto |
| Synthetix | SNX | crypto |
| Solana | SOL | crypto |
| Sperax | SPA | crypto |
| Spell Token | SPELL | crypto |
| Stargate Finance V1 | STG | crypto |
| Storj | STORJ | crypto |
| Starknet | STRK | crypto |
| Stacks | STX | crypto |
| Sui | SUI | crypto |
| SUKU | SUKU | crypto |
| SuperFarm | SUPER | crypto |
| SushiSwap | SUSHI | crypto |
| SwftCoin | SWFTC | crypto |
| Sylo | SYLO | crypto |
| Synapse | SYN | crypto |
| Threshold | T | crypto |
| TBTC | TBTC | crypto |
| Celestia | TIA | crypto |
| Chrono.tech | TIME | crypto |
| Tensor | TNSR | crypto |
| TE-FOOD | TONE | crypto |
| OriginTrail | TRAC | crypto |
| Tellor | TRB | crypto |
| Tribe | TRIBE | crypto |
| TrueFi | TRU | crypto |
| The Virtua Kolect | TVK | crypto |
| UMA | UMA | crypto |
| Unifi Protocol DAO | UNFI | crypto |
| Uniswap | UNI | crypto |
| Pawtocol | UPI | crypto |
| United States Dollar | USD | fiat |
| USD Coin | USDC | crypto |
| Tether | USDT | crypto |
| TerraClassicUSD | UST | crypto |
| Vara | VARA | crypto |
| Velodrome Finance | VELO | crypto |
| VeChain | VET | crypto |
| Voyager Token | VGX | crypto |
| Voxies | VOXEL | crypto |
| VeThor | VTHO | crypto |
| Wrapped Ampleforth | WAMPL | crypto |
| Wrapped Axelar | WAXL | crypto |
| Wrapped Bitcoin | WBTC | crypto |
| Wrapped Centrifuge | WCFG | crypto |
| Wrapped Luna Classic | WLUNA | crypto |
| Onyxcoin | XCN | crypto |
| Stellar | XLM | crypto |
| XMON | XMON | crypto |
| XRP | XRP | crypto |
| Tezos | XTZ | crypto |
| XYO | XYO | crypto |
| yearn.finance | YFI | crypto |
| DFI.Money | YFII | crypto |
| Zcash | ZEC | crypto |
| Horizen | ZEN | crypto |
| Zetachain | ZETA | crypto |
| 0x | ZRX | crypto |
To perform a simple currency conversion, execute:
Convert-Currency -Value 100 -From USD -To GBP74.666100
Or for a crypto currency:
Convert-CryptoCurrency -Value 100 -From BTC -To GBP6107769.00
To use the ExhangeRate-API registered API, provide your key via the -APIKey parameter:
Convert-Currency -Value 100 -From USD -To GBP -ApiKey yourapikeystringhereTip
See here for a list of supported currencies: https://www.exchangerate-api.com/docs/supported-currencies. Alternatively you can use the Get-Currency cmdlet.
The value can alternatively be provided via the pipeline:
100 | Convert-Currency -From EUR -To CAD
100 | Convert-CryptoCurrency -From BTC -To GBP157.186500
6107769.00
This means that you can pipe multiple values in to perform a series of conversions:
100,200,250 | Convert-Currency -From USD -To JPY
100,200,250 | Convert-CryptoCurrency -From BTC -To GBP15692.063700
31384.127400
39230.159250
6107769.00
12215538.00
15269422.50
If you would like to return the result as a formatted string including the currency symbol and rounded to a number of decimal places, execute:
100 | Format-Currency -Currency USD$100.00
100 | Format-Currency -Currency ETHΞ100.00
This cmdlet rounds to two decimal places by default. To specify a different number of decimal places, use the -Decimals parameter:
Format-Currency -Value 123.4567890 -Currency GBP -Decimals 4£123.4568
You can also perform a currency conversion at the same time as performing the format:
Format-Currency -Value 100 -Currency GBP -ConvertTo USD$125.85
If you would prefer the currency symbol to appear after the value, use the -SymbolAtEnd switch parameter:
Format-Currency -Value 100 -Currency GBP -SymbolAtEnd125.85£
You can also pipe the result of Convert-Currency or Convert-CryptoCurrency to Format-Currency. The destination currency is automatically picked up from the pipeline, so there's no need to specify -Currency:
Convert-Currency -Value 100 -From USD -To EUR | Format-Currency€93.04
To see a full list of currency codes supported by this tool, along with their name and country, execute:
Get-CurrencyTo see a full list of crypto currency codes supported by this tool, along with their name and type, execute:
Get-CryptoCurrencyYou can also specify a specific code (this requires an exact match):
Get-Currency -Currency GBP
Get-CryptoCurrency -Currency BTCOr you can filter by currency or country name (this will return partial matches):
Get-Currency -Name 'Pound'Code Name Country
---- ---- -------
EGP Egyptian Pound Egypt
FKP Falkland Islands Pound Falkland Islands
GBP Pound Sterling United Kingdom
GGP Guernsey Pound Guernsey
GIP Gibraltar Pound Gibraltar
IMP Manx Pound Isle of Man
JEP Jersey Pound Jersey
LBP Lebanese Pound Lebanon
SDG Sudanese Pound Sudan
SHP Saint Helena Pound Saint Helena
SSP South Sudanese Pound South Sudan
SYP Syrian Pound Syria
Get-Currency -Country 'United'Code Name Country
---- ---- -------
AED UAE Dirham United Arab Emirates
GBP Pound Sterling United Kingdom
USD United States Dollar United States
To return the full result from the API as a PowerShell object, use the Get-ExchangeRate cmdlet:
Get-ExchangeRate -Currency USDOr for crypto currencies:
Get-CryptoExchangeRate -Currency BTCTo use the registered API, provide your key via the -APIKey parameter:
Get-ExchangeRate -Currency GBP -ApiKey yourapikeystringhereNote
When an API key is provided, the v6 API is invoked. This returns the rates as a property called 'conversion_rates'. The Open API returns the property as 'rates'.
result : success
provider : https://www.exchangerate-api.com
documentation : https://www.exchangerate-api.com/docs/free
terms_of_use : https://www.exchangerate-api.com/terms
time_last_update_unix : 1707350551
time_last_update_utc : Thu, 08 Feb 2024 00:02:31 +0000
time_next_update_unix : 1707437661
time_next_update_utc : Fri, 09 Feb 2024 00:14:21 +0000
time_eol_unix : 0
base_code : USD
rates : @{USD=1; AED=3.6725; AFN=73.755496; ALL=96.818553; AMD=405.868756; ANG=1.79; AOA=839.476403; ARS=830.15;
AUD=1.533245; AWG=1.79; AZN=1.699659; BAM=1.81591; BBD=2; BDT=109.768633; BGN=1.81581; BHD=0.376;
BIF=2850.388516; BMD=1; BND=1.343391; BOB=6.934197; BRL=4.962119; BSD=1; BTN=83.001945; BWP=13.679849;
BYN=3.245101; BZD=2; CAD=1.346345; CDF=2728.475301; CHF=0.873457; CLP=947.575519; CNY=7.19952;
COP=3954.758146; CRC=517.23293; CUP=24; CVE=102.376655; CZK=23.176359; DJF=177.721; DKK=6.92457;
DOP=58.566572; DZD=134.658699; EGP=30.904297; ERN=15; ETB=56.700184; EUR=0.928449; FJD=2.247047;
FKP=0.792018; FOK=6.92461; GBP=0.792011; GEL=2.659816; GGP=0.792018; GHS=12.422748; GIP=0.792018;
GMD=66.562902; GNF=8588.188018; GTQ=7.814905; GYD=209.536717; HKD=7.820255; HNL=24.66876; HRK=6.995483;
HTG=131.989675; HUF=360.172059; IDR=15650.579046; ILS=3.652044; IMP=0.792018; INR=83.001968;
IQD=1310.842088; IRR=42080.433475; ISK=137.663905; JEP=0.792018; JMD=156.245808; JOD=0.709;
JPY=148.053154; KES=160.352692; KGS=89.414602; KHR=4091.328437; KID=1.533294; KMF=456.772434;
KRW=1326.84486; KWD=0.307938; KYD=0.833333; KZT=452.274884; LAK=20736.087575; LBP=15000; LKR=312.628935;
LRD=192.145847; LSL=18.897808; LYD=4.844127; MAD=10.061229; MDL=17.827961; MGA=4536.616958;
MKD=57.312368; MMK=2099.744651; MNT=3412.288092; MOP=8.054862; MRU=39.584855; MUR=45.384067;
MVR=15.453447; MWK=1689.264206; MXN=17.05608; MYR=4.761416; MZN=63.917225; NAD=18.897808;
NGN=1407.528785; NIO=36.672231; NOK=10.577722; NPR=132.803112; NZD=1.636807; OMR=0.384497; PAB=1;
PEN=3.861833; PGK=3.749532; PHP=56.01365; PKR=279.042023; PLN=4.033029; PYG=7296.21721; QAR=3.64;
RON=4.620779; RSD=108.801814; RUB=91.346239; RWF=1284.744312; SAR=3.75; SBD=8.488406; SCR=13.291546;
SDG=544.79719; SEK=10.475851; SGD=1.343391; SHP=0.792018; SLE=22.587694; SLL=22587.694431;
SOS=571.785619; SRD=36.611265; SSP=1102.449099; STN=22.747273; SYP=12950.775091; SZL=18.897808;
THB=35.595367; TJS=10.947348; TMT=3.500938; TND=3.129049; TOP=2.371485; TRY=30.62091; TTD=6.777386;
TVD=1.533294; TWD=31.341578; TZS=2541.212285; UAH=37.600041; UGX=3817.518963; UYU=39.148736;
UZS=12479.514661; VES=36.2375; VND=24413.241561; VUV=120.508933; WST=2.745778; XAF=609.029912; XCD=2.7;
XDR=0.754059; XOF=609.029912; XPF=110.795003; YER=250.331823; ZAR=18.897825; ZMW=27.029301;
ZWL=10811.587531}
If you want to return just the exchange rates, you can execute Get-ExchangeRate or Get-CryptoExchangeRate and specify -Rates:
Get-ExchangeRate -Currency GBP -RatesGBP : 1
AED : 4.636888
AFN : 92.99538
ALL : 122.070196
AMD : 510.608906
ANG : 2.260049
AOA : 1067.044213
ARS : 1048.144979
AUD : 1.935836
AWG : 2.260049
AZN : 2.145246
BAM : 2.292681
BBD : 2.525194
BDT : 138.549806
...
If you just want to return a specific exchange rate, you can execute Get-ExchangeRate or Get-CryptoExchangeRate and specify -From and -To:
Get-ExchangeRate -From GBP -To USD1.262609
If you regularly convert between the same currencies, or always use the same API key, you can save them as defaults so you don't need to specify them every time:
Set-CurrencyDefault -From USD -To GBP -APIKey yourapikeystringhereOnce saved, Convert-Currency, Convert-CryptoCurrency, Get-ExchangeRate and Get-CryptoExchangeRate will use these values automatically whenever -From/-Currency, -To or -APIKey aren't explicitly specified:
100 | Convert-Currency79.200
Explicitly specifying a parameter always overrides the saved default:
100 | Convert-Currency -From GBP -To USDDefaults are saved to ~/.currencyconverter. To see the currently saved defaults, use Get-CurrencyDefault. To remove all saved defaults, use Set-CurrencyDefault -Reset.
If you have an object with a property that represents a currency value, you can use Add-CurrencyMember to add a new property to it that is a currency conversion of that value:
[pscustomobject]@{ Product = 'Widget'; Price = 100 } | Add-CurrencyMember -Property Price -From USD -To GBP -PassThruProduct Price PriceGBP
------- ----- --------
Widget 100 79.20
By default the new property is named <Property><To>, e.g. PriceGBP. You can specify a different name with -MemberName. -From and -To also fall back to any saved defaults, and crypto currency codes are converted via Convert-CryptoCurrency automatically. As with Add-Member, the updated object is only returned to the pipeline if -PassThru is specified.