Pricing Models & Design Patterns

As part of Design Patterns and Derivatives Pricing coursework, I was tasked with using Design Patterns to price financial securities and process market orders. This was fairly rudimentary as far as the financial aspects are concerned, i.e. there wasn’t large throughput and multithreading wasn’t discussed in depth. The items below are a showcase of several of the assignments from that course.

StockQuotelink

This was the second assignment. We were tasked with taking user input for 10 securities. Among the information was bid, ask and last price.
Then this was outputted back to the screen. The point of this early assignment was to under user input (via cin), output (via cout) and getting used to the idea of user generated data structure, as showcased by the struct useage.

PolyOption link

This was the third assignment. This started to introduce concepts of object oriented programming, specifically inheritence with the Instrument class and Stock / Option derived classes. Within the main program there is a showcase of polymorphism where pointers of the Instrument class are assigned to reference of Option and Stock instances

Option opt;
Stock stk;
Instrument * instru1 = &opt;
Instrument * instru2 = &stk;

InstrumentMap link

This assignment introduced the associative container of C++ std library maps. The key value pair of the map contained a string (for either the Stock or Option derived class) and then a std library vector to hold the various Stocks and Options.

Binary Power link
This was the point where we started to do some option pricing using design patterns. The Logger class is based off a Singleton design pattern, as we only need one instance. The Option class uses a bridge design pattern to handle of the PayOff of the Option.

Order Book link
This was the midterm assignment. Input was given via a CSV file and we were tasked with applying object oriented principles in processing it. The end result was to give a list of orders which was executed based on the input. I created an Order class and used a vector to maintain state.

Bridge Order Book link
After the Order Book project, this was the next extension. We were assigned to use the Bridge design pattern principle from the Binary Power project and to reimplement the Order Book project using it.