|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Carpenstar\ByBitAPI\Spot\LeverageToken\Purchase\Response; |
|
4
|
|
|
|
|
5
|
|
|
use Carpenstar\ByBitAPI\Core\Helpers\DateTimeHelper; |
|
6
|
|
|
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse; |
|
7
|
|
|
use Carpenstar\ByBitAPI\Spot\LeverageToken\Purchase\Interfaces\IPurchaseResponseInterface; |
|
8
|
|
|
|
|
9
|
|
|
class PurchaseResponse extends AbstractResponse implements IPurchaseResponseInterface |
|
10
|
|
|
{ |
|
11
|
|
|
/** |
|
12
|
|
|
* Actual purchase value of the LT |
|
13
|
|
|
* @var float $amount |
|
14
|
|
|
*/ |
|
15
|
|
|
private float $amount; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Transaction ID |
|
19
|
|
|
* @var string $id |
|
20
|
|
|
*/ |
|
21
|
|
|
private string $id; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Abbreviation of the LT |
|
25
|
|
|
* @var string $ltCode |
|
26
|
|
|
*/ |
|
27
|
|
|
private string $ltCode; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Order value of the LT |
|
31
|
|
|
* @var float $orderAmount |
|
32
|
|
|
*/ |
|
33
|
|
|
private float $orderAmount; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Order quantity of the LT |
|
37
|
|
|
* @var float $orderQuantity |
|
38
|
|
|
*/ |
|
39
|
|
|
private float $orderQuantity; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Order status. 1: Completed; 2: In progress; 3: Failed |
|
43
|
|
|
* @var int $orderStatus |
|
44
|
|
|
*/ |
|
45
|
|
|
private int $orderStatus; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Serial number |
|
49
|
|
|
* @var string $serialNo |
|
50
|
|
|
*/ |
|
51
|
|
|
private string $serialNo; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Timestamp |
|
55
|
|
|
* @var \DateTime $timestamp |
|
56
|
|
|
*/ |
|
57
|
|
|
private \DateTime $timestamp; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Quote asset |
|
61
|
|
|
* @var string $valueCoin |
|
62
|
|
|
*/ |
|
63
|
|
|
private string $valueCoin; |
|
64
|
|
|
|
|
65
|
|
|
public function __construct(array $data) |
|
66
|
|
|
{ |
|
67
|
|
|
$this->timestamp = DateTimeHelper::makeFromTimestamp($data['timestamp']); |
|
68
|
|
|
$this->id = $data['id']; |
|
69
|
|
|
$this->amount = (float) $data['amount']; |
|
70
|
|
|
$this->ltCode = $data['ltCode']; |
|
71
|
|
|
$this->orderAmount = (float) $data['orderAmount']; |
|
72
|
|
|
$this->orderQuantity = (float) $data['orderQuantity']; |
|
73
|
|
|
$this->orderStatus = $data['orderStatus']; |
|
74
|
|
|
$this->serialNo = $data['serialNo']; |
|
75
|
|
|
$this->valueCoin = $data['valueCoin']; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @return float |
|
80
|
|
|
*/ |
|
81
|
|
|
public function getAmount(): float |
|
82
|
|
|
{ |
|
83
|
|
|
return $this->amount; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* @return string |
|
88
|
|
|
*/ |
|
89
|
|
|
public function getId(): string |
|
90
|
|
|
{ |
|
91
|
|
|
return $this->id; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @return string |
|
96
|
|
|
*/ |
|
97
|
|
|
public function getLtCode(): string |
|
98
|
|
|
{ |
|
99
|
|
|
return $this->ltCode; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* @return float |
|
104
|
|
|
*/ |
|
105
|
|
|
public function getOrderAmount(): float |
|
106
|
|
|
{ |
|
107
|
|
|
return $this->orderAmount; |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* @return float |
|
112
|
|
|
*/ |
|
113
|
|
|
public function getOrderQuantity(): float |
|
114
|
|
|
{ |
|
115
|
|
|
return $this->orderQuantity; |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
/** |
|
119
|
|
|
* @return int |
|
120
|
|
|
*/ |
|
121
|
|
|
public function getOrderStatus(): int |
|
122
|
|
|
{ |
|
123
|
|
|
return $this->orderStatus; |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* @return string |
|
128
|
|
|
*/ |
|
129
|
|
|
public function getSerialNo(): string |
|
130
|
|
|
{ |
|
131
|
|
|
return $this->serialNo; |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* @return \DateTime |
|
136
|
|
|
*/ |
|
137
|
|
|
public function getTimestamp(): \DateTime |
|
138
|
|
|
{ |
|
139
|
|
|
return $this->timestamp; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
/** |
|
143
|
|
|
* @return string |
|
144
|
|
|
*/ |
|
145
|
|
|
public function getValueCoin(): string |
|
146
|
|
|
{ |
|
147
|
|
|
return $this->valueCoin; |
|
148
|
|
|
} |
|
149
|
|
|
} |
|
150
|
|
|
|