plot: plot

Description Usage Arguments Details Value Examples

Description

Plotting the orderbook.

Usage

1
2
## S4 method for signature 'orderbook'
plot(x, bounds = 0.1, n = 10, type = "n")

Arguments

x

Object of class orderbook

bounds

Percentage above and below the midpoint to determine the y limits.

n

Number of price levels to plot.

type

Either "n", "sd", "o", or "s".

Details

This function plots the orderbook. n is only needed for type = "s", which plots the best bid vs. the best ask, and then the second best bid vs. the second best ask, for n bids and asks. If type = "n" then the orderbook will be plotted with price levels on the y-axis, and size on the x-axis. type = "o" is similar, except the number of orders for each price level are plotted. type = "sd" makes a plot that shows the supply and demand curves of the order book.

Value

Prints a Trellis object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(orderbook)
filename <- system.file("extdata", "sample.txt",
                        package = "orderbook")

ob <- orderbook(file = filename)
ob <- read.orders(ob, n = 1000)
plot(ob)
plot(ob, type = "o")
plot(ob, type = "sd")
plot(ob, type = "s")

Example output

Loading required package: lattice
Loading required package: hash
hash-3.0.1 provided by Decision Patterns

Loading required package: grid

orderbook documentation built on May 2, 2019, 6:11 p.m.