[R-SIG-Finance] blotter->chart.Posn -- 'no transactions/position to chart'

Mark Knecht markknecht at gmail.com
Thu Nov 21 20:08:29 CET 2013


Hi,
   I wonder if someone can help me with this error message "no
transactions/positions to chart'? I seem to get this in a lot of my
programs so I created a small self-contained program that also does
it. It sort of comes and goes. I figure maybe I'm doing something
wrong earlier in the program but I haven't found it.

   Data does exist prior to the transaction, and there is a
transaction, so I'm lost as to what chart.Posn is upset with me about.

   Here's what I see when I run the code below:

> getTxns("Equity","VTI")
           Txn.Qty Txn.Price Txn.Fees Txn.Value Txn.Avg.Cost Net.Txn.Realized.PL
1990-01-01       0      0.00        0         0         0.00                   0
2001-06-18     100     47.41        0      4741        47.41                   0
> head(VTI)
           VTI.Open VTI.High  VTI.Low VTI.Close VTI.Volume VTI.Adjusted
2001-06-15 47.08257 47.57527 46.87020  47.28645  1256529.6        44.81
2001-06-18 47.41387 47.49882 46.98488  46.98488   332673.1        44.53
2001-06-19 47.69845 47.71119 46.92117  47.11655  2092568.0        44.65
2001-06-20 47.04010 47.63474 47.04010  47.61350   560341.1        45.12
2001-06-21 47.57102 48.18690 47.46484  47.99577   282995.8        45.48
2001-06-22 47.95329 47.95329 47.46484  47.68995   212600.0        45.19
>
> chart.Posn("Equity", Symbol = "VTI", Dates = "2001-06-15")
Error in chart.Posn("Equity", Symbol = "VTI", Dates = "2001-06-15") :
  no transactions/positions to chart

   If it matters, I'm running Gentoo Linux and built blotter and
accompanying programs about 1.5 weeks ago.

Thanks,
Mark




library(blotter)

MyPortfolios = c("Equity")

MySymbols = list()
MySymbols[[1]]= c("VTI","VEU")

currency("USD")

Date_Start = "1990-01-01"
Date_End = format(Sys.time(), "%Y-%m-%d")
Sys.setenv(TZ = "UTC")

stock(MySymbols[[1]], currency = "USD", multiplier = 1)

suppressWarnings(rm("account.ETF_Momentum", pos = .blotter))
suppressWarnings(rm("portfolio.Equity", pos = .blotter))

initPortf(MyPortfolios[1], as.list(MySymbols[[1]]), initDate = "1990-01-01")
initAcct("ETF_Momentum", MyPortfolios, initDate = "1990-01-01", initEq = 1e+05)

getSymbols(MySymbols[[1]], from = Date_Start, to = Date_End, adjust = T)

addTxn("Equity", Symbol = "VTI",  TxnQty = 100,  TxnPrice = 47.41,
TxnDate = "2001-06-18", TxnFees = 0, verbose = FALSE)

updatePortf("Equity")
updateAcct("ETF_Momentum")
updateEndEq("ETF_Momentum")

getTxns("Equity","VTI")
head(VTI)

chart.Posn("Equity", Symbol = "VTI", Dates = "2001-06-15")



More information about the R-SIG-Finance mailing list