[R-SIG-Finance] Process used to manage workspace and large data files
s
algotr8der at gmail.com
Sun May 15 02:14:53 CEST 2011
On 5/14/11 4:02 PM, Jeffrey Ryan wrote:
> Yes, this should be altering the actual SQL to avoid reading the full series
> from the database. Thanks for the report.
The problem I am having is with the retrieval of subset data from an
.rda file although this may also be the case with retrieving data from SQL.
> Jeff
>
> On Sat, May 14, 2011 at 11:28 AM, G See <gsee000 at gmail.com> wrote:
>
>> I've had this problem before. I think it is a bug. I got around it as
>> follows.
>>
>> rewrite getSymbols in your .GlobalEnv. Just type getSymbols, and copy and
>> paste all the code, adding "<-" without the quotes between getSymbols and
>> function(...
>>
>> Now replace this line towards the end:
>> fr <- convert.time.series(fr = fr, return.class = return.class)
>>
>> with these lines:
>> fr <- quantmod:::convert.time.series(fr = fr, return.class = return.class)
>> fr <- fr[paste(from,to,sep='::')] #I added this so that from and to work
>>
>> It will still download all the data, but before returning it, it will
>> subset
>> it.
>>
>> HTH,
>> Garret
>>
>> On Sat, May 14, 2011 at 11:08 AM, s <algotr8der at gmail.com> wrote:
>>
>>> Thank you Garrett and Brian. I will take a look.
>>>
>>> In the mean time I just saved one of my symbols in mySQL to an rda file.
>>> I want to be able to retrieve a subset of the data using one of the
>>> getSymbols variants. Is this possible?
>>>
>>> For example, the time series for AMKR starts on 2002-04-08. I want to
>>> grab the subset between 2009-01-01 and end of day 2010-10-06. It appears
>>> the entire object is loaded. Appreciate the help.
>>>
>>>> getSymbols('AMKR', from="2009-01-01 09:31:00", to="2010-10-06
>>> 16:00:00", src='rda', col.names=c("open", "high", "low", "close",
>>> "volume"))
>>> [1] "AMKR"
>>>
>>>> head(AMKR)
>>> AMKR.open AMKR.high AMKR.low AMKR.close AMKR.volume
>>> 2002-04-08 09:31:00 21.50 21.50 21.42 21.42 7300
>>> 2002-04-08 09:32:00 21.41 21.46 21.39 21.40 1100
>>> 2002-04-08 09:33:00 21.35 21.35 21.30 21.30 900
>>> 2002-04-08 09:34:00 21.37 21.44 21.37 21.43 4100
>>> 2002-04-08 09:35:00 21.43 21.43 21.43 21.43 400
>>> 2002-04-08 09:36:00 21.43 21.43 21.35 21.37 3200
>>>
>>> Or even everything from 2009-01-01 onwards
>>>
>>>> getSymbols('AMKR', from="2009-01-01", src='rda', col.names=c("open",
>>> "high", "low", "close", "volume"))
>>>
>>> [1] "AMKR"
>>>
>>>> head(AMKR)
>>> AMKR.open AMKR.high AMKR.low AMKR.close AMKR.volume
>>> 2002-04-08 09:31:00 21.50 21.50 21.42 21.42 7300
>>> 2002-04-08 09:32:00 21.41 21.46 21.39 21.40 1100
>>> 2002-04-08 09:33:00 21.35 21.35 21.30 21.30 900
>>> 2002-04-08 09:34:00 21.37 21.44 21.37 21.43 4100
>>> 2002-04-08 09:35:00 21.43 21.43 21.43 21.43 400
>>> 2002-04-08 09:36:00 21.43 21.43 21.35 21.37 3200
>>>
>>> On 5/14/11 12:02 PM, G See wrote:
>>>> You could have different data files for different days, and write a
>>> wrapper
>>>> for getSymbols to rbind it all together when you need it. I think
>>>> getSymbols.FI, in the FinancialInstrument package, does this.
>>>>
>>>> On Sat, May 14, 2011 at 8:54 AM, s <algotr8der at gmail.com> wrote:
>>>>
>>>>> Now how do you maintain these rda files as new data arrives each day -
>>>>> is there some way of adding incremental data to the object? For
>> example
>>>>> if I have minute data for QQQ from 2002-01-01 to 2011-05-13 I don't
>> want
>>>>> to pull all of the data beginning 2002-01-01 from my source to update
>>>>> one day's worth of data at the end of business this coming Monday.
>>>>>
>>>>>
>>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-SIG-Finance at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only. If you want to post, subscribe first.
>> -- Also note that this is not the r-help list where general R questions
>> should go.
>>
>
>
More information about the R-SIG-Finance
mailing list