Passed
Push — master ( 3e99b0...1fa2df )
by Vladislav
04:12 queued 01:58
created

PublicTradingHistoryResponse::getSize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Carpenstar\ByBitAPI\Derivatives\MarketData\PublicTradingHistory\Response;
3
4
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
5
use Carpenstar\ByBitAPI\Core\Objects\ResponseEntity;
6
use Carpenstar\ByBitAPI\Derivatives\MarketData\PublicTradingHistory\Interfaces\IPublicTradingHistoryResponse;
7
8
class PublicTradingHistoryResponse extends ResponseEntity implements IPublicTradingHistoryResponse
9
{
10
    /**
11
     * Execution id
12
     * @var string $execId
13
     */
14
    private string $execId;
15
16
    /**
17
     * Symbol name
18
     * @var string $symbol
19
     */
20
    private string $symbol;
21
22
    /**
23
     * Trade price
24
     * @var float $price
25
     */
26
    private float $price;
27
28
    /**
29
     * Trade size
30
     * @var float $size
31
     */
32
    private float $size;
33
34
    /**
35
     * Side of taker Buy, Sell
36
     * @var string $side
37
     */
38
    private string $side;
39
40
    /**
41
     * Trade time
42
     * @var \DateTime $time
43
     */
44
    private \DateTime $time;
45
46
    /**
47
     * Is block trade
48
     * @var bool $isBlockTrade
49
     */
50
    private bool $isBlockTrade;
51
52
    public function __construct(array $data)
53
    {
54
        $this
55
            ->setSymbol($data['symbol'])
56
            ->setTime($data['time'])
57
            ->setPrice($data['price'])
58
            ->setSize($data['size'])
59
            ->setSide($data['side'])
60
            ->setExecId($data['execId'])
61
            ->setIsBlockTrade($data['isBlockTrade']);
62
    }
63
64
    /**
65
     * @param string $execId
66
     * @return PublicTradingHistoryResponse
67
     */
68
    private function setExecId(string $execId): self
69
    {
70
        $this->execId = $execId;
71
        return $this;
72
    }
73
74
    /**
75
     * @return string
76
     */
77
    public function getExecId(): string
78
    {
79
        return $this->execId;
80
    }
81
82
    /**
83
     * @param string $symbol
84
     * @return PublicTradingHistoryResponse
85
     */
86
    public function setSymbol(string $symbol): self
87
    {
88
        $this->symbol = $symbol;
89
        return $this;
90
    }
91
92
    /**
93
     * @return string
94
     */
95
    public function getSymbol(): string
96
    {
97
        return $this->symbol;
98
    }
99
100
    /**
101
     * @param float $price
102
     * @return PublicTradingHistoryResponse
103
     */
104
    public function setPrice(float $price): self
105
    {
106
        $this->price = $price;
107
        return $this;
108
    }
109
110
    /**
111
     * @return float
112
     */
113
    public function getPrice(): float
114
    {
115
        return $this->price;
116
    }
117
118
    /**
119
     * @param float $size
120
     * @return PublicTradingHistoryResponse
121
     */
122
    private function setSize(float $size): self
123
    {
124
        $this->size = $size;
125
        return $this;
126
    }
127
128
    /**
129
     * @return float
130
     */
131
    public function getSize(): float
132
    {
133
        return $this->size;
134
    }
135
136
    /**
137
     * @param string $side
138
     * @return PublicTradingHistoryResponse
139
     */
140
    private function setSide(string $side): self
141
    {
142
        $this->side = $side;
143
        return $this;
144
    }
145
146
    /**
147
     * @return string
148
     */
149
    public function getSide(): string
150
    {
151
        return $this->side;
152
    }
153
154
    /**
155
     * @param int $timestamp
156
     * @return PublicTradingHistoryResponse
157
     */
158
    private function setTime(int $timestamp): self
159
    {
160
        $this->time = DateTimeHelper::makeFromTimestamp($timestamp);
161
        return $this;
162
    }
163
164
    /**
165
     * @return \DateTime
166
     */
167
    public function getTime(): \DateTime
168
    {
169
        return $this->time;
170
    }
171
172
    /**
173
     * @param bool $isBlockTrade
174
     * @return PublicTradingHistoryResponse
175
     */
176
    private function setIsBlockTrade(bool $isBlockTrade): self
177
    {
178
        $this->isBlockTrade = $isBlockTrade;
179
        return $this;
180
    }
181
182
    /**
183
     * @return bool
184
     */
185
    public function isBlockTrade(): bool
186
    {
187
        return $this->isBlockTrade;
188
    }
189
190
191
}