Giter Site home page Giter Site logo

currency-conversion-backend's Introduction

Currency Conversion Backend

This is a Currency Conversion backend service that uses the FastAPI framework.

Installation

  1. Make sure you have Python 3.9 installed. It is suggested to use conda to create a dedicated environment on your computer.
  2. Clone or download the repository to your local machine.
  3. Open a terminal or command prompt and navigate to the project directory.
  4. Create a new conda environment: conda create --name CurrencyConversion python=3.9.
  5. Activate the environment: conda activate CurrencyConversion.
  6. Install the required dependencies: pip install -r requirements.txt.

Usage

To run the program, make sure the conda environment is activated by running conda activate CurrencyConversion,

Run the following command to start the program for development:

uvicorn main:app --reload

Now, use Postman or your browser to send request to http://localhost:8000/. Explore the API Endpoints below.

API Endpoints

  • GET /exchange_rate/{source_currency}/{target_currency}

    Retrieves the exchange rate from the source currency to the target currency.

    Example response:

    {
        "source_currency":"USD",
        "target_currency":"EUR",
        "exchange_rate":"0.96",
        "source_precision":2
    }
  • GET /convert/{source_currency}/{target_currency}?amount={figure}

    Obtain the requested amount conversion from the source currency to the target currency.

    Example response:

    {
        "source_currency":"USD",
        "source_amount":"10",
        "target_currency":"JPY",
        "target_amount":"1332",
        "exchange_rate":"133.24819"
    }

Testing

Unit testing code is included in test_main.py. It is built based on PyTest framework with HTTPX to start the emulator as an AsyncClient.

Run the following command to execute testing:

pytest

License

This project is licensed under the MIT License.

currency-conversion-backend's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.