Page 1 of 2

GetExchangeData

Posted: Tue Feb 08, 2011 5:22 pm
by EViews Esther
This thread is about the GetExchangeData add-in that provides an easy way to download historical exchange rate data into EViews.

Even though the top 21 currencies are currently avaiable, you can add a new currency by editing the program.
In particular, when you open the program GetExchangeData.prg, you will see the following two lines:

Code: Select all

%currency_list = """US Dollar"" ""Euro"" ""Australian Dollar"" ""Brazilian Real"" ""British Pound"" ""Canadian Dollar"" ""Chinese Yuan"" ""Danish Krone"" ""Hong Kong Dollar"" ""Indian Rupee"" ""Japanese Yen"" ""Korean Won"" ""Malaysian Ringgit"" ""Mexican Peso"" ""New Zealand Dollar"" ""Norwegian Krone"" ""Singapore Dollar"" ""South African Rand"" ""Sri Lanka Rupee"" ""Swedish Krona"" ""Swiss Franc""" %currency_code = "USD EUR AUD BRL GBP CAD CNY DKK HKD INR JPY KRW MYR MXN NZD NOK SGD ZAR LKR SEK CHF"
Now suppose that you want to download the exchange rate between the US Dollars and the Argentine Peso.
By filling the last element of %currency_list and %currency_code with "Argentine Peso" and "ARS", respectively, you can download the series of interest.

Code: Select all

%currency_list = """US Dollar"" ""Euro"" ""Australian Dollar"" ""Brazilian Real"" ""British Pound"" ""Canadian Dollar"" ""Chinese Yuan"" ""Danish Krone"" ""Hong Kong Dollar"" ""Indian Rupee"" ""Japanese Yen"" ""Korean Won"" ""Malaysian Ringgit"" ""Mexican Peso"" ""New Zealand Dollar"" ""Norwegian Krone"" ""Singapore Dollar"" ""South African Rand"" ""Sri Lanka Rupee"" ""Swedish Krona"" ""Swiss Franc"" ""Argentine Peso""" %currency_code = "USD EUR AUD BRL GBP CAD CNY DKK HKD INR JPY KRW MYR MXN NZD NOK SGD ZAR LKR SEK CHF ARS"
*Note that "Argentine Peso" and "ARS" should be in the same order as each other.

[Change log]
  • 2011/02/11 Able to retrieve the data with more than 500 observations

Re: GetExchangeData

Posted: Thu Feb 10, 2011 1:10 am
by MantaRay
Hi there:


It seems like to get the identical data series when the requested sample is larger than 500.

Thanks for your consideration.

Re: GetExchangeData

Posted: Thu Feb 10, 2011 9:33 am
by EViews Esther
It seems like to get the identical data series when the requested sample is larger than 500.
I am sorry that I do not get your question. Can you tell me more about your "identical series"?

As you know, when a currently active workfile has the series of interest (say "UDS2EUR"),
you will see the identical series with a different name (i.e. "USD2EUR01").

Re: GetExchangeData

Posted: Thu Feb 10, 2011 11:05 pm
by MantaRay
Hi Esther:

Eviews will obtain the FRX data series matching with the chosen currency when data numbers are no more than 500.

When data numbers equal to 501, Eviews will report the error message, Sorry, couldn't create table, because you entered incorrect dates....

When data numbers set to be more than 501, Eviews will obtain the identical series with different series name no matter which currency you choose.

In the three different time interval, for example, data numbers <500, =500 and >500 respectively, let Eviews retrieve two FRX data series, say usd2eur and usd2jpy, together in each time interval.

Both data series will be they should be when data numbers no more than 500.
It will get the mentioned error message showed in the data series when data numbers equal to 501.
Both data series will be identical when data numbers set to be more than 501.

Thanks for your patience and consideration.

Re: GetExchangeData

Posted: Fri Feb 11, 2011 9:23 am
by EViews Esther
I fix the problem. You can reinstall the updated "GetExchangeData" add-in.

Thank you.

Re: GetExchangeData

Posted: Fri Feb 11, 2011 10:45 am
by MantaRay
Hi Esther:

Many thanks for your quick responses and admirable efforts.

The fixed version works like charm except for the data numbers set to be just equal to 501.

Best Regards,
MantaRay

Re: GetExchangeData

Posted: Fri Feb 11, 2011 11:09 am
by EViews Esther
Thank you for your valuable comments. The new version will allow you to retrieve the data with >500, including 501 observations.

Re: GetExchangeData

Posted: Fri Feb 11, 2011 11:19 am
by MantaRay
Hi Esther:

The attached please find the available information regarding the issue.

Regards,

Re: GetExchangeData

Posted: Fri Feb 11, 2011 11:20 am
by EViews Gareth
Try re-downloading the add-in.

Re: GetExchangeData

Posted: Fri Feb 11, 2011 11:36 am
by MantaRay
Dear Gareth:

Many many thanks for your excellent job.

The issue finally gets resolved in the second revised version.
It now works great without any problem.

Best regards,

Re: GetExchangeData

Posted: Fri Feb 11, 2011 11:38 am
by EViews Gareth
Thank Esther not me :D

Glad to see you're getting use out of the add-in anyway.

Re: GetExchangeData

Posted: Fri Feb 11, 2011 11:47 am
by MantaRay
Sure, thank both of you, Gareth and Esther. :D

Re: GetExchangeData

Posted: Fri Aug 23, 2013 7:28 am
by statcon
Hi EViews-team,

one of our customers just asked for a bug-fix in this addin. As it seems the addin fails when you want to update an exchange rate in an existing workfile. I got the feeling that something with the import command might have changed with eviews8 because getting the exchange-rates in a new workfile works for me.

Is there a solution available for the problem?

Thanks in advance!

Re: GetExchangeData

Posted: Fri Aug 23, 2013 7:54 am
by EViews Gareth
Could you provide more details, or, possibly, an example?

Re: GetExchangeData

Posted: Tue Aug 27, 2013 12:41 am
by statcon
Hi Gareth,

now I was able to figure out where the problem is, but sadly not how to solve it. On my machine the addin works perfectly fine. But when running the addin with "logmode all" on our customers pc we get the following log.

setmaxerrs 100
%currency_list = """US Dollar"" ""Euro"" ""Australian Dollar"" ""Brazilian Real"" ""British Pound"" ""Canadian Dollar"" ""Chines ...
%CURRENCY_LIST successfully computed
%currency_code = "USD EUR AUD BRL GBP CAD CNY DKK HKD INR JPY KRW MYR MXN NZD NOK SGD ZAR LKR SEK CHF"
%CURRENCY_CODE successfully computed
%end = @datestr(@now,"MM/DD/YY")
%END successfully computed
%start = @datestr(@dateadd(@dateval(%end),-499,"dd"),"MM/DD/YY")
%START successfully computed
%importops = """Create new workfile"""
%IMPORTOPS successfully computed
%wfname = @wfname
%WFNAME successfully computed
IF @LEN("") THEN
!series_1 = 1
!SERIES_1 successfully computed
!series_2 = 2
!SERIES_2 successfully computed
!create = 1
!CREATE successfully computed
%wfname = "EXCHANGE"
%WFNAME successfully computed
!result = @uidialog( "text","Choose which data to fetch:", "list",!series_1, "From this currency",%currency_list, "list",!series ...
!RESULT successfully computed
IF !RESULT=-1 THEN
%currency_1 = @word(%currency_code, !series_1)
%CURRENCY_1 successfully computed
%currency_2 = @word(%currency_code, !series_2)
%CURRENCY_2 successfully computed
%name = %currency_1 + "2" +%currency_2
%NAME successfully computed
!diff = @dateval(%end) - @dateval(%start) +1
!DIFF successfully computed
IF NA > 500 THEN
%url = "http://www.oanda.com/currency/historica ... t=us&date=" + %end + "&date1=" + %start + "&exch=" + %curr ...
%URL successfully computed
IF !CREATE= 1 THEN
wfcreate(wf=EXCHANGE, page=USD2EUR) d7 01/01/10 08/26/13
Illegal date 08/26/13 in "WFCREATE(WF=EXCHANGE, PAGE=USD2EUR) D7 01/01/10 08/26/13".
import(type=html, page=USD2EUR) http://www.oanda.com/currency/historica ... 1=01/01/10& ...
16373 bytes read.
Analyzing dataset: obtaining table count
Opening table...
Analyzing table: obtaining row count
1 rows counted...
Setting up the series...
Created 3 series
1 row read, 1 row used
Setting series formats...
Alpha series truncated to maximum length.

Maximum length may be changed from the Options/Alpha Truncation menu in "IMPORT(TYPE= ...

ENDIF
d(noerr) series01

Do you have any suggestions on that? Thanks in advance.