position(amount = c(1, 1, -1, 3, -4),
timestamp = 1:5, when = 4.9)
## using a journal
J <- journal(timestamp = 1:5, amount = c(1, 1, -1, 3, -4))
position(J, when = 4.9)
## 'declaring' a position, using named amounts
amount <- c(1, 1, 1)
instrument <- c("A", "A", "B")
position(amount = amount, instrument = instrument)
## .... or equivalently
amount <- c(A = 2, B = 1)
position(amount)
## ignore names of amount
position(amount, use.names = FALSE)
Run the code above in your browser using DataLab