[Blotter-commits] r188 - pkg/blotter/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 19 22:29:53 CET 2010


Author: braverock
Date: 2010-01-19 22:29:53 +0100 (Tue, 19 Jan 2010)
New Revision: 188

Modified:
   pkg/blotter/R/synthetic.R
Log:
- add check for spread instrument type

Modified: pkg/blotter/R/synthetic.R
===================================================================
--- pkg/blotter/R/synthetic.R	2010-01-19 21:26:51 UTC (rev 187)
+++ pkg/blotter/R/synthetic.R	2010-01-19 21:29:53 UTC (rev 188)
@@ -1,8 +1,9 @@
-buildSpread(primary_id, ..., ) {
+buildSpread<- function(primary_id, ..., ) {
     tmp_instr<-try(getInstrument(primary_id)
     if(inherits(tmp_instr,"try-error") | !is.instrument(tmp_instr)){
-        stop(paste("Instrument",Symbol," not found, please create it first.))
+        stop(paste("Instrument",Symbol," not found, please create it first."))
     } 
+    if(!inherits(tmp_instr,"spread")) stop (paste("Instrument",Symbol," is not a spread, please use the primary_id of a spread."))
 
 }
 



More information about the Blotter-commits mailing list