[R-SIG-Finance] Using attachSymbols with non-default argument values (Was: the ZigZag function)

G See gsee000 at gmail.com
Fri Apr 27 01:00:15 CEST 2012


I'd do something like this, which is effectively the same as using
attachSymbols with a cache directory. (But I'm pretty sure this will
fail at some point in the data download process because of yahoo 404
errors)

library(FinancialInstrument)
library(quantmod)

s <- quantmod:::getSymbolsDB()
getSymbols(s, src='yahoo', from=Sys.Date()-150)
saveSymbols.common(s, "/path/to/storage/dir", extension='RData')

# Then, to load from disk:
getSymbols(s, src='FI', dir="/path/to/storage/dir/",
split_method='common', extension='RData')

Garrett

On Thu, Apr 26, 2012 at 5:49 PM, G See <gsee000 at gmail.com> wrote:
> get("AAPL")
>
> But, see my last e-mail about not using attachSymbols for this. ;-)
>
> Garrett
>
> On Thu, Apr 26, 2012 at 5:46 PM, Gordon Erlebacher
> <gordon.erlebach at gmail.com> wrote:
>> Hi Brian,
>>
>> I have huge amounts of disk. The issue is time efficiency. Why download 150
>> days of 7000 stocks each day, when I need only download 1 day of each
>> stock. Of course, I can write my own caching system, but why duplicate what
>> somebody may have done already. I am relatively new to R, but I have done
>> similar things in other computer languages (not in Finance though).
>>
>> On an aside, using attachSymbols, I can load on demand. I would like to
>> cycle through the list of 7000 stocks. I can get the list, but given "AAPL"
>> for example, I need to execute AAPL. I do not know how to do this yet.
>>
>>   Thanks for the input!
>>
>>     Gordon



More information about the R-SIG-Finance mailing list