Lo catches slow

Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Lo catches slow

Ilya Kipnis
Minimum reproducible example:

require(quantmod)
require(TTR)

getSymbols('SPY')
data <- cbind(OHLC(SPY), stoch(HLC(SPY)))
head(Lo(data))
head(HLC(data))

Lo catches both the low from the OHLC object (which it's supposed to), and
the slowD column (because it has low in the name), which it isn't supposed
to.

This can cause issues down the line with other functions that call
functions that search for the Low column which might cause a dimnames error
down the line.

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Lo catches slow

Joshua Ulrich
On Tue, Mar 12, 2019 at 11:53 PM Ilya Kipnis <[hidden email]> wrote:

>
> Minimum reproducible example:
>
> require(quantmod)
> require(TTR)
>
> getSymbols('SPY')
> data <- cbind(OHLC(SPY), stoch(HLC(SPY)))
> head(Lo(data))
> head(HLC(data))
>
> Lo catches both the low from the OHLC object (which it's supposed to), and
> the slowD column (because it has low in the name), which it isn't supposed
> to.
>
This is a known issue that is hard to fix.  See
https://github.com/joshuaulrich/quantmod/issues/24

> This can cause issues down the line with other functions that call
> functions that search for the Low column which might cause a dimnames error
> down the line.
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> [hidden email] 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.



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

_______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Lo catches slow

Enrico Schumann-2
>>>>> "Joshua" == Joshua Ulrich <[hidden email]> writes:

    Joshua> On Tue, Mar 12, 2019 at 11:53 PM Ilya Kipnis <[hidden email]> wrote:
    >>
    >> Minimum reproducible example:
    >>
    >> require(quantmod)
    >> require(TTR)
    >>
    >> getSymbols('SPY')
    >> data <- cbind(OHLC(SPY), stoch(HLC(SPY)))
    >> head(Lo(data))
    >> head(HLC(data))
    >>
    >> Lo catches both the low from the OHLC object
    >> (which it's supposed to), and the slowD column
    >> (because it has low in the name), which it isn't
    >> supposed to.
    >>
    Joshua> This is a known issue that is hard to fix.  See
    Joshua> https://github.com/joshuaulrich/quantmod/issues/24

Perhaps one could add a warning for this case, either
in `Lo` or `has.Lo`?

i <- grep("Low", colnames(x), ignore.case = TRUE)
if (length(i) > 1L)
    warning("more than one column match 'low': ",
            paste(colnames(x)[i], collapse = " "))


    >> This can cause issues down the line with other functions that call
    >> functions that search for the Low column which might cause a dimnames error
    >> down the line.
    >>

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


--
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net

_______________________________________________
[hidden email] 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.