blotter
blotter copied to clipboard
Refactor perTradeStats and error handle scenario where timespan is length 1 (buy and sell txn on same timestamp)
It is possible there is a round turn trade with buy and sell transactions occurring on the same whole second timestamp. Not sure about microseconds...should be rare if possible.
This feature request is about handling the error by giving the user an appropriate message if the condition is triggered.
I think the fix might be better done in addTxns than in perTradeStats.
make.index.unique in xts was created in part for this exact problem, to ensure strict time ordering of transactions even when timestamp frequency isn't high enough to keep things separated.