[Blotter-commits] r753 - in pkg/FinancialInstrument: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Sep 5 19:09:34 CEST 2011
Author: gsee
Date: 2011-09-05 19:09:34 +0200 (Mon, 05 Sep 2011)
New Revision: 753
Modified:
pkg/FinancialInstrument/DESCRIPTION
pkg/FinancialInstrument/R/buildSpread.R
pkg/FinancialInstrument/R/synthetic.R
pkg/FinancialInstrument/man/synthetic.instrument.Rd
Log:
- synthetic.ratio body replaced with call to .Deprecated
- minor update to example in synthetic.instrument
- minor patch in a warning message in buildSpread
Modified: pkg/FinancialInstrument/DESCRIPTION
===================================================================
--- pkg/FinancialInstrument/DESCRIPTION 2011-09-05 16:55:31 UTC (rev 752)
+++ pkg/FinancialInstrument/DESCRIPTION 2011-09-05 17:09:34 UTC (rev 753)
@@ -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.1
+Version: 0.5.2
URL: https://r-forge.r-project.org/projects/blotter/
Date: $Date$
Depends:
Modified: pkg/FinancialInstrument/R/buildSpread.R
===================================================================
--- pkg/FinancialInstrument/R/buildSpread.R 2011-09-05 16:55:31 UTC (rev 752)
+++ pkg/FinancialInstrument/R/buildSpread.R 2011-09-05 17:09:34 UTC (rev 753)
@@ -65,7 +65,7 @@
for (i in 1:length(spread_instr$members)) {
instr <- try(getInstrument(as.character(spread_instr$members[i])))
if (inherits(instr, "try-error") || !is.instrument(instr))
- stop(paste("Instrument", instr, " not found, please create it first."))
+ stop(paste("Instrument", spread_instr$members[i], " not found, please create it first."))
instr_currency <- instr$currency
instr_mult <- as.numeric(instr$multiplier)
instr_ratio <- spread_instr$memberratio[i]
Modified: pkg/FinancialInstrument/R/synthetic.R
===================================================================
--- pkg/FinancialInstrument/R/synthetic.R 2011-09-05 16:55:31 UTC (rev 752)
+++ pkg/FinancialInstrument/R/synthetic.R 2011-09-05 17:09:34 UTC (rev 753)
@@ -46,38 +46,7 @@
#' @export
synthetic.ratio <- function(primary_id , currency , members, memberratio, ..., multiplier=1, identifiers = NULL, type=c("synthetic.ratio","synthetic"))
{
- #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){
- stop("length of members and memberratio must be equal, and contain two or more instruments")
- } else {
- memberlist<-list(members=members,memberratio=memberratio,currencies=vector(),memberpositions=NULL)
- }
- for(member in members) {
- tmp_symbol<-member
- tmp_instr<-try(getInstrument(member))
- if(inherits(tmp_instr,"try-error") | !is.instrument(tmp_instr)){
- message(paste("Instrument",tmp_symbol," not found, using currency of",currency))
- memberlist$currencies[member]<-currency
- } else {
- memberlist$currencies[member]<-tmp_instr$currency
- }
- }
- names(memberlist$members)<-memberlist$members
- names(memberlist$memberratio)<- memberlist$members
- names(memberlist$currencies)<- memberlist$members
- } else {
- # TODO do some sanity checking here on the list elements
- warning("passing in members as a list not fully tested")
- memberlist=members
- }
- if(is.null(currency)) currency<- as.character(memberlist$currencies[1]) #use the currency of the front leg
-
- if (hasArg(tick_size)){
- tick_size<-match.call(expand.dots=TRUE)$tick_size
- } else tick_size<-0
-
- synthetic(primary_id=primary_id , currency=currency , multiplier=multiplier , identifiers = identifiers, members=memberlist , memberratio=memberratio, ...=... ,type=type, tick_size=tick_size)
+ .Deprecated(new='synthetic.instrument',package='FinancialInstrument')
}
#' synthetic instrument constructors
@@ -123,7 +92,7 @@
#' \dontrun{
#' stock('SPY','USD',1)
#' stock('DIA','USD',1)
-#' spread('SPYDIA','USD',c('SPY','DIA'),c(1,-1))
+#' spread('SPY.DIA','USD',c('SPY','DIA'),c(1,-1))
#' }
#' @export
synthetic.instrument <- function (primary_id, currency, members, memberratio, ..., multiplier = 1, tick_size=NULL,
Modified: pkg/FinancialInstrument/man/synthetic.instrument.Rd
===================================================================
--- pkg/FinancialInstrument/man/synthetic.instrument.Rd 2011-09-05 16:55:31 UTC (rev 752)
+++ pkg/FinancialInstrument/man/synthetic.instrument.Rd 2011-09-05 17:09:34 UTC (rev 753)
@@ -105,7 +105,7 @@
\dontrun{
stock('SPY','USD',1)
stock('DIA','USD',1)
-spread('SPYDIA','USD',c('SPY','DIA'),c(1,-1))
+spread('SPY.DIA','USD',c('SPY','DIA'),c(1,-1))
}
}
\author{
More information about the Blotter-commits
mailing list