obAnalytics-package: obAnalytics.

Description Main functionality Data processing Visualisation Analysis Author(s) References

Description

Limit order book analytics.

Main functionality

Data processing

The main focus of this package is reconstruction of a limit order book. The processData function will perform data processing based on a supplied CSV file, the schema of which is defined in the processData function documentation. Example preprocessed limit order data are also provided (see lob.data) which has been derived from the example raw data provided the inst/extdata directory.

The data processing consists of a number of stages:

Limit order events are related to one another by volume deltas (the change in volume for a limit order). To simulate a matching-engine, and thus determine directional trade data, volume deltas from both sides of the limit order book are ordered by time, yielding a sequence alignment problem, to which the the Needleman-Wunsch algorithm has been applied.

Visualisation

The package provides a number of functions for the visualisation of limit order events and order book liquidity. The visualisations all make use of the ggplot2 plotting system:

plotTimeSeries

General time series plotting.

plotTrades

Plot trades data.

plotCurrentDepth

Visualise the shape of an orderBook.

plotPriceLevels

Visualise volume by price level through time.

plotVolumePercentiles

Visualise order book liquidity through time.

plotEventMap

Visualise sequential limit order events by price level.

plotVolumeMap

Visualise sequential limit order events by volume.

plotEventsHistogram

Convenience function.

The plotPriceLevels visualisation is designed to show the ebb and flow of limit order volume at all price levels including the interplay between the bid/ask spread. It is possible to identify interesting market participant behaviour and to visualise market shocks and resilience with this function.

The plotEventMap function is useful for studying systematic market participant behaviour. Interesting sequential patterns can be observed in this visualisation as algorithms react to various market events by repositioning orders.

The plotVolumeMap function shows a visualisation of cancelled volume through time. It is possible to identify and filter out individual trading algorithms from this graph.

The plotVolumePercentiles visualisation is inspired by the size map chart included in many articles from Nanex research and is intended to show available market liquidity.

In all visualisations it is possible to filter the data by time, price and volume.

Analysis

In addition to the generated lob.data which are intended to be used as a basis for further research, the package currently provides a limited set of trade and order book analysis functions:

filterDepth

Filter depth data by time period.

getSpread

Extract the bid/ask quotes from the depth.summary data.

orderBook

Reconstruct a Limit order book from events data.

tradeImpacts

Group trades into individual impact events.

Additional functionality will be added to the package in the future.

Author(s)

Philip Stubbings phil@parasec.net

References

http://parasec.net/transmission/order-book-visualisation


obAnalytics documentation built on May 1, 2019, 7:04 p.m.