Dear all,

I am trying to write a function that can retrieve stock data via R from Yahoo finance as follows.
This script is working both under my ubuntu and XP with gretl 1.9.12 cvs build date 2013-05-06.
A problem occurred when I replace 
        getSymbols("@sym",return.class="ts",from="@s1",to="2012-08-02")
with
        getSymbols("@sym",return.class="ts",from="@s1",to="@s2")

It seems that the second string replacement @s2 does not work. It cannot be recognized as a valid argument in R.
Do anyone have an idea?
Thanks

Yi-Nung Yang

<hansl>
function list getsymbols(string sym[null],string s1[null], string s2[null])
    foreign language=R
        library(quantmod)
        getSymbols("@sym",return.class="ts",from="@s1",to="2012-08-02")
        tmpM <- @sym
        gretl.export(tmpM)
    end foreign
append "@dotdir/tmpM.csv"
list tmplist= *
return tmplist
end function

nulldata 9
string mys1="2012-07-22"
setobs 5 @mys1 --time-series
string mySym="MSFT"
string mys1="2012-07-22"
string mys2="2012-08-02"
list xlist = getsymbols(mySym,mys1,mys1)

</hansl>