Learn R Programming

quantmod (version 0.4.25)

has.OHLC: Check For OHLC Data

Description

A set of functions to check for appropriate OHLC and HLC column names within a data object, as well as the availability and position of those columns.

Usage

is.OHLC(x)
has.OHLC(x, which = FALSE)

is.OHLCV(x) has.OHLCV(x, which = FALSE)

is.HLC(x) has.HLC(x, which = FALSE)

is.HL(x) has.HL(x, which = FALSE)

has.Op(x, which = FALSE) has.Hi(x, which = FALSE) has.Lo(x, which = FALSE) has.Cl(x, which = FALSE) has.Vo(x, which = FALSE) has.Ad(x, which = FALSE)

is.BBO(x) is.TBBO(x)

has.Ask(x, which = FALSE) has.Bid(x, which = FALSE) has.Price(x, which = FALSE) has.Qty(x, which = FALSE) has.Trade(x, which = FALSE)

Value

A logical value indicating success or failure by default.

If which = TRUE, a numeric value representing the column position will be returned.

is.OHLC, is.HL, and is.HLC return a single logical value, either TRUE or FALSE.

Arguments

x

data object

which

display position of match

Author

Jeffrey A. Ryan

Details

Mostly used internally by quantmod, they can be useful for checking whether an object can be used in OHLC requiring functions like Op, OpCl, etc.

Columns names must contain the full description of data, that is, Open, High, Low, Close, Volume or Adjusted. Abbreviations will return FALSE (or NA when which = TRUE). See quantmod.OHLC for details of quantmod naming conventions.

The "is" functions only return TRUE when the objects has the relevant column names:

  • is.HL: High, Low

  • is.HLC: High, Low, Close

  • is.OHLC: Open, High, Low, Close

The search for relevant column names is not case sensitive. Any additional columns in the object does not affect the return value.

See Also

quantmod.OHLC,OHLC.Transformations

Examples

Run this code
if (FALSE) {
getSymbols("YHOO")

is.OHLC(YHOO)
has.OHLC(YHOO)

has.Ad(YHOO)

}

Run the code above in your browser using DataLab