GetOrderListResponseItem::getTpslMode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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