Hi Folks;

Seems that dissimilar but related problems happen with blotter for me. See <
https://stat.ethz.ch/pipermail/r-sig-finance/2009q4/005014.html>

I was playing with the FOSS Trading blog example Tactical Asset Allocation
Using Blotter <
http://blog.fosstrading.com/2009/11/tactical-asset-allocation-using-blotter.html>
and initially it ran faultlessly. I then updated my R packages, this this:

update.packages() using a local mirror (University of Waterloo) and example
no longer worked.

When I reran the tactical example R spat out:

"source("tactical.R") -  (This is a verbatim copy of Josh's code in the
article)
Loading required package: xts
Loading required package: zoo
Loading required package: Defaults
Loading required package: TTR
Loading required package: FinancialInstrument

Package PerformanceAnalytics (1.0.0) loaded.
Econometric tools for performance and risk analysis.
(c) 2004-2009 Peter Carl, Brian G. Peterson. License: GPL
http://braverock.com/R/


Attaching package: 'PerformanceAnalytics'


        The following object(s) are masked from package:graphics :

         legend

[1] "Loading data"
[1] "Setting up indicators"
[1] "Initializing portfolio and account structure"
Error in vector("list", length = length(symbols)) : element 1 is empty;
   the part of the args list of 'length' being evaluated was:
   (symbols)


I then went and tried the example in the blotter package. It did not work
either and I then tried Jeff Ryan's suggestion and updated
blotter, xts & quantmod and reran the example:

# Construct a portfolio object and add some transactions
library(blotter)
# Download price data
symbols = c("IBM","F","MMM")
require(quantmod)
getSymbols(symbols, from='2007-01-01', to='2007-01-31',
index.class="POSIXct")

# Initialize a portfolio object 'p'
print('Creating portfolio \"p\"...')
p = initPortf(symbols=symbols)

## Trades must be made in date order.
print('Adding trades to \"p\"...')
# Make a couple of trades in IBM
p = addTxn(p, "IBM", '2007-01-03', 50, 96.5, -0.05*50)
p = addTxn(p, "IBM", '2007-01-04', 50, 97.1, -0.05*50)

# ...a few in F...
p = addTxn(p, "F", '2007-01-03', -100, 7.60, -0.05*100)
p = addTxn(p, "F", '2007-01-04', 50, 7.70, -0.05*50)
p = addTxn(p, "F", '2007-01-10', 50, 7.78, -0.05*50)

# ...and some in MMM
p = addTxn(p, "MMM", '2007-01-05', -50, 77.9, -0.05*50)
p = addTxn(p, "MMM", '2007-01-08', 50, 77.6, -0.05*50)
p = addTxn(p, "MMM", '2007-01-09', 50, 77.6, -0.05*50)

print('Updating portfolio \"p\"...')
p = updatePortf(p,'2007-01')
calcPortfSummary(p)
getBySymbol(p,'Pos.Qty')

print('Creating account \"a\" for portfolio \"p\"...')
a = initAcct(portfolios="p")
print('Updating account \"a\"...')
a = updateAcct(a,'2007-01') # Check out the sweet date scoping. Thanks, xts.
a = updateEndEq(a,'2007-01')
print(a)

which gave me:

source("Blotter_ex.R")
Loading required package: xts
Loading required package: zoo
Loading required package: quantmod
Loading required package: Defaults
Loading required package: TTR
Loading required package: FinancialInstrument
[1] "Creating portfolio \"p\"..."
[1] "Adding trades to \"p\"..."
[1] "2007-01-03 IBM 50 @ 96.5"
Error in get(paste("portfolio", pname, sep = "."), envir = .blotter) :
  object 'portfolio.list(txn = c(0, 50, 0, 96.5, 0, 0, 0, 4825, 0, 96.5, 0,
50, 0, 96.5, 0, 0, 0, 1), posPL = c(0, 1, 1, 0, 0, 0, 0, 0, 0))' not found
In addition: Warning message:
In addTxn(p, "IBM", "2007-01-03", 50, 96.5, -0.05 * 50) :
  Instrument IBM  not found, using contract multiplier of 1

I've tried to puzzle my way through this. I seems that there are updates
that introduce these different errors. Are they related ?

Any assistance would be appreciated.

Jan Vandermeer

	[[alternative HTML version deleted]]

