-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
56 lines (42 loc) · 1.49 KB
/
main.cpp
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
// Author: Steven Date:20151116
#include <iostream>
#include "portfolio.h"
#include "mean_variance_frontier.h"
#include "blacklitterman.h"
#include <iomanip>
using namespace std;
int main()
{
cout << "Mean-variance frontier:" << endl << endl;
int num_assets;
int num_observations;
double expected_return;
cout << "Please input the number of assets:" << endl;
cin >> num_assets;
cout << "Please input the number of observations:" << endl;
cin >> num_observations;
cout << "Please input the expected return of the portfolio:" << endl;
cin >> expected_return;
portfolio port("data.txt", num_assets, num_observations);
mean_variance_frontier weights;
cout << endl <<"The frontier portfolio weights are:" << endl;
for (int i = 0; i < num_assets; i++)
{
cout << setw(11) << port.GetTickers()[i];
}
cout << endl;
cout << weights.ComputeWeights(port, num_assets, num_observations, expected_return) << endl;
//Mean-variance frontier ends
//*******************************************************************************************************
//BlackLitterman begins
cout << endl << endl << "BLACKLITTERMAN:" << endl << endl;
BlackLitterman blweights(port, num_assets, num_observations);
cout << endl << "The portfolio weights of BlackLitterman approach is:" << endl ;
for (int i = 0; i < num_assets; i++)
{
cout << setw(9) << port.GetTickers()[i];
}
cout << endl;
cout << blweights.ComputeWeights() << endl << endl;
return 0;
}