[R-SIG-Finance] blotter updatePortf issue..

G See gsee000 at gmail.com
Mon Sep 3 21:14:52 CEST 2012


Hi Pie,

Thanks for providing reproducible code.  I committed a patch in Rev.
1151 that I believe will fix your problem.  If you need help checking
out and building the latest revision, see this post on SO:
http://stackoverflow.com/a/11105132/967840

Internally, the code was checking to see if "Dates" was timeBased.  If
it wasn't, it was being converted to a timeBased vector.  But, later,
the code was treating "Dates" as if it were not timeBased.  Hopefully
my patch fixes your problem and doesn't create others.

There are a couple other things to mention.  First, these lines are
not going to work:

    updateAcct(account, Dates=paste('::',as.Date(Sys.time()),sep=''))
    updateEndEq(account, Dates=paste('::',as.Date(Sys.time()),sep=''))

These functions do not support that type of "Dates" strings.  You'll
have to either use Dates=NULL, or supply both starting and ending
dates like this:

    updateAcct(account, Dates=paste(initDate, as.Date(Sys.time()),sep='::') )
    updateEndEq(account, Dates=paste(initDate, as.Date(Sys.time()),sep='::') )


Second, I didn't get these warnings that you got

>> > getSymbols(symbols, src='yahoo',
>> index.class=c("POSIXt","POSIXct"),from='2001-01-01')
>> [1] "QQQ" "IWM"
>> Warning messages:
>> 1: In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,  :
>>   downloaded length 147933 != reported length 200
>> 2: In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,  :
>>   downloaded length 147996 != reported length 200

I'm not sure why you get those warnings, but your version of quantmod
is a little older than mine (the R-forge version).

HTH,
Garrett


On Sun, Sep 2, 2012 at 11:27 PM, pie trader <pietrader at gmail.com> wrote:
> Hi,
> Currently I am stuck on an error with updatePortf function in blotter. The
> error message is same as the issue mentioned on R-sig-finance previously
> i.e.,
> http://r.789695.n4.nabble.com/blotter-updatePortf-issues-tp4635933.html
>
>>
>> updatePortf(Portfolio=portfolio,Dates=paste('::',as.Date(Sys.time()),sep=''))
>> Error in if (length(c(year, month, day, hour, min, sec)) == 6 && c(year,
>>  :
>>   missing value where TRUE/FALSE needed
>> In addition: Warning message:
>> In as_numeric(YYYY) : NAs introduced by coercion
>
>



More information about the R-SIG-Finance mailing list