Skip to content
Prev 12054 / 15274 Next

blotter package, can't add new symbol to existing portfolio

ce
Dear all,

I am following blotter example in the http://artax.karlin.mff.cuni.cz/r-help/library/blotter/html/blotter-package.html
I create, initialize , and add transactions. but when it comes to add a new stock symbol to  portfolio it gives an error message. Example adds MMM, I get Error in if (nrow(PosData) > 1) { : argument is of length zero 

R version 3.0.2
Loading required package: xts
Loading required package: zoo

Attaching package: ?zoo?

The following objects are masked from ?package:base?:

    as.Date, as.Date.numeric

Loading required package: FinancialInstrument
Loading required package: quantmod
Loading required package: Defaults
Loading required package: TTR
Version 0.4-0 included new data defaults. See ?getSymbols.
Loading required package: PerformanceAnalytics

Package PerformanceAnalytics (1.1.0) loaded.
Econometric tools for performance and risk analysis.
(c) 2004-2012 Peter Carl, Brian G. Peterson. License: GPL
http://r-forge.r-project.org/projects/returnanalytics/
[1] "USD"
+     stock(symbol, currency="USD", multiplier=1)
+ }
+ index.class=c("POSIXt","POSIXct"))
[1] "IBM" "F"
[1] "Creating portfolio \"p\"..."
[1] "p"
[1] "Adding trades to \"p\"..."
+ TxnPrice = 96.5, TxnFees = -0.05*50)
[1] "2007-01-03 00:00:00 IBM 50 @ 96.5"
[1] "2007-01-04 00:00:00 IBM 50 @ 97.1"
[1] "2007-01-03 00:00:00 F -100 @ 7.6"
[1] "2007-01-04 00:00:00 F 50 @ 7.7"
[1] "2007-01-10 00:00:00 F 50 @ 7.78"
+ index.class=c("POSIXt","POSIXct")) # Download price data
[1] "MMM"
[1] "MMM"
Error in if (nrow(PosData) > 1) { : argument is of length zero