OpenOrdersResponseItem   A
last analyzed

Complexity

Total Complexity 39

Size/Duplication

Total Lines 479
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 97
dl 0
loc 479
rs 9.28
c 1
b 0
f 0
wmc 39

39 Methods

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

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

406
        $this->createTime = DateTimeHelper::makeFromTimestamp(/** @scrutinizer ignore-type */ $createTime);
Loading history...
407
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Carpenstar\ByBitAPI\Spot...\OpenOrdersResponseItem which is incompatible with the documented return type Carpenstar\ByBitAPI\Spot...onse\OpenOrdersResponse.
Loading history...
408
    }
409
410
    /**
411
     * @return \DateTime
412
     */
413
    public function getCreateTime(): \DateTime
414
    {
415
        return $this->createTime;
416
    }
417
418
    /**
419
     * @param string $updateTime
420
     * @return OpenOrdersResponse
421
     */
422
    public function setUpdateTime(string $updateTime): self
423
    {
424
        $this->updateTime = DateTimeHelper::makeFromTimestamp($updateTime);
0 ignored issues
show
Bug introduced by
$updateTime of type string is incompatible with the type integer expected by parameter $timestamp of Carpenstar\ByBitAPI\Core...er::makeFromTimestamp(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

424
        $this->updateTime = DateTimeHelper::makeFromTimestamp(/** @scrutinizer ignore-type */ $updateTime);
Loading history...
425
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Carpenstar\ByBitAPI\Spot...\OpenOrdersResponseItem which is incompatible with the documented return type Carpenstar\ByBitAPI\Spot...onse\OpenOrdersResponse.
Loading history...
426
    }
427
428
    /**
429
     * @return \DateTime
430
     */
431
    public function getUpdateTime(): \DateTime
432
    {
433
        return $this->updateTime;
434
    }
435
436
    /**
437
     * @param int $isWorking
438
     * @return OpenOrdersResponse
439
     */
440
    public function setIsWorking(int $isWorking): self
441
    {
442
        $this->isWorking = $isWorking;
443
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Carpenstar\ByBitAPI\Spot...\OpenOrdersResponseItem which is incompatible with the documented return type Carpenstar\ByBitAPI\Spot...onse\OpenOrdersResponse.
Loading history...
444
    }
445
446
    /**
447
     * @return int
448
     */
449
    public function getIsWorking(): int
450
    {
451
        return $this->isWorking;
452
    }
453
454
    /**
455
     * @param int $orderCategory
456
     * @return OpenOrdersResponse
457
     */
458
    public function setOrderCategory(int $orderCategory): self
459
    {
460
        $this->orderCategory = $orderCategory;
461
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Carpenstar\ByBitAPI\Spot...\OpenOrdersResponseItem which is incompatible with the documented return type Carpenstar\ByBitAPI\Spot...onse\OpenOrdersResponse.
Loading history...
462
    }
463
464
    /**
465
     * @return int
466
     */
467
    public function getOrderCategory(): int
468
    {
469
        return $this->orderCategory;
470
    }
471
472
    /**
473
     * @param float $triggerPrice
474
     * @return OpenOrdersResponse
475
     */
476
    public function setTriggerPrice(?float $triggerPrice): self
477
    {
478
        $this->triggerPrice = $triggerPrice;
479
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Carpenstar\ByBitAPI\Spot...\OpenOrdersResponseItem which is incompatible with the documented return type Carpenstar\ByBitAPI\Spot...onse\OpenOrdersResponse.
Loading history...
480
    }
481
482
    /**
483
     * @return float
484
     */
485
    public function getTriggerPrice(): ?float
486
    {
487
        return $this->triggerPrice;
488
    }
489
}
490