Test Failed
Push — master ( f1d563...1fab6c )
by Vladislav
10:20 queued 07:53
created

GetOrderListResponseItem::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 39
Code Lines 37

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 37
nc 1
nop 1
dl 0
loc 39
rs 9.328
c 1
b 0
f 0
1
<?php
2
namespace Carpenstar\ByBitAPI\Derivatives\Contract\Order\GetOrderList\Response;
3
4
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper;
5
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse;
6
use Carpenstar\ByBitAPI\Derivatives\Contract\Order\GetOrderList\Interfaces\IGetOrderListResponseItemInterface;
7
8
class GetOrderListResponseItem extends AbstractResponse implements IGetOrderListResponseItemInterface
9
{
10
    /**
11
     * Symbol name
12
     * @var string $symbol
13
     */
14
    private string $symbol;
15
16
    /**
17
     * Order ID
18
     * @var string $orderId
19
     */
20
    private string $orderId;
21
22
    /**
23
     * User customised order ID.
24
     * @var string $orderLinkId
25
     */
26
    private string $orderLinkId;
27
28
    /**
29
     * Buy,Sell
30
     * @var string $side
31
     */
32
    private string $side;
33
34
    /**
35
     * Order type. Market,Limit. For TP/SL order, it means the order type after triggered
36
     * @var string $orderType
37
     */
38
    private string $orderType;
39
40
    /**
41
     * Order price
42
     * @var float $price
43
     */
44
    private float $price;
45
46
    /**
47
     * Order quantity
48
     * @var float $qty
49
     */
50
    private float $qty;
51
52
    /**
53
     * Time in force
54
     * @var string $timeInForce
55
     */
56
    private string $timeInForce;
57
58
    /**
59
     * Order status
60
     * @var string $orderStatus
61
     */
62
    private string $orderStatus;
63
64
    /**
65
     * Position index. 0: one-way mode, 1: buy side hedge mode, 2: sell side hedge mode
66
     * @var int $positionIdx
67
     */
68
    private int $positionIdx;
69
70
    /**
71
     * Last price when place the order
72
     * @var float $lastPriceOnCreated
73
     */
74
    private float $lastPriceOnCreated;
75
76
    /**
77
     * Order created timestamp (ms)
78
     * @var \DateTime $createdTime
79
     */
80
    private \DateTime $createdTime;
81
82
    /**
83
     * Order updated timestamp (ms)
84
     * @var \DateTime $updatedTime
85
     */
86
    private \DateTime $updatedTime;
87
88
    /**
89
     * Cancel type
90
     * @var string $cancelType
91
     */
92
    private string $cancelType;
93
94
    /**
95
     * Reject reason
96
     * @var string $rejectReason
97
     */
98
    private string $rejectReason;
99
100
    /**
101
     * Stop order type
102
     * @var string $stopOrderType
103
     */
104
    private string $stopOrderType;
105
106
    /**
107
     * Trigger direction. 1: rise, 2: fall
108
     * @var int $triggerDirection
109
     */
110
    private int $triggerDirection;
111
112
    /**
113
     * The trigger type of trigger price
114
     * @var string $triggerBy
115
     */
116
    private string $triggerBy;
117
118
    /**
119
     * Trigger price
120
     * @var float $triggerPrice
121
     */
122
    private float $triggerPrice;
123
124
    /**
125
     * Cumulative executed order value
126
     * @var float $cumExecValue
127
     */
128
    private float $cumExecValue;
129
130
    /**
131
     * Cumulative executed trading fee
132
     * @var float $cumExecFee
133
     */
134
    private float $cumExecFee;
135
136
    /**
137
     * Cumulative executed order qty
138
     * @var float $cumExecQty
139
     */
140
    private float $cumExecQty;
141
142
    /**
143
     * The estimated value not executed
144
     * @var float $leavesValue
145
     */
146
    private float $leavesValue;
147
148
    /**
149
     * The remaining qty not executed
150
     * @var float $leavesQty
151
     */
152
    private float $leavesQty;
153
154
    /**
155
     * Take profit price
156
     * @var float $takeProfit
157
     */
158
    private float $takeProfit;
159
160
    /**
161
     * Stop loss price
162
     * @var float $stopLoss
163
     */
164
    private float $stopLoss;
165
166
    /**
167
     * TP/SL mode, Full: entire position for TP/SL. Partial: partial position tp/sl
168
     * @var string $tpslMode
169
     */
170
    private string $tpslMode;
171
172
    /**
173
     * The limit order price when take profit price is triggered
174
     * @var float $tpLimitPrice
175
     */
176
    private float $tpLimitPrice;
177
178
    /**
179
     * The limit order price when stop loss price is triggered
180
     * @var float $slLimitPrice
181
     */
182
    private float $slLimitPrice;
183
184
    /**
185
     * The price type to trigger take profit
186
     * @var string $tpTriggerBy
187
     */
188
    private string $tpTriggerBy;
189
190
    /**
191
     * The price type to trigger stop loss
192
     * @var string $slTriggerBy
193
     */
194
    private string $slTriggerBy;
195
196
    /**
197
     * Reduce only. true means reduce position size
198
     * @var bool $reduceOnly
199
     */
200
    private bool $reduceOnly;
201
202
    /**
203
     * Close on trigger. What is a close on trigger order?. Keeps "" for option
204
     * @var bool $closeOnTrigger
205
     */
206
    private bool $closeOnTrigger;
207
208
    /**
209
     * Paradigm block trade ID
210
     * @var string $blockTradeId
211
     */
212
    private string $blockTradeId;
213
214
    /**
215
     * SMP execution type
216
     * @var string $smpType
217
     */
218
    private string $smpType;
219
220
    /**
221
     * Smp group ID. If the uid has no group, it is 0 by default
222
     * @var int $smpGroup
223
     */
224
    private int $smpGroup;
225
226
    /**
227
     * The counterparty's orderID which triggers this SMP execution
228
     * @var string $smpOrderId
229
     */
230
    private string $smpOrderId;
231
232
    public function __construct(array $data)
233
    {
234
        $this->symbol = $data['symbol'];
235
        $this->orderId = $data['orderId'];
236
        $this->orderLinkId = $data['orderLinkId'];
237
        $this->side = $data['side'];
238
        $this->orderType = $data['orderType'];
239
        $this->price = $data['price'];
240
        $this->qty = $data['qty'];
241
        $this->timeInForce = $data['timeInForce'];
242
        $this->orderStatus = $data['orderStatus'];
243
        $this->positionIdx = $data['positionIdx'];
244
        $this->lastPriceOnCreated = $data['lastPriceOnCreated'];
245
        $this->createdTime = DateTimeHelper::makeFromTimestamp($data['createdTime']);
246
        $this->updatedTime = DateTimeHelper::makeFromTimestamp($data['updatedTime']);
247
        $this->cancelType = $data['cancelType'];
248
        $this->rejectReason = $data['rejectReason'];
249
        $this->stopOrderType = $data['stopOrderType'];
250
        $this->triggerDirection = $data['triggerDirection'];
251
        $this->triggerBy = $data['triggerBy'];
252
        $this->cumExecFee = $data['cumExecFee'];
253
        $this->cumExecValue = $data['cumExecValue'];
254
        $this->triggerPrice = $data['triggerPrice'];
255
        $this->cumExecQty = $data['cumExecQty'];
256
        $this->leavesValue = $data['leavesValue'];
257
        $this->leavesQty = $data['leavesQty'];
258
        $this->takeProfit = $data['takeProfit'];
259
        $this->stopLoss = $data['stopLoss'];
260
        $this->tpslMode = $data['tpslMode'];
261
        $this->tpLimitPrice = (float) $data['tpLimitPrice'];
262
        $this->slLimitPrice = (float) $data['slLimitPrice'];
263
        $this->tpTriggerBy = $data['tpTriggerBy'];
264
        $this->slTriggerBy = $data['slTriggerBy'];
265
        $this->reduceOnly = $data['reduceOnly'];
266
        $this->closeOnTrigger = $data['closeOnTrigger'];
267
        $this->blockTradeId = $data['blockTradeId'];
268
        $this->smpType = $data['smpType'];
269
        $this->smpGroup = $data['smpGroup'];
270
        $this->smpOrderId = $data['smpOrderId'];
271
    }
272
273
    /**
274
     * @return string
275
     */
276
    public function getSymbol(): string
277
    {
278
        return $this->symbol;
279
    }
280
281
    /**
282
     * @return string
283
     */
284
    public function getOrderId(): string
285
    {
286
        return $this->orderId;
287
    }
288
289
    /**
290
     * @return string
291
     */
292
    public function getOrderLinkId(): string
293
    {
294
        return $this->orderLinkId;
295
    }
296
297
    /**
298
     * @return string
299
     */
300
    public function getSide(): string
301
    {
302
        return $this->side;
303
    }
304
305
    /**
306
     * @return string
307
     */
308
    public function getOrderType(): string
309
    {
310
        return $this->orderType;
311
    }
312
313
    /**
314
     * @return float
315
     */
316
    public function getPrice(): float
317
    {
318
        return $this->price;
319
    }
320
321
    /**
322
     * @return float
323
     */
324
    public function getQty(): float
325
    {
326
        return $this->qty;
327
    }
328
329
    /**
330
     * @return string
331
     */
332
    public function getTimeInForce(): string
333
    {
334
        return $this->timeInForce;
335
    }
336
337
    /**
338
     * @return string
339
     */
340
    public function getOrderStatus(): string
341
    {
342
        return $this->orderStatus;
343
    }
344
345
    /**
346
     * @return int
347
     */
348
    public function getPositionIdx(): int
349
    {
350
        return $this->positionIdx;
351
    }
352
353
    /**
354
     * @return float
355
     */
356
    public function getLastPriceOnCreated(): float
357
    {
358
        return $this->lastPriceOnCreated;
359
    }
360
361
    /**
362
     * @return \DateTime
363
     */
364
    public function getCreatedTime(): \DateTime
365
    {
366
        return $this->createdTime;
367
    }
368
369
    /**
370
     * @return \DateTime
371
     */
372
    public function getUpdatedTime(): \DateTime
373
    {
374
        return $this->updatedTime;
375
    }
376
377
    /**
378
     * @return string
379
     */
380
    public function getCancelType(): string
381
    {
382
        return $this->cancelType;
383
    }
384
385
    /**
386
     * @return string
387
     */
388
    public function getRejectReason(): string
389
    {
390
        return $this->rejectReason;
391
    }
392
393
    /**
394
     * @return string
395
     */
396
    public function getStopOrderType(): string
397
    {
398
        return $this->stopOrderType;
399
    }
400
401
    /**
402
     * @return int
403
     */
404
    public function getTriggerDirection(): int
405
    {
406
        return $this->triggerDirection;
407
    }
408
409
    /**
410
     * @return string
411
     */
412
    public function getTriggerBy(): string
413
    {
414
        return $this->triggerBy;
415
    }
416
417
    /**
418
     * @return float
419
     */
420
    public function getTriggerPrice(): float
421
    {
422
        return $this->triggerPrice;
423
    }
424
425
    /**
426
     * @return float
427
     */
428
    public function getCumExecValue(): float
429
    {
430
        return $this->cumExecValue;
431
    }
432
433
    /**
434
     * @return float
435
     */
436
    public function getCumExecFee(): float
437
    {
438
        return $this->cumExecFee;
439
    }
440
441
    /**
442
     * @return float
443
     */
444
    public function getCumExecQty(): float
445
    {
446
        return $this->cumExecQty;
447
    }
448
449
    /**
450
     * @return float
451
     */
452
    public function getLeavesValue(): float
453
    {
454
        return $this->leavesValue;
455
    }
456
457
    /**
458
     * @return float
459
     */
460
    public function getLeavesQty(): float
461
    {
462
        return $this->leavesQty;
463
    }
464
465
    /**
466
     * @return float
467
     */
468
    public function getTakeProfit(): float
469
    {
470
        return $this->takeProfit;
471
    }
472
473
    /**
474
     * @return float
475
     */
476
    public function getStopLoss(): float
477
    {
478
        return $this->stopLoss;
479
    }
480
481
    /**
482
     * @return string
483
     */
484
    public function getTpslMode(): string
485
    {
486
        return $this->tpslMode;
487
    }
488
489
    /**
490
     * @return float
491
     */
492
    public function getTpLimitPrice(): float
493
    {
494
        return $this->tpLimitPrice;
495
    }
496
497
    /**
498
     * @return float
499
     */
500
    public function getSlLimitPrice(): float
501
    {
502
        return $this->slLimitPrice;
503
    }
504
505
    /**
506
     * @return string
507
     */
508
    public function getTpTriggerBy(): string
509
    {
510
        return $this->tpTriggerBy;
511
    }
512
513
    /**
514
     * @return string
515
     */
516
    public function getSlTriggerBy(): string
517
    {
518
        return $this->slTriggerBy;
519
    }
520
521
    /**
522
     * @return bool
523
     */
524
    public function isReduceOnly(): bool
525
    {
526
        return $this->reduceOnly;
527
    }
528
529
    /**
530
     * @return bool
531
     */
532
    public function isCloseOnTrigger(): bool
533
    {
534
        return $this->closeOnTrigger;
535
    }
536
537
    /**
538
     * @return string
539
     */
540
    public function getBlockTradeId(): string
541
    {
542
        return $this->blockTradeId;
543
    }
544
545
    /**
546
     * @return string
547
     */
548
    public function getSmpType(): string
549
    {
550
        return $this->smpType;
551
    }
552
553
    /**
554
     * @return int
555
     */
556
    public function getSmpGroup(): int
557
    {
558
        return $this->smpGroup;
559
    }
560
561
    /**
562
     * @return string
563
     */
564
    public function getSmpOrderId(): string
565
    {
566
        return $this->smpOrderId;
567
    }
568
}