Skip to content

arturschuch/quotation-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status

quotation-api

API to get currency quotation on determinated date.

The data source used will be the Brazilian central bank CSV file available at: http://www4.bcb.gov.br/pec/taxas/batch/cotacaomoedas.asp?id=txtodas

It was created the function currencyQuotation that return the quotation of "from" to "to"

public BigDecimal currencyQuotation(String from, String to, Number value, String quotationDate);

Parameters:

from: String with the currency name (example "USD") you want to convert;

to: String with the currency name (example "EUR") you want to see the result;

value: The value that should be converted. The currency of this value will be expressed in the “from” parameter;

quotationDate: A date as String in the format “dd/MM/yyyy”;

Respecting the rules:

  • You shall not work with non-native classes / libraries;

  • If the from or to parameters are not valid, an exception must be thrown;

  • If the value is smaller than zero, an exception must be thrown;

  • For non-working days (Saturday and Sunday, ignoring holidays) takes the quotation from the immediately preceding business day. If the quotation of the previous day is not available, an exception must be thrown;

  • If the quotation date is not available, an exception must be thrown;

  • The return value should be rounded to two decimal places.

  • You must convert the currency through rate "Taxa Compra".

Tests

mvn test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages