- Provide working source code that will :-
a. For a given stock,
- Given any price as input, calculate the dividend yield
- Given any price as input, calculate the P/E Ratio
- Record a trade, with timestamp, quantity of shares, buy or sell indicator and traded price
- Calculate Volume Weighted Stock Price based on trades in past 15 minutes
- Calculate the GBCE All Share Index using the geometric mean of prices for all stocks
- Source code in this project is written in C++ and follows C++11 standard.
- Developed and tested in Microsoft Visual Studio 15 2017 Win64.
- In this program, I assume that price of each stock used to calculate the GBCE All Share Index comes from the volume-weighted stock price on trades in past 15 minutes.
- Since there are no requirements for the precision scale and the boundary of stock price, I decide to use Double to store the value and the output of calculated price is not scaled.
- It is assumed that all the input value is in a correct formats, e.g. stock price is a positive number.
- Example of function calling is provided in the main class.
- the StockExchange class is a service for performing all tasks provided in this project.ห
This work is produced by Krittaboon Tantikarun as part of application to JP Morgan Chase & Co.