[Blotter-commits] r198 - pkg/FinancialInstrument/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jan 25 14:33:47 CET 2010
Author: braverock
Date: 2010-01-25 14:33:47 +0100 (Mon, 25 Jan 2010)
New Revision: 198
Modified:
pkg/FinancialInstrument/R/instrument.R
pkg/FinancialInstrument/R/synthetic.R
Log:
- further debugging in handling synthetics such as spreads
Property changes on: pkg/FinancialInstrument/R/instrument.R
___________________________________________________________________
Name: svn:keywords
- Id Rev Date
+ Id Revision Date Author
Modified: pkg/FinancialInstrument/R/synthetic.R
===================================================================
--- pkg/FinancialInstrument/R/synthetic.R 2010-01-24 16:11:07 UTC (rev 197)
+++ pkg/FinancialInstrument/R/synthetic.R 2010-01-25 13:33:47 UTC (rev 198)
@@ -11,7 +11,9 @@
#
###############################################################################
-synthetic <- function(primary_id , currency , multiplier=NULL, identifiers = NULL, ..., members=NULL, cl=c(type,"synthetic", "instrument")){
+synthetic <- function(primary_id , currency , multiplier=1, identifiers = NULL, ..., members=NULL, cl=c("synthetic", "instrument"))
+{
+
synthetic_temp = instrument(primary_id , currency , multiplier , identifiers = identifiers, ..., type=NULL )
## now structure and return
@@ -25,7 +27,8 @@
)
}
-synthetic.ratio <- function(primary_id , currency , multiplier=NULL, identifiers = NULL, ..., cl=c("synthetic.ratio","synthetic","instrument"), members, memberratio){
+synthetic.ratio <- function(primary_id , currency , multiplier=1, identifiers = NULL, ..., cl=c("synthetic.ratio","synthetic","instrument"), members, memberratio)
+{
#TODO make sure that with options/futures or other instruments that we have you use the base contract
if(!is.list(members)){
if(length(members)!=length(memberratio) | length(members)<2){
@@ -51,7 +54,7 @@
warning("passing in members as a list not fully tested")
memberlist=members
}
- synthetic_temp = synthetic(primary_id , currency , multiplier , identifiers = identifiers, ..., members, type=NULL )
+ synthetic_temp = synthetic(primary_id , currency , multiplier=multiplier , identifiers = identifiers, members=members , ... )
## now structure and return
assign(primary_id, structure( list(primary_id = synthetic_temp$primary_id,
currency = synthetic_temp$currency,
@@ -65,6 +68,7 @@
)
}
-spread <- function(primary_id , currency , multiplier=NULL, identifiers = NULL, ..., members, memberratio){
- synthetic.ratio(primary_id , currency , multiplier=NULL, identifiers = NULL, ..., cl=c("spread","synthetic.ratio","synthetic","instrument"), members=members, memberratio=memberratio)
+spread <- function(primary_id , currency , members, memberratio, ..., multiplier=1, identifiers = NULL)
+{
+ synthetic.ratio(primary_id , currency , multiplier=multiplier, identifiers = NULL, cl=c("spread","synthetic.ratio","synthetic","instrument"), members=members, memberratio=memberratio, ...=...)
}
More information about the Blotter-commits
mailing list