EuropeanCentralBank.ExchangeRates 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package EuropeanCentralBank.ExchangeRates --version 1.0.1
NuGet\Install-Package EuropeanCentralBank.ExchangeRates -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EuropeanCentralBank.ExchangeRates" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EuropeanCentralBank.ExchangeRates --version 1.0.1
#r "nuget: EuropeanCentralBank.ExchangeRates, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EuropeanCentralBank.ExchangeRates as a Cake Addin
#addin nuget:?package=EuropeanCentralBank.ExchangeRates&version=1.0.1

// Install EuropeanCentralBank.ExchangeRates as a Cake Tool
#tool nuget:?package=EuropeanCentralBank.ExchangeRates&version=1.0.1

EuropeanCentralBank.ExchangeRates

European CentralBank ExchangeRates Api Client for C# / uses the European Central Bank's daily feed for accuracy

Build status CodeFactor License: MIT

Port of https://github.com/facundofarias/ecb-exchange-rates

For : https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html

Installation

Usage

Using the libary should be straight forward

Get Currencies information (Interfaces can be mocked for testing purpose)

    IExchangeRatesSource source = new ExchangeRatesSource();
    var rates = await source.GetCurrenciesAsync();

Currencies conversion (always using Euro as a base) Using double rule of 3 for calculation with a non euro base conversion.

    
    IExchangeRatesCalculator calculator = new ExchangeRatesCalculator(source); // will take any IExchangeRatesSource

    double originalAmount = 40;
    var amountInEuros = await calculator.Calculate(Currencies.USDollar, Currencies.Euro, originalAmount);
    Console.WriteLine($"You spent {originalAmount} US and it is equals to {amountInEuros} in EU");

    // from chf to dollar
    originalAmount = 100;
    var amountInDollars = await calculator.Calculate(Currencies.SwissFranc, Currencies.USDollar, originalAmount);
    Console.WriteLine($"You spent {originalAmount} CHF and it is equals to {amountInDollars} in USD");

Here is a sample https://github.com/davidrevoledo/EuropeanCentralBank.ExchangeRates/tree/master/src/ECB.Sample

Supported Currencies

  • AUD - Australian Dollar
  • BGN - Bulgarian Lev
  • BRL - Brazilian Real
  • CAD - Canadian Dollar
  • CHF - Swiss Franc
  • CNY - Chinese Yuan
  • CZK - Czech Koruna
  • DKK - Danish Krone
  • EUR - Euro
  • GBP - British Pound
  • HKD - Hong Kong Dollar
  • HRK - Croatian Kuna
  • HUF - Hungarian Forint
  • IDR - Indonesian Rupiah
  • ILS - Israeli New Shekel
  • INR - Indian Rupee
  • JPY - Japanese Yen
  • KRW - South Korean Won
  • LTL - Lithuanian Litas
  • LVL - Latvian Lats
  • MXN - Mexian Peso
  • MYR - Malaysian Ringgit
  • NOK - Norwegian Krone
  • NZD - New Zealand Dollar
  • PHP - Phillippine Peso
  • PLN - Polish Zloty
  • RON - Romanian New Leu
  • RUB - Russian Rouble
  • SEK - Swedish Krona
  • SGD - Singapore Dollar
  • THB - Thai Baht
  • TRY - Turkish Lira
  • USD - US Dollar
  • ZAR - South African Rand

Disclaimer ECB Api may remove some of the supported currencies, the library is ready to don't break in that case but nothing will be retrieved for that currency, for more information please see : https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 3,293 11/1/2018
1.0.1 650 11/1/2018