inst/tinytest/test_pl_along.timestamp.R

## timestamps passed via 'along.timestamp' get sorted

ans <- pl(amount = c(1, -1),
          timestamp = c(2, 3),
          price = c(1, 2),
          along.timestamp = 3:1,
          vprice = 1:3)

expect_equal(ans[[1]]$timestamp , 1:3)

expect_equal(unname(ans[[1]]$pl), c(0,1,1))

Try the PMwR package in your browser

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

PMwR documentation built on Oct. 19, 2023, 9:09 a.m.