Learn R Programming

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

highfrequency (version 0.6.1)

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

Version

0.6.1

License

GPL (>= 2)

Maintainer

Kris Boudt

Last Published

August 29th, 2019

Functions in highfrequency (0.6.1)

aggregateQuotes

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

An estimator of realized variance.
AJjumptest

Ait-Sahalia and Jacod (2009) 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))
BNSjumptest

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

Calculate the realized tripower quarticity
aggregatePrice

Aggregate a time series but keep first and last observation
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.
getPrice

Get price column(s) from a timeseries
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.
mergeTradesSameTimestamp

Merge multiple transactions with the same time stamp
matchTradesQuotes

Match trade and quote data
makeReturns

Compute log returns
exchangeHoursOnly

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

Merge multiple quote entries with the same time stamp
autoSelectExchangeQuotes

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

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

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

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

Get trade direction
rOWCov

Realized Outlyingness Weighted Covariance
minRQ

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

Realized quad-power variation of highfrequency return series.
medRV

medRV
minRV

minRV
rTPVar

Realized tri-power variation of highfrequency return series.
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
lltc

LLTC Data
rTSCov

Two time scale covariance estimation
rHYCov

Hayashi-Yoshida Covariance
hasQty

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

Realized kurtosis of highfrequency return series.
quotesCleanup

Cleans quote data
rMPV

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

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

Threshold Covariance
rKernelCov

Realized Covariance: Kernel
realized_library

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

Available Kernels
rmTradeOutliersUsingQuotes

Delete transactions with unlikely transaction prices
sample_tdata

Sample of cleaned trades for stock XXX for 1 day
sample_returns_5min

Sample returns data
rmTradeOutliers

Delete transactions with unlikely transaction prices
aggregateTrades

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

Realized semivariance of highfrequency return series.
rSkew

Realized skewness of highfrequency return series.
sample_tdataraw

Sample of raw trades for stock XXX for 1 day
sample_tdata_microseconds

Sample of cleaned trades for stock XXX for 2 days
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
sample_qdata

Sample of cleaned quotes for stock XXX for 1 day
sample_5minprices_jumps

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

Sample of raw trades for stock XXX for 2 days
rBPCov

Realized BiPower Covariance
rRTSCov

Robust two time scale covariance estimation
rAVGCov

Realized Covariance: Average Subsample
rQuar

Realized quarticity of highfrequency return series.
rmOutliersQuotes

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

Delete entries for which the spread is negative
sample_5minprices

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

Delete entries with abnormal Sale Condition.
aggregatets

Aggregate a time series
selectExchange

Retain only data from a single stock exchange
highfrequency-package

highfrequency: Tools for Highfrequency Data Analysis
heavyModel

HEAVY Model estimation
spotDrift

Spot Drift Estimation
sbux

Starbucks Data
tradesCleanupUsingQuotes

Perform a final cleaning procedure on trade data
noZeroPrices

Delete the observations where the price is zero
mukp

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

Realized Covariance
rmLargeSpread

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

Sample of raw quotes for stock XXX for 1 day
tradesCleanup

Cleans trade data
sample_qdata_microseconds

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

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

Spot volatility estimation
refreshTime

Synchronize (multiple) irregular timeseries by refresh time