-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathqt.php
101 lines (90 loc) · 1.71 KB
/
qt.php
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
class QT
{
private $market;
private $category;
private $items;
function __construct($market, $category, $qtData = false) {
$this->market = $market;
$this->category = $category;
if($qtData) {
$this->items = $qtData;
}
}
//股票名称
public function getName(){
return $this->items[1];
}
//获得涨跌幅
public function getPercent() {
$ret = $this->items[32];
if($ret > 0) {
$ret = '+'.$ret;
}
return $ret.'%';
}
//得到当前市价
public function getPrice(){
if($this->items[40] && $this->category != 'ZS') {
return $this->items[40];
} else {
return $this->items[3];
}
}
//得到昨收价
public function getLastClosePrice(){
return $this->items[4];
}
//得到今开盘
public function getTodayOpenPrice(){
return $this->items[5];
}
//最高
public function getHighPrice(){
return $this->items[33];
}
//最低
public function getLowPrice(){
return $this->items[34];
}
//获取状态
public function getStatus() {
return $this->items[40];
}
//获取普通状态
public function getErrorStatus() {
$status = $this->getStatus();
switch($status) {
case 'D':
return '退市';
case 'S':
return '停牌';
case 'U':
return '未上市';
case 'Z':
return '暂停上市';
break;
}
return false;
}
}
class QTHk extends QT {}
class QTUs extends QT {}
class QTJj extends QT
{
public function getPrice(){
return $this->items[3];
}
public function getValueDate() {
return $this->items[2];
}
public function isHBType() {
return $this->items[18] == '货币型';
}
public function getEarnPer() {
return $this->items[27];
}
public function getYearRadio() {
return $this->items[28].'%';
}
}