closest_market_price {dispositionEffect}R Documentation

Closest market price

Description

Find the market price closest to a certain datetime and for specific assets.

Usage

closest_market_price(
  asset,
  datetime,
  market_prices,
  price_only = FALSE,
  exact = FALSE,
  substitute_datetime = FALSE
)

Arguments

asset

Character vector of assets' names to look for.

datetime

POSIXct of the datetime at which looking for the asset's price.

market_prices

Data frame containing the market prices.

price_only

Logical. If TRUE then only the price is returned.

exact

Logical. If TRUE then it looks for market prices at the same datetime only, otherwise it looks for the nearest before the datetime.

substitute_datetime

Logical. If TRUE the datetime is substituted with the datetime argument.

Value

The data frame of closest market prices.

See Also

evaluate, lubridate::round_date


[Package dispositionEffect version 1.0.1 Index]