||Blotter provides transaction infrastructure for defining instruments, transactions, portfolios and accounts for trading systems and simulation. Eventually, it will provide portfolio support for multi-asset class and multi-currency portfolios - but first things first.
This version of blotter serves only as a proof-of-concept for P&L calculation on a set of trades in a portfolio of several instruments. This 0.3 release is carefully scoped to remain simple and understandable.
As a prototype, this version works under the following assumptions:
* The instrument has a contract multiplier of 1, such as a stock
* Uses average cost accounting to calculate P&L. The model can be extended to FIFO if tax efficiency or other conditions are important, but FIFO is considered out of scope for this release.
* The code is unaware of the instrument being used, and will be extended to accommodate an architecture for including contract specifications.
* The code does not test for short covering or long sales that would take the resulting position through zero (from a positive position to a negative position or vice versa). Such transactions will result in incorrect realized gains or losses. We need to add a test and decide whether to break the trade up.
* No multi-currency support. This is also better done through an instrument class.
* One trade per day. Extending to support multiple trades per day is likely in the next release, see comments in updateEq().
* No margin support. Again, this will be instrument specific.
The model presented here, however, is extensible to cover the limitations of this release.