Skip to content

voutsasva/RatesExchangeApi-Core

Repository files navigation

RatesExchangeApi-Core

NuGet

A .NET Standard Library for using the Rates Exchange API.

Installation

NuGet: Install-Package RatesExchangeApi

Usage

The main class is RatesExchangeApiService. When using it you will need provide your API key after signing up for an account.

An example console app is included. In order to use it replace the [YOUR_API_KEY] with your own API key from rates exchange api.

Quick Start

Initialization

using RatesExchangeApi;
using RatesExchangeApi.Models;
...
var client = new RatesExchangeApiService("[YOUR_API_KEY]");
...

Check if API is online

...
var result = await client.CheckIfApiIsOnline();
...

Get latest rates from ECB

...
var rates = await client.GetLatestRates("USD");
...
List<string> isoCurrencies = new List<string> { "USD", "CHF", "GBP", "AUD", "JPY" };
var rates = await client.GetLatestRates("USD", isoCurrencies);
...

Convert rates

...
var rates = await client.ConvertCurrency("USD", "120", "2018-06-01");
...

Tests

NUnit is used for some simple integration tests with the actual web service. To run the tests, a valid API key must be added. Replace the [YOUR_API_KEY] in ApiTests.cs with your own API key from rates exchange api. You can see an example usage in the api tests.

Author

Vassilis Voutsas, [email protected]

License

ECB Currency Converter is released under the MIT license. See LICENSE for more information.