CNB 1.2.2

CNB.cz Daily Exchange + Bank codes Rates .NET Standard 2.0 Library

Install-Package CNB -Version 1.2.2
dotnet add package CNB --version 1.2.2
<PackageReference Include="CNB" Version="1.2.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CNB --version 1.2.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

CNB.Exchange

CNB.cz .NET Standard 2.0 Library (netstandard2.0). By ČNB

Supports

  • Dependency injection by IHttpClientFactory
  • CurrencyCode as enum (Generator project included)
  • direct query for exchange-rate by ExchangeRateCode

Dependency injection

More in CNB.Tests project, file: TestFixture.cs and BasicTest.cs.

// DI configuration
services.AddHttpClient();
services.AddScoped<CnbClient>();

// in constructor
_cnb = test.Services.GetRequiredService<CnbClient>();

Using

// return decimal value of Exchange rate for EUR
await _cnb.ExchangeRateCode(CurrencyCode.EUR);

// return all Exchange rates
await _cnb.ExchangeRateAll();

// return all Bank codes
await _cnb.BankCodeAll();

ExchangeRate.cs contains:

  • Country - country name (in Czech)
  • CurrencyName - currency name (in Czech)
  • Amount - currency amount (example: 1, 100)
  • Code - currency code (as string; example: EUR, USD, ...)
  • Rate - exchange rate (as decimal; example: 25.877)
  • CurrencyCode - code (as nullable enum; example: CurrencyCode.EUR, CurrencyCode.GBR, ...)

BankCode.cs contains:

  • Code - bank code
  • Name - bank name (in Czech)
  • BIC - BIC (SWIFT)
  • CERTIS - CERTIS

CNB.Exchange

CNB.cz .NET Standard 2.0 Library (netstandard2.0). By ČNB

Supports

  • Dependency injection by IHttpClientFactory
  • CurrencyCode as enum (Generator project included)
  • direct query for exchange-rate by ExchangeRateCode

Dependency injection

More in CNB.Tests project, file: TestFixture.cs and BasicTest.cs.

// DI configuration
services.AddHttpClient();
services.AddScoped<CnbClient>();

// in constructor
_cnb = test.Services.GetRequiredService<CnbClient>();

Using

// return decimal value of Exchange rate for EUR
await _cnb.ExchangeRateCode(CurrencyCode.EUR);

// return all Exchange rates
await _cnb.ExchangeRateAll();

// return all Bank codes
await _cnb.BankCodeAll();

ExchangeRate.cs contains:

  • Country - country name (in Czech)
  • CurrencyName - currency name (in Czech)
  • Amount - currency amount (example: 1, 100)
  • Code - currency code (as string; example: EUR, USD, ...)
  • Rate - exchange rate (as decimal; example: 25.877)
  • CurrencyCode - code (as nullable enum; example: CurrencyCode.EUR, CurrencyCode.GBR, ...)

BankCode.cs contains:

  • Code - bank code
  • Name - bank name (in Czech)
  • BIC - BIC (SWIFT)
  • CERTIS - CERTIS

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.2.2 86 12/5/2019