[Blotter-commits] r471 - pkg/blotter/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Nov 24 20:51:44 CET 2010


Author: peter_carl
Date: 2010-11-24 20:51:43 +0100 (Wed, 24 Nov 2010)
New Revision: 471

Modified:
   pkg/blotter/man/blotter-package.Rd
Log:
- fixed example


Modified: pkg/blotter/man/blotter-package.Rd
===================================================================
--- pkg/blotter/man/blotter-package.Rd	2010-11-24 18:51:57 UTC (rev 470)
+++ pkg/blotter/man/blotter-package.Rd	2010-11-24 19:51:43 UTC (rev 471)
@@ -45,12 +45,13 @@
 if(!exists(".instrument")) .instrument <<- new.env()
 if(!exists(".blotter")) .blotter <<- new.env()
 
-# Define a currency and some stocks
+# Use the FinancialInstrument package to manage information about tradable instruments
 require(FinancialInstrument)
+# Define a currency and a couple stocks
 currency("USD")
 symbols = c("IBM","F")
 for(symbol in symbols){ # establish tradable instruments
-    stock(symbol, currency="USD",multiplier=1)
+    stock(symbol, currency="USD", multiplier=1)
 }
 
 # Download price data
@@ -75,8 +76,9 @@
 
 # ...and some in MMM
 # We didn't include this in the list of symbols for the portfolio, so first we have to download prices and add a slot for MMM to the portfolio
-getSymbols("MMM", from='2007-01-01', to='2007-01-31', src='yahoo', index.class=c("POSIXt","POSIXct"))
-addPortfInstr("p",symbols="MMM")
+getSymbols("MMM", from='2007-01-01', to='2007-01-31', src='yahoo', index.class=c("POSIXt","POSIXct")) # Download price data
+stock("MMM", currency="USD", multiplier=1) # Add the instrument
+
 # Now we can add transactions:
 addTxn("p", "MMM", '2007-01-05', -50, 77.9, TxnFees = -0.05*50)
 addTxn("p", "MMM", '2007-01-08', 50, 77.6, TxnFees = -0.05*50)



More information about the Blotter-commits mailing list