[R-SIG-Finance] Using attachSymbols with non-default argument values (Was: the ZigZag function)
G See
gsee000 at gmail.com
Thu Apr 26 23:49:35 CEST 2012
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 at 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 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: attachSymbolsWithArgs.R
Type: application/octet-stream
Size: 5379 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20120426/2745388d/attachment.obj>
More information about the R-SIG-Finance
mailing list