PublicTradingHistoryResponseItem   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 109
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 22
c 1
b 0
f 0
dl 0
loc 109
rs 10
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getSymbol() 0 3 1
A getExecId() 0 3 1
A __construct() 0 9 1
A getTime() 0 3 1
A getPrice() 0 3 1
A isBlockTrade() 0 3 1
A getSize() 0 3 1
A getSide() 0 3 1
1
<?php
2
3
namespace Carpenstar\ByBitAPI\Derivatives\MarketData\PublicTradingHistory\Response;
4
5
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
6
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
7
use Carpenstar\ByBitAPI\Derivatives\MarketData\PublicTradingHistory\Interfaces\IPublicTradingHistoryResponseItemInterface;
8
9
class PublicTradingHistoryResponseItem extends AbstractResponse implements IPublicTradingHistoryResponseItemInterface
10
{
11
    /**
12
     * Execution id
13
     * @var string $execId
14
     */
15
    private string $execId;
16
17
    /**
18
     * Symbol name
19
     * @var string $symbol
20
     */
21
    private string $symbol;
22
23
    /**
24
     * Trade price
25
     * @var float $price
26
     */
27
    private float $price;
28
29
    /**
30
     * Trade size
31
     * @var float $size
32
     */
33
    private float $size;
34
35
    /**
36
     * Side of taker Buy, Sell
37
     * @var string $side
38
     */
39
    private string $side;
40
41
    /**
42
     * Trade time
43
     * @var \DateTime $time
44
     */
45
    private \DateTime $time;
46
47
    /**
48
     * Is block trade
49
     * @var bool $isBlockTrade
50
     */
51
    private bool $isBlockTrade;
52
53
    public function __construct(array $data)
54
    {
55
        $this->execId = $data['execId'];
56
        $this->symbol = $data['symbol'];
57
        $this->price = $data['price'];
58
        $this->size = $data['size'];
59
        $this->side = $data['side'];
60
        $this->time = DateTimeHelper::makeFromTimestamp($data['time']);
61
        $this->isBlockTrade = $data['isBlockTrade'];
62
    }
63
64
    /**
65
     * @return string
66
     */
67
    public function getExecId(): string
68
    {
69
        return $this->execId;
70
    }
71
72
    /**
73
     * @return string
74
     */
75
    public function getSymbol(): string
76
    {
77
        return $this->symbol;
78
    }
79
80
    /**
81
     * @return float
82
     */
83
    public function getPrice(): float
84
    {
85
        return $this->price;
86
    }
87
88
    /**
89
     * @return float
90
     */
91
    public function getSize(): float
92
    {
93
        return $this->size;
94
    }
95
96
    /**
97
     * @return string
98
     */
99
    public function getSide(): string
100
    {
101
        return $this->side;
102
    }
103
104
    /**
105
     * @return \DateTime
106
     */
107
    public function getTime(): \DateTime
108
    {
109
        return $this->time;
110
    }
111
112
    /**
113
     * @return bool
114
     */
115
    public function isBlockTrade(): bool
116
    {
117
        return $this->isBlockTrade;
118
    }
119
}
120