What codes does the Central Bank currency listing webservice accept?

Asked

Viewed 13,710 times

28

I had to develop a routine that would take the sale price of the dollar and insert it into a table in the bank. The central bank provides a webservice where it is possible to make the queries. For this just inform a code and it make the quotation for you.

The problem I have is to get the documentation to say what each code returns. I did not find anything on the Central Bank website. What currency codes does this service accept? Where to get this documentation?

2 answers

33


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

This webservice has the following methods:

getUltimoValorVO - Recovers the last value of a given series and returns an object of type Wsserievo.

Parameters: long codeSerie - Code of the series. Return: Wsserievo - Object series.

Getultimovalorxml - Recovers the last value of a given series and returns the result in XML format.

Parameters: long codeSerie - Code of the series. Return: String - String containing the result of the query in XML format.

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

Parameters: long codeSerie - Code of the series. String data - String containing the date (dd/MM/yyyy) of the value to be searched for. Return: Bigdecimal - Object containing the value.

getValorEspecial - Recovers the value of a special series in a period.

Parameters: long codeSerie - Code of the series. String data - String containing the initial date (dd/MM/yyyy). String dataFim - String containing the final date (dd/MM/yyyy). Return: Bigdecimal - Object containing the value.

getValoresSeriesXML - Recovers the values of one or more series within a certain period. The result of the query is returned to the client in XML format.

Parameters: long[] codesSeries - List(array) of series codes. String dataInicio - String containing the initial date (dd/MM/yyyy). String dataFim - String containing the final date (dd/MM/yyyy). Return: String - String containing the result of the query in XML format.

getValue - Recovers 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[] codesSeries - List(array) of series codes. String dataInicio - String containing the initial date (dd/MM/yyyy). String dataFim - String containing the final date (dd/MM/yyyy). Return: Wsserievo - List(array) of serial object.

If you want to obtain the quotation of the previous day (for example), use the method getUltimoValorVO that this method returns the last quotation registered and passes as parameter some of the codes listed below.

Below is a list of the quotation 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 one step by step on how to generate a routine in SSIS (SQL Server Integration Services) to fetch this quote and write to a table.

Edit 06-01-2019

I posted on my github another way to fetch quotes using an Asp net MVC and hangfire application to pick up quotes daily. The code is available on Github and details on how the implementation was made here

  • 1

    Cool would be if you did a "documentation" and put it on Github, will someone need someday?

  • 2

    Good idea! I’ll do an example project and put it in GIT. Once I have it in the way I put the repository link here.

3

I looped through the webservice and saved in txt what each quotation code represents, I don’t know if it caught all but my loop went from 1 to 50,000 and stopped bringing results there by the 22,000. Follow the link http://egas.digital/cotacoes.txt

Browser other questions tagged

You are not signed in. Login or sign up in order to post.