Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CPT206 Computer Programming for Financial Mathematics:

Coursework Resit Task Specification

2022

1    Program description (65 marks)

The aim of this coursework is to build a stock portfolio management system. All the work should be coded into a single Java NetBeans project, with the class structure and different functionalities of the program described as follows.  All classes should be properly encapsulated, as seen in the Lectures and Labs throughout the semester. Your project should also contain a Controller class for testing.

1.1    StockOption class (10 marks)

The basic building block of the program will be a  StockOption class.   A StockOption object comprises of a ticker” (e.g.  "BABA") that identifies the option, the current price of the option, and

its volatility coecient (which should be a number between 0 and 1).

Stock option prices should update randomly, via an update() method, according to the following formula:

Pnew = Pold(1 + v : r) ,

where:

  Pnew  is the new current price of the option (after update);

  Pold  is its old current price (before update);

  v is its volatility coecient;

  r is a uniform random variable on [ -1, 1].

For security purposes,  StockOption objects should be  immutable, so the update() method should return a new StockOption object with the updated price.

1.2    TradingBusiness class (25 marks)

A trading business is an organisation that trades (buys and sells) stock options. A TradingBusiness object should have a name, and a stock portfolio, describing which stock options, and how many

shares in these options, the business currently holds. The portfolio should also store the business’s net spend on each stock option that it currently holds. The net spend on a given stock option o is calculated as follows.

  If the business holds no shares in the option o, the net spend is 0.

●  If the business buys k shares in the option o, with a current price of p, increase the net spend by k × p.

●  If the business sells k shares in the option o, with a current price of p, decrease the net spend by k × p.

You should choose a suitable data structure in the Java collection framework for this, keeping in mind that the business can hold a particular stock option at most once, but can hold any (positive) number of shares in such a stock option. Leave a comment in your code explaining your choice of data structure for this.

A trading businesss main responsibility is to buy and sell stock shares.

● When buying shares, the business should specify which stock option they wish to invest in, and how many shares they wish to buy.  If the business already holds some shares in that particular stock option, this should modify the net spend, as outlined above.

● When selling shares, the business should have the option of either selling a given number of shares in a particular stock option, or selling all shares of that stock option.  In the first case (selling a given number of shares), this should modify the net spend on that option, as outlined above.  In the second case (selling all shares), this should remove that particular stock option from the business’s portfolio.

● A trading business should also be able to nd out how much profit they would make if they sold all shares currently held in a given stock option at the current price. The profit is given by the amount of money that would be made by selling all the shares in that option, minus the current net spend on the option.

●  There should also be an updateAll() method that updates the prices of all stock options held by the business, according to the price update formula in Section 1.1.

● Finally, a trading business should be able to obtain its current valuation, defined as the total money the business would make from selling all shares held in their stock option portfolio.

1.3    TradingCompany class (15 marks)

A trading company is a trading business with an added attribute measuring the company’s liquidity : the amount of money (in liquid, rather than stock option, form) currently held by the company.

When a trading company is launched, it has an empty stock portfolio to begin with.

The TradingCompany class should have the same functionalities as the TradingBusiness class, with the following modifications.

 When selling shares, the money raised from that sale is added to the companys liquidity.

● When buying shares, the money spent on that acquisition is removed from the company’s liquidity, and this operation can only be processed if there is sufficient remaining liquidity.

●  The valuation of a trading company is the total money they would make from selling all their shares, plus their current liquidity.

The company can also liquidate (sell) all of its current stock option portfolio at any given time.

1.4    Code quality (15 marks)

The remaining marks (15) will be awarded for the quality of your code, as covered throughout the

semester in the Lectures and Labs.

 Keep your code neat and tidy; make sure it is properly indented throughout.

●  Choose suitable names for variables and methods, respecting standard Java naming conventions.

●  Comment your code as needed.

●  Split your code into separate methods as appropriate; methods should not be too long.

2    Report (35 marks)

For this part of the assignment, you will write a report detailing how you designed, implemented,

and tested the program described in Section 1.   The report should be typed into e.g.   a Word document, and submitted as a PDF (see Section 3 for more details).

2.1    System design and implementation (20 marks)

You should explain the design and implementation of your system in terms of its class structure, and how you incorporated some of the OOP concepts covered in the course materials.  This part should be no more than 3 pages in length. You should consider the following questions.

● How did you go about implementing some of the main functionalities of the program from Section 1? Here you should pay particular attention to explaining some of the more complicated features in your system (i.e. no need to detail a getter method).

● Which OOP concepts are incorporated into your system design?  where?  (see original task sheet for more details)

2.2    Testing description (15 marks)

As covered throughout the Lectures and Labs in this module, testing is an essential part of writing computer programs.  In your report, you will include a description of how you tested the various parts of the program described in Section 1. You will state clearly what functionalities you tested, and describe how you tested them, thinking carefully about possible corner cases. You may include some sample code if you wish.   This section should be one-and-a-half to two pages in length (screenshots excluded).

3    Submission instructions

In the dedicated Resit submission” Assignment activity on the Learning Mall Online, you will need to submit the following two (2) documents.

● A single ZIP archive of your entire  NetBeans  project.   Include all the resources your project needs to run. This le will be named CPT206 Resit Project studentId.zip”.

● Your report from Section 2, typed into e.g. a Word document, and converted into a PDF le. This le will be named CPT206 Resit Report studentId.pdf”.

The submission deadline is: Sunday, 31 July, 2022, at 10pm.

This assignment is individual work. Plagiarism (e.g. copying materials from other sources without proper acknowledgement) is a serious academic offence. Plagiarism and collusion will not be tolerated and will be dealt with in accordance with the University Code of Practice on Academic Integrity.  Submitting work created by others, whether paid for or not, is a serious offence, and will be prosecuted vigorously. Individual students may be invited to explain parts of their code in person during a dedicated BBB session, and if they fail to demonstrate an understanding of the code, no credit will be given for that part of the code.

Late  submissions.   The standard University policy on late submissions will apply:  5% of the total marks available for the component shall be deducted from the assessment mark for each working day after the submission date, up to a maximum of ve working days, so long as this does not reduce the mark below the pass mark (40%); submissions more than ve working days late will not be accepted.