[R-SIG-Finance] quantstrat example stragey error

Immanuel mane.desk at googlemail.com
Tue Mar 1 13:52:00 CET 2011


Hello,

what are the implications of this error, is there a workaround?
I'm just starting with quantstrat and really like the idea to implement
strategies not directly with blotter anymore.

regards,
Immanuel

On 02/26/2011 09:48 PM, Jeffrey Ryan wrote:
> Yes, that isn't an xts issue - just happens to be taking place during a
> subset.
>
> The issue is somewhere else
>
> 3: In `[.xts`(PosData, index(PosData) < Date) :
>  Incompatible methods ("Ops.POSIXt", "Ops.Date") for "<"
> Time difference of 0.387223 secs
>
> The lhs [index(PosData)] is POSIX and the rhs is Date, which R can't compare
> correctly.  The warning is happening - and probably resulting in all TRUE
> values - which isn't likely the desired outcome.
>
> I'm not looking at the code at the moment, but you can rule out xts.  There
> are likely better ways to do this with xts, and I'll see what I can do to
> make the quantstrat code use more of the built-in xts functionality.
>
> Jeff
>
>
> On Sat, Feb 26, 2011 at 12:34 PM, Immanuel <mane.desk at googlemail.com> wrote:
>
>> hello,
>> seems to be already installed:
>> ----------
>> [1] "2001-06-26 AAPL 100 @ 11.88"
>> Error in if (getPosQty(Portfolio = portfolio, Symbol = symbol, Date =
>> timestamp) ==  :
>>  argument is of length zero
>> In addition: Warning messages:
>> 1: In match.names(columns, colnames(data)) :
>>  all columns not located in ma50 ma200 for AAPL.Open AAPL.High AAPL.Low
>> AAPL.Close AAPL.Volume AAPL.Adjusted ma50 ma200 ma50.gt.ma200
>> 2: In max(i) : no non-missing arguments to max; returning -Inf
>> 3: In `[.xts`(PosData, index(PosData) < Date) :
>>  Incompatible methods ("Ops.POSIXt", "Ops.Date") for "<"
>> Time difference of 0.387223 secs
>> [1] "trade blotter portfolio update:"
>> Time difference of 0.7028229 secs
>> Warning message:
>> In max(i) : no non-missing arguments to max; returning -Inf
>>> sessionInfo()
>> R version 2.12.1 (2010-12-16)
>> Platform: i486-pc-linux-gnu (32-bit)
>>
>> locale:
>>  [1] LC_CTYPE=en_US.UTF-8          LC_NUMERIC=C
>>  [3] LC_TIME=en_US.UTF-8           LC_COLLATE=en_US.UTF-8
>>  [5] LC_MONETARY=en_US.UTF-8       LC_MESSAGES=en_US.UTF-8
>>  [7] LC_PAPER=en_US.UTF-8          LC_NAME=en_US.UTF-8
>>  [9] LC_ADDRESS=en_US.UTF-8        LC_TELEPHONE=en_US.UTF-8
>> [11] LC_MEASUREMENT=en_US.UTF-8    LC_IDENTIFICATION=en_US.UTF-8
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> other attached packages:
>> [1] quantstrat_0.4.0        blotter_0.8             FinancialInstrument_0.4
>> [4] quantmod_0.3-15         Defaults_1.1-1          TTR_0.20-2
>> [7] xts_0.8-0               zoo_1.6-4               rj_0.5.0-5
>>
>> loaded via a namespace (and not attached):
>> [1] grid_2.12.1     lattice_0.19-17 rJava_0.8-7     tools_2.12.1
>> ------------------
>>
>> On 02/26/2011 06:07 PM, Brian G. Peterson wrote:
>>> On 02/26/2011 11:03 AM, Immanuel wrote:
>>>> I just run the examples from the quantstrat package and
>>>> received following error for every example:
>>>> ----------
>>> <...>
>>>
>>>> 2: In `[.xts`(PosData, index(PosData)<  Date) :
>>>>    Incompatible methods ("Ops.POSIXt", "Ops.Date") for "<"
>>>> any ideas?
>>> Try upgrading xts to the latest version (0.8) from R-Forge or CRAN
>>>
>>> _______________________________________________
>>> 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.
>>>
>> _______________________________________________
>> 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