[R-SIG-Finance] blotter 0.8.17 addPosLimit function fix
Joshua Ulrich
josh.m.ulrich at gmail.com
Fri Oct 18 20:10:47 CEST 2013
What, exactly, does this fix?
--
Joshua Ulrich | about.me/joshuaulrich
FOSS Trading | www.fosstrading.com
On Fri, Oct 18, 2013 at 12:53 PM, Ilya Kipnis <ilya.kipnis at gmail.com> wrote:
> Hello...thought I would fix the addPosLimit function--notice the two \\ in
> the last line of the function.
>
> *******
>
> addPosLimit <- function (portfolio, symbol, timestamp, maxpos, longlevels =
> 1,
> minpos = -maxpos, shortlevels = longlevels)
> {
> portf <- getPortfolio(portfolio)
> if (length(maxpos) > 1)
> maxpos <- maxpos[, 1]
> if (length(minpos) > 1)
> minpos <- minpos[, 1]
> newrow <- xts(cbind(maxpos, longlevels, minpos, shortlevels),
> order.by = as.POSIXct(timestamp))
> tc <- try(colnames(newrow) <- c("MaxPos", "LongLevels", "MinPos",
> "ShortLevels"))
> if (is.null(portf$symbols[[symbol]]$PosLimit)) {
> portf$symbols[[symbol]]$PosLimit <- newrow
> }
> else {
> if (is.null(portf$symbols[[symbol]]$PosLimit[timestamp])) {
> portf$symbols[[symbol]]$PosLimit[timestamp] <- newrow
> }
> else {
> portf$symbols[[symbol]]$PosLimit <-
> rbind(portf$symbols[[symbol]]$PosLimit,
> newrow)
> }
> }
> assign(paste("portfolio", portfolio, sep = "\\."), portf, envir =
> .blotter)
> }
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at r-project.org 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.
More information about the R-SIG-Finance
mailing list