# bid/ask spread.
spread <- with(lob.data, getSpread(depth.summary))
## Not run:
#
# # plot all depth levels, rescaling the volume by 10^-8.
# # produce 2 plots side-by-side: second plot contains depth levels with > 50
# # units of volume.
# p1 <- with(lob.data, plotPriceLevels(depth, spread,
# col.bias=0.1,
# volume.scale=10^-8))
# p2 <- with(lob.data, plotPriceLevels(depth, spread,
# col.bias=0.1,
# volume.scale=10^-8,
# volume.from=50))
# library(grid)
# pushViewport(viewport(layout=grid.layout(1, 2)))
# print(p1, vp=viewport(layout.pos.row=1, layout.pos.col=1))
# print(p2, vp=viewport(layout.pos.row=1, layout.pos.col=2))
# ## End(Not run)
# zoom into 1 hour of activity, show the spread and directional trades.
with(lob.data, plotPriceLevels(depth, spread, trades,
start.time=as.POSIXct("2015-05-01 03:25:00.000", tz="UTC"),
end.time=as.POSIXct("2015-05-01 04:25:00.000", tz="UTC"),
volume.scale=10^-8))
# zoom in to 15 minutes of activity, show the bid/ask midprice.
with(lob.data, plotPriceLevels(depth, spread,
show.mp=FALSE,
start.time=as.POSIXct("2015-05-01 03:30:00.000", tz="UTC"),
end.time=as.POSIXct("2015-05-01 03:45:00.000", tz="UTC")))
Run the code above in your browser using DataLab