blotter error updatePortf Error in if (length(CcyMult) == 1 && CcyMult == 1)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

blotter error updatePortf Error in if (length(CcyMult) == 1 && CcyMult == 1)

zadig

I am getting this error in my opensuse linux with blotter_0.14.2 . it works fine with blotter_0.9.1741 in my old linux box.
Here is the script :

#====================================================================
library(quantstrat)
library(quantmod)

currency("USD")
currency("CHF")

exchange_rate("USDCHF", currency="CHF", counter_currency="USD", src=list(name='USD/CHF', src='oanda'))

getSymbols("USD/CHF", src="oanda", from="2019-04-01",to="2019-04-07")
colnames(USDCHF) <- "price"

initPortf("PF1", symbols= c("USDCHF"), currency="USD",initDate="2019-04-04")
initAcct("myacct", portfolios="PF1", initDate="2019-04-04",currency="USD", initEq=200000)
initOrders(portfolio="PF1",initDate="2019-04-04")

addTxn("PF1", Symbol="USDCHF", TxnDate="2019-04-05", TxnPrice = 0.96555, TxnQty= 100000)
addTxn("PF1", Symbol="USDCHF", TxnDate="2019-04-05", TxnPrice = 0.96550, TxnQty=-100000)

updatePortf("PF1")
updateAcct("myacct")
updateEndEq("myacct")

getPortfolio("PF1")
getAccount("myacct")
getEndEq("myacct","2019-04-05")
#============================================================================

error I get :

> updatePortf("PF1")
Error in if (length(CcyMult) == 1 && CcyMult == 1) { :
  missing value where TRUE/FALSE needed
In addition: Warning message:
In .updatePosPL(Portfolio = pname, Symbol = as.character(symbol),  :
  NAs introduced by coercion

> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-suse-linux-gnu (64-bit)
Running under: openSUSE Leap 15.0

Matrix products: default
BLAS: /usr/lib64/R/lib/libRblas.so
LAPACK: /usr/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8   LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] quantstrat_0.15.6          foreach_1.4.4
[3] blotter_0.14.2             PerformanceAnalytics_1.5.2
[5] FinancialInstrument_1.3.1  quantmod_0.4-14
[7] TTR_0.23-4     xts_0.11-2
[9] zoo_1.8-5

loaded via a namespace (and not attached):
 [1] quadprog_1.5-5   lattice_0.20-35  codetools_0.2-15 MASS_7.3-49
 [5] grid_3.5.0       jsonlite_1.6     curl_3.3         boot_1.3-20
 [9] iterators_1.0.10 compiler_3.5.0

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.