TickersResponse::getLowPrice()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Carpenstar\ByBitAPI\Spot\MarketData\Tickers\Response;
4
5
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
6
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
7
use Carpenstar\ByBitAPI\Spot\MarketData\Tickers\Interfaces\ITickersResponseInterface;
8
9
class TickersResponse extends AbstractResponse implements ITickersResponseInterface
10
{
11
    /**
12
     * Current timestamp
13
     * @var \DateTime $t
14
     */
15
    private \DateTime $t;
16
17
    /**
18
     * Name of the trading pair
19
     * @var string $s
20
     */
21
    private string $s;
22
23
    /**
24
     * Last traded price
25
     * @var float $lp
26
     */
27
    private float $lp;
28
29
    /**
30
     * High price
31
     * @var float $h
32
     */
33
    private float $h;
34
35
    /**
36
     * Low price
37
     * @var float $l
38
     */
39
    private float $l;
40
41
    /**
42
     * Open price
43
     * @var float $o
44
     */
45
    private float $o;
46
47
    /**
48
     * Best bid price
49
     * @var float $bp
50
     */
51
    private float $bp;
52
53
    /**
54
     * Best ask price
55
     * @var float $ap
56
     */
57
    private float $ap;
58
59
    /**
60
     * Trading volume
61
     * @var float $v
62
     */
63
    private float $v;
64
65
    /**
66
     * Trading quote volume
67
     * @var float $qv
68
     */
69
    private float $qv;
70
71
    /**
72
     * @param array $data
73
     */
74
    public function __construct(array $data)
75
    {
76
        $this
77
            ->setT($data['t'])
78
            ->setS($data['s'])
79
            ->setLp($data['lp'])
80
            ->setH($data['h'])
81
            ->setL($data['l'])
82
            ->setO($data['o'])
83
            ->setBp($data['bp'])
84
            ->setAp($data['ap'])
85
            ->setV($data['v'])
86
            ->setQv($data['qv']);
87
    }
88
89
    /**
90
     * @param int $timestamp
91
     * @return TickersResponse
92
     */
93
    private function setT(int $timestamp): self
94
    {
95
        $this->t = DateTimeHelper::makeFromTimestamp($timestamp);
96
        return $this;
97
    }
98
99
    /**
100
     * @return \DateTime
101
     */
102
    public function getTime(): \DateTime
103
    {
104
        return $this->t;
105
    }
106
107
    /**
108
     * @param string $s
109
     * @return TickersResponse
110
     */
111
    private function setS(string $s): self
112
    {
113
        $this->s = $s;
114
        return $this;
115
    }
116
117
    /**
118
     * @return string
119
     */
120
    public function getSymbol(): string
121
    {
122
        return $this->s;
123
    }
124
125
    /**
126
     * @param float $ap
127
     */
128
    private function setAp(float $ap): self
129
    {
130
        $this->ap = $ap;
131
        return $this;
132
    }
133
134
    /**
135
     * Best ask price
136
     * @return float
137
     */
138
    public function getBestAskPrice(): float
139
    {
140
        return $this->ap;
141
    }
142
143
    /**
144
     * @param float $lp
145
     * @return TickersResponse
146
     */
147
    private function setLp(float $lp): self
148
    {
149
        $this->lp = $lp;
150
        return $this;
151
    }
152
153
    /**
154
     * Last traded price
155
     * @return float
156
     */
157
    public function getLastTradedPrice(): float
158
    {
159
        return $this->lp;
160
    }
161
162
    /**
163
     * @param float $h
164
     * @return TickersResponse
165
     */
166
    private function setH(float $h): self
167
    {
168
        $this->h = $h;
169
        return $this;
170
    }
171
172
    /**
173
     * High price
174
     * @return int
175
     */
176
    public function getHighPrice(): float
177
    {
178
        return $this->h;
179
    }
180
181
    /**
182
     * @param float $l
183
     * @return TickersResponse
184
     */
185
    private function setL(float $l): self
186
    {
187
        $this->l = $l;
188
        return $this;
189
    }
190
191
    /**
192
     * Low price
193
     * @return float
194
     */
195
    public function getLowPrice(): float
196
    {
197
        return $this->l;
198
    }
199
200
    /**
201
     * @param float $o
202
     * @return TickersResponse
203
     */
204
    private function setO(float $o): self
205
    {
206
        $this->o = $o;
207
        return $this;
208
    }
209
210
    /**
211
     * Open price
212
     * @return float
213
     */
214
    public function getOpenPrice(): float
215
    {
216
        return $this->o;
217
    }
218
219
    /**
220
     * @param float $bp
221
     * @return TickersResponse
222
     */
223
    private function setBp(float $bp): self
224
    {
225
        $this->bp = $bp;
226
        return $this;
227
    }
228
229
    /**
230
     * Best bid price
231
     * @return float
232
     */
233
    public function getBestBidPrice(): float
234
    {
235
        return $this->bp;
236
    }
237
238
    /**
239
     * @param float $v
240
     * @return TickersResponse
241
     */
242
    private function setV(float $v): self
243
    {
244
        $this->v = $v;
245
        return $this;
246
    }
247
248
    /**
249
     * Trading volume
250
     * @return float
251
     */
252
    public function getTradingVolume(): float
253
    {
254
        return $this->v;
255
    }
256
257
    /**
258
     * @param float $qv
259
     * @return TickersResponse
260
     */
261
    private function setQv(float $qv): self
262
    {
263
        $this->qv = $qv;
264
        return $this;
265
    }
266
267
    /**
268
     * Trading quote volume
269
     * @return float
270
     */
271
    public function getTradingQuoteVolume(): float
272
    {
273
        return $this->qv;
274
    }
275
}
276