Learn R Programming

⚠️There's a newer version (1.0.1) of this package.Take me there.

highfrequency (version 0.6.4)

Tools for Highfrequency Data Analysis

Description

Provide functionality to manage, clean and match highfrequency trades and quotes data, calculate various liquidity measures, estimate and forecast volatility, detect price jumps and investigate microstructure noise and intraday periodicity.

Copy Link

Version

Install

install.packages('highfrequency')

Monthly Downloads

1,419

Version

0.6.4

License

GPL (>= 2)

Maintainer

Kris Boudt

Last Published

February 26th, 2020

Functions in highfrequency (0.6.4)

harModel

HAR model estimation (Heterogeneous Autoregressive model for Realized volatility)
hasQty

Check for Trade, Bid, and Ask/Offer (BBO/TBBO), Quantity, and Price data
autoSelectExchangeQuotes

Retain only data from the stock exchange with the highest volume
noZeroQuotes

Delete the observations where the bid or ask is zero
listAvailableKernels

Available Kernels
getPrice

Get price column(s) from a timeseries
aggregateQuotes

Aggregate a data.table or xts object containing quote data
aggregateTrades

Aggregate a data.table or xts object containing trades data
heavyModel

HEAVY Model estimation
aggregatets

Aggregate a time series
rCov

Realized Covariance
aggregatePrice

Aggregate a time series but keep first and last observation
quotesCleanup

Cleans quote data
medRV

medRV
tradesCleanupUsingQuotes

Perform a final cleaning procedure on trade data
getLiquidityMeasures

Compute Liquidity Measure Function returns an xts or data.table object containing 23 liquidity measures. Please see details below. Note that this assumes a regular time grid. The Lee + Ready measure uses two lags for the Tick Rule.
ivInference

Function returns the value, the standard error and the confidence band of the integrated variance (IV) estimator.
minRQ

An estimator of integrated quarticity from applying the minimum operator on blocks of two returns.
makePsd

Returns the positive semidinite projection of a symmetric matrix using the eigenvalue method
medRQ

An estimator of integrated quarticity from applying the median operator on blocks of three returns.
autoSelectExchangeTrades

Retain only data from the stock exchange with the highest trading volume
getTradeDirection

Get trade direction
highfrequency-package

highfrequency: Tools for Highfrequency Data Analysis
rMPV

Realized multipower variation (MPV), an estimator of integrated power variation.
makeReturns

Compute log returns
rRTSCov

Robust two time scale covariance estimation
rOWCov

Realized Outlyingness Weighted Covariance
lltc

LLTC Data
rBeta

Realized beta: a tool in measuring risk with respect to the market.
mergeTradesSameTimestamp

Merge multiple transactions with the same time stamp
rThresholdCov

Threshold Covariance
matchTradesQuotes

Match trade and quote data
rQuar

Realized quarticity of highfrequency return series.
mergeQuotesSameTimestamp

Merge multiple quote entries with the same time stamp
rmNegativeSpread

Delete entries for which the spread is negative
realized_library

The realized library from the Oxford-Man Institute of Quantitative Finance
rBPCov

Realized BiPower Covariance
minRV

minRV
sample_qdataraw

Sample of raw quotes for stock XXX for 1 day
sample_tdataraw

Sample of raw trades for stock XXX for 1 day
rKurt

Realized kurtosis of highfrequency return series.
rSkew

Realized skewness of highfrequency return series.
rSV

Realized semivariance of highfrequency return series.
sample_5minprices_jumps

Ten artificial time series (including jumps) for the NYSE trading days during January 2010
sample_qdata

Sample of cleaned quotes for stock XXX for 1 day
mukp

## mukp: to use when p,k different from range [4,6]
noZeroPrices

Delete the observations where the price is zero
rHYCov

Hayashi-Yoshida Covariance
spotvol

Spot volatility estimation
rQPVar

Realized quad-power variation of highfrequency return series.
sample_tdata_microseconds

Sample of cleaned trades for stock XXX for 2 days
rKernelCov

Realized Covariance: Kernel
rAVGCov

Realized Covariance: Average Subsample
rmTradeOutliers

Delete transactions with unlikely transaction prices
rmLargeSpread

Delete entries for which the spread is more than "maxi" times the median spread
rTPVar

Realized tri-power variation estimator of quarticity for a highfrequency return series.
sample_qdata_microseconds

Sample of cleaned quotes for stock XXX for 2 days measured in microseconds
selectExchange

Retain only data from a single stock exchange
rmTradeOutliersUsingQuotes

Delete transactions with unlikely transaction prices
spotDrift

Spot Drift Estimation
rTSCov

Two time scale covariance estimation
refreshTime

Synchronize (multiple) irregular timeseries by refresh time
sample_tdataraw_microseconds

Sample of raw trades for stock XXX for 2 days
sample_5minprices

Ten artificial time series for the NYSE trading days during January 2010
tradesCleanup

Cleans trade data
sample_qdataraw_microseconds

Sample of raw quotes for stock XXX for 2 days measured in microseconds
rmOutliersQuotes

Delete entries for which the mid-quote is outlying with respect to surrounding entries
salesCondition

Delete entries with abnormal Sale Condition.
sample_real5minprices

Sample of imaginary price data for 61 days
sbux

Starbucks Data
sample_returns_5min

Sample returns data
sample_tdata

Sample of cleaned trades for stock XXX for 1 day
JOjumptest

Jiang and Oomen (2008) tests for the presence of jumps in the price series.
MRC

Modulated Realized Covariance (MRC): Return univariate or multivariate preaveraged estimator.
RTQ

Calculate the realized tripower quarticity
RV

An estimator of realized variance.
AJjumptest

Ait-Sahalia and Jacod (2009) tests for the presence of jumps in the price series.
BNSjumptest

Barndorff-Nielsen and Shephard (2006) tests for the presence of jumps in the price series.
SP500RM

SP500 Realized Measures calculated with 5 minute sampling
TSCov_bi

rvKernel <- function(x, # Tick Data kernel.type = "rectangular", # Kernel name (or number) kernel.param = 1, # Kernel parameter (usually lags) kernel.dofadj = TRUE, # Kernel Degree of freedom adjustment align.by = "seconds", # Align the tick data to [seconds|minutes|hours] align.period = 1) # Align the tick data to this many [seconds|minutes|hours] # Multiday adjustment: multixts <- multixts(x) if (multixts == TRUE) result <- apply.daily(x, rv.kernel,kernel.type,kernel.param,kernel.dofadj, align.by, align.period, cts, makeReturns) return(result) else #Daily estimation: align.period <- .getAlignPeriod(align.period, align.by) cdata <- .convertData(x, cts = cts, makeReturns = makeReturns) x <- cdata$data x <- .alignReturns(x, align.period) type <- kernelCharToInt(kernel.type) kernelEstimator(as.double(x), as.double(x), as.integer(length(x)), as.integer(kernel.param), as.integer(ifelse(kernel.dofadj, 1, 0)), as.integer(type), ab = double(kernel.param + 1), ab2 = double(kernel.param + 1))
exchangeHoursOnly

Extract data from an xts object for the Exchange Hours Only