Skip to content

Mulitple FI Sources

1 message · G See

#
forgot to copy the list

---------- Forwarded message ----------
From: G See <gsee000 at gmail.com>
Date: Thu, Dec 29, 2011 at 5:33 PM
Subject: Re: [R-SIG-Finance] Mulitple FI Sources
To: Mark Harrison <harrisonmark1 at gmail.com>


Mark,

You did not tell us which version of FinancialInstrument you are
using, but my guess is that it is out of date.

Also, you defined your exchange_rate backwards. ?Please see
?exchange_rate ... or the e-mail I sent you on Dec 17th ;-)

Now, I'll let you know upfront that setSymbolLookup.FI doesn't really
work. ?(more specifically, setSymbolLookup doesn't work well when you
pass it a list). ?It sort of works, but once you've used it, the
defaults you set cannot be overridden without another call to
setSymbolLookup.FI. ?Luckly, you don't really need setSymbolLookup.FI.

Before we get to that, getSymbols.FI requires a single base_dir for a
given Symbol. ?If you want to end up with a single xts object with
data from 2 different base directories, then you'll have to load the
data from each base directory separately, then rbind or merge the data
together.

If you're simply asking how to have different instruments have
different directories, one solution may be to update to the latest
version of FinancialInstrument. ?You can make multiple calls to
setSymbolLookup.FI and use the "Symbols" argument to set different
directories for different Symbols, or you can use the "src" argument
of an "instrument" call or in an "instrument_attr" call. ?(I'll
demonstrate below.)

But, as I already mentioned, I'd avoid doing that because
setSymbolLookup does not really work when it is given a list. ?So,
instead I'd simply use setSymbolLookup to specify that "FI" is the
src, and call setDefaults on getSymbols.FI. ?Here's some code to show
why.
+ ? ? ? src=list(src="FI", extension='rda'))
[1] "XXX"
? ? ? ? ? ? ? ? ? ?[,1]
2011-12-29 17:10:37 ? ?1
2011-12-29 17:11:37 ? ?2
2011-12-29 17:12:37 ? ?3
2011-12-29 17:13:37 ? ?4
2011-12-29 17:14:37 ? ?5
2011-12-29 17:15:37 ? ?6
2011-12-29 17:16:37 ? ?7
2011-12-29 17:17:37 ? ?8
2011-12-29 17:18:37 ? ?9
2011-12-29 17:19:37 ? 10
? ? ? ? ? ? ? ? ? ?[,1]
2011-12-29 17:10:37 ? 20
2011-12-29 17:11:37 ? 19
2011-12-29 17:12:37 ? 18
2011-12-29 17:13:37 ? 17
2011-12-29 17:14:37 ? 16
2011-12-29 17:15:37 ? 15
2011-12-29 17:16:37 ? 14
2011-12-29 17:17:37 ? 13
2011-12-29 17:18:37 ? 12
2011-12-29 17:19:37 ? 11
? ? ? ? ? ? ? ? ? ?[,1]
2011-12-29 17:10:37 ? ?1
2011-12-29 17:11:37 ? ?2
2011-12-29 17:12:37 ? ?3
2011-12-29 17:13:37 ? ?4
2011-12-29 17:14:37 ? ?5
2011-12-29 17:15:37 ? ?6
2011-12-29 17:16:37 ? ?7
2011-12-29 17:17:37 ? ?8
2011-12-29 17:18:37 ? ?9
2011-12-29 17:19:37 ? 10
? ? ? ? ? ? ? ? ? ?[,1]
2011-12-29 17:10:37 ? ?1
2011-12-29 17:11:37 ? ?2
2011-12-29 17:12:37 ? ?3
2011-12-29 17:13:37 ? ?4
2011-12-29 17:14:37 ? ?5
2011-12-29 17:15:37 ? ?6
2011-12-29 17:16:37 ? ?7
2011-12-29 17:17:37 ? ?8
2011-12-29 17:18:37 ? ?9
2011-12-29 17:19:37 ? 10
? ? ? ? ? ? ? ? ? ?[,1]
2011-12-29 17:10:37 ? 20
2011-12-29 17:11:37 ? 19
2011-12-29 17:12:37 ? 18
2011-12-29 17:13:37 ? 17
2011-12-29 17:14:37 ? 16
2011-12-29 17:15:37 ? 15
2011-12-29 17:16:37 ? 14
2011-12-29 17:17:37 ? 13
2011-12-29 17:18:37 ? 12
2011-12-29 17:19:37 ? 11
[1] "XXX"
? ? ? ? ? ? ? ? ? ?[,1]
2011-12-29 17:10:37 ? 20
2011-12-29 17:11:37 ? 19
2011-12-29 17:12:37 ? 18
2011-12-29 17:13:37 ? 17
2011-12-29 17:14:37 ? 16
2011-12-29 17:15:37 ? 15
2011-12-29 17:16:37 ? 14
2011-12-29 17:17:37 ? 13
2011-12-29 17:18:37 ? 12
2011-12-29 17:19:37 ? 11
? ? ? ? ? ? ? ? ? ?[,1]
2011-12-29 17:10:37 ? ?1
2011-12-29 17:11:37 ? ?2
2011-12-29 17:12:37 ? ?3
2011-12-29 17:13:37 ? ?4
2011-12-29 17:14:37 ? ?5
2011-12-29 17:15:37 ? ?6
2011-12-29 17:16:37 ? ?7
2011-12-29 17:17:37 ? ?8
2011-12-29 17:18:37 ? ?9
2011-12-29 17:19:37 ? 10
unlink("tmpA", recursive=TRUE)
unlink("tmpB", recursive=TRUE)

HTH,
Garrett
On Wed, Dec 28, 2011 at 2:37 PM, Mark Harrison <harrisonmark1 at gmail.com> wrote: