-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbid.cpp
74 lines (69 loc) · 1.2 KB
/
bid.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include "bid.h"
bid::bid(QString row)
{
is_valid=false;
QStringList list=row.split(",");
QStringList __date=list.at(0).split(".");
int year=__date.at(0).toInt();
int month=__date.at(1).toInt();
int day=__date.at(2).toInt();
if(QDate::isValid(year,month,day))
_date=QDate(year,month,day);
else
return;
QStringList __time=list.at(1).split(":");
int hours=__time.at(0).toInt();
int minutes=__time.at(1).toInt();
if(QTime::isValid(hours,minutes,0))
_time=QTime(hours,minutes);
else
return;
bool ok;
_open=list.at(2).toDouble(&ok);
if(ok)
_high=list.at(3).toDouble(&ok);
else
return;
if(ok)
_low=list.at(4).toDouble(&ok);
else
return;
if(ok)
_close=list.at(5).toDouble(&ok);
else
return;
if(ok)
is_valid=true;
}
double bid::close()
{
return _close;
}
QDate bid::date()
{
return _date;
}
double bid::high()
{
return _high;
}
double bid::low()
{
return _low;
}
double bid::median()
{
return (_high+_low)/2;
}
double bid::open()
{
return _open;
}
QTime bid::time()
{
return _time;
}
bool bid::isValid()
{
return is_valid;
}