[Blotter-commits] r797 - in pkg/FinancialInstrument: . R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Sep 26 23:51:10 CEST 2011
Author: gsee
Date: 2011-09-26 23:51:10 +0200 (Mon, 26 Sep 2011)
New Revision: 797
Modified:
pkg/FinancialInstrument/DESCRIPTION
pkg/FinancialInstrument/R/instrument.R
Log:
some code was trapped inside an if statement in instrument.auto, and check to make sure root is a root and not a series.
Modified: pkg/FinancialInstrument/DESCRIPTION
===================================================================
--- pkg/FinancialInstrument/DESCRIPTION 2011-09-26 19:24:37 UTC (rev 796)
+++ pkg/FinancialInstrument/DESCRIPTION 2011-09-26 21:51:10 UTC (rev 797)
@@ -11,7 +11,7 @@
meta-data and relationships. Provides support for
multi-asset class and multi-currency portfolios.
Still in heavy development.
-Version: 0.6.7
+Version: 0.6.8
URL: https://r-forge.r-project.org/projects/blotter/
Date: $Date$
Depends:
Modified: pkg/FinancialInstrument/R/instrument.R
===================================================================
--- pkg/FinancialInstrument/R/instrument.R 2011-09-26 19:24:37 UTC (rev 796)
+++ pkg/FinancialInstrument/R/instrument.R 2011-09-26 21:51:10 UTC (rev 797)
@@ -709,13 +709,15 @@
}
if (any(pid$type == 'future')) {
root <- getInstrument(pid$root,silent=TRUE,type='future')
- if (is.instrument(root)) {
+ if (is.instrument(root) && !inherits(root, 'future_series')) {
return(future_series(primary_id,defined.by='auto',...))
- } else if (!silent) {
- warning(paste(primary_id," appears to be a future_series, ",
- "but its root cannot be found. ",
- "Creating _", default_type, "_ instrument instead.", sep=""))
- warned <- TRUE
+ } else {
+ if (!silent) {
+ warning(paste(primary_id," appears to be a future_series, ",
+ "but its root cannot be found. ",
+ "Creating _", default_type, "_ instrument instead.", sep=""))
+ warned <- TRUE
+ }
dargs$root_id <- pid$root
dargs$suffix_id <- pid$suffix
dargs$expires <- paste(pid$year, sprintf("%02d", month_cycle2numeric(pid$month)), sep="-")
@@ -723,13 +725,15 @@
}
if (any(pid$type == 'option')) {
root <- getInstrument(pid$root,silent=TRUE,type='option')
- if (is.instrument(root)) {
+ if (is.instrument(root) && !inherits(root, 'option_series')) {
return(option_series(primary_id, defined.by='auto', ...))
- } else if (!silent) {
- warning(paste(primary_id," appears to be an option_series, ",
- "but its root cannot be found. ",
- "Creating _", default_type, "_ instrument instead.", sep=""))
- warned <- TRUE
+ } else {
+ if (!silent) {
+ warning(paste(primary_id," appears to be an option_series, ",
+ "but its root cannot be found. ",
+ "Creating _", default_type, "_ instrument instead.", sep=""))
+ warned <- TRUE
+ }
dargs$root_id <- pid$root
dargs$suffix_id <- pid$suffix
dargs$expires <- if(pid$format == 'opt2') {
More information about the Blotter-commits
mailing list