SetTradingStopRequest   A
last analyzed

Complexity

Total Complexity 30

Size/Duplication

Total Lines 364
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 61
dl 0
loc 364
rs 10
c 2
b 0
f 0
wmc 30

30 Methods

Rating   Name   Duplication   Size   Complexity  
A getSymbol() 0 3 1
A setTrailingStop() 0 4 1
A setSlLimitPrice() 0 4 1
A getTpOrderType() 0 3 1
A getSlLimitPrice() 0 3 1
A setTpSize() 0 4 1
A setTakeProfit() 0 4 1
A setTpslMode() 0 4 1
A getStopLoss() 0 3 1
A setSlTriggerBy() 0 4 1
A getTrailingStop() 0 3 1
A getTpslMode() 0 3 1
A setTpTriggerBy() 0 4 1
A setSlOrderType() 0 4 1
A setStopLoss() 0 4 1
A getTakeProfit() 0 3 1
A setSymbol() 0 4 1
A getSlOrderType() 0 3 1
A getSlSize() 0 3 1
A getSlTriggerBy() 0 3 1
A setTpOrderType() 0 4 1
A setTpLimitPrice() 0 4 1
A getPositionIdx() 0 3 1
A setPositionIdx() 0 4 1
A setSlSize() 0 4 1
A getTpTriggerBy() 0 3 1
A setActivePrice() 0 4 1
A getTpLimitPrice() 0 3 1
A getTpSize() 0 3 1
A getActivePrice() 0 3 1
1
<?php
2
3
namespace Carpenstar\ByBitAPI\Derivatives\Contract\Position\SetTradingStop\Request;
4
5
use Carpenstar\ByBitAPI\Core\Objects\AbstractParameters;
6
use Carpenstar\ByBitAPI\Derivatives\Contract\Position\SetTradingStop\Interfaces\ISetTradingStopRequestInterface;
7
8
class SetTradingStopRequest extends AbstractParameters implements ISetTradingStopRequestInterface
9
{
10
    /**
11
     * Symbol name
12
     * @var string $symbol
13
     */
14
    protected string $symbol;
15
16
    /**
17
     * Cannot be less than 0, 0 means cancel TP. Partial TP/SL cannot be cancelled by set it 0
18
     * @var float $takeProfit
19
     */
20
    protected float $takeProfit;
21
22
    /**
23
     * Cannot be less than 0, 0 means cancel SL. Partial TP/SL cannot be cancelled by set it 0
24
     * @var float $stopLoss
25
     */
26
    protected float $stopLoss;
27
28
    /**
29
     * TP/SL mode. Full: entire position TP/SL, Partial: partial position TP/SL.
30
     * As each contract has an initial full TP/SL mode, if it has been modified before, it may be partial.
31
     * Therefore, if not provided, the system will automatically retrieve the current TP/SL mode configuration for the contract.
32
     * @var string $tpslMode
33
     */
34
    protected string $tpslMode;
35
36
    /**
37
     * Take profit size. Valid in TP/SL partial mode only. Note: the value of tpSize and slSize must equal
38
     * @var float $tpSize
39
     */
40
    protected float $tpSize;
41
42
    /**
43
     * Stop loss size. Valid in TP/SL partial mode only. Note: the value of tpSize and slSize must equal
44
     * @var float $slSize
45
     */
46
    protected float $slSize;
47
48
    /**
49
     * Take profit trigger price type. default: LastPrice
50
     * @var string $tpTriggerBy
51
     */
52
    protected string $tpTriggerBy;
53
54
    /**
55
     * Stop loss trigger price type. default: LastPrice
56
     * @var string $slTriggerBy
57
     */
58
    protected string $slTriggerBy;
59
60
    /**
61
     * Cannot be less than 0, 0 means cancel TS
62
     * @var float $trailingStop
63
     */
64
    protected float $trailingStop;
65
66
    /**
67
     * Trailing stop trigger price. Trailing stop will be triggered when this price is reached only
68
     * @var float $activePrice
69
     */
70
    protected float $activePrice;
71
72
    /**
73
     * The limit order price when take profit price is triggered. Only works when tpslMode=Partial and tpOrderType=Limit
74
     * @var float $tpLimitPrice
75
     */
76
    protected float $tpLimitPrice;
77
78
    /**
79
     * The limit order price when stop loss price is triggered. Only works when tpslMode=Partial and slOrderType=Limit
80
     * @var float $slLimitPrice
81
     */
82
    protected float $slLimitPrice;
83
84
    /**
85
     * The order type when take profit is triggered. Market(default), Limit. For tpslMode=Full, it only supports tpOrderType=Market
86
     * @var string $tpOrderType
87
     */
88
    protected string $tpOrderType;
89
90
    /**
91
     * The order type when stop loss is triggered. Market(default), Limit. For tpslMode=Full, it only supports slOrderType=Market
92
     * @var string $slOrderType
93
     */
94
    protected string $slOrderType;
95
96
    /**
97
     * Used to identify positions in different position modes. For hedge-mode, this param is required
98
     *  0: one-way mode
99
     *  1: hedge-mode Buy side
100
     *  2: hedge-mode Sell side
101
     */
102
    protected int $positionIdx;
103
104
    /**
105
     * @return string
106
     */
107
    public function getSymbol(): string
108
    {
109
        return $this->symbol;
110
    }
111
112
    /**
113
     * @param string $symbol
114
     * @return SetTradingStopRequest
115
     */
116
    public function setSymbol(string $symbol): self
117
    {
118
        $this->symbol = $symbol;
119
        return $this;
120
    }
121
122
    /**
123
     * @return float
124
     */
125
    public function getTakeProfit(): float
126
    {
127
        return $this->takeProfit;
128
    }
129
130
    /**
131
     * @param float $takeProfit
132
     * @return SetTradingStopRequest
133
     */
134
    public function setTakeProfit(float $takeProfit): self
135
    {
136
        $this->takeProfit = $takeProfit;
137
        return $this;
138
    }
139
140
    /**
141
     * @return float
142
     */
143
    public function getStopLoss(): float
144
    {
145
        return $this->stopLoss;
146
    }
147
148
    /**
149
     * @param float $stopLoss
150
     * @return SetTradingStopRequest
151
     */
152
    public function setStopLoss(float $stopLoss): self
153
    {
154
        $this->stopLoss = $stopLoss;
155
        return $this;
156
    }
157
158
    /**
159
     * @return string
160
     */
161
    public function getTpslMode(): string
162
    {
163
        return $this->tpslMode;
164
    }
165
166
    /**
167
     * @param string $tpslMode
168
     * @return SetTradingStopRequest
169
     */
170
    public function setTpslMode(string $tpslMode): self
171
    {
172
        $this->tpslMode = $tpslMode;
173
        return $this;
174
    }
175
176
    /**
177
     * @return float
178
     */
179
    public function getTpSize(): float
180
    {
181
        return $this->tpSize;
182
    }
183
184
    /**
185
     * @param float $tpSize
186
     * @return SetTradingStopRequest
187
     */
188
    public function setTpSize(float $tpSize): self
189
    {
190
        $this->tpSize = $tpSize;
191
        return $this;
192
    }
193
194
    /**
195
     * @return float
196
     */
197
    public function getSlSize(): float
198
    {
199
        return $this->slSize;
200
    }
201
202
    /**
203
     * @param float $slSize
204
     * @return SetTradingStopRequest
205
     */
206
    public function setSlSize(float $slSize): self
207
    {
208
        $this->slSize = $slSize;
209
        return $this;
210
    }
211
212
    /**
213
     * @return string
214
     */
215
    public function getTpTriggerBy(): string
216
    {
217
        return $this->tpTriggerBy;
218
    }
219
220
    /**
221
     * @param string $tpTriggerBy
222
     * @return SetTradingStopRequest
223
     */
224
    public function setTpTriggerBy(string $tpTriggerBy): self
225
    {
226
        $this->tpTriggerBy = $tpTriggerBy;
227
        return $this;
228
    }
229
230
    /**
231
     * @return string
232
     */
233
    public function getSlTriggerBy(): string
234
    {
235
        return $this->slTriggerBy;
236
    }
237
238
    /**
239
     * @param string $slTriggerBy
240
     * @return SetTradingStopRequest
241
     */
242
    public function setSlTriggerBy(string $slTriggerBy): self
243
    {
244
        $this->slTriggerBy = $slTriggerBy;
245
        return $this;
246
    }
247
248
    /**
249
     * @return float
250
     */
251
    public function getTrailingStop(): float
252
    {
253
        return $this->trailingStop;
254
    }
255
256
    /**
257
     * @param float $trailingStop
258
     * @return SetTradingStopRequest
259
     */
260
    public function setTrailingStop(float $trailingStop): self
261
    {
262
        $this->trailingStop = $trailingStop;
263
        return $this;
264
    }
265
266
    /**
267
     * @return float
268
     */
269
    public function getActivePrice(): float
270
    {
271
        return $this->activePrice;
272
    }
273
274
    /**
275
     * @param float $activePrice
276
     * @return SetTradingStopRequest
277
     */
278
    public function setActivePrice(float $activePrice): self
279
    {
280
        $this->activePrice = $activePrice;
281
        return $this;
282
    }
283
284
    /**
285
     * @return float
286
     */
287
    public function getTpLimitPrice(): float
288
    {
289
        return $this->tpLimitPrice;
290
    }
291
292
    /**
293
     * @param float $tpLimitPrice
294
     * @return SetTradingStopRequest
295
     */
296
    public function setTpLimitPrice(float $tpLimitPrice): self
297
    {
298
        $this->tpLimitPrice = $tpLimitPrice;
299
        return $this;
300
    }
301
302
    /**
303
     * @return float
304
     */
305
    public function getSlLimitPrice(): float
306
    {
307
        return $this->slLimitPrice;
308
    }
309
310
    /**
311
     * @param float $slLimitPrice
312
     * @return SetTradingStopRequest
313
     */
314
    public function setSlLimitPrice(float $slLimitPrice): self
315
    {
316
        $this->slLimitPrice = $slLimitPrice;
317
        return $this;
318
    }
319
320
    /**
321
     * @return string
322
     */
323
    public function getTpOrderType(): string
324
    {
325
        return $this->tpOrderType;
326
    }
327
328
    /**
329
     * @param string $tpOrderType
330
     * @return SetTradingStopRequest
331
     */
332
    public function setTpOrderType(string $tpOrderType): self
333
    {
334
        $this->tpOrderType = $tpOrderType;
335
        return $this;
336
    }
337
338
    /**
339
     * @return string
340
     */
341
    public function getSlOrderType(): string
342
    {
343
        return $this->slOrderType;
344
    }
345
346
    /**
347
     * @param string $slOrderType
348
     * @return SetTradingStopRequest
349
     */
350
    public function setSlOrderType(string $slOrderType): self
351
    {
352
        $this->slOrderType = $slOrderType;
353
        return $this;
354
    }
355
356
    /**
357
     * @return int
358
     */
359
    public function getPositionIdx(): int
360
    {
361
        return $this->positionIdx;
362
    }
363
364
    /**
365
     * @param int $positionIdx
366
     * @return SetTradingStopRequest
367
     */
368
    public function setPositionIdx(int $positionIdx): self
369
    {
370
        $this->positionIdx = $positionIdx;
371
        return $this;
372
    }
373
}
374