view.trade: view.trade

Description Usage Arguments Details Value Examples

Description

View the orderbook object when a particular trade happens.

Usage

1
2
3
4
view.trade(object, tradenum)
next.trade(object)
previous.trade(object)
midpoint.return(object, tradenum, time)

Arguments

object

Object of class orderbook

tradenum

the trade we want to view.

time

Specifies the number of seconds after the trade to calculate the midpoint return for. Can also be a vector of times.

Details

The orderbook object internally keeps track of the the trades it has read from the data file. The view.trade function returns information about the nth trade. This function can only view trades that occurred prior to the current order.book time.

previous.trade sets the state of the orderbook to the first trade to have happened before the current time. next.trade sets the state to the orderbook at the very next trade to have happened after the current time.

midpoint.return calculates the midpoint return for a trade a specified number of seconds into the future.

Value

Return an object of class orderbook. view.trade and midpoint.return print information to the terminal about the trade and midpoint return, respectively.

Examples

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

ob <- orderbook(file = filename)
ob <- next.trade(ob)
view.trade(ob, 1)
midpoint.return(ob, 1, c(5, 10))

Example output

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

Loading required package: grid
       trade 1
row         24
time  12:29:13
id      265397
price    11.54
size       300
          midpoint.return
5 second             0.03
10 second            0.03

orderbook documentation built on May 2, 2019, 12:19 p.m.