tests/next.previous.trade.test.R

library(orderbook)

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

ob <- orderbook(file = filename)
ob <- read.orders(ob, 5000)
ob <- next.trade(ob)

## Next trade

stopifnot(isTRUE(identical(5045, ob@file.index)))

## Trade after

ob <- next.trade(ob)

stopifnot(isTRUE(identical(5047, ob@file.index)))

## Trade before

ob <- previous.trade(ob)

stopifnot(isTRUE(identical(5045, ob@file.index)))

## Trade before

ob <- previous.trade(ob)

stopifnot(isTRUE(identical(4994, ob@file.index)))

Try the orderbook package in your browser

Any scripts or data that you put into this service are public.

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