This installment of the Spartan Trader builds several additional metrics (TPV, TaTPV, TE, TE%...) and adds options trading functionality, except for the computation of delta and the margin after transaction. Implement Buy, Sell, SellShort, X-Put and X-Call.
This vLab shows a demo and comments on the code. As always, some work is left to you.
This and all other Spartan Trader homework is cumulative, which means that it needs to do everything that the previous homework did, plus the new functionality.
NOTE: the video has a bug. The margin number is not computed correctly: rather than sum(short positions in AP) + sum(short positions in IP), it computes instead sum(shorts in AP) + sum(shorts in AP). There is however no errors in the code shown. The mistake was in one of the procedures left for you to develop.