[R] currency conversion function?
Jeff Ryan
jeff.a.ryan at gmail.com
Fri Oct 16 16:07:05 CEST 2009
On Fri, Oct 16, 2009 at 8:04 AM, Liviu Andronic <landronimirc at gmail.com> wrote:
> On 10/15/09, Jeff Ryan <jeff.a.ryan at gmail.com> wrote:
>> > getFX("EUR/USD",from="2009-04-01")
>>
> Indeed, with the date correctly specified, the function no longer
> generates errors. There is one issue though (similar to the one in the
> code posted by Henrique):
>> getFX("EUR/PEN",from="2009-10-16")
> [1] "EURPEN"
>> EURPEN
> EUR.PEN
> 2009-10-16 4.3197
>> getFX("PEN/EUR",from="2009-10-16")
> [1] "PENEUR"
>> PENEUR ### doesn't coincide with the value on the web page
> PEN.EUR
> 2009-10-16 0.2377
> #Friday, October 16, 2009
> #1 Euro = 4.31973 Peruvian Nuevo Sol
> #1 Peruvian Nuevo Sol (PEN) = 0.23150 Euro (EUR)
>
> While EUR/PEN is correct, PEN/EUR seems wrong. I spotted this in other
> currencies, too.
>
When I look on the site now:
onversion Table: PEN to EUR (Interbank rate)
Time period: 10/10/09 to 10/16/09.
Daily averages:
10/10/2009,0.23960
10/11/2009,0.24120
10/12/2009,0.24120
10/13/2009,0.24170
10/14/2009,0.24090
10/15/2009,0.23630
10/16/2009,0.23770
Which seems to match... This is from the FXHistory section.
> getFX("PEN/EUR", from="2009-10-16")
[1] "PENEUR"
> PENEUR
PEN.EUR
2009-10-16 0.2377
Is it possible you are looking at a 'live' quote? Or maybe just
getting an update at precisely the wrong time?
Given the 24-7 nature of the market, I think this just reflects when
they choose to mark the price for history quotes.
Jeff
>
>
>> If you are looking for additional FX data, the FRED archive (St. Louis Fed)
>> is very good as well...
>>
>> http://research.stlouisfed.org/fred2/categories/94
>>
>> > getSymbols("DEXUSEU", src="FRED")
>>
> Thank you for the pointer. Best
> Liviu
>
--
Jeffrey Ryan
jeffrey.ryan at insightalgo.com
ia: insight algorithmics
www.insightalgo.com
More information about the R-help
mailing list