Giter Club home page Giter Club logo

cotizaciones-brou's Introduction

Cotizaciones BROU

El problema

No existe una API pública para obtener las cotizaciones del BROU

Esta solución

Este proyecto implementa una REST API abierta que puede ser utilizada para obtener cotizaciones de las siguientes monedas en Pesos Uruguayos:

  • USD: Dólar Estadounidense
  • ARS: Peso Argentino
  • BRL: Real Brasileño
  • EUR: Euro

Está alojada en Fly.io.

Dato curioso: La cotización más antigua accesible a traves de esta API es del 30 de diciembre de 1999.

Los datos

Los datos son obtenidos desde el Histórico de Cotizaciones del Instituto Nacional de Estadística del Uruguay.

Particularmente, la base de datos de genera a partir de este archivo XLS .

¿Cómo se usa?

URL base

https://cotizaciones-brou-v2-e449.fly.dev

Endponits

GET /currency/latest

Devuelve las cotizaciones más recientes disponibles

  • URL: /currency/latest
  • Método: GET
  • Respuesta exitosa: GET /currency/latest
    {
      "base": "UYU",
      "timestamp": 1681430400000,
      "dateISOString": "2023-04-14",
      "rates": {
        "USD": {
          "buy": 37.6,
          "sell": 40
        },
        "ARS": {
          "buy": 0.05,
          "sell": 0.35
        },
        "BRL": {
          "buy": 7.73,
          "sell": 9.53
        },
        "EUR": {
          "buy": 40.53,
          "sell": 45.45
        }
      }
    }

GET /currency/:date

Devuelve las cotizaciones vigentes para la fecha indicada por el parámetro date. Si no hay cotizaciones para esa fecha, se devuelven las más recientes previo a la misma.

Por ejemplo, GET /currency/2018-10-07 devuelve las cotizaciones del 5 de octubre de 2018, debido a que el 7 fue domingo y no hay cotizaciones para ese día; las más recientes previo a esa fecha son las del viernes 5 de octubre.

  • URL: /currency/:date

  • Método: GET

  • Params:

    • date (requerido): Fecha con formato YYYY-MM-DD. Ej: 2018-10-07 para las cotizaciones vigentes al 7 de octubre del 2018.
  • Respuesta exitosa: GET /currency/2018-10-07

    {
      "base": "UYU",
      "timestamp": 1538697600000,
      "dateISOString": "2018-10-05",
      "rates": {
        "USD": {
          "buy": 32.34,
          "sell": 33.74
        },
        "ARS": {
          "buy": 0.58,
          "sell": 1.18
        },
        "BRL": {
          "buy": 7.88,
          "sell": 8.88
        },
        "EUR": {
          "buy": 36.34,
          "sell": 39.96
        }
      }
    }
  • Respuesta cuando la fecha es inválida: GET /currency/2018-10-32

    Status code: 400 - Invalid date

cotizaciones-brou's People

Contributors

dependabot[bot] avatar gmanriqueuy 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cotizaciones-brou's Issues

Cotizaciones intercambiadas

Saludos.

Está intercambiando la cotización de EUR con la BRL.

{"base":"UYU","timestamp":1554336000,"rates":{"ARS":{"sell":34.15,"buy":33.43},"BRL":{"sell":39.83,"buy":36.26},"EUR":{"sell":1.1,"buy":0.5},"USD":{"sell":34.45,"buy":33.05}}}

/currency/latest is returning from 22/10/2020

GET /currency/latest and GET currency/2020-12-09 are returning currency from October 22.

{ "base": "UYU", "timestamp": 1603324800, "rates": { "ARS": { "sell": 0.6, "buy": 0.1 }, "BRL": { "sell": 8.7, "buy": 6.7 }, "EUR": { "sell": 53.51, "buy": 47.99 }, "USD": { "sell": 43.85, "buy": 41.45 } } }

Handle error on file download

Sometimes, the following error is thrown when downloading file:
Error: getaddrinfo EAI_AGAIN www.ine.gub.uy:80

The seed script needs to handle it and try again 3, or 4 times.

archivo XLS fuente no existe más en la ruta original

El archivo https://www5.ine.gub.uy/documents/Estadísticaseconómicas/SERIES%20Y%20OTROS/Cotización%20de%20monedas/Cotización%20monedas.xlsx de donde se sacan los datos no existe más, entonces la db no se está actualizando. Estuve buscando y no encontré otra ruta.

Encontré esto https://www.gub.uy/instituto-nacional-estadistica/tematica/cotizacion-monedas pero está vacío.
Acá hay una lista de datos del INE, pero no figuran las cotizaciones: https://www.gub.uy/instituto-nacional-estadistica/estadisticas-economicas.

Me hubiera gustado ser de más ayuda, pero no encontré nada.

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.