matchTrades {obAnalytics} | R Documentation |
Construct trades data.table.
Description
Given event data which has been pre-matched with maker/taker event ids, this function will return a data.table containing all matched executions.
Usage
matchTrades(events)
Arguments
events |
Limit order event data with assigned maker/taker event ids. |
Value
A data.frame describing marketable order executions of the following form:
- timestamp
min(maker timestamp, taker timestamp) (first time we learned of this trade)
- price
Maker price (taker limit price can cross the book.)
- volume
Lifted/traded volume
- direction
Trade direction (side of the aggressor/taker)
- maker.event.id
event.id corresponding to row in events data
- taker.event.id
event.id corresponding to tow in events data
- maker
Maker limit order id
- taker
Taker limit order id
A market limit order (marketable) is first a taker and then becomes a maker after landing in the order book before it's limit is reached.
A market order is always a taker: it's volume will be filled before it's limit is reached.
Grouping executions by maker/taker can be used to analyse market impact events.
Author(s)
phil
Examples
## Not run:
csv.file <- system.file("extdata", "orders.csv.xz", package="obAnalytics")
events <- loadEventData(csv.file)
events <- eventMatch(events)
trades <- matchTrades(events)
## End(Not run)