Thanks Garrett. I thought about this solution on my way home from work.
Glad I did not have to do it. So here is a harder problem, but one you
might have solved, or might need to solve.

I wish to keep the last 150 days of 7000 stocks on disk. Every day, I would
like to run an update that removes the earliest entry of every stock, and
stores the latest entry of every stock. So cache size remains constant, but
contents change.
Any ideas? Am I clear?

   thanks,

    Gordon

On Thu, Apr 26, 2012 at 5:49 PM, G See <gsee000@gmail.com> wrote:

> Gordon,
>
> The way I did it was by storing other arguments/values in the DDB object.
>
> I did this for other getSymbols methods, but not for getSymbols.yahoo.
>  Since you asked, I mashed together some code that will do what you
> ask.  (see attached).
>
> For this solution, I replaced create.binding, attachSymbols, and
> DDB_Yahoo.  I don't know that all of that is necessary.  Anyway, if
> you source the attached script, then you can do this.
>
> > attachSymbols2(DB=DDB_Yahoo2(from=Sys.Date()-150))
> > head(DIA)
> DIA not in memory. fetching....
>           DIA.Open DIA.High DIA.Low DIA.Close DIA.Volume DIA.Adjusted
> 2011-11-28   114.78   115.48  114.31    115.10    6666100       113.96
> 2011-11-29   115.32   116.18  115.11    115.56    5325400       114.41
> 2011-11-30   118.41   120.39  118.41    120.19   11581500       119.00
> 2011-12-01   120.01   120.55  119.66    120.13    5437700       118.94
> 2011-12-02   121.22   121.40  120.00    120.06    5584400       118.87
> 2011-12-05   121.77   121.85  120.21    120.95    6285400       119.75
>
>
> Best,
> Garrett
>
> On Thu, Apr 26, 2012 at 3:55 PM, Gordon Erlebacher
> <gordon.erlebach@gmail.com> wrote:
> > Hi,
> >
> > I'd like to use attachSymbols() to create an on-demand database. I have
> two
> > questions:
> >
> > 1) I'd like to restrict the stocks to the past 150 days. I found that
> > quantmod:::create.binding  uses the function "getSymbols", which allows a
> > range. But how to change the function quantmod:::create.binding to use a
> > version of getSymbols() with a different date range? Alternatively, how
> to
> > replace "quantmod:::create.binding" with my own version such that any
> > function in quantmod that uses create.binding will use my version.
> Thanks.
> >
> > Or there is an easier way to restrict the range of symbols retrieved on
> > demand.
> >
> > Thanks!
> >
> >    Gordon
> >
> >        [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-SIG-Finance@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.
>

	[[alternative HTML version deleted]]

