[R-SIG-Finance] Error in addTxn - Quantstrat

Daniel Cegiełka daniel.cegielka at gmail.com
Wed May 24 20:10:56 CEST 2017


2017-05-24 19:45 GMT+02:00 Joshua Ulrich <josh.m.ulrich at gmail.com>:
>
> This is a bug that was introduced here:
> https://github.com/braverock/blotter/commit/24b578628415111885d29ef97d5ab0eed1c7bb75


https://github.com/braverock/blotter/commit/24b578628415111885d29ef97d5ab0eed1c7bb75#diff-7347fe5a0f184f79ef064e92e3beb297R69

https://github.com/braverock/blotter/blob/master/R/addTxn.R#L85

why end() from stats?

https://github.com/braverock/blotter/blob/master/R/addTxn.R#L154

Should be end.xts(), eg:

end.xts <- function (x, ...)
{
    if (!length(x)) {
        index(x[length(.index(x)), ])
    } else
        index(x[NROW(x), ])
}

If I understood the problem correctly...

Best,
Daniel


>
>
>
> Here's a *minimal* reproducible example:
> require(blotter)
> currency("USD")
> initPortf("test", symbols="AAPL", currency="USD")
>
> addTxn("test", "AAPL", as.Date("2017-01-01"),  1, 10)
> addTxn("test", "AAPL", as.Date("2017-01-02"), -1, 10)
>
> Thanks for the report!  I'll work on a fix.
>
> Best,
> Josh
>



More information about the R-SIG-Finance mailing list