-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPortfolio.h
More file actions
65 lines (54 loc) · 2.13 KB
/
Portfolio.h
File metadata and controls
65 lines (54 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* Portfolio.h
*
* Created on: Oct 24, 2016
* Author: Vadim
We want to write a portfolio analytics application that tracks portfolio performance over a variety of
portfolio holdings, such as cash in interest bearing account, stocks, dividend paying stocks, preferred
stocks, bonds etc.
Let’s build on last homework assignment, we now proceed to build our portfolio application.
*/
using namespace std;
#include<string>
#include<vector>
#include "Position.h""
//1. Write a class Portfolio that contains
#ifndef PORTFOLIO_H_
#define PORTFOLIO_H_
class Portfolio {
//1a data members
private:
string portfolioName;
vector<Position> Pos;
static double benchMarkReturnRate;
public:
Portfolio(string portfolioName);
virtual ~Portfolio();
//1c) A function to add a position to portfolio
void addPosition(Position p);
//1d) A function to add several Position to Portfolio
void addSeveralPositions(vector<Position> v);
//1e) A function to remove a Position of a given symbol from Portfolio
void removePosition(string givenName);
//1f) A function to return number of positions
int getNumOfPositions();
//1g) A function to get the benchmark return rate, since it returns static variable i implemented it fully here
static double getBenchMarkReturnRate(){ return benchMarkReturnRate; }
//1h) A function currValue that returns the current value of the portfolio
double getCurrentPorfolioValue();
//1i) A function currValueByAssetType that returns the current value of all the positions of a given asset type, e.g.“EQUITY”
double getValByAssetType(string givenSymbol);
//1j) A function getAvgRetRate to return the weighted average rate of return of this portfolio
double getAvgRetRate();
//1k) A function getExcessRetRate to return the excess return above the benchmark return rate
double getExcessRetRate(){
double benchMark = getBenchMarkReturnRate();
double excessRetRate = getAvgRetRate() - benchMark;
return excessRetRate;
}
//benchmark setter
static void setBenchMarkReturnRate(double inputRate){
benchMarkReturnRate = inputRate;
}
};
#endif /* PORTFOLIO_H_ */