1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Carpenstar\ByBitAPI\Derivatives\Contract\Order\ReplaceOrder\Request; |
4
|
|
|
|
5
|
|
|
use Carpenstar\ByBitAPI\Core\Objects\AbstractParameters; |
6
|
|
|
use Carpenstar\ByBitAPI\Derivatives\Contract\Order\ReplaceOrder\Interfaces\IReplaceOrderRequestInterface; |
7
|
|
|
|
8
|
|
|
class ReplaceOrderRequest extends AbstractParameters implements IReplaceOrderRequestInterface |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @var string $symbol |
12
|
|
|
*/ |
13
|
|
|
protected string $symbol; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @var string $orderId |
17
|
|
|
*/ |
18
|
|
|
protected string $orderId; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var string $orderLinkId |
22
|
|
|
*/ |
23
|
|
|
protected string $orderLinkId; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Order price after modification. Don't pass it if not modify the price |
27
|
|
|
* @var float $price |
28
|
|
|
*/ |
29
|
|
|
protected float $price; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Order quantity after modification. Don't pass it if not modify the qty |
33
|
|
|
* @var float $qty |
34
|
|
|
*/ |
35
|
|
|
protected float $qty; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Trigger price. Don't pass it if not modify the qty |
39
|
|
|
* @var float $triggerPrice |
40
|
|
|
*/ |
41
|
|
|
protected float $triggerPrice; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Take profit price after modification. Don't pass it if not modify the take profit |
45
|
|
|
* @var float $takeProfit |
46
|
|
|
*/ |
47
|
|
|
protected float $takeProfit; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Stop loss price after modification. Don't pass it if not modify the Stop loss |
51
|
|
|
* @var float $stopLoss |
52
|
|
|
*/ |
53
|
|
|
protected float $stopLoss; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* The price type to trigger take profit. When set a take profit, this param is required if no initial value for the order |
57
|
|
|
* @var string $tpTriggerBy |
58
|
|
|
*/ |
59
|
|
|
protected string $tpTriggerBy; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* The price type to trigger stop loss. When set a stop loss, this param is required if no initial value for the order |
63
|
|
|
* @var string $slTriggerBy |
64
|
|
|
*/ |
65
|
|
|
protected string $slTriggerBy; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Trigger price type. LastPrice, IndexPrice, MarkPrice, LastPrice |
69
|
|
|
* @var string $triggerBy |
70
|
|
|
*/ |
71
|
|
|
protected string $triggerBy; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Limit order price when take profit is triggered. Only working when original order sets partial limit tp/sl |
75
|
|
|
* @var float $tpLimitPrice |
76
|
|
|
*/ |
77
|
|
|
protected float $tpLimitPrice; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Limit order price when stop loss is triggered. Only working when original order sets partial limit tp/sl |
81
|
|
|
* @var array $requiredBetweenFields |
82
|
|
|
*/ |
83
|
|
|
protected array $requiredBetweenFields; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @return string |
87
|
|
|
*/ |
88
|
|
|
public function getSymbol(): string |
89
|
|
|
{ |
90
|
|
|
return $this->symbol; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @param string $symbol |
95
|
|
|
* @return ReplaceOrderRequest |
96
|
|
|
*/ |
97
|
|
|
public function setSymbol(string $symbol): self |
98
|
|
|
{ |
99
|
|
|
$this->symbol = $symbol; |
100
|
|
|
return $this; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @return string |
105
|
|
|
*/ |
106
|
|
|
public function getOrderId(): string |
107
|
|
|
{ |
108
|
|
|
return $this->orderId; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @param string $orderId |
113
|
|
|
* @return ReplaceOrderRequest |
114
|
|
|
*/ |
115
|
|
|
public function setOrderId(string $orderId): self |
116
|
|
|
{ |
117
|
|
|
$this->orderId = $orderId; |
118
|
|
|
return $this; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @return string |
123
|
|
|
*/ |
124
|
|
|
public function getOrderLinkId(): string |
125
|
|
|
{ |
126
|
|
|
return $this->orderLinkId; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @param string $orderLinkId |
131
|
|
|
* @return ReplaceOrderRequest |
132
|
|
|
*/ |
133
|
|
|
public function setOrderLinkId(string $orderLinkId): self |
134
|
|
|
{ |
135
|
|
|
$this->orderLinkId = $orderLinkId; |
136
|
|
|
return $this; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @return float |
141
|
|
|
*/ |
142
|
|
|
public function getPrice(): float |
143
|
|
|
{ |
144
|
|
|
return $this->price; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @param float $price |
149
|
|
|
* @return ReplaceOrderRequest |
150
|
|
|
*/ |
151
|
|
|
public function setPrice(float $price): self |
152
|
|
|
{ |
153
|
|
|
$this->price = $price; |
154
|
|
|
return $this; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* @return float |
159
|
|
|
*/ |
160
|
|
|
public function getQty(): float |
161
|
|
|
{ |
162
|
|
|
return $this->qty; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @param float $qty |
167
|
|
|
* @return ReplaceOrderRequest |
168
|
|
|
*/ |
169
|
|
|
public function setQty(float $qty): self |
170
|
|
|
{ |
171
|
|
|
$this->qty = $qty; |
172
|
|
|
return $this; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* @return float |
177
|
|
|
*/ |
178
|
|
|
public function getTriggerPrice(): float |
179
|
|
|
{ |
180
|
|
|
return $this->triggerPrice; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* @param float $triggerPrice |
185
|
|
|
* @return ReplaceOrderRequest |
186
|
|
|
*/ |
187
|
|
|
public function setTriggerPrice(float $triggerPrice): self |
188
|
|
|
{ |
189
|
|
|
$this->triggerPrice = $triggerPrice; |
190
|
|
|
return $this; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* @return float |
195
|
|
|
*/ |
196
|
|
|
public function getTakeProfit(): float |
197
|
|
|
{ |
198
|
|
|
return $this->takeProfit; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* @param float $takeProfit |
203
|
|
|
* @return ReplaceOrderRequest |
204
|
|
|
*/ |
205
|
|
|
public function setTakeProfit(float $takeProfit): self |
206
|
|
|
{ |
207
|
|
|
$this->takeProfit = $takeProfit; |
208
|
|
|
return $this; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @return float |
213
|
|
|
*/ |
214
|
|
|
public function getStopLoss(): float |
215
|
|
|
{ |
216
|
|
|
return $this->stopLoss; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* @param float $stopLoss |
221
|
|
|
* @return ReplaceOrderRequest |
222
|
|
|
*/ |
223
|
|
|
public function setStopLoss(float $stopLoss): self |
224
|
|
|
{ |
225
|
|
|
$this->stopLoss = $stopLoss; |
226
|
|
|
return $this; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* @return string |
231
|
|
|
*/ |
232
|
|
|
public function getTpTriggerBy(): string |
233
|
|
|
{ |
234
|
|
|
return $this->tpTriggerBy; |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* @param string $tpTriggerBy |
239
|
|
|
* @return ReplaceOrderRequest |
240
|
|
|
*/ |
241
|
|
|
public function setTpTriggerBy(string $tpTriggerBy): self |
242
|
|
|
{ |
243
|
|
|
$this->tpTriggerBy = $tpTriggerBy; |
244
|
|
|
return $this; |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
/** |
248
|
|
|
* @return string |
249
|
|
|
*/ |
250
|
|
|
public function getSlTriggerBy(): string |
251
|
|
|
{ |
252
|
|
|
return $this->slTriggerBy; |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* @param string $slTriggerBy |
257
|
|
|
* @return ReplaceOrderRequest |
258
|
|
|
*/ |
259
|
|
|
public function setSlTriggerBy(string $slTriggerBy): self |
260
|
|
|
{ |
261
|
|
|
$this->slTriggerBy = $slTriggerBy; |
262
|
|
|
return $this; |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
/** |
266
|
|
|
* @return string |
267
|
|
|
*/ |
268
|
|
|
public function getTriggerBy(): string |
269
|
|
|
{ |
270
|
|
|
return $this->triggerBy; |
271
|
|
|
} |
272
|
|
|
|
273
|
|
|
/** |
274
|
|
|
* @param string $triggerBy |
275
|
|
|
* @return ReplaceOrderRequest |
276
|
|
|
*/ |
277
|
|
|
public function setTriggerBy(string $triggerBy): self |
278
|
|
|
{ |
279
|
|
|
$this->triggerBy = $triggerBy; |
280
|
|
|
return $this; |
281
|
|
|
} |
282
|
|
|
|
283
|
|
|
/** |
284
|
|
|
* @return float |
285
|
|
|
*/ |
286
|
|
|
public function getTpLimitPrice(): float |
287
|
|
|
{ |
288
|
|
|
return $this->tpLimitPrice; |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
/** |
292
|
|
|
* @param float $tpLimitPrice |
293
|
|
|
* @return ReplaceOrderRequest |
294
|
|
|
*/ |
295
|
|
|
public function setTpLimitPrice(float $tpLimitPrice): self |
296
|
|
|
{ |
297
|
|
|
$this->tpLimitPrice = $tpLimitPrice; |
298
|
|
|
return $this; |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
/** |
302
|
|
|
* @return float |
303
|
|
|
*/ |
304
|
|
|
public function getSlLimitPrice(): float |
305
|
|
|
{ |
306
|
|
|
return $this->tpLimitPrice; |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
/** |
310
|
|
|
* @param float $slLimitPrice |
311
|
|
|
* @return ReplaceOrderRequest |
312
|
|
|
*/ |
313
|
|
|
public function setSlLimitPrice(float $slLimitPrice): self |
314
|
|
|
{ |
315
|
|
|
$this->tpLimitPrice = $slLimitPrice; |
316
|
|
|
return $this; |
317
|
|
|
} |
318
|
|
|
} |
319
|
|
|
|