web-service – What codes does the Central Bank currency quote webservice accept?

Question:

I needed to develop a routine that would take the selling price of the dollar and insert it into a table in the bank. The central bank provides a webservice where queries can be made. To do this, just enter a code and it will make the quote for you.

The problem I have is getting the documentation that tells what each code returns. I didn't find anything on the Central Bank website. What currency codes does this service accept? Where can I get this documentation?

Answer:

After a lot of research I got the code for all the quotes and decided to share it here. Before getting to the use of the code, follow the BC webservice address and the description of each method contained in this service. The central bank webservice address is https://www3.bcb.gov.br/sgspub/JSP/sgsgeral/FachadaWSSGS.wsdl

This webservice has the following methods:

getUltimoValorVO – Retrieves the last value of a given series and returns an object of type WSSerieVO.

Parameters: long codeSerie – Series code. Return: WSSerieVO – Serial object.

GetUltimoValorXML – Retrieves the last value of a given series and returns the result in XML format.

Parameters: long codeSerie – Series code. Return: String – String containing the query result in XML format.

getValor – Retrieves the value of a series on a given date (dd/MM/yyyy).

Parameters: long codeSerie – Series code. String date – String containing the date (dd/MM/yyyy) of the value to be searched. Return: BigDecimal – Object containing the value.

getSpecialValue – Retrieves the value of a special series in a period.

Parameters: long codeSerie – Series code. String date – String containing the starting date (dd/MM/yyyy). String dateFim – String containing the end date (dd/MM/yyyy). Return: BigDecimal – Object containing the value.

getValoresSeriesXML – Retrieves the values ​​of one or more series within a given period. The query result is returned to the client in XML format.

Parameters: long[] codigosSeries – List(array) of series codes. String dateInicio – String containing the starting date (dd/MM/yyyy). String dateFim – String containing the end date (dd/MM/yyyy). Return: String – String containing the query result in XML format.

getValoresSeriesVO – Retrieves the values ​​of one or more series within a given period and returns the result in the form of an Array of objects of type WSSerieVO.

Parameters: long[] codigosSeries – List(array) of series codes. String dateInicio – String containing the starting date (dd/MM/yyyy). String dateFim – String containing the end date (dd/MM/yyyy). Return: WSSerieVO – List(array) of series object.

If you want to get the quote from the previous day (for example), use the getUltimoValorVO method, this method returns the last registered quote and pass one of the codes listed below as a parameter.

Below is a list of quote codes.

CÓDIGO  NOME
1       Dólar (venda)
10813   Dólar (compra)
21619   Euro (venda)
21620   Euro (compra)
21621   Iene (venda)
21622   Iene (compra)
21623   Libra esterlina (venda)
21624   Libra esterlina (compra)
21625   Franco Suíço (venda)
21626   Franco Suíço (compra)
21627   Coroa Dinamarquesa (venda)
21628   Coroa Dinamarquesa (compra)
21629   Coroa Norueguesa (venda)
21630   Coroa Norueguesa (compra)
21631   Coroa Sueca (venda)
21632   Coroa Sueca (compra)
21633   Dólar Australiano (venda)
21634   Dólar Australiano (compra)
21635   Dólar Canadense (venda)
21636   Dólar Canadense (compra)

In case anyone needs it, I have a step-by-step guide on how to generate a routine in SSIS (SQL Server Integration Services) to fetch this quote and write it to a table.

Edit 06-01-2019

I posted on my github another way to get quotes using an asp net MVC application and hangfire to get quotes daily. The code is available on Github and details on how it was implemented are here

Scroll to Top