Skip to content

The Currency Converter project allows you to convert from one currency to another with real-time exchange rates.

License

Notifications You must be signed in to change notification settings

karanzaveri/Currency-Conversion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Currency Conversion

The Currency Converter project allows you to convert from one currency to another with real-time exchange rates. It is built using Python and Exchange Rate Api that provides accurate and reliable currency conversion rates for 161 currencies. It provides integration for SaaS, Dashboards, and E-Commerce with exceptional uptime and support.

Table Of Contents

  1. Code
  2. UML Diagrams
  3. Requirements Engineering
  4. Analysis
  5. DDD
  6. Metrics
  7. Clean Code Development
  8. Build Management
  9. Unit Tests
  10. IDE
  11. Functional Programming

Code

To access the code: Currency Conversion Code

UML Diagrams

1. Activity Diagram

  • The activity diagram showcases a user-driven process, starting with entering source currency followed by target currency and then the amount. Once the valid data is entered, the conversion process is triggered and the converted amount with the applied exchange rate is displayed.
  • Activity Diagram

2. Use Case Diagram

  • The use case diagram outlines how the users interact with the system. Users initiate the currency conversion process by specifying source currency, target currency and amount, while the system performs conversions and provides the results.
  • Use Case Diagram

3. Class Diagram

  • The class diagram represents classes like Currency Converter, Currency Rates, GUI and Error Handling elements, illustrating their relationships and interactions in facilitating user input, data retrieval, and conversion processes within the application.
  • Class Diagram

Requirements Engineering

1. Functional Requirements

  • Currency Conversion
  • Real-Time Exchange Rates
  • Graphical User Interface (GUI)
  • User Input Handling
  • Transaction History

2. Non-Functional Requirements

  • Performance
  • User Experience (UX)
  • Reliability
  • Maintainability
  • Quality Assurance

Analysis

You can find my Analysis for the Semester Project here

DDD

Domain-Driven Design (DDD) is an approach to software development that centers around a deep understanding of the business domain. PDF

Metrics

Quality Gate Status

Bugs

Security Rating

Maintainability Rating

Technical Debt

Clean Code Development

Clean Code Development (CCD) focuses on writing code that is easy to read, understand, and maintain. PDF

Build Management

Build management for the Currency Conversion project has been implemented using Github Actions

Python CI

Unit Tests

The unit tests has been done in 2 parts and is written using the unittest framework in Python.

Unit Test 1 Unit Test 2

1. TestRealTimeCurrencyConverter Class

  • TestRealTimeCurrencyConverter: This is a test case class that inherits from 'unittest.TestCase'. It contains test methods for the 'RealTimeCurrencyConverter' class.
test_main.py
  • test_get_exchange_rates: Checks if the 'get_exchange_rates' method of 'RealTimeCurrencyConverter' returns valid data.
  • test_convert: Checks if the 'convert' method of 'RealTimeCurrencyConverter' behaves as expected.
test_non_gui.py
  • test_get_exchange_rates: Checks if the API request to obtain exchange rates for USD is successful and if the returned data contains the 'rates' key.
  • test_convert: Tests the currency conversion functionality by converting 1 unit of USD to INR, ensuring that the result is not None and is of type float.

2. TestCurrencyConverterApp Class

  • TestCurrencyConverterApp: This is another test case class for the 'CurrencyConverterApp' class.
  • setUp: A special method that is run before each test method. It creates instances of 'RealTimeCurrencyConverter' and 'CurrencyConverterApp'.
  • test_restrict_number_only: Checks the 'restrict_number_only' method of 'CurrencyConverterApp' for different input cases.

3. Running Tests:

  • The main block ensures that if the script is run directly (not imported as a module), the 'unittest.main()' function is called, which discovers and runs the tests.

Result

IDE

I have used Visual Studio Code IDE, mentioned below are my few favorite shortcuts:

  • F5 : Run and Debug
  • Ctrl + ] / Ctrl + [ : Indentation
  • Ctrl + / : Comment/Uncomment code lines
  • Ctrl + B : Show or hide the sidebar
  • Ctrl + Shift + P : Open the command palette

Functional Programming

In my Currency Conversion code, certain functional programming principles are applied. Here's how the code adheres to these principles:

  1. Final Data Structures: The 'data' attribute in RealTimeCurrencyConverter is initialized with the final result of the API call ('response.json()'), representing exchange rates. It remains unmodified afterward.

  2. Side-Effect-Free Functions: The get_exchange_rates function has no side effects, performing an HTTP GET request and returning the JSON response without modifying external state. The convert method is also side-effect-free.

  3. Higher-Order Functions: The requests.get function in 'get_exchange_rates' is a higher-order function, taking a URL as an argument and returning a function ('get') that performs an HTTP GET request.

  4. Functions as Parameters and Return Values: The 'convert' method takes parameters and returns a calculated value. Button widgets use functions like perform_conversion and show_transaction_history as parameters for the 'command' attribute.

  5. Closures / Anonymous Functions: While 'lambda' functions are not explicitly used, functions passed to the command attribute of buttons can be considered as anonymous functions.

Built Using

python Visual Studio Code

Contact Me

gmail

About

The Currency Converter project allows you to convert from one currency to another with real-time exchange rates.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages