Giter Site home page Giter Site logo

rator's Introduction

README

Setting up

  1. This project assumes you're on Python3
  2. pip3 install -r requirements.txt
  3. Install and create postgres db + user.
  4. Update the DATABASE in settings.py with the step 3 info.
  5. python manage.py migrate
  6. python manage.py populate_exchange_rates
  7. python manage.py runserver
  8. Go to your browser and check http://127.0.0.1:8000/api/rates/ to see the expected output
  9. http://127.0.0.1:8000/api/rates/?currency=USD will give filtered output.
  10. Run pytest to run the tests.
  11. As a proper app, we would run celery too as such celery -A rator worker --loglevel=info

What is this about?

This app reads the RSS feeds for each currecy's exchange rate from https://www.ecb.europa.eu/home/html/rss.en.html, saves it into the database and exposes it via an API endpoint.

  • The database consists of a single table that stores the currency <-> rate mapping
  • All rates are equivalent to 1 EURO.
  • Contains a single endpoint with filters to fetch the exchange rates.

Improvements

  1. Celerybeat

The feeds are updated at 2.15PM. Need to figure out the timeone and setup celerybeat to run the task and update the exchange rates on a daily basis.

  1. Redis cache

Since the rates are updated only on a daily basis, setup redis cache with daily expiry to serve the exchange rates. Would probably use redis-py library to achieve this.

  1. urllib mocking

The tests now mock the requests call with the proper HTML response but mocks the feedparser.parse call directly since that was taking some time to figure out how to mock the correspoding urllib methods that feedparser uses underneath.

rator's People

Contributors

harisibrahimkv avatar

Stargazers

 avatar

Forkers

karagul fagan2888

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.