1
|
|
|
<?php |
2
|
|
|
namespace Carpenstar\ByBitAPI\WebSockets\Spot\PublicChannels\Kline\Entities; |
3
|
|
|
|
4
|
|
|
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper; |
5
|
|
|
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse; |
6
|
|
|
|
7
|
|
|
class KlineResponseItem extends AbstractResponse |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* The start timestamp of the bar |
11
|
|
|
* @var \DateTime $barTimestamp |
12
|
|
|
*/ |
13
|
|
|
private \DateTime $barTimestamp; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Trading pair |
17
|
|
|
* @var string $symbol |
18
|
|
|
*/ |
19
|
|
|
private string $symbol; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Close price |
23
|
|
|
* @var float $closePrice |
24
|
|
|
*/ |
25
|
|
|
private float $closePrice; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* High price |
29
|
|
|
* @var float $highPrice |
30
|
|
|
*/ |
31
|
|
|
private float $highPrice; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Low price |
35
|
|
|
* @var float $lowPrice |
36
|
|
|
*/ |
37
|
|
|
private float $lowPrice; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Open price |
41
|
|
|
* @var float $openPrice |
42
|
|
|
*/ |
43
|
|
|
private float $openPrice; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Trading volume |
47
|
|
|
* @var float $tradingVolume |
48
|
|
|
*/ |
49
|
|
|
private float $tradingVolume; |
50
|
|
|
|
51
|
|
|
public function __construct(array $data) |
52
|
|
|
{ |
53
|
|
|
$this->barTimestamp = DateTimeHelper::makeFromTimestamp($data['t']); |
54
|
|
|
$this->symbol = $data['s']; |
55
|
|
|
$this->closePrice = $data['c']; |
56
|
|
|
$this->highPrice = $data['h']; |
57
|
|
|
$this->lowPrice = $data['l']; |
58
|
|
|
$this->openPrice = $data['o']; |
59
|
|
|
$this->tradingVolume = $data['v']; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
|
63
|
|
|
public function getBarTimestamp(): \DateTime |
64
|
|
|
{ |
65
|
|
|
return $this->barTimestamp; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function getSymbol(): string |
69
|
|
|
{ |
70
|
|
|
return $this->symbol; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function getClosePrice(): float |
74
|
|
|
{ |
75
|
|
|
return $this->closePrice; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function getHighPrice(): float |
79
|
|
|
{ |
80
|
|
|
return $this->highPrice; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function getLowPrice(): float |
84
|
|
|
{ |
85
|
|
|
return $this->lowPrice; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function getOpenPrice(): float |
89
|
|
|
{ |
90
|
|
|
return $this->openPrice; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function getTradingVolume(): float |
94
|
|
|
{ |
95
|
|
|
return $this->tradingVolume; |
96
|
|
|
} |
97
|
|
|
} |
98
|
|
|
|