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