Code Monkey home page Code Monkey logo

goexrates's Introduction

Go Report Card

๐Ÿ’ฐ goexrates

A foreign exchange rates and currency conversion API that exposes data published by European Central Bank.

The rates are updated daily around 4PM CET.

Usage

Get the latest foreign exchange reference rates in JSON format.

GET /v1/latest
Host: localhost:3000

Get historical rates for any day since 1999-01-04.

GET /v1/historical/2008-03-18
Host: localhost:3000

Rates are quoted against the Euro by default. Quote against a different currency by setting the base parameter in your request.

GET /v1/latest?base=USD
Host: localhost:3000

Request specific exchange rates by setting the codes parameter.

GET /v1/latest?codes=USD,GBP
Host: localhost:3000

Response format.

{
    "base": "EUR",
    "date": "2021-05-05",
    "rates": {
        "AUD": 1.4832,
        "PLN": 4.2173,
        "MYR": 4.7543,
        "USD": 1.0961,
        [41 world currencies],
    }
}

Run

# Build and start containers:
docker compose up -d
# Enter api container:
docker exec -it api bash
# Apply database migrations:
make db/migrations/up
# Populate database with rates published by ECB (check goexrates-cli --help):
goexrates-cli load historical
# Run the API:
goexrates-api

API's endpoints can be accessed at localhost:3000. Both API (3000) and database (5432) ports are published and can be accessed via localhost:port.

Run make help to see all available commands and goexrates-cli --help to see more informations about additional CLI commands that help to manage common/recurring tasks.

goexrates's People

Contributors

lmikolajczak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

goexrates's Issues

Float -> decimal

Float for currencies, money is bad idea and produces "unexpected" results.

Dockerize the project

The project should be dockerized to allow ease of use and consistent deployment across various systems.

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.