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

Joshua Ulrich josh.m.ulrich at gmail.com
Thu May 25 21:39:21 CEST 2017


This is now fixed in:
https://github.com/braverock/blotter/commit/537f7870665859346a1157b2bc786c6d7325f6fb

Thanks for the report!

On Wed, May 24, 2017 at 3:46 PM, John Kumar <rjkft at yahoo.com> wrote:

> Thanks for taking the time to look at this guys. Sorry for the verbose
> example but minimal means different things to different people depending on
> their skills, or lack thereof in my case. Cheers
> John
>
> -----Original Message-----
> From: Joshua Ulrich [mailto:josh.m.ulrich at gmail.com]
> Sent: Wednesday, 24 May 2017 10:31 PM
> To: Daniel Cegiełka <daniel.cegielka at gmail.com>
> Cc: John Kumar <rjkft at yahoo.com>; r-sig-finance <
> R-SIG-Finance at r-project.org>
> Subject: Re: [R-SIG-Finance] Error in addTxn - Quantstrat
>
> On Wed, May 24, 2017 at 1:10 PM, Daniel Cegiełka <
> daniel.cegielka at gmail.com> wrote:
> > 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/24b578628415111885d29ef97
> >> d5ab0eed1c7bb75
> >
> >
> > https://github.com/braverock/blotter/commit/24b578628415111885d29ef97d
> > 5ab0eed1c7bb75#diff-7347fe5a0f184f79ef064e92e3beb297R69
> >
> > https://github.com/braverock/blotter/blob/master/R/addTxn.R#L85
> >
> > why end() from stats?
> >
> Because stats::end is the generic.
>
> > https://github.com/braverock/blotter/blob/master/R/addTxn.R#L154
> >
> > Should be end.xts(), eg:
> >
> end.xts() is not exported from the xts namespace.  And it's generally a
> bad idea to call methods directly, because you do not know if that method
> will be able to handle objects of different classes.
>
> > 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
> >>
>
>
>
> --
> Joshua Ulrich  |  about.me/joshuaulrich
> FOSS Trading  |  www.fosstrading.com
> R/Finance 2017 | www.rinfinance.com
>
>


-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list