[Blotter-commits] r123 - pkg/blotter/tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 24 04:46:44 CET 2009


Author: peter_carl
Date: 2009-11-24 04:46:44 +0100 (Tue, 24 Nov 2009)
New Revision: 123

Modified:
   pkg/blotter/tests/addTxn.R
Log:
- added library calls and removed untested functions


Modified: pkg/blotter/tests/addTxn.R
===================================================================
--- pkg/blotter/tests/addTxn.R	2009-11-24 03:46:05 UTC (rev 122)
+++ pkg/blotter/tests/addTxn.R	2009-11-24 03:46:44 UTC (rev 123)
@@ -4,6 +4,8 @@
 data(IBM)                               # data included in package
 symbols <- c("IBM")
 
+suppressMessages(library(blotter))  # to suppress the TZ noise from xts
+suppressMessages(library(quantmod))
 # Initialize a portfolio object 'p'
 # Creating portfolio:
 p = initPortf(symbols=symbols)
@@ -134,66 +136,66 @@
 print(all.equal(rpl4, 99.7)) # Test Realized.PL aggregation
 
 # Tests for P&L
-p = updatePortf(p,start(IBM),end(IBM))
-# Resulting postions table:
-# p[["IBM"]]$posPL
-# > p[["IBM"]]$posPL                                                 
-#            Pos.Qty Pos.Value Txn.Value Txn.Fees Realized.PL Unrealized.PL
-# 1950-01-01       0      0.00      0.00     0.00         0.0          0.00
-# 2007-01-03      50   4863.50   4822.50     2.50         0.0         41.00
-# 2007-01-04       0      0.00  -4857.50     2.50        35.0        -41.00
-# 2007-01-05       0      0.00      0.00     0.00         0.0          0.00
-# 2007-01-08     -10   -989.00   -992.50     0.50         0.0          3.50
-# 2007-01-09     -20  -2001.40  -1001.50     0.50         0.0        -10.90
-# 2007-01-10     -20  -1977.80      0.00     0.00         0.0         23.60
-# 2007-01-11     -20  -1973.00      0.00     0.00         0.0          4.80
-# 2007-01-12     -20  -1986.80      0.00     0.00         0.0        -13.80
-# 2007-01-16     -20  -2016.40      0.00     0.00         0.0        -29.60
-# 2007-01-17     -30  -3000.60  -1003.00     0.50         0.0         18.80
-# 2007-01-18     -30  -2983.50      0.00     0.00         0.0         17.10
-# 2007-01-19       0      0.00   2848.50     1.50       148.5        -13.50
-# 2007-01-22      25   2427.75   2406.25     1.25         0.0         21.50
-# 2007-01-23      50   4854.00   2409.25     1.25         0.0         17.00
-# 2007-01-24      50   4870.00      0.00     0.00         0.0         16.00
-# 2007-01-25      50   4875.50      0.00     0.00         0.0          5.50
-# 2007-01-26      25   2436.25  -2439.25     1.25        31.5        -31.50
-# 2007-01-29      25   2463.50      0.00     0.00         0.0         27.25
-# 2007-01-30      25   2484.25      0.00     0.00         0.0         20.75
-# 2007-01-31       0      0.00  -2471.25     1.25        95.0       -108.00
-#            Trading.PL
-# 1950-01-01       0.00
-# 2007-01-03      41.00
-# 2007-01-04      -6.00
-# 2007-01-05       0.00
-# 2007-01-08       3.50
-# 2007-01-09     -10.90
-# 2007-01-10      23.60
-# 2007-01-11       4.80
-# 2007-01-12     -13.80
-# 2007-01-16     -29.60
-# 2007-01-17      18.80
-# 2007-01-18      17.10
-# 2007-01-19     135.00
-# 2007-01-22      21.50
-# 2007-01-23      17.00
-# 2007-01-24      16.00
-# 2007-01-25       5.50
-# 2007-01-26       0.00
-# 2007-01-29      27.25
-# 2007-01-30      20.75
-# 2007-01-31     -13.00
+# p = updatePortf(p,'2007-01')
+# # Resulting postions table:
+# # p[["IBM"]]$posPL
+# # > p[["IBM"]]$posPL                                                 
+# #            Pos.Qty Pos.Value Txn.Value Txn.Fees Realized.PL Unrealized.PL
+# # 1950-01-01       0      0.00      0.00     0.00         0.0          0.00
+# # 2007-01-03      50   4863.50   4822.50     2.50         0.0         41.00
+# # 2007-01-04       0      0.00  -4857.50     2.50        35.0        -41.00
+# # 2007-01-05       0      0.00      0.00     0.00         0.0          0.00
+# # 2007-01-08     -10   -989.00   -992.50     0.50         0.0          3.50
+# # 2007-01-09     -20  -2001.40  -1001.50     0.50         0.0        -10.90
+# # 2007-01-10     -20  -1977.80      0.00     0.00         0.0         23.60
+# # 2007-01-11     -20  -1973.00      0.00     0.00         0.0          4.80
+# # 2007-01-12     -20  -1986.80      0.00     0.00         0.0        -13.80
+# # 2007-01-16     -20  -2016.40      0.00     0.00         0.0        -29.60
+# # 2007-01-17     -30  -3000.60  -1003.00     0.50         0.0         18.80
+# # 2007-01-18     -30  -2983.50      0.00     0.00         0.0         17.10
+# # 2007-01-19       0      0.00   2848.50     1.50       148.5        -13.50
+# # 2007-01-22      25   2427.75   2406.25     1.25         0.0         21.50
+# # 2007-01-23      50   4854.00   2409.25     1.25         0.0         17.00
+# # 2007-01-24      50   4870.00      0.00     0.00         0.0         16.00
+# # 2007-01-25      50   4875.50      0.00     0.00         0.0          5.50
+# # 2007-01-26      25   2436.25  -2439.25     1.25        31.5        -31.50
+# # 2007-01-29      25   2463.50      0.00     0.00         0.0         27.25
+# # 2007-01-30      25   2484.25      0.00     0.00         0.0         20.75
+# # 2007-01-31       0      0.00  -2471.25     1.25        95.0       -108.00
+# #            Trading.PL
+# # 1950-01-01       0.00
+# # 2007-01-03      41.00
+# # 2007-01-04      -6.00
+# # 2007-01-05       0.00
+# # 2007-01-08       3.50
+# # 2007-01-09     -10.90
+# # 2007-01-10      23.60
+# # 2007-01-11       4.80
+# # 2007-01-12     -13.80
+# # 2007-01-16     -29.60
+# # 2007-01-17      18.80
+# # 2007-01-18      17.10
+# # 2007-01-19     135.00
+# # 2007-01-22      21.50
+# # 2007-01-23      17.00
+# # 2007-01-24      16.00
+# # 2007-01-25       5.50
+# # 2007-01-26       0.00
+# # 2007-01-29      27.25
+# # 2007-01-30      20.75
+# # 2007-01-31     -13.00
+# 
+# # @todo: add tests for functions currently buried in updatePortf
+# 
+# x1 = calcPortfSummary(p)
+# x2 = getBySymbol(p,'Pos.Qty')
+# 
+# # Initialize account:
+# a = initAcct(portfolios="p")
+# # Updating account:
+# a = updateAcct(a,'2007-01')
+# a = updateEndEq(a,'2007-01')
 
-# @todo: add tests for functions currently buried in updatePortf
 
-x1 = calcPortfSummary(p)
-x2 = getBySymbol(p,'Pos.Qty')
 
-# Initialize account:
-a = initAcct(portfolios="p")
-# Updating account:
-a = updateAcct(a,'2007-01')
-a = updateEndEq(a,'2007-01')
 
-
-
-



More information about the Blotter-commits mailing list