Ulrich,thanks for your reply. I found the reason why equity are always zero. the argument 'initDate' in initPortf and initAcct should be earlier than market data's start date,in this case, the start date is '2012-01-18 09:15:00',so argument 'initDate' in initPortf and initAcct should at least be '2012-01-18 09:14:00' or earlier. Having replace both of the value of initDate with '2012-01-18 09:14:00', I got the result of txns as below:
> head(txns) Txn.Qty Txn.Price Txn.Fees Txn.Value Txn.Avg.Cost Net.Txn.Realized.PL 2012-01-18 09:14:00 0 0.0 0.000 0 0.0 0.000 2012-01-18 09:35:00 8 2580.0 -309.600 6192000 2580.0 -309.600 2012-01-18 09:43:00 -8 2582.0 -309.840 -6196800 2582.0 4490.160 2012-01-18 09:54:00 8 2580.8 -309.696 6193920 2580.8 -309.696 2012-01-18 09:57:00 -8 2575.8 -309.096 -6181920 2575.8 -12309.096 2012-01-18 09:58:00 8 2581.8 -309.816 6196320 2581.8 -309.816 all transactions are OK,except the first transaction. why it occurs ? I tried to run the codes in debug mode line-by-line,but couldn't find the reason. PS: I couldn't find the reason why argument 'initDate' in initPortf and initAcct must be earlier than market data's start date/time in help documents. regards. -- View this message in context: http://r.789695.n4.nabble.com/function-addtxn-in-blotter-package-can-t-add-intraday-trade-into-account-tp4696291p4696314.html Sent from the Rmetrics mailing list archive at Nabble.com. _______________________________________________ R-SIG-Finance@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.