-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcsv.h
66 lines (43 loc) · 1.5 KB
/
csv.h
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
66
#include <fstream>
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <string>
#ifndef PRG1_LABO3_CG_CSV_H
#define PRG1_LABO3_CG_CSV_H
struct Date{
int jour;
int mois;
int annee;
Date(int jour, int mois, int annee)
: jour(jour), mois(mois), annee(annee){}
std::string to_string(){
return "Jour: " + std::to_string(jour) + ", mois: " + std::to_string(mois) + ", annee: " + std::to_string(annee);
}
};
struct CsvArray {
Date date;
double high;
double low;
double close;
CsvArray(Date date, double high, double low, double close)
: date(date), high(high), low(low), close(close){}
std::string to_string(){
return "Date: " + std::to_string(date.jour) + "-" + std::to_string(date.mois) + "-" + std::to_string(date.annee) + ", High: " + std::to_string(high) + ", Low: " + std::to_string(low) + ", close: " + std::to_string(close);
}
};
struct Dividende {
Date date;
double value;
Dividende(Date date, double dividende)
: date(date), value(dividende){}
std::string to_string(){
return "Date: " + std::to_string(date.jour) + "-" + std::to_string(date.mois) + "-" + std::to_string(date.annee) + ", value: " + std::to_string(value);
}
};
// Function's Initialization
std::vector<CsvArray> csv_to_array (std::string path_stock);
std::vector<Dividende> csv_to_dividendes(std::string path_dividende);
Date string_to_date(std::string date);
#endif //PRG1_LABO3_CG_CSV_H