-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.cpp
41 lines (27 loc) · 1.1 KB
/
test.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
#include <iostream>
#include "sys.cpp"
using namespace std;
int main() {
PriceHistory *snp500History = new PriceHistory("AAPL");
PriceHistory *eurusdHistory = new PriceHistory("EURUSD=X");
PriceHistory *euraudHistory = new PriceHistory("EURAUD=X");
snp500History->fetchHistoricalData("2017-12-01", "2017-12-31", "1d");
eurusdHistory->fetchHistoricalData("2018-01-01", "2018-01-10", "1d");
euraudHistory->fetchHistoricalData("2018-01-01", "2018-01-10", "1d");
cout << "Historical data for S&P 500 (Dec 2017):" << endl;
snp500History->printDataPoints();
try {
PricePoint dataPoint = snp500History->getDataPoint("2017-12-01");
cout << "Data point at 2017-12-01:" << endl;
dataPoint.printPricePoint();
} catch (const exception &e) {
cerr << e.what() << endl;
}
cout << "EUR/USD rates (Jan 2018):" << endl;
eurusdHistory->printDataPoints();
cout << "EUR/AUD rates (Jan 2018):" << endl;
euraudHistory->printDataPoints();
delete snp500History;
delete eurusdHistory;
delete euraudHistory;
}