1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Carpenstar\ByBitAPI\Derivatives\Contract\Order\PlaceOrder\Request; |
4
|
|
|
|
5
|
|
|
use Carpenstar\ByBitAPI\Core\Enums\EnumOrderType; |
6
|
|
|
use Carpenstar\ByBitAPI\Core\Enums\EnumSide; |
7
|
|
|
use Carpenstar\ByBitAPI\Core\Enums\EnumTimeInForce; |
8
|
|
|
use Carpenstar\ByBitAPI\Core\Enums\EnumTPSLModes; |
9
|
|
|
use Carpenstar\ByBitAPI\Core\Enums\EnumTriggerDirection; |
10
|
|
|
use Carpenstar\ByBitAPI\Core\Enums\EnumTriggerPriceType; |
11
|
|
|
use Carpenstar\ByBitAPI\Core\Exceptions\SDKException; |
12
|
|
|
use Carpenstar\ByBitAPI\Core\Helpers\ArrayHelper; |
13
|
|
|
use Carpenstar\ByBitAPI\Core\Helpers\NumericHelper; |
14
|
|
|
use Carpenstar\ByBitAPI\Core\Objects\AbstractParameters; |
15
|
|
|
use Carpenstar\ByBitAPI\Derivatives\Contract\Order\PlaceOrder\Interfaces\IPlaceOrderRequestInterface; |
16
|
|
|
|
17
|
|
|
class PlaceOrderRequest extends AbstractParameters implements IPlaceOrderRequestInterface |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* Symbol name |
21
|
|
|
* @var string $symbol |
22
|
|
|
*/ |
23
|
|
|
protected string $symbol; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Buy,Sell |
27
|
|
|
* @var string $side |
28
|
|
|
*/ |
29
|
|
|
protected string $side; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Market, Limit |
33
|
|
|
* @var string $orderType |
34
|
|
|
*/ |
35
|
|
|
protected string $orderType; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Order quantity |
39
|
|
|
* @var float $qty |
40
|
|
|
*/ |
41
|
|
|
protected float $qty; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* |
45
|
|
|
* @var string $timeInForce |
46
|
|
|
*/ |
47
|
|
|
protected string $timeInForce = EnumTimeInForce::GOOD_TILL_CANCELED_FULL; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Order price. Invalid if orderType=Market |
51
|
|
|
* @var float $price |
52
|
|
|
*/ |
53
|
|
|
protected float $price; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Conditional order param. Used to identify the expected direction of the conditional order. |
57
|
|
|
* 1: triggered when market price rises to triggerPrice |
58
|
|
|
* 2: triggered when market price falls to triggerPrice |
59
|
|
|
* @var int $triggerDirection |
60
|
|
|
*/ |
61
|
|
|
protected int $triggerDirection; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Conditional order param. If you expect the price to rise to trigger your conditional order, make sure: |
65
|
|
|
* triggerPrice > market price |
66
|
|
|
* Else, triggerPrice < market price |
67
|
|
|
* @var string $triggerPrice |
68
|
|
|
*/ |
69
|
|
|
protected string $triggerPrice; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Trigger price type. default:LastPrice. |
73
|
|
|
* @var string $triggerBy |
74
|
|
|
*/ |
75
|
|
|
protected string $triggerBy = EnumTriggerPriceType::PRICE_TYPE_LAST; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Position index. It is required for hedge position mode |
79
|
|
|
* @var int |
80
|
|
|
*/ |
81
|
|
|
protected int $positionIdx; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* User customised order id. A max of 36 characters. Combinations of numbers, letters (upper and lower cases), dashes, and underscores are supported. |
85
|
|
|
* rule of future: |
86
|
|
|
* optional param |
87
|
|
|
* The same orderLinkId can be used for both USDC PERP and USDT PERP. |
88
|
|
|
* An orderLinkId can be reused once the original order is either Filled or Cancelled |
89
|
|
|
* rule of option: |
90
|
|
|
* This param is required |
91
|
|
|
* always unique |
92
|
|
|
* @var string $orderLinkId |
93
|
|
|
*/ |
94
|
|
|
protected string $orderLinkId; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Take profit price |
98
|
|
|
* @var float $takeProfit |
99
|
|
|
*/ |
100
|
|
|
protected float $takeProfit; |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Stop loss price |
104
|
|
|
* @var float $stopLoss |
105
|
|
|
*/ |
106
|
|
|
protected float $stopLoss; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* The price type to trigger take profit. default:LastPrice |
110
|
|
|
* @var string $tpTriggerBy |
111
|
|
|
*/ |
112
|
|
|
protected string $tpTriggerBy; |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* The price type to trigger stop loss. default:LastPrice |
116
|
|
|
* @var string $slTriggerBy |
117
|
|
|
*/ |
118
|
|
|
protected string $slTriggerBy; |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* What is a reduce-only order? true means your position can only reduce in size if this order is triggered. |
122
|
|
|
* When reduce_only is true, take profit/stop loss cannot be set |
123
|
|
|
* @var bool $reduceOnly |
124
|
|
|
*/ |
125
|
|
|
protected bool $reduceOnly; |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* @var string $smpType |
129
|
|
|
*/ |
130
|
|
|
protected string $smpType; |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* What is a close on trigger order? For a closing order. It can only reduce your position, not increase it. |
134
|
|
|
* If the account has insufficient available balance when the closing order is triggered, then other active orders |
135
|
|
|
* of similar contracts will be cancelled or reduced. It can be used to ensure your stop loss reduces your position |
136
|
|
|
* regardless of current available margin. |
137
|
|
|
* @var bool $closeOnTrigger |
138
|
|
|
*/ |
139
|
|
|
protected bool $closeOnTrigger; |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* TP/SL mode |
143
|
|
|
* Full: entire position for TP/SL. Then, tpOrderType or slOrderType must be Market |
144
|
|
|
* Partial: partial position tp/sl. Limit TP/SL order are supported. Note: When create limit tp/sl, |
145
|
|
|
* tpslMode is required and it must be Partial |
146
|
|
|
* @var string $tpslMode |
147
|
|
|
*/ |
148
|
|
|
protected string $tpslMode; |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* The limit order price when take profit price is triggered. Only works when tpslMode=Partial and tpOrderType=Limit |
152
|
|
|
* @var string $tpLimitPrice |
153
|
|
|
*/ |
154
|
|
|
protected string $tpLimitPrice; |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* The limit order price when stop loss price is triggered. Only works when tpslMode=Partial and slOrderType=Limit |
158
|
|
|
* @var string $slLimitPrice |
159
|
|
|
*/ |
160
|
|
|
protected string $slLimitPrice; |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* The order type when take profit is triggered. Market(default), Limit. For tpslMode=Full, |
164
|
|
|
* it only supports tpOrderType=Market |
165
|
|
|
* @var string $tpOrderType |
166
|
|
|
*/ |
167
|
|
|
protected string $tpOrderType; |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* The order type when stop loss is triggered. Market(default), Limit. For tpslMode=Full, |
171
|
|
|
* it only supports slOrderType=Market |
172
|
|
|
* @var string $slOrderType |
173
|
|
|
*/ |
174
|
|
|
protected string $slOrderType; |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* @return string |
178
|
|
|
*/ |
179
|
|
|
public function getSymbol(): string |
180
|
|
|
{ |
181
|
|
|
return $this->symbol; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* @param string $symbol |
186
|
|
|
* @return PlaceOrderRequest |
187
|
|
|
*/ |
188
|
|
|
public function setSymbol(string $symbol): self |
189
|
|
|
{ |
190
|
|
|
$this->symbol = $symbol; |
191
|
|
|
return $this; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* @return string |
196
|
|
|
*/ |
197
|
|
|
public function getSide(): string |
198
|
|
|
{ |
199
|
|
|
return $this->side; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @param string $side |
204
|
|
|
* @return PlaceOrderRequest |
205
|
|
|
* @throws SDKException |
206
|
|
|
*/ |
207
|
|
|
public function setSide(string $side): self |
208
|
|
|
{ |
209
|
|
|
ArrayHelper::checkValueWithStack($side, EnumSide::ORDER_SIDE_LIST); |
210
|
|
|
$this->side = $side; |
211
|
|
|
|
212
|
|
|
return $this; |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
/** |
216
|
|
|
* @return string |
217
|
|
|
*/ |
218
|
|
|
public function getOrderType(): string |
219
|
|
|
{ |
220
|
|
|
return $this->orderType; |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
/** |
224
|
|
|
* @param string $orderType |
225
|
|
|
* @return PlaceOrderRequest |
226
|
|
|
* @throws SDKException |
227
|
|
|
*/ |
228
|
|
|
public function setOrderType(string $orderType): self |
229
|
|
|
{ |
230
|
|
|
ArrayHelper::checkValueWithStack($orderType, EnumOrderType::ORDER_TYPE_LIST); |
231
|
|
|
$this->orderType = $orderType; |
232
|
|
|
|
233
|
|
|
return $this; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* @return float |
238
|
|
|
*/ |
239
|
|
|
public function getQty(): float |
240
|
|
|
{ |
241
|
|
|
return $this->qty; |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
/** |
245
|
|
|
* @param float $quantity |
246
|
|
|
* @return PlaceOrderRequest |
247
|
|
|
* @throws SDKException |
248
|
|
|
*/ |
249
|
|
|
public function setQty(float $quantity): self |
250
|
|
|
{ |
251
|
|
|
NumericHelper::checkValueMoreThan($quantity, 0.00000001); |
252
|
|
|
$this->qty = $quantity; |
253
|
|
|
|
254
|
|
|
return $this; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* @return string |
259
|
|
|
*/ |
260
|
|
|
public function getTimeInForce(): string |
261
|
|
|
{ |
262
|
|
|
return $this->timeInForce; |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
/** |
266
|
|
|
* @param string $timeInForce |
267
|
|
|
* @return PlaceOrderRequest |
268
|
|
|
*/ |
269
|
|
|
public function setTimeInForce(string $timeInForce): self |
270
|
|
|
{ |
271
|
|
|
ArrayHelper::checkValueWithStack($timeInForce, EnumTimeInForce::TIME_IN_FORCE_LIST_FULL); |
272
|
|
|
$this->timeInForce = $timeInForce; |
273
|
|
|
return $this; |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
/** |
277
|
|
|
* @return float |
278
|
|
|
*/ |
279
|
|
|
public function getPrice(): float |
280
|
|
|
{ |
281
|
|
|
return $this->price; |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
/** |
285
|
|
|
* @param float $price |
286
|
|
|
* @return PlaceOrderRequest |
287
|
|
|
* @throws SDKException |
288
|
|
|
*/ |
289
|
|
|
public function setPrice(float $price): self |
290
|
|
|
{ |
291
|
|
|
NumericHelper::checkValueMoreThan($price, 0.000001); |
292
|
|
|
$this->price = $price; |
293
|
|
|
return $this; |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
/** |
297
|
|
|
* @return int |
298
|
|
|
*/ |
299
|
|
|
public function getTriggerDirection(): int |
300
|
|
|
{ |
301
|
|
|
return $this->triggerDirection; |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
/** |
305
|
|
|
* @param int $triggerDirection |
306
|
|
|
* @return PlaceOrderRequest |
307
|
|
|
* @throws SDKException |
308
|
|
|
*/ |
309
|
|
|
public function setTriggerDirection(int $triggerDirection): self |
310
|
|
|
{ |
311
|
|
|
ArrayHelper::checkValueWithStack($triggerDirection, EnumTriggerDirection::DIRECTION_LIST); |
312
|
|
|
$this->triggerDirection = $triggerDirection; |
|
|
|
|
313
|
|
|
|
314
|
|
|
return $this; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* @return string |
319
|
|
|
*/ |
320
|
|
|
public function getTriggerPrice(): string |
321
|
|
|
{ |
322
|
|
|
return $this->triggerPrice; |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
/** |
326
|
|
|
* @param string $triggerPrice |
327
|
|
|
* @return PlaceOrderRequest |
328
|
|
|
* @throws SDKException |
329
|
|
|
*/ |
330
|
|
|
public function setTriggerPrice(string $triggerPrice): self |
331
|
|
|
{ |
332
|
|
|
NumericHelper::checkValueMoreThan($triggerPrice, 0.000001); |
|
|
|
|
333
|
|
|
$this->triggerPrice = $triggerPrice; |
334
|
|
|
return $this; |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
/** |
338
|
|
|
* @return string |
339
|
|
|
*/ |
340
|
|
|
public function getTriggerBy(): string |
341
|
|
|
{ |
342
|
|
|
return $this->triggerBy; |
343
|
|
|
} |
344
|
|
|
|
345
|
|
|
/** |
346
|
|
|
* @param string $triggerBy |
347
|
|
|
* @return PlaceOrderRequest |
348
|
|
|
* @throws SDKException |
349
|
|
|
*/ |
350
|
|
|
public function setTriggerBy(string $triggerBy): self |
351
|
|
|
{ |
352
|
|
|
ArrayHelper::checkValueWithStack($triggerBy, EnumTriggerPriceType::PRICE_TYPE_LIST); |
353
|
|
|
$this->triggerBy = $triggerBy; |
354
|
|
|
|
355
|
|
|
return $this; |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
/** |
359
|
|
|
* @return int |
360
|
|
|
*/ |
361
|
|
|
public function getPositionIdx(): int |
362
|
|
|
{ |
363
|
|
|
return $this->positionIdx; |
364
|
|
|
} |
365
|
|
|
|
366
|
|
|
/** |
367
|
|
|
* @param int $positionIdx |
368
|
|
|
* @return PlaceOrderRequest |
369
|
|
|
*/ |
370
|
|
|
public function setPositionIdx(int $positionIdx): self |
371
|
|
|
{ |
372
|
|
|
$this->positionIdx = $positionIdx; |
373
|
|
|
return $this; |
374
|
|
|
} |
375
|
|
|
|
376
|
|
|
/** |
377
|
|
|
* @return string |
378
|
|
|
*/ |
379
|
|
|
public function getOrderLinkId(): string |
380
|
|
|
{ |
381
|
|
|
return $this->orderLinkId; |
382
|
|
|
} |
383
|
|
|
|
384
|
|
|
/** |
385
|
|
|
* @param string $orderLinkId |
386
|
|
|
* @return PlaceOrderRequest |
387
|
|
|
*/ |
388
|
|
|
public function setOrderLinkId(string $orderLinkId): self |
389
|
|
|
{ |
390
|
|
|
$this->orderLinkId = $orderLinkId; |
391
|
|
|
return $this; |
392
|
|
|
} |
393
|
|
|
|
394
|
|
|
/** |
395
|
|
|
* @return float |
396
|
|
|
*/ |
397
|
|
|
public function getTakeProfit(): float |
398
|
|
|
{ |
399
|
|
|
return $this->takeProfit; |
400
|
|
|
} |
401
|
|
|
|
402
|
|
|
/** |
403
|
|
|
* @param float $takeProfit |
404
|
|
|
* @return PlaceOrderRequest |
405
|
|
|
* @throws SDKException |
406
|
|
|
*/ |
407
|
|
|
public function setTakeProfit(float $takeProfit): self |
408
|
|
|
{ |
409
|
|
|
NumericHelper::checkValueMoreThan($takeProfit, 0.000001); |
410
|
|
|
$this->takeProfit = $takeProfit; |
411
|
|
|
|
412
|
|
|
return $this; |
413
|
|
|
} |
414
|
|
|
|
415
|
|
|
/** |
416
|
|
|
* @return float |
417
|
|
|
*/ |
418
|
|
|
public function getStopLoss(): float |
419
|
|
|
{ |
420
|
|
|
return $this->stopLoss; |
421
|
|
|
} |
422
|
|
|
|
423
|
|
|
/** |
424
|
|
|
* @param float $stopLoss |
425
|
|
|
* @return PlaceOrderRequest |
426
|
|
|
* @throws SDKException |
427
|
|
|
*/ |
428
|
|
|
public function setStopLoss(float $stopLoss): self |
429
|
|
|
{ |
430
|
|
|
NumericHelper::checkValueMoreThan($stopLoss, 0.000001); |
431
|
|
|
$this->stopLoss = $stopLoss; |
432
|
|
|
return $this; |
433
|
|
|
} |
434
|
|
|
|
435
|
|
|
/** |
436
|
|
|
* @return string |
437
|
|
|
*/ |
438
|
|
|
public function getTpTriggerBy(): string |
439
|
|
|
{ |
440
|
|
|
return $this->tpTriggerBy; |
441
|
|
|
} |
442
|
|
|
|
443
|
|
|
/** |
444
|
|
|
* @param string $tpTriggerBy |
445
|
|
|
* @return PlaceOrderRequest |
446
|
|
|
*/ |
447
|
|
|
public function setTpTriggerBy(string $tpTriggerBy): self |
448
|
|
|
{ |
449
|
|
|
$this->tpTriggerBy = $tpTriggerBy; |
450
|
|
|
return $this; |
451
|
|
|
} |
452
|
|
|
|
453
|
|
|
/** |
454
|
|
|
* @return string |
455
|
|
|
*/ |
456
|
|
|
public function getSlTriggerBy(): string |
457
|
|
|
{ |
458
|
|
|
return $this->slTriggerBy; |
459
|
|
|
} |
460
|
|
|
|
461
|
|
|
/** |
462
|
|
|
* @param string $slTriggerBy |
463
|
|
|
* @return PlaceOrderRequest |
464
|
|
|
*/ |
465
|
|
|
public function setSlTriggerBy(string $slTriggerBy): self |
466
|
|
|
{ |
467
|
|
|
$this->slTriggerBy = $slTriggerBy; |
468
|
|
|
return $this; |
469
|
|
|
} |
470
|
|
|
|
471
|
|
|
/** |
472
|
|
|
* @return bool |
473
|
|
|
*/ |
474
|
|
|
public function isReduceOnly(): bool |
475
|
|
|
{ |
476
|
|
|
return $this->reduceOnly; |
477
|
|
|
} |
478
|
|
|
|
479
|
|
|
/** |
480
|
|
|
* @param bool $reduceOnly |
481
|
|
|
* @return PlaceOrderRequest |
482
|
|
|
*/ |
483
|
|
|
public function setReduceOnly(bool $reduceOnly): self |
484
|
|
|
{ |
485
|
|
|
$this->reduceOnly = $reduceOnly; |
486
|
|
|
return $this; |
487
|
|
|
} |
488
|
|
|
|
489
|
|
|
/** |
490
|
|
|
* @return string |
491
|
|
|
*/ |
492
|
|
|
public function getSmpType(): string |
493
|
|
|
{ |
494
|
|
|
return $this->smpType; |
495
|
|
|
} |
496
|
|
|
|
497
|
|
|
/** |
498
|
|
|
* @param string $smpType |
499
|
|
|
* @return PlaceOrderRequest |
500
|
|
|
*/ |
501
|
|
|
public function setSmpType(string $smpType): self |
502
|
|
|
{ |
503
|
|
|
$this->smpType = $smpType; |
504
|
|
|
return $this; |
505
|
|
|
} |
506
|
|
|
|
507
|
|
|
/** |
508
|
|
|
* @return bool |
509
|
|
|
*/ |
510
|
|
|
public function isCloseOnTrigger(): bool |
511
|
|
|
{ |
512
|
|
|
return $this->closeOnTrigger; |
513
|
|
|
} |
514
|
|
|
|
515
|
|
|
/** |
516
|
|
|
* @param bool $closeOnTrigger |
517
|
|
|
* @return PlaceOrderRequest |
518
|
|
|
*/ |
519
|
|
|
public function setCloseOnTrigger(bool $closeOnTrigger): self |
520
|
|
|
{ |
521
|
|
|
$this->closeOnTrigger = $closeOnTrigger; |
522
|
|
|
return $this; |
523
|
|
|
} |
524
|
|
|
|
525
|
|
|
/** |
526
|
|
|
* @return string |
527
|
|
|
*/ |
528
|
|
|
public function getTpslMode(): string |
529
|
|
|
{ |
530
|
|
|
return $this->tpslMode; |
531
|
|
|
} |
532
|
|
|
|
533
|
|
|
/** |
534
|
|
|
* @param string $tpslMode |
535
|
|
|
* @return PlaceOrderRequest |
536
|
|
|
* @throws SDKException |
537
|
|
|
*/ |
538
|
|
|
public function setTpslMode(string $tpslMode): self |
539
|
|
|
{ |
540
|
|
|
ArrayHelper::checkValueWithStack($tpslMode, EnumTPSLModes::MODE_LIST); |
541
|
|
|
$this->tpslMode = $tpslMode; |
542
|
|
|
|
543
|
|
|
return $this; |
544
|
|
|
} |
545
|
|
|
|
546
|
|
|
/** |
547
|
|
|
* @return string |
548
|
|
|
*/ |
549
|
|
|
public function getTpLimitPrice(): string |
550
|
|
|
{ |
551
|
|
|
return $this->tpLimitPrice; |
552
|
|
|
} |
553
|
|
|
|
554
|
|
|
/** |
555
|
|
|
* @param string $tpLimitPrice |
556
|
|
|
* @return PlaceOrderRequest |
557
|
|
|
*/ |
558
|
|
|
public function setTpLimitPrice(string $tpLimitPrice): self |
559
|
|
|
{ |
560
|
|
|
$this->tpLimitPrice = $tpLimitPrice; |
561
|
|
|
return $this; |
562
|
|
|
} |
563
|
|
|
|
564
|
|
|
/** |
565
|
|
|
* @return string |
566
|
|
|
*/ |
567
|
|
|
public function getSlLimitPrice(): string |
568
|
|
|
{ |
569
|
|
|
return $this->slLimitPrice; |
570
|
|
|
} |
571
|
|
|
|
572
|
|
|
/** |
573
|
|
|
* @param string $slLimitPrice |
574
|
|
|
* @return PlaceOrderRequest |
575
|
|
|
*/ |
576
|
|
|
public function setSlLimitPrice(string $slLimitPrice): self |
577
|
|
|
{ |
578
|
|
|
$this->slLimitPrice = $slLimitPrice; |
579
|
|
|
return $this; |
580
|
|
|
} |
581
|
|
|
|
582
|
|
|
/** |
583
|
|
|
* @return string |
584
|
|
|
*/ |
585
|
|
|
public function getTpOrderType(): string |
586
|
|
|
{ |
587
|
|
|
return $this->tpOrderType; |
588
|
|
|
} |
589
|
|
|
|
590
|
|
|
/** |
591
|
|
|
* @param string $tpOrderType |
592
|
|
|
* @return PlaceOrderRequest |
593
|
|
|
* @throws SDKException |
594
|
|
|
*/ |
595
|
|
|
public function setTpOrderType(string $tpOrderType): self |
596
|
|
|
{ |
597
|
|
|
ArrayHelper::checkValueWithStack($tpOrderType, EnumOrderType::ORDER_TYPE_LIST); |
598
|
|
|
$this->tpOrderType = $tpOrderType; |
599
|
|
|
|
600
|
|
|
return $this; |
601
|
|
|
} |
602
|
|
|
|
603
|
|
|
/** |
604
|
|
|
* @return string |
605
|
|
|
*/ |
606
|
|
|
public function getSlOrderType(): string |
607
|
|
|
{ |
608
|
|
|
return $this->slOrderType; |
609
|
|
|
} |
610
|
|
|
|
611
|
|
|
/** |
612
|
|
|
* @param string $slOrderType |
613
|
|
|
* @return PlaceOrderRequest |
614
|
|
|
* @throws SDKException |
615
|
|
|
*/ |
616
|
|
|
public function setSlOrderType(string $slOrderType): self |
617
|
|
|
{ |
618
|
|
|
ArrayHelper::checkValueWithStack($slOrderType, EnumOrderType::ORDER_TYPE_LIST); |
619
|
|
|
$this->slOrderType = $slOrderType; |
620
|
|
|
|
621
|
|
|
return $this; |
622
|
|
|
} |
623
|
|
|
} |
624
|
|
|
|
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.