-
Notifications
You must be signed in to change notification settings - Fork 552
Exchange rate provider - Diego Fernandez Pandiello #726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
diego-pandiello
wants to merge
16
commits into
MewsSystems:master
Choose a base branch
from
diego-pandiello:exchange-rate-provider
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Exchange rate provider - Diego Fernandez Pandiello #726
diego-pandiello
wants to merge
16
commits into
MewsSystems:master
from
diego-pandiello:exchange-rate-provider
+928
−68
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…y injection setup
…dd appsettings.json configuration
Remove optional and reloadOnChange parameters from the AddJsonFile method, making appsettings.json a required configuration file without automatic reload on changes.
Update CNBOptions from a record to a class with mutable properties. Modify InfrastructureServiceCollection to include necessary using directives and configure HttpClient for IExchangeRateProvider using the BaseUrl from CNBOptions.
Refactor CNBExchangeRateProvider to use HttpClient for asynchronous fetching of exchange rates from the CNB API, improving data retrieval and parsing.
Introduce a new `Metrics` class to manage observability metrics for exchange rate updates, including counters for HTTP client retries and circuit breaker events. Add an extension method `AddObservabilityInfrastructure` to register the `Metrics` class as a singleton and configure OpenTelemetry for tracing and metrics, ensuring proper instrumentation and console exporting.
Add resilience handlers to retry and circuit break the provider
Update the project to include `InternalsVisibleTo` for testing, add a new test project for `ExchangeRateUpdaterTests`, and implement unit tests for `ExchangeRateProvider`, `CNBExchangeRateFetcher`, `CNBExchangeRateParser`, and `CachedExchangeRateFetcher`. Update solution and project files to target .NET 9.0 and include necessary testing packages.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Exchange Rate Updater
Overview
This project is a C# console application designed to fetch and update foreign exchange rates using data provided by the Czech National Bank (CNB). The application retrieves the latest daily exchange rates and can be integrated into financial systems or used as a standalone tool for currency conversion and rate analysis.
Features
Data Source
Component and Project Structure
The solution is organized for clarity, maintainability, and extensibility:
Domain Layer (
Domain/
):Currency.cs
: Value object representing a currency.ExchangeRate.cs
: Value object representing an exchange rate between two currencies.ExchangeRateProvider.cs
: Exchange rate provider.IExchangeRateFetcher.cs
: Interface for fetching exchange rates.Infrastructure Layer (
Infrastructure/
):CNB/
:CNBExchangeRateFetcher.cs
: Fetches and parses rates from the CNB API.CNBExchangeRateParser.cs
: Parses the CNB data format.CachedExchangeRateFetcher.cs
: Adds caching to the fetcher.CNBOptions.cs
: Configuration options for the CNB provider.Observability/
:Metrics.cs
: Exposes application metrics.Application Entry Point:
Program.cs
: Main entry point, orchestrates fetching and processing of exchange rates.Configuration:
appsettings.json
: Application configuration (e.g., endpoints, logging).Testing (
Tests/ExchangeRateUpdaterTests/
):This structure supports separation of concerns, testability, and future extension (e.g., adding new providers or output formats).
Architecture & Design Decisions
Testing
Tests/ExchangeRateUpdaterTests/
directory.dotnet test
.Extensibility
IExchangeRateFetcher
interface and register it in the DI container.Error Handling & Resilience
Configuration
appsettings.json
.Usage
ExchangeRateUpdater.sln
).Requirements
License
This project is provided as an exercise for recruitment purposes. License terms may be specified by the author or company.