SCM

SCM Repository

[blotter] Diff of /pkg/blotter/R/updatePortf.R
ViewVC logotype

Diff of /pkg/blotter/R/updatePortf.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1503, Fri Sep 13 21:37:20 2013 UTC revision 1504, Fri Sep 13 22:50:16 2013 UTC
# Line 32  Line 32 
32       # Calculate and store portfolio summary table       # Calculate and store portfolio summary table
33       Portfolio<-getPortfolio(pname) # refresh with an updated object       Portfolio<-getPortfolio(pname) # refresh with an updated object
34       #if(is.null(Dates)) Dates <- xts:::time.xts(Portfolio$symbols[[1]]$posPL)  #not quite right, only using first symbol...       #if(is.null(Dates)) Dates <- xts:::time.xts(Portfolio$symbols[[1]]$posPL)  #not quite right, only using first symbol...
35       if(is.null(Dates)) Dates <- xts(,do.call(unlist,c(lapply(Portfolio$symbols, function(x) index(x[["posPL"]][Dates]) ))))       if(is.null(Dates)) Dates <- unique(do.call(c,c(lapply(Portfolio$symbols, function(x) index(x[["posPL"]][Dates]) ), use.names=FALSE, recursive=FALSE)))
36    
37       #Symbols = ls(Portfolio$symbols)       #Symbols = ls(Portfolio$symbols)
38       Attributes = c('Long.Value', 'Short.Value', 'Net.Value', 'Gross.Value', 'Period.Realized.PL', 'Period.Unrealized.PL', 'Gross.Trading.PL', 'Txn.Fees', 'Net.Trading.PL')       Attributes = c('Long.Value', 'Short.Value', 'Net.Value', 'Gross.Value', 'Period.Realized.PL', 'Period.Unrealized.PL', 'Gross.Trading.PL', 'Txn.Fees', 'Net.Trading.PL')
# Line 94  Line 94 
94    
95       # if(!is.timeBased(Dates)) Dates = xts:::time.xts(Portfolio$symbols[[1]][["posPL"]][Dates])       # if(!is.timeBased(Dates)) Dates = xts:::time.xts(Portfolio$symbols[[1]][["posPL"]][Dates])
96       #xts(,do.call(unlist,c(lapply(symbols,index),use.names=FALSE)))       #xts(,do.call(unlist,c(lapply(symbols,index),use.names=FALSE)))
97       if(!is.timeBased(Dates)) Dates <- xts(,do.call(unlist,c(lapply(Portfolio$symbols, function(x) index(x[["posPL"]][Dates]) ))))       if(!is.timeBased(Dates)) Dates <- unique(do.call(c,c(lapply(Portfolio$symbols, function(x) index(x[["posPL"]][Dates]) ), use.names=FALSE, recursive=FALSE)))
98       startDate = first(xts:::.parseISO8601(Dates))$first.time-.00001       startDate = first(xts:::.parseISO8601(Dates))$first.time-.00001
99       # trim summary slot to not double count, related to bug 831 on R-Forge, and rbind new summary       # trim summary slot to not double count, related to bug 831 on R-Forge, and rbind new summary
100       if( as.POSIXct(attr(Portfolio,'initDate'))>=startDate || length(Portfolio$summary)==0 ){       if( as.POSIXct(attr(Portfolio,'initDate'))>=startDate || length(Portfolio$summary)==0 ){

Legend:
Removed from v.1503  
changed lines
  Added in v.1504

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge