Repository navigation
Convert Currency
Converts a decimal value between specified currencies
Convert-Currency [-Value] <Decimal> [-From <String>] [-To <String>] [-APIKey <String>] [-Date <DateTime>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
Uses the Open Exchange Rate API (https://www.exchangerate-api.com/docs/free) to perform currency conversions. Caches the conversion rates for the specified currency (valid for 24 hours).
100 | Convert-Currency -From USD -To GBP
Converts the value 100 (provided via the pipeline) from USD (US Dollar) to GBP (British Pound), example result: 79.674700
Convert-Currency -Value 100 -From AUD -To EUR
Converts the value 100 from USD (US Dollar) to AUD (Australian Dollar), example result: 154.211800
Convert-Currency -Value 100 -From USD -To EUR | Format-Currency
Converts 100 USD to EUR and pipes the result to Format-Currency, which picks up the destination currency (EUR) from the pipeline, example result: €92.15
Set-CurrencyDefault -From USD -To GBP
Convert-Currency -Value 100
Saves USD/GBP as the default currencies to convert between, then converts 100 USD to GBP without needing to specify -From/-To.
Convert-Currency -Value 100 -From USD -To GBP -Date '2024-01-15' -ApiKey yourapikeystringhere
Converts 100 USD to GBP using the exchange rate as it was on 15th January 2024.
The amount you want to convert between currencies.
Type: Decimal
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: 0
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseThe currency to convert from. Defaults to the value saved with Set-CurrencyDefault -From, if any.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: (Get-CurrencyDefaultValue -Name 'From')
Accept pipeline input: False
Accept wildcard characters: FalseThe currency to convert to. Defaults to the value saved with Set-CurrencyDefault -To, if any.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: (Get-CurrencyDefaultValue -Name 'To')
Accept pipeline input: False
Accept wildcard characters: FalseOptional: To use the v6 API, provide your API key, as provided by https://www.exchangerate-api.com/ Defaults to the value saved with Set-CurrencyDefault -APIKey, if any.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: (Get-CurrencyDefaultValue -Name 'APIKey')
Accept pipeline input: False
Accept wildcard characters: FalseOptional: Converts using the historical exchange rates for the specified date, instead of the latest rates. This requires an -APIKey, as historical data is only available via the registered v6 API. Historical results are cached indefinitely once retrieved, as they do not change.
Type: DateTime
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False{{Fill ProgressAction Description}}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
https://github.com/markwragg/PowerShell-CurrencyConverter/wiki/Convert-Currency