Description Usage Arguments Details Value Examples
Perform OHLC and VWAP on tick trades.
1 |
x |
data.table of tick trades, columns: date, price, amount, tid, type. |
units |
time units period to aggregate. |
trunc_ceiling |
character, default trunc, also possible ceiling. |
Rows where amount==0
(normally should not happened) should be filtered before passing the tick data to the function.
data.table aggregated to specified time units, price column is VWAP.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | suppressPackageStartupMessages(library(dwtools))
# populate tick data
suppressPackageStartupMessages(library(Rbitcoin))
tick = market.api.process("hitbtc",c("BTC","USD"),"trades")[["trades"]]
print(tick)
# ohlc + vwap
DT = vwap(tick, "30 mins")
print(DT)
# same with timing
DT = timing(vwap(tick, "30 mins"), nrow(tick))
get.timing()
# ohlc + vwap, aggregate using ceiling
DT = vwap(tick, "30 mins", "ceiling")
print(DT)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.