Learn R Programming

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

highfrequency (version 0.7.0.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,788

Version

0.7.0.1

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

September 28th, 2020

Functions in highfrequency (0.7.0.1)

BNSjumpTest

Barndorff-Nielsen and Shephard (2006) 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.
highfrequency-package

highfrequency: Tools for Highfrequency Data Analysis
intradayJumpTest

Intraday jump tests
ReMeDI

ReMeDI This function estimates the auto-covariance of market-microstructure noise
RTQ

Calculate the realized tripower quarticity
aggregateQuotes

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

Aggregate a time series
RV

An estimator of realized variance.
TSCov_bi

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

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

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

Get high frequency data from Alpha Vantage
exchangeHoursOnly

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

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

Get trade direction
makeReturns

Compute log returns
MRC

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

Merge multiple transactions with the same time stamp
quotesCleanup

Cleans quote data
makePsd

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

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

Aggregate a time series but keep first and last observation
HEAVYmodel

HEAVY Model estimation
rankJumpTest

Rank jump test
rSemiCov

Realized Semicovariance
rAVGCov

Realized Covariance: Average Subsample
rSV

Realized semivariance of highfrequency return series.
aggregateTrades

Aggregate a data.table or xts object containing trades 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.
autoSelectExchangeQuotes

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

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

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

Sample of imaginary price data for 61 days
leadLag

Lead-Lag estimation
listCholCovEstimators

Utility function listing the available estimators for the CholCov estimation
listAvailableKernels

Available Kernels
spotVol

Spot volatility estimation
noZeroPrices

Delete the observations where the price is zero
getPrice

Get price column(s) from a timeseries
autoSelectExchangeTrades

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

Match trade and quote data
medRQ

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

Business time aggregation
mukp

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

LLTC Data
minRV

minRV
SP500RM

SP500 Realized Measures calculated with 5 minute sampling
rBPCov

Realized BiPower Covariance
noZeroQuotes

Delete the observations where the bid or ask is zero
rOWCov

Realized Outlyingness Weighted Covariance
rKurt

Realized kurtosis of highfrequency return series.
rHYCov

Hayashi-Yoshida Covariance
rMPV

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

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

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

Synchronize (multiple) irregular timeseries by refresh time
rKernelCov

Realized Covariance: Kernel
tradesCleanup

Cleans trade data
rmNegativeSpread

Delete entries for which the spread is negative
knChooseReMeDI

ReMeDI tuning parameter function to choose the tuning parameter, kn in ReMeDI estimation
medRV

medRV
rmLargeSpread

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

Delete transactions with unlikely transaction prices
tradesCleanupUsingQuotes

Perform a final cleaning procedure on trade data
rmOutliersQuotes

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

Realized quad-power variation of highfrequency return series.
sampleQDataMicroseconds

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

Sample of raw quotes for stock XXX for 1 day
sampleReturns5Min

Sample returns data
rSkew

Realized skewness of highfrequency return series.
rCholCov

rCholCov positive semi-definite covariance estimation using the CholCov algorithm
rmTradeOutliersUsingQuotes

Delete transactions with unlikely transaction prices
mergeQuotesSameTimestamp

Merge multiple quote entries with the same time stamp
sampleTData

Sample of cleaned trades for stock XXX for 1 day
rCov

Realized Covariance
sampleTDataMicroseconds

Sample of cleaned trades for stock XXX for 2 days
rRTSCov

Robust two time scale covariance estimation
rTSCov

Two time scale covariance estimation
rQuar

Realized quarticity of highfrequency return series.
sample5MinPricesJumps

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

Sample of raw trades for stock XXX for 1 day
sampleQData

Sample of cleaned quotes for stock XXX for 1 day
rThresholdCov

Threshold Covariance
selectExchange

Retain only data from a single stock exchange
spotDrift

Spot Drift Estimation
rTPVar

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

Delete entries with abnormal Sale Condition.
sample5MinPrices

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

Sample of raw trades for stock XXX for 2 days
sbux

Starbucks Data