FX Cross Rates Program

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

GFXFTS
Posts: 42
Joined: Wed Nov 21, 2018 10:33 am

FX Cross Rates Program

Postby GFXFTS » Wed Nov 21, 2018 12:37 pm

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13305
Joined: Tue Sep 16, 2008 5:38 pm

Re: FX Cross Rates Program

Postby EViews Gareth » Wed Nov 21, 2018 12:45 pm

What does "calculate each rate versus each other" mean?
Follow us on Twitter @IHSEViews

GFXFTS
Posts: 42
Joined: Wed Nov 21, 2018 10:33 am

Re: FX Cross Rates Program

Postby GFXFTS » Wed Nov 21, 2018 1:21 pm

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13305
Joined: Tue Sep 16, 2008 5:38 pm

Re: FX Cross Rates Program

Postby EViews Gareth » Wed Nov 21, 2018 7:58 pm

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.
Follow us on Twitter @IHSEViews

GFXFTS
Posts: 42
Joined: Wed Nov 21, 2018 10:33 am

Re: FX Cross Rates Program

Postby GFXFTS » Wed Nov 21, 2018 11:54 pm

Fantastic. Thank you very much Gareth. Best, Günter


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 24 guests