computeDurations {ACDm} | R Documentation |
Durations computation
Description
Computes durations from a data.frame containing the time stamps of transactions. Trade durations, price durations and volume durations can be computed (if the appropriate data columns are given).
Usage
computeDurations(transactions, open = "10:00:00", close = "18:25:00",
rm0dur = TRUE, type = "trade", priceDiff = .1, cumVol = 10000)
Arguments
transactions |
a data.frame with, at least, transaction time in a column named 'time' (see Details) |
open |
the opening time of the exchange. Transactions done outside the trading hours will be ignored. |
close |
the closing time of the exchange. |
rm0dur |
if |
type |
the type of durations to be computed. Either "trade", "price", or "volume". |
priceDiff |
only if |
cumVol |
only if |
Details
The data.frame must include a column named 'time' with the time of each transaction, in a time format recognizable by POSIXlt or strings in format "yyyy-mm-dd hh:mm:ss". If the column 'price' or 'volume' is included its also possible to compute price- and volume durations (see arguments priceDiff
and cumVol
)
Value
a data.frame with columns:
time |
the calander time of the start of each duration spell. |
price |
the volume weighted avrage price of the shares traded during the spell of the duration. |
volume |
the volume (total shares traded) during the duration spell. |
Ntrans |
number of transactions done during the spell. |
durations |
the computed duration. |
Author(s)
Markus Belfrage
Examples
## Not run:
#only the first 3 days of data:
durDataShort <- computeDurations(transData[1:56700, ])
str(durDataShort)
head(durDataShort)
## End(Not run)