Dear Gretl Community,
I'm trying to download and open some Banco Central do Brasil (BCB)
data using its API and I don't know if there's a more "ellegant" way
to achieve that goal. Please take a look at the code I'm using now:
<hansl>
string str_csv =
readfile("http://api.bcb.gov.br/dados/serie/bcdata.sgs.24363/dados?formato=csv")
# It is possible to download data using json format using this:
# "http://api.bcb.gov.br/dados/serie/bcdata.sgs.24363/dados?formato=json"
string str_csv = strsub(str_csv, "data", "")
string str_csv = regsub(str_csv, "\"", "") # <--- it
doesn't work with
the strsub function.
outfile "data.csv" --quiet
print str_csv
end outfile
open "data.csv"
</hansl>
Best regards,
Henrique Andrade