Learn R Programming

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

highfrequency (version 0.6.3)

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,607

Version

0.6.3

License

GPL (>= 2)

Maintainer

Kris Boudt

Last Published

January 15th, 2020

Functions in highfrequency (0.6.3)

JOjumptest

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

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

Calculate the realized tripower quarticity
SP500RM

SP500 Realized Measures calculated with 5 minute sampling
aggregatePrice

Aggregate a time series but keep first and last observation
autoSelectExchangeQuotes

Retain only data from the stock exchange with the highest volume
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.
exchangeHoursOnly

Extract data from an xts object for the Exchange Hours Only
getPrice

Get price column(s) from a timeseries
RV

An estimator of realized variance.
autoSelectExchangeTrades

etain only data from the stock exchange with the highest trading volume
medRV

medRV
medRQ

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

Match trade and quote data
makeReturns

Compute log returns
minRQ

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

Aggregate a time series
aggregateTrades

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

Realized Covariance: Average Subsample
rBPCov

Realized BiPower Covariance
harModel

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

Merge multiple transactions with the same time stamp
ivInference

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

Realized semivariance of highfrequency return series.
getTradeDirection

Get trade direction
rHYCov

Hayashi-Yoshida Covariance
minRV

minRV
lltc

LLTC Data
sample_5minprices_jumps

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

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

Delete the observations where the bid or ask is zero
rQuar

Realized quarticity of highfrequency return series.
hasQty

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

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

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

HEAVY Model estimation
mukp

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

highfrequency: Tools for Highfrequency Data Analysis
noZeroPrices

Delete the observations where the price is zero
rCov

Realized Covariance
rThresholdCov

Threshold Covariance
rRTSCov

Robust two time scale covariance estimation
realized_library

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

Realized Covariance: Kernel
sample_qdata_microseconds

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

Available Kernels
sample_returns_5min

Sample returns data
sample_tdata

Sample of cleaned trades for stock XXX for 1 day
rmTradeOutliersUsingQuotes

Delete transactions with unlikely transaction prices
refreshTime

Synchronize (multiple) irregular timeseries by refresh time
rmTradeOutliers

Delete transactions with unlikely transaction prices
sample_tdata_microseconds

Sample of cleaned trades for stock XXX for 2 days
rTPVar

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

Merge multiple quote entries with the same time stamp
rmNegativeSpread

Delete entries for which the spread is negative
rKurt

Realized kurtosis of highfrequency return series.
rMPV

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

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

Sample of raw quotes for stock XXX for 1 day
sample_tdataraw_microseconds

Sample of raw trades for stock XXX for 2 days
sbux

Starbucks Data
sample_qdataraw_microseconds

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

Sample of imaginary price data for 61 days
spotvol

Spot volatility estimation
rTSCov

Two time scale covariance estimation
sample_5minprices

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

Perform a final cleaning procedure on trade data
salesCondition

Delete entries with abnormal Sale Condition.
rOWCov

Realized Outlyingness Weighted Covariance
sample_tdataraw

Sample of raw trades for stock XXX for 1 day
rQPVar

Realized quad-power variation of highfrequency return series.
selectExchange

Retain only data from a single stock exchange
sample_qdata

Sample of cleaned quotes for stock XXX for 1 day
quotesCleanup

Cleans quote data
tradesCleanup

Cleans trade data
rSkew

Realized skewness of highfrequency return series.
spotDrift

Spot Drift Estimation
MRC

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

Barndorff-Nielsen and Shephard (2006) tests for the presence of jumps in the price series.
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))
aggregateQuotes

Aggregate a data.table or xts object containing quote data