1
|
|
|
<?php |
2
|
|
|
namespace Carpenstar\ByBitAPI\Derivatives\Contract\Position\GetExecutionList\Response; |
3
|
|
|
|
4
|
|
|
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper; |
5
|
|
|
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse; |
6
|
|
|
use Carpenstar\ByBitAPI\Derivatives\Contract\Position\GetExecutionList\Interfaces\IGetExecutionListResponseItemInterface; |
7
|
|
|
|
8
|
|
|
class GetExecutionListResponseItem extends AbstractResponse implements IGetExecutionListResponseItemInterface |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* Symbol name |
12
|
|
|
* @var string $symbol |
13
|
|
|
*/ |
14
|
|
|
private string $symbol; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Buy,Sell |
18
|
|
|
* @var string $side |
19
|
|
|
*/ |
20
|
|
|
private string $side; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Order id |
24
|
|
|
* @var string $orderId |
25
|
|
|
*/ |
26
|
|
|
private string $orderId; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* User customised order id |
30
|
|
|
* @var string $orderLinkId |
31
|
|
|
*/ |
32
|
|
|
private string $orderLinkId; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Order price |
36
|
|
|
* @var float $orderPrice |
37
|
|
|
*/ |
38
|
|
|
private float $orderPrice; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Order qty |
42
|
|
|
* @var float $orderQty |
43
|
|
|
*/ |
44
|
|
|
private float $orderQty; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Market,Limit |
48
|
|
|
* @var string $orderType |
49
|
|
|
*/ |
50
|
|
|
private string $orderType; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Stop order type |
54
|
|
|
* @var string $stopOrderType |
55
|
|
|
*/ |
56
|
|
|
private string $stopOrderType; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Trade Id |
60
|
|
|
* @var string $execId |
61
|
|
|
*/ |
62
|
|
|
private string $execId; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Execution price |
66
|
|
|
* @var float $execPrice |
67
|
|
|
*/ |
68
|
|
|
private float $execPrice; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Execution qty |
72
|
|
|
* @var float $execQty |
73
|
|
|
*/ |
74
|
|
|
private float $execQty; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Execution fee |
78
|
|
|
* @var float $execFee |
79
|
|
|
*/ |
80
|
|
|
private float $execFee; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Execution type |
84
|
|
|
* @var string $execType |
85
|
|
|
*/ |
86
|
|
|
private string $execType; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Execution position value |
90
|
|
|
* @var float $execValue |
91
|
|
|
*/ |
92
|
|
|
private float $execValue; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Trading fee rate |
96
|
|
|
* @var float $feeRate |
97
|
|
|
*/ |
98
|
|
|
private float $feeRate; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* AddedLiquidity, RemovedLiquidity |
102
|
|
|
* @var string $lastLiquidityInd |
103
|
|
|
*/ |
104
|
|
|
private string $lastLiquidityInd; |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* Is maker |
108
|
|
|
* @var bool $isMaker |
109
|
|
|
*/ |
110
|
|
|
private bool $isMaker; |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Remaining qty waiting for execution |
114
|
|
|
* @var float $leavesQty |
115
|
|
|
*/ |
116
|
|
|
private float $leavesQty; |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Close size |
120
|
|
|
* @var float $closedSize |
121
|
|
|
*/ |
122
|
|
|
private float $closedSize; |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Block trade id |
126
|
|
|
* @var string $blockTradeId |
127
|
|
|
*/ |
128
|
|
|
private string $blockTradeId; |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* Mark price |
132
|
|
|
* @var float $markPrice |
133
|
|
|
*/ |
134
|
|
|
private float $markPrice; |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Index price |
138
|
|
|
* @var float $indexPrice |
139
|
|
|
*/ |
140
|
|
|
private float $indexPrice; |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* Underlying price |
144
|
|
|
* @var float $underlyingPrice |
145
|
|
|
*/ |
146
|
|
|
private float $underlyingPrice; |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* Execution timestamp (ms) |
150
|
|
|
* @var \DateTime $execTime |
151
|
|
|
*/ |
152
|
|
|
private \DateTime $execTime; |
153
|
|
|
|
154
|
|
|
public function __construct(array $data) |
155
|
|
|
{ |
156
|
|
|
$this->symbol = $data['symbol']; |
157
|
|
|
$this->side = $data['side']; |
158
|
|
|
$this->orderId = $data['orderId']; |
159
|
|
|
$this->orderLinkId = $data['orderLinkId']; |
160
|
|
|
$this->orderPrice = (float) $data['orderPrice']; |
161
|
|
|
$this->orderQty = (float) $data['orderQty']; |
162
|
|
|
$this->orderType = $data['orderType']; |
163
|
|
|
$this->stopOrderType = $data['stopOrderType']; |
164
|
|
|
$this->execId = $data['execId']; |
165
|
|
|
$this->execPrice = (float) $data['execPrice']; |
166
|
|
|
$this->execQty = (float) $data['execQty']; |
167
|
|
|
$this->execFee = (float) $data['execFee']; |
168
|
|
|
$this->execType = $data['execType']; |
169
|
|
|
$this->execValue = (float) $data['execValue']; |
170
|
|
|
$this->feeRate = (float) $data['feeRate']; |
171
|
|
|
$this->lastLiquidityInd = $data['lastLiquidityInd']; |
172
|
|
|
$this->isMaker = $data['isMaker']; |
173
|
|
|
$this->leavesQty = (float) $data['leavesQty']; |
174
|
|
|
$this->closedSize = (float) $data['closedSize']; |
175
|
|
|
$this->blockTradeId = $data['blockTradeId']; |
176
|
|
|
$this->markPrice = (float) $data['markPrice']; |
177
|
|
|
$this->indexPrice = (float) $data['indexPrice']; |
178
|
|
|
$this->underlyingPrice = (float) $data['underlyingPrice']; |
179
|
|
|
$this->execTime = DateTimeHelper::makeFromTimestamp($data['execTime']); |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* @return string |
184
|
|
|
*/ |
185
|
|
|
public function getSymbol(): string |
186
|
|
|
{ |
187
|
|
|
return $this->symbol; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* @return string |
192
|
|
|
*/ |
193
|
|
|
public function getSide(): string |
194
|
|
|
{ |
195
|
|
|
return $this->side; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* @return string |
200
|
|
|
*/ |
201
|
|
|
public function getOrderId(): string |
202
|
|
|
{ |
203
|
|
|
return $this->orderId; |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* @return string |
208
|
|
|
*/ |
209
|
|
|
public function getOrderLinkId(): string |
210
|
|
|
{ |
211
|
|
|
return $this->orderLinkId; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* @return float |
216
|
|
|
*/ |
217
|
|
|
public function getOrderPrice(): float |
218
|
|
|
{ |
219
|
|
|
return $this->orderPrice; |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
/** |
223
|
|
|
* @return float |
224
|
|
|
*/ |
225
|
|
|
public function getOrderQty(): float |
226
|
|
|
{ |
227
|
|
|
return $this->orderQty; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* @return string |
232
|
|
|
*/ |
233
|
|
|
public function getOrderType(): string |
234
|
|
|
{ |
235
|
|
|
return $this->orderType; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
/** |
239
|
|
|
* @return string |
240
|
|
|
*/ |
241
|
|
|
public function getStopOrderType(): string |
242
|
|
|
{ |
243
|
|
|
return $this->stopOrderType; |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* @return string |
248
|
|
|
*/ |
249
|
|
|
public function getExecId(): string |
250
|
|
|
{ |
251
|
|
|
return $this->execId; |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
/** |
255
|
|
|
* @return float |
256
|
|
|
*/ |
257
|
|
|
public function getExecPrice(): float |
258
|
|
|
{ |
259
|
|
|
return $this->execPrice; |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
/** |
263
|
|
|
* @return float |
264
|
|
|
*/ |
265
|
|
|
public function getExecQty(): float |
266
|
|
|
{ |
267
|
|
|
return $this->execQty; |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* @return float |
272
|
|
|
*/ |
273
|
|
|
public function getExecFee(): float |
274
|
|
|
{ |
275
|
|
|
return $this->execFee; |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
/** |
279
|
|
|
* @return string |
280
|
|
|
*/ |
281
|
|
|
public function getExecType(): string |
282
|
|
|
{ |
283
|
|
|
return $this->execType; |
284
|
|
|
} |
285
|
|
|
|
286
|
|
|
/** |
287
|
|
|
* @return float |
288
|
|
|
*/ |
289
|
|
|
public function getExecValue(): float |
290
|
|
|
{ |
291
|
|
|
return $this->execValue; |
292
|
|
|
} |
293
|
|
|
|
294
|
|
|
/** |
295
|
|
|
* @return float |
296
|
|
|
*/ |
297
|
|
|
public function getFeeRate(): float |
298
|
|
|
{ |
299
|
|
|
return $this->feeRate; |
300
|
|
|
} |
301
|
|
|
|
302
|
|
|
/** |
303
|
|
|
* @return string |
304
|
|
|
*/ |
305
|
|
|
public function getLastLiquidityInd(): string |
306
|
|
|
{ |
307
|
|
|
return $this->lastLiquidityInd; |
308
|
|
|
} |
309
|
|
|
|
310
|
|
|
/** |
311
|
|
|
* @return bool |
312
|
|
|
*/ |
313
|
|
|
public function isMaker(): bool |
314
|
|
|
{ |
315
|
|
|
return $this->isMaker; |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
/** |
319
|
|
|
* @return float |
320
|
|
|
*/ |
321
|
|
|
public function getLeavesQty(): float |
322
|
|
|
{ |
323
|
|
|
return $this->leavesQty; |
324
|
|
|
} |
325
|
|
|
|
326
|
|
|
/** |
327
|
|
|
* @return float |
328
|
|
|
*/ |
329
|
|
|
public function getClosedSize(): float |
330
|
|
|
{ |
331
|
|
|
return $this->closedSize; |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
/** |
335
|
|
|
* @return string |
336
|
|
|
*/ |
337
|
|
|
public function getBlockTradeId(): string |
338
|
|
|
{ |
339
|
|
|
return $this->blockTradeId; |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
/** |
343
|
|
|
* @return float |
344
|
|
|
*/ |
345
|
|
|
public function getMarkPrice(): float |
346
|
|
|
{ |
347
|
|
|
return $this->markPrice; |
348
|
|
|
} |
349
|
|
|
|
350
|
|
|
/** |
351
|
|
|
* @return float |
352
|
|
|
*/ |
353
|
|
|
public function getIndexPrice(): float |
354
|
|
|
{ |
355
|
|
|
return $this->indexPrice; |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
/** |
359
|
|
|
* @return float |
360
|
|
|
*/ |
361
|
|
|
public function getUnderlyingPrice(): float |
362
|
|
|
{ |
363
|
|
|
return $this->underlyingPrice; |
364
|
|
|
} |
365
|
|
|
|
366
|
|
|
/** |
367
|
|
|
* @return \DateTime |
368
|
|
|
*/ |
369
|
|
|
public function getExecTime(): \DateTime |
370
|
|
|
{ |
371
|
|
|
return $this->execTime; |
372
|
|
|
} |
373
|
|
|
} |