Hi kafkaz,

I also have this problem with the 0 size transactions if I run the
demo(longtrend).

It looks like there is a small bug in the longtrend.R script in the demo
directory. The account is not initialized with a beginning equity.

replace the line:
initAcct(ltaccount,portfolios='longtrend', initDate=initDate)

with:
initAcct(ltaccount,portfolios='longtrend', initDate=initDate, initEq=initEq)

Save the modification and run "demo(longtrend) again. This solved it for me.

HTH,

-Mark-
2010/3/1 kafkaz <kafka@centras.lt>

>
> demo('longtrend')
>
> [1] "1998-10-30 GSPC 0 @ 1098.67"
> .
> [1] "1998-11-30 GSPC 0 @ 1163.63"
> .
> [1] "1998-12-31 GSPC 0 @ 1229.23"
> .
> [1] "1999-01-29 GSPC 0 @ 1279.64"
> .
> [1] "1999-02-26 GSPC 0 @ 1238.33"
> .
> [1] "1999-03-31 GSPC 0 @ 1286.37"
> .
> [1] "1999-04-30 GSPC 0 @ 1335.18"
> .
> [1] "1999-05-28 GSPC 0 @ 1301.84"
> .
> [1] "1999-06-30 GSPC 0 @ 1372.71"
> .
> [1] "1999-07-30 GSPC 0 @ 1328.72"
> .
> [1] "1999-08-31 GSPC 0 @ 1320.41"
> ..
> [1] "1999-10-29 GSPC 0 @ 1362.93"
> .
> [1] "1999-11-30 GSPC 0 @ 1388.91"
> .
> [1] "1999-12-31 GSPC 0 @ 1469.25"
> .
> [1] "2000-01-31 GSPC 0 @ 1394.46"
> .
> [1] "2000-02-29 GSPC 0 @ 1366.42"
> .
> [1] "2000-03-31 GSPC 0 @ 1498.58"
> .
> [1] "2000-04-28 GSPC 0 @ 1452.43"
> .
> [1] "2000-05-31 GSPC 0 @ 1420.6"
> .
> [1] "2000-06-30 GSPC 0 @ 1454.6"
> .
> [1] "2000-07-31 GSPC 0 @ 1430.83"
> .
> [1] "2000-08-31 GSPC 0 @ 1517.68"
> ...................
> [1] "2002-03-28 GSPC 0 @ 1147.39"
> .............
> [1] "2003-04-30 GSPC 0 @ 916.92"
> .
> [1] "2003-05-30 GSPC 0 @ 963.59"
> .
> [1] "2003-06-30 GSPC 0 @ 974.5"
> .
> [1] "2003-07-31 GSPC 0 @ 990.31"
> .
> [1] "2003-08-29 GSPC 0 @ 1008.01"
> .
> [1] "2003-09-30 GSPC 0 @ 995.97"
> .
> [1] "2003-10-31 GSPC 0 @ 1050.71"
> .
> [1] "2003-11-28 GSPC 0 @ 1058.2"
> .
> [1] "2003-12-31 GSPC 0 @ 1111.92"
> .
> [1] "2004-01-30 GSPC 0 @ 1131.13"
> .
> [1] "2004-02-27 GSPC 0 @ 1144.94"
> .
> [1] "2004-03-31 GSPC 0 @ 1126.21"
> .
> [1] "2004-04-30 GSPC 0 @ 1107.3"
> .
> [1] "2004-05-28 GSPC 0 @ 1120.68"
> .
> [1] "2004-06-30 GSPC 0 @ 1140.84"
> ....
> [1] "2004-10-29 GSPC 0 @ 1130.2"
> .
> [1] "2004-11-30 GSPC 0 @ 1173.82"
> .
> [1] "2004-12-31 GSPC 0 @ 1211.92"
> .
> [1] "2005-01-31 GSPC 0 @ 1181.27"
> .
> [1] "2005-02-28 GSPC 0 @ 1203.6"
> .
> [1] "2005-03-31 GSPC 0 @ 1180.59"
> .
> [1] "2005-04-29 GSPC 0 @ 1156.85"
> .
> [1] "2005-05-31 GSPC 0 @ 1191.5"
> .
> [1] "2005-06-30 GSPC 0 @ 1191.33"
> .
> [1] "2005-07-29 GSPC 0 @ 1234.18"
> .
> [1] "2005-08-31 GSPC 0 @ 1220.33"
> .
> [1] "2005-09-30 GSPC 0 @ 1228.81"
> .
> [1] "2005-10-31 GSPC 0 @ 1207.01"
> .
> [1] "2005-11-30 GSPC 0 @ 1249.48"
> .
> [1] "2005-12-30 GSPC 0 @ 1248.29"
> .
> [1] "2006-01-31 GSPC 0 @ 1280.08"
> .
> [1] "2006-02-28 GSPC 0 @ 1280.66"
> .
> [1] "2006-03-31 GSPC 0 @ 1294.87"
> .
> [1] "2006-04-28 GSPC 0 @ 1310.61"
> .
> [1] "2006-05-31 GSPC 0 @ 1270.09"
> .
> [1] "2006-06-30 GSPC 0 @ 1270.2"
> .
> [1] "2006-07-31 GSPC 0 @ 1276.66"
> .
> [1] "2006-08-31 GSPC 0 @ 1303.82"
> .
> [1] "2006-09-29 GSPC 0 @ 1335.85"
> .
> [1] "2006-10-31 GSPC 0 @ 1377.94"
> .
> [1] "2006-11-30 GSPC 0 @ 1400.63"
> .
> [1] "2006-12-29 GSPC 0 @ 1418.3"
> .
> [1] "2007-01-31 GSPC 0 @ 1438.24"
> .
> [1] "2007-02-28 GSPC 0 @ 1406.82"
> .
> [1] "2007-03-30 GSPC 0 @ 1420.86"
> .
> [1] "2007-04-30 GSPC 0 @ 1482.37"
> .
> [1] "2007-05-31 GSPC 0 @ 1530.62"
> .
> [1] "2007-06-29 GSPC 0 @ 1503.35"
> .
> [1] "2007-07-31 GSPC 0 @ 1455.27"
> .
> [1] "2007-08-31 GSPC 0 @ 1473.99"
> .
> [1] "2007-09-28 GSPC 0 @ 1526.75"
> .
> [1] "2007-10-31 GSPC 0 @ 1549.38"
> ....................
> [1] "2009-06-30 GSPC 0 @ 919.32"
> .
> [1] "2009-07-31 GSPC 0 @ 987.48"
> .
> [1] "2009-08-31 GSPC 0 @ 1020.62"
> .
> [1] "2009-09-30 GSPC 0 @ 1057.08"
> .
> [1] "2009-10-30 GSPC 0 @ 1036.19"
> .
> [1] "2009-11-30 GSPC 0 @ 1095.63"
> .
> [1] "2009-12-31 GSPC 0 @ 1115.1"
> .
> [1] "2010-01-29 GSPC 0 @ 1073.87"
> .
> [1] "2010-02-26 GSPC 0 @ 1104.49"
>
> > cat('\n')
>
>
> > # Chart results with quantmod
> > chart.Posn(ltportfolio, Symbol = 'GSPC', Dates =
> > '1998::',theme=chartTheme('white', up.col='lightgreen', dn.col='pink'),
> > type='bar')
> Hit <Return> to see next plot:
> Hit <Return> to see next plot:
> Hit <Return> to see next plot:
>
> > plot(addSMA(n=10,col='darkgreen', on=1))
> Hit <Return> to see next plot:
>
> > getTxns(Portfolio="longtrend", Symbol="GSPC", Date="2000::2004")
>           Txn.Qty Txn.Price Txn.Fees Txn.Value Txn.Avg.Cost
> 2000-01-31       0   1394.46        0         0          NaN
> 2000-02-29       0   1366.42        0         0          NaN
> 2000-03-31       0   1498.58        0         0          NaN
> 2000-04-28       0   1452.43        0         0          NaN
> 2000-05-31       0   1420.60        0         0          NaN
> 2000-06-30       0   1454.60        0         0          NaN
> 2000-07-31       0   1430.83        0         0          NaN
> 2000-08-31       0   1517.68        0         0          NaN
> 2002-03-28       0   1147.39        0         0          NaN
> 2003-04-30       0    916.92        0         0          NaN
> 2003-05-30       0    963.59        0         0          NaN
> 2003-06-30       0    974.50        0         0          NaN
> 2003-07-31       0    990.31        0         0          NaN
> 2003-08-29       0   1008.01        0         0          NaN
> 2003-09-30       0    995.97        0         0          NaN
> 2003-10-31       0   1050.71        0         0          NaN
> 2003-11-28       0   1058.20        0         0          NaN
> 2003-12-31       0   1111.92        0         0          NaN
> 2004-01-30       0   1131.13        0         0          NaN
> 2004-02-27       0   1144.94        0         0          NaN
> 2004-03-31       0   1126.21        0         0          NaN
> 2004-04-30       0   1107.30        0         0          NaN
> 2004-05-28       0   1120.68        0         0          NaN
> 2004-06-30       0   1140.84        0         0          NaN
> 2004-10-29       0   1130.20        0         0          NaN
> 2004-11-30       0   1173.82        0         0          NaN
> 2004-12-31       0   1211.92        0         0          NaN
>
> > # Copy the results into the local environment
> > print("Retrieving resulting portfolio and account")
> [1] "Retrieving resulting portfolio and account"
>
> > ltportfolio = getPortfolio("longtrend")
>
> > ltaccount = getAccount("longtrend")
> Warning messages:
> 1: In max(i) : no non-missing arguments to max; returning -Inf
> 2: In max(i) : no non-missing arguments to max; returning -Inf
> 3: In max(i) : no non-missing arguments to max; returning -Inf
> 4: In max(i) : no non-missing arguments to max; returning -Inf
>
> I had the same warnings in my code.
> Is it normal, what quantity/position size is 0?
>
> --
> View this message in context:
> http://n4.nabble.com/Blotter-package-problem-with-example-tp1018634p1573601.html
> Sent from the Rmetrics mailing list archive at Nabble.com.
>
> _______________________________________________
> R-SIG-Finance@stat.math.ethz.ch 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.
>

	[[alternative HTML version deleted]]

