[Blotter-commits] r754 - in pkg/FinancialInstrument: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 6 20:44:51 CEST 2011


Author: gsee
Date: 2011-09-06 20:44:50 +0200 (Tue, 06 Sep 2011)
New Revision: 754

Modified:
   pkg/FinancialInstrument/DESCRIPTION
   pkg/FinancialInstrument/R/parse_id.R
   pkg/FinancialInstrument/man/parse_id.Rd
   pkg/FinancialInstrument/man/parse_suffix.Rd
Log:
- moved decimal for option suffixes that are non decimal representation of strikes with decimals to be consistent with IB. (8 digit strike now implies 3 digits after the decimal)
- minor updates to docs


Modified: pkg/FinancialInstrument/DESCRIPTION
===================================================================
--- pkg/FinancialInstrument/DESCRIPTION	2011-09-05 17:09:34 UTC (rev 753)
+++ pkg/FinancialInstrument/DESCRIPTION	2011-09-06 18:44:50 UTC (rev 754)
@@ -11,7 +11,7 @@
     meta-data and relationships. Provides support for
     multi-asset class and multi-currency portfolios.  
     Still in heavy development.
-Version: 0.5.2
+Version: 0.5.3
 URL: https://r-forge.r-project.org/projects/blotter/
 Date: $Date$
 Depends:

Modified: pkg/FinancialInstrument/R/parse_id.R
===================================================================
--- pkg/FinancialInstrument/R/parse_id.R	2011-09-05 17:09:34 UTC (rev 753)
+++ pkg/FinancialInstrument/R/parse_id.R	2011-09-06 18:44:50 UTC (rev 754)
@@ -14,7 +14,7 @@
 #' @param silent silence warnings?
 #' @param root character name of instrument root_id.  Optionally provide this to make parsing easier.
 #' @return a list of class \sQuote{id.list} containing \sQuote{root} and \sQuote{suffix} as well as 
-#' what is returned from \code{\link{parse_suffix}} (type, month, year, strike, right, cm, cc)
+#' what is returned from \code{\link{parse_suffix}} (type, month, year, strike, right, cm, cc, format)
 #' @author Garrett See
 #' @note this function will identify \code{x} as an \code{\link{exchange_rate}} only if it is 
 #' 6 characters long and made up of 2 previously defined \code{\link{currency}} instruments.
@@ -94,7 +94,7 @@
 #' U1, U11, SEP1, SEP11, U2011, Sep2011, SEP2011
 #' 
 #' These would be recognized as a call with a strike of 122.5 that expires Sep 17, 2011:
-#' 110917C122.5, 20110917C122.5
+#' 110917C122.5, 20110917C122.5, 110917C00122500, 20110917C00122500
 #'
 #' These would be recognized as Sep 2011 single stock futures:
 #' 1CU1, 1CU11, 1CSEP11, 1DU1 (dividend protected)
@@ -149,7 +149,7 @@
         format <- 'cc'
     } else if (nchar(x) > 7 && (any(substr(x,7,7) == c("C","P")) || any(substr(x,9,9) == c("C","P"))) ) {
         # if the 7th or 9th char is a "C" or "P", it's an option
-        # 110917C125 or 20110917C125 or 110917C00012500 or 20110917C00012500
+        # 110917C125 or 20110917C125 or 110917C00125000 or 20110917C00125000
         hasdot <- !identical(integer(0),grep("\\.",x))
         if (!hasdot
             || (hasdot 
@@ -162,7 +162,7 @@
                 month <- toupper(month.abb[as.numeric(substr(x,3,4))])
                 year <- 2000 + as.numeric(substr(x,1,2))
                 strike <- as.numeric(substr(x,8,nchar(x)))
-                if (nchar(x) >= 15) strike <- strike/100                 
+                if (nchar(x) >= 15) strike <- strike/1000                 
                 right <- substr(x,7,7)
                 format <- 'opt2'    
             } else if (any(substr(x,9,9) == c("C","P"))) {
@@ -170,7 +170,7 @@
                 month <- toupper(month.abb[as.numeric(substr(x,5,6))])
                 year <- as.numeric(substr(x,1,4))
                 strike <- as.numeric(substr(x,10,nchar(x)))
-                if (nchar(x) >= 15) strike <- strike/100
+                if (nchar(x) >= 15) strike <- strike/1000
                 right <- substr(x,9,9)
                 format <- 'opt4'
             } else stop("how did you get here?")

Modified: pkg/FinancialInstrument/man/parse_id.Rd
===================================================================
--- pkg/FinancialInstrument/man/parse_id.Rd	2011-09-05 17:09:34 UTC (rev 753)
+++ pkg/FinancialInstrument/man/parse_id.Rd	2011-09-06 18:44:50 UTC (rev 754)
@@ -17,7 +17,7 @@
   a list of class \sQuote{id.list} containing \sQuote{root}
   and \sQuote{suffix} as well as what is returned from
   \code{\link{parse_suffix}} (type, month, year, strike,
-  right, cm, cc)
+  right, cm, cc, format)
 }
 \description{
   Extract/infer descriptive information about an instrument

Modified: pkg/FinancialInstrument/man/parse_suffix.Rd
===================================================================
--- pkg/FinancialInstrument/man/parse_suffix.Rd	2011-09-05 17:09:34 UTC (rev 753)
+++ pkg/FinancialInstrument/man/parse_suffix.Rd	2011-09-06 18:44:50 UTC (rev 754)
@@ -29,7 +29,7 @@
 
   These would be recognized as a call with a strike of
   122.5 that expires Sep 17, 2011: 110917C122.5,
-  20110917C122.5
+  20110917C122.5, 110917C00122500, 20110917C00122500
 
   These would be recognized as Sep 2011 single stock
   futures: 1CU1, 1CU11, 1CSEP11, 1DU1 (dividend protected)



More information about the Blotter-commits mailing list