Page 1 of 1

FX Cross Rates Program

Posted: Wed Nov 21, 2018 12:37 pm
by GFXFTS
Hello,

I am new to the Eviews programming language and would like write a program which calculates foreign exchange cross rates.

wfcreate FX_D d(1,5) 01/01/1980 31/12/2018

dbopen(type=Macrobond)

fetch(mb) eur jpy chf gbp sek nok aud nzd cad ' these are the rates vs the US dollar

I now would like to calculate each rate versus each other. How would I do that please? I guess one needs to use a for loop but I don't know how to start.

Thanks a lot,

Günter

Re: FX Cross Rates Program

Posted: Wed Nov 21, 2018 12:45 pm
by EViews Gareth
What does "calculate each rate versus each other" mean?

Re: FX Cross Rates Program

Posted: Wed Nov 21, 2018 1:21 pm
by GFXFTS
Hi Gareth,

Something like this:

frml EURJPY = {%JPY}/{%EUR}
frml EURCAD = {%CAD}/{%EUR}
frml EURNZD = {%NZD}/{%EUR}
....

and then
frml GBPJPY = {%JPY}/{%GBP}
frml GBPCAD = {%CAD}/{%GBP}

and so on

So each series divided individually by all the other series.

Thanks a lot,

Günter

Re: FX Cross Rates Program

Posted: Wed Nov 21, 2018 7:58 pm
by EViews Gareth
Something like:

Code: Select all

for %i eur jpy chf gbp sek nok aud nzd cad for %j eur jpy chf gbp sek nok aud nzd cad if %j<>%i then frml {%i}{%j} = {%i}/{%j} endif next next
That will give you the pairs in both directions.

Re: FX Cross Rates Program

Posted: Wed Nov 21, 2018 11:54 pm
by GFXFTS
Fantastic. Thank you very much Gareth. Best, Günter