Passed
Push — master ( 7a134a...be08d2 )
by Vladislav
02:35 queued 13s
created

OrderHistoryResponse   A

Complexity

Total Complexity 39

Size/Duplication

Total Lines 484
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 39
eloc 98
dl 0
loc 484
rs 9.28
c 0
b 0
f 0

39 Methods

Rating   Name   Duplication   Size   Complexity  
A getOrderLinkId() 0 3 1
A getCreateTime() 0 3 1
A setAccountId() 0 4 1
A getExecQty() 0 3 1
A __construct() 0 23 1
A getAccountId() 0 3 1
A setStatus() 0 4 1
A getCummulativeQuoteQty() 0 3 1
A setTimeInForce() 0 4 1
A getStopPrice() 0 3 1
A setOrderQty() 0 4 1
A setIsWorking() 0 4 1
A setOrderLinkId() 0 4 1
A getTriggerPrice() 0 3 1
A getUpdateTime() 0 3 1
A setAvgPrice() 0 4 1
A getIsWorking() 0 3 1
A setSymbol() 0 4 1
A setSide() 0 4 1
A setOrderId() 0 4 1
A setUpdateTime() 0 4 1
A setOrderPrice() 0 4 1
A getAvgPrice() 0 3 1
A getSide() 0 3 1
A setOrderCategory() 0 4 1
A setStopPrice() 0 4 1
A getOrderId() 0 3 1
A getOrderQty() 0 3 1
A getOrderCategory() 0 3 1
A setOrderType() 0 4 1
A setCreateTime() 0 4 1
A setExecQty() 0 4 1
A getStatus() 0 3 1
A getSymbol() 0 3 1
A getOrderType() 0 3 1
A getOrderPrice() 0 3 1
A setTriggerPrice() 0 4 1
A setCummulativeQuoteQty() 0 4 1
A getTimeInForce() 0 3 1
1
<?php
2
namespace Carpenstar\ByBitAPI\Spot\Trade\OrderHistory\Response;
3
4
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
5
use Carpenstar\ByBitAPI\Core\Objects\ResponseEntity;
6
use DateTime;
7
8
class OrderHistoryResponse extends ResponseEntity
9
{
10
    /**
11
     * Account ID
12
     * @var int $accountId
13
     */
14
    private int $accountId;
15
16
    /**
17
     * Name of the trading pair
18
     * @var string $symbol
19
     */
20
    private string $symbol;
21
22
    /**
23
     * User-generated order ID
24
     * @var string $orderLinkId
25
     */
26
    private string $orderLinkId;
27
28
    /**
29
     * Order ID
30
     * @var int $orderId
31
     */
32
    private int $orderId;
33
34
    /**
35
     * Last traded price
36
     * @var float $orderPrice
37
     */
38
    private float $orderPrice;
39
40
    /**
41
     * Order quantity
42
     * @var float $orderQty
43
     */
44
    private float $orderQty;
45
46
    /**
47
     * Executed quantity
48
     * @var float $execQty
49
     */
50
    private float $execQty;
51
52
    /**
53
     * Total order quantity
54
     * @var float $cummulativeQuoteQty
55
     */
56
    private float $cummulativeQuoteQty;
57
58
    /**
59
     * Average filled price
60
     * @var float $avgPrice
61
     */
62
    private float $avgPrice;
63
64
    /**
65
     * Order status
66
     * @var string $status
67
     */
68
    private string $status;
69
70
    /**
71
     * Time in force
72
     * @var string $timeInForce
73
     */
74
    private string $timeInForce;
75
76
    /**
77
     * Order type
78
     * @var string $orderType
79
     */
80
    private string $orderType;
81
82
    /**
83
     * Side. BUY, SELL
84
     * @var string $side
85
     */
86
    private string $side;
87
88
    /**
89
     * Stop price
90
     * @var float $stopPrice
91
     */
92
    private float $stopPrice;
93
94
    /**
95
     * Order created time in the match engine
96
     * @var DateTime $createTime;
97
     */
98
    private DateTime $createTime;
99
100
    /**
101
     * Last time order was updated
102
     * @var DateTime $updateTime
103
     */
104
    private DateTime $updateTime;
105
106
    /**
107
     * Is working. 0:valid, 1:invalid
108
     * @var int $isWorking
109
     */
110
    private int $isWorking;
111
112
    /**
113
     * Order category. 0:normal order; 1:TP/SL order. TP/SL order has this field
114
     * @var int $orderCategory
115
     */
116
    private int $orderCategory;
117
118
    /**
119
     * Trigger price. TP/SL order has this field
120
     * @var float $triggerPrice
121
     */
122
    private ?float $triggerPrice;
123
124
    /**
125
     * @param array $data
126
     */
127
    public function __construct(array $data)
128
    {
129
        $this
130
            ->setAccountId($data['accountId'])
131
            ->setSymbol($data['symbol'])
132
            ->setOrderLinkId($data['orderLinkId'])
133
            ->setOrderId($data['orderId'])
134
            ->setOrderId($data['orderPrice'])
135
            ->setOrderQty($data['orderQty'])
136
            ->setExecQty($data['execQty'])
137
            ->setCummulativeQuoteQty($data['cummulativeQuoteQty'])
138
            ->setAvgPrice($data['avgPrice'])
139
            ->setStatus($data['status'])
140
            ->setTimeInForce($data['timeInForce'])
141
            ->setOrderType($data['orderType'])
142
            ->setSide($data['side'])
143
            ->setStopPrice($data['stopPrice'])
144
            ->setCreateTime($data['createTime'])
145
            ->setUpdateTime($data['updateTime'])
146
            ->setIsWorking($data['isWorking'])
147
            ->setOrderCategory($data['orderCategory'])
148
            ->setOrderPrice($data['orderPrice'])
149
            ->setTriggerPrice($data['triggerPrice'] ?? null);
150
    }
151
152
    /**
153
     * @param int $accountId
154
     * @return OrderHistoryResponse
155
     */
156
    public function setAccountId(int $accountId): self
157
    {
158
        $this->accountId = $accountId;
159
        return $this;
160
    }
161
162
    /**
163
     * @return int
164
     */
165
    public function getAccountId(): int
166
    {
167
        return $this->accountId;
168
    }
169
170
    /**
171
     * @param string $symbol
172
     * @return OrderHistoryResponse
173
     */
174
    public function setSymbol(string $symbol): self
175
    {
176
        $this->symbol = $symbol;
177
        return $this;
178
    }
179
180
    /**
181
     * @return string
182
     */
183
    public function getSymbol(): string
184
    {
185
        return $this->symbol;
186
    }
187
188
    /**
189
     * @param string $orderLinkId
190
     * @return OrderHistoryResponse
191
     */
192
    public function setOrderLinkId(string $orderLinkId): self
193
    {
194
        $this->orderLinkId = $orderLinkId;
195
        return $this;
196
    }
197
198
    /**
199
     * @return string
200
     */
201
    public function getOrderLinkId(): string
202
    {
203
        return $this->orderLinkId;
204
    }
205
206
    /**
207
     * @param int $orderId
208
     * @return OrderHistoryResponse
209
     */
210
    public function setOrderId(int $orderId): self
211
    {
212
        $this->orderId = $orderId;
213
        return $this;
214
    }
215
216
    /**
217
     * @return int
218
     */
219
    public function getOrderId(): int
220
    {
221
        return $this->orderId;
222
    }
223
224
    /**
225
     * @param float $orderPrice
226
     * @return OrderHistoryResponse
227
     */
228
    public function setOrderPrice(float $orderPrice): self
229
    {
230
        $this->orderPrice = $orderPrice;
231
        return $this;
232
    }
233
234
    /**
235
     * @return float
236
     */
237
    public function getOrderPrice(): float
238
    {
239
        return $this->orderPrice;
240
    }
241
242
    /**
243
     * @param float $orderQty
244
     * @return OrderHistoryResponse
245
     */
246
    public function setOrderQty(float $orderQty): self
247
    {
248
        $this->orderQty = $orderQty;
249
        return $this;
250
    }
251
252
    /**
253
     * @return float
254
     */
255
    public function getOrderQty(): float
256
    {
257
        return $this->orderQty;
258
    }
259
260
    /**
261
     * @param float $execQty
262
     * @return OrderHistoryResponse
263
     */
264
    public function setExecQty(float $execQty): self
265
    {
266
        $this->execQty = $execQty;
267
        return $this;
268
    }
269
270
    /**
271
     * @return float
272
     */
273
    public function getExecQty(): float
274
    {
275
        return $this->execQty;
276
    }
277
278
    /**
279
     * @param float $cummulativeQuoteQty
280
     * @return OrderHistoryResponse
281
     */
282
    public function setCummulativeQuoteQty(float $cummulativeQuoteQty): self
283
    {
284
        $this->cummulativeQuoteQty = $cummulativeQuoteQty;
285
        return $this;
286
    }
287
288
    /**
289
     * @return float
290
     */
291
    public function getCummulativeQuoteQty(): float
292
    {
293
        return $this->cummulativeQuoteQty;
294
    }
295
296
    /**
297
     * @param float $avgPrice
298
     * @return OrderHistoryResponse
299
     */
300
    public function setAvgPrice(float $avgPrice): self
301
    {
302
        $this->avgPrice = $avgPrice;
303
        return $this;
304
    }
305
306
    /**
307
     * @return float
308
     */
309
    public function getAvgPrice(): float
310
    {
311
        return $this->avgPrice;
312
    }
313
314
    /**
315
     * @param string $status
316
     * @return OrderHistoryResponse
317
     */
318
    public function setStatus(string $status): self
319
    {
320
        $this->status = $status;
321
        return $this;
322
    }
323
324
    /**
325
     * @return string
326
     */
327
    public function getStatus(): string
328
    {
329
        return $this->status;
330
    }
331
332
    /**
333
     * @param string $timeInForce
334
     * @return OrderHistoryResponse
335
     */
336
    public function setTimeInForce(string $timeInForce): self
337
    {
338
        $this->timeInForce = $timeInForce;
339
        return $this;
340
    }
341
342
    /**
343
     * @return string
344
     */
345
    public function getTimeInForce(): string
346
    {
347
        return $this->timeInForce;
348
    }
349
350
    /**
351
     * @param string $orderType
352
     * @return OrderHistoryResponse
353
     */
354
    public function setOrderType(string $orderType): self
355
    {
356
        $this->orderType = $orderType;
357
        return $this;
358
    }
359
360
    /**
361
     * @return string
362
     */
363
    public function getOrderType(): string
364
    {
365
        return $this->orderType;
366
    }
367
368
    /**
369
     * @param string $side
370
     * @return OrderHistoryResponse
371
     */
372
    public function setSide(string $side): self
373
    {
374
        $this->side = $side;
375
        return $this;
376
    }
377
378
    /**
379
     * @return string
380
     */
381
    public function getSide(): string
382
    {
383
        return $this->side;
384
    }
385
386
    /**
387
     * @param float $stopPrice
388
     * @return OrderHistoryResponse
389
     */
390
    public function setStopPrice(float $stopPrice): self
391
    {
392
        $this->stopPrice = $stopPrice;
393
        return $this;
394
    }
395
396
    /**
397
     * @return float
398
     */
399
    public function getStopPrice(): float
400
    {
401
        return $this->stopPrice;
402
    }
403
404
    /**
405
     * @param int $createTime
406
     * @return OrderHistoryResponse
407
     */
408
    public function setCreateTime(int $createTime): self
409
    {
410
        $this->createTime = DateTimeHelper::makeFromTimestamp($createTime);
411
        return $this;
412
    }
413
414
    /**
415
     * @return DateTime
416
     */
417
    public function getCreateTime(): DateTime
418
    {
419
        return $this->createTime;
420
    }
421
422
    /**
423
     * @param int $updateTime
424
     * @return OrderHistoryResponse
425
     */
426
    public function setUpdateTime(int $updateTime): self
427
    {
428
        $this->updateTime = DateTimeHelper::makeFromTimestamp($updateTime);
429
        return $this;
430
    }
431
432
    /**
433
     * @return DateTime
434
     */
435
    public function getUpdateTime(): DateTime
436
    {
437
        return $this->updateTime;
438
    }
439
440
    /**
441
     * @param int $isWorking
442
     * @return OrderHistoryResponse
443
     */
444
    public function setIsWorking(int $isWorking): self
445
    {
446
        $this->isWorking = $isWorking;
447
        return $this;
448
    }
449
450
    /**
451
     * @return int
452
     */
453
    public function getIsWorking(): int
454
    {
455
        return $this->isWorking;
456
    }
457
458
    /**
459
     * @param int $orderCategory
460
     * @return OrderHistoryResponse
461
     */
462
    public function setOrderCategory(int $orderCategory): self
463
    {
464
        $this->orderCategory = $orderCategory;
465
        return $this;
466
    }
467
468
    /**
469
     * @return int
470
     */
471
    public function getOrderCategory(): int
472
    {
473
        return $this->orderCategory;
474
    }
475
476
    /**
477
     * @param float $triggerPrice
478
     * @return OrderHistoryResponse
479
     */
480
    public function setTriggerPrice(?float $triggerPrice): self
481
    {
482
        $this->triggerPrice = $triggerPrice;
483
        return $this;
484
    }
485
486
    /**
487
     * @return float
488
     */
489
    public function getTriggerPrice(): ?float
490
    {
491
        return $this->triggerPrice;
492
    }
493
}