orderbook-class: Class "orderbook"

Description Objects from the class Slots Methods Examples

Description

Functions for manipulating and extractiong information from an orderbook

Objects from the class

Objects can be created by calls to the function orderbook

Slots

current.ob:

A data frame containing the current state of the orderbook.

current.time:

A numeric value in milliseconds after midnight that indicates the time of current.ob.

file:

A character string which specifies the location of the file containing the data file.

file.index:

A numeric value that indicates the current row number of the input file.

ob.data:

A hash that contains all orders currently in the orderbook. Essentially the same as current.ob, but a different data structure.

trade.data:

A vector that contains data on all trades that occurred before current.time.

trader:

A logical indicating whether the order book should expect data with user orders and trades marked.

Methods

show

signature(object = "orderbook"): Prints the variables used in the orderbook

best.bid

signature(object = "orderbook"): Returns the current best bid.

best.ask

signature(object = "orderbook"): Returns the current best ask.

summary

signature(object="orderbook"): Prints a summary of the orderbook

[

signature(x = "orderbook", i = "character"): Prints the orders at that price level.

copy

signature(x = "orderbook"): Creates a copy of the orderbook.

get.order.info

signature(object = "orderbook"): Returns the price and size of the order with the specified ID.

display

signature(object="orderbook"): Prints the state of the orderbook. The result is similar to plot

bid.price.levels

signature(object="orderbook"): Returns the number of bid price levels.

ask.price.levels

signature(object="orderbook"): Returns the number of ask price levels.

total.price.levels

signature(object="orderbook"): Returns the total number of price levels.

bid.orders

signature(object="orderbook"): Returns the number of bids.

ask.orders

signature(object="orderbook"): Returns the number of asks.

total.orders

signature(object="orderbook"): Returns the total number of orders.

mid.point

signature(object="orderbook"): Returns the midpoint between the best ask and the best bid.

inside.market

signature(object="orderbook"): Returns a data frame with a row for the best ask and a row for the best bid. The columns are price, size, and type.

spread

signature(object="orderbook"): Returns the spread between the best ask and best bid .

reset

signature(object="orderbook"): Reset the orderbook to its initial state.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(orderbook)

filename <- system.file("extdata", "sample.txt",
                        package = "orderbook")

ob <- orderbook(file = filename)
ob <- read.orders(ob, 500)

show(ob)
summary(ob)
display(ob)

orderbook documentation built on May 30, 2017, 3:15 a.m.

Search within the orderbook package
Search all R packages, documentation and source code