|
1
|
|
|
<?php |
|
2
|
|
|
namespace Carpenstar\ByBitAPI\Derivatives\Contract\Account\WalletBalance\Response; |
|
3
|
|
|
|
|
4
|
|
|
use Carpenstar\ByBitAPI\Core\Objects\AbstractResponse; |
|
5
|
|
|
|
|
6
|
|
|
class WalletBalanceAbstractResponse extends AbstractResponse |
|
7
|
|
|
{ |
|
8
|
|
|
private string $coin; |
|
9
|
|
|
private float $equity; |
|
10
|
|
|
private float $walletBalance; |
|
11
|
|
|
private float $positionMargin; |
|
12
|
|
|
private float $availableBalance; |
|
13
|
|
|
private float $orderMargin; |
|
14
|
|
|
private float $occClosingFee; |
|
15
|
|
|
private float $occFundingFee; |
|
16
|
|
|
private float $unrealisedPnl; |
|
17
|
|
|
private float $cumRealisedPnl; |
|
18
|
|
|
private float $givenCash; |
|
19
|
|
|
private float $serviceCash; |
|
20
|
|
|
private string $accountIM; |
|
21
|
|
|
private string $accountMM; |
|
22
|
|
|
|
|
23
|
|
|
public function __construct(array $data) |
|
24
|
|
|
{ |
|
25
|
|
|
$this |
|
26
|
|
|
->setCoin($data['coin']) |
|
27
|
|
|
->setEquity($data['equity']) |
|
28
|
|
|
->setWalletBalance($data['walletBalance']) |
|
29
|
|
|
->setPositionMargin($data['positionMargin']) |
|
30
|
|
|
->setAvailableBalance($data['availableBalance']) |
|
31
|
|
|
->setOrderMargin($data['orderMargin']) |
|
32
|
|
|
->setOccClosingFee($data['occClosingFee']) |
|
33
|
|
|
->setOccFundingFee($data['occFundingFee']) |
|
34
|
|
|
->setUnrealisedPnl($data['unrealisedPnl']) |
|
35
|
|
|
->setCumRealisedPnl($data['cumRealisedPnl']) |
|
36
|
|
|
->setGivenCash($data['givenCash']) |
|
37
|
|
|
->setServiceCash($data['serviceCash']) |
|
38
|
|
|
->setAccountIM($data['accountIM']) |
|
39
|
|
|
->setAccountMM($data['accountMM']); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @param string $coin |
|
44
|
|
|
* @return WalletBalanceAbstractResponse |
|
45
|
|
|
*/ |
|
46
|
|
|
private function setCoin(string $coin): self |
|
47
|
|
|
{ |
|
48
|
|
|
$this->coin = $coin; |
|
49
|
|
|
return $this; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @return string |
|
54
|
|
|
*/ |
|
55
|
|
|
public function getCoin(): string |
|
56
|
|
|
{ |
|
57
|
|
|
return $this->coin; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @param float $equity |
|
62
|
|
|
* @return WalletBalanceAbstractResponse |
|
63
|
|
|
*/ |
|
64
|
|
|
private function setEquity(float $equity): self |
|
65
|
|
|
{ |
|
66
|
|
|
$this->equity = $equity; |
|
67
|
|
|
return $this; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @return float |
|
72
|
|
|
*/ |
|
73
|
|
|
public function getEquity(): float |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->equity; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @param float $walletBalance |
|
80
|
|
|
* @return WalletBalanceAbstractResponse |
|
81
|
|
|
*/ |
|
82
|
|
|
private function setWalletBalance(float $walletBalance): self |
|
83
|
|
|
{ |
|
84
|
|
|
$this->walletBalance = $walletBalance; |
|
85
|
|
|
return $this; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @return float |
|
90
|
|
|
*/ |
|
91
|
|
|
public function getWalletBalance(): float |
|
92
|
|
|
{ |
|
93
|
|
|
return $this->walletBalance; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @param float $positionMargin |
|
98
|
|
|
* @return WalletBalanceAbstractResponse |
|
99
|
|
|
*/ |
|
100
|
|
|
private function setPositionMargin(float $positionMargin): self |
|
101
|
|
|
{ |
|
102
|
|
|
$this->positionMargin = $positionMargin; |
|
103
|
|
|
return $this; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* @return float |
|
108
|
|
|
*/ |
|
109
|
|
|
public function getPositionMargin(): float |
|
110
|
|
|
{ |
|
111
|
|
|
return $this->positionMargin; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* @param float $availableBalance |
|
116
|
|
|
* @return WalletBalanceAbstractResponse |
|
117
|
|
|
*/ |
|
118
|
|
|
private function setAvailableBalance(float $availableBalance): self |
|
119
|
|
|
{ |
|
120
|
|
|
$this->availableBalance = $availableBalance; |
|
121
|
|
|
return $this; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* @return float |
|
126
|
|
|
*/ |
|
127
|
|
|
public function getAvailableBalance(): float |
|
128
|
|
|
{ |
|
129
|
|
|
return $this->availableBalance; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* @param float $orderMargin |
|
134
|
|
|
* @return WalletBalanceAbstractResponse |
|
135
|
|
|
*/ |
|
136
|
|
|
public function setOrderMargin(float $orderMargin): self |
|
137
|
|
|
{ |
|
138
|
|
|
$this->orderMargin = $orderMargin; |
|
139
|
|
|
return $this; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
/** |
|
143
|
|
|
* @return float |
|
144
|
|
|
*/ |
|
145
|
|
|
public function getOrderMargin(): float |
|
146
|
|
|
{ |
|
147
|
|
|
return $this->orderMargin; |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
/** |
|
151
|
|
|
* @param float $occClosingFee |
|
152
|
|
|
* @return WalletBalanceAbstractResponse |
|
153
|
|
|
*/ |
|
154
|
|
|
private function setOccClosingFee(float $occClosingFee): self |
|
155
|
|
|
{ |
|
156
|
|
|
$this->occClosingFee = $occClosingFee; |
|
157
|
|
|
return $this; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* @return float |
|
162
|
|
|
*/ |
|
163
|
|
|
public function getOccClosingFee(): float |
|
164
|
|
|
{ |
|
165
|
|
|
return $this->occClosingFee; |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* @param float $occFundingFee |
|
170
|
|
|
* @return WalletBalanceAbstractResponse |
|
171
|
|
|
*/ |
|
172
|
|
|
private function setOccFundingFee(float $occFundingFee): self |
|
173
|
|
|
{ |
|
174
|
|
|
$this->occFundingFee = $occFundingFee; |
|
175
|
|
|
return $this; |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* @return float |
|
180
|
|
|
*/ |
|
181
|
|
|
public function getOccFundingFee(): float |
|
182
|
|
|
{ |
|
183
|
|
|
return $this->occFundingFee; |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
|
|
/** |
|
187
|
|
|
* @param float $unrealisedPnl |
|
188
|
|
|
* @return WalletBalanceAbstractResponse |
|
189
|
|
|
*/ |
|
190
|
|
|
public function setUnrealisedPnl(float $unrealisedPnl): self |
|
191
|
|
|
{ |
|
192
|
|
|
$this->unrealisedPnl = $unrealisedPnl; |
|
193
|
|
|
return $this; |
|
194
|
|
|
} |
|
195
|
|
|
|
|
196
|
|
|
/** |
|
197
|
|
|
* @return float |
|
198
|
|
|
*/ |
|
199
|
|
|
public function getUnrealisedPnl(): float |
|
200
|
|
|
{ |
|
201
|
|
|
return $this->unrealisedPnl; |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
/** |
|
205
|
|
|
* @param float $cumRealisedPnl |
|
206
|
|
|
* @return WalletBalanceAbstractResponse |
|
207
|
|
|
*/ |
|
208
|
|
|
private function setCumRealisedPnl(float $cumRealisedPnl): self |
|
209
|
|
|
{ |
|
210
|
|
|
$this->cumRealisedPnl = $cumRealisedPnl; |
|
211
|
|
|
return $this; |
|
212
|
|
|
} |
|
213
|
|
|
|
|
214
|
|
|
/** |
|
215
|
|
|
* @return float |
|
216
|
|
|
*/ |
|
217
|
|
|
public function getCumRealisedPnl(): float |
|
218
|
|
|
{ |
|
219
|
|
|
return $this->cumRealisedPnl; |
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
/** |
|
223
|
|
|
* @param float $givenCash |
|
224
|
|
|
* @return WalletBalanceAbstractResponse |
|
225
|
|
|
*/ |
|
226
|
|
|
private function setGivenCash(float $givenCash): self |
|
227
|
|
|
{ |
|
228
|
|
|
$this->givenCash = $givenCash; |
|
229
|
|
|
return $this; |
|
230
|
|
|
} |
|
231
|
|
|
|
|
232
|
|
|
/** |
|
233
|
|
|
* @return float |
|
234
|
|
|
*/ |
|
235
|
|
|
public function getGivenCash(): float |
|
236
|
|
|
{ |
|
237
|
|
|
return $this->givenCash; |
|
238
|
|
|
} |
|
239
|
|
|
|
|
240
|
|
|
/** |
|
241
|
|
|
* @param float $serviceCash |
|
242
|
|
|
* @return WalletBalanceAbstractResponse |
|
243
|
|
|
*/ |
|
244
|
|
|
private function setServiceCash(float $serviceCash): self |
|
245
|
|
|
{ |
|
246
|
|
|
$this->serviceCash = $serviceCash; |
|
247
|
|
|
return $this; |
|
248
|
|
|
} |
|
249
|
|
|
|
|
250
|
|
|
/** |
|
251
|
|
|
* @return float |
|
252
|
|
|
*/ |
|
253
|
|
|
public function getServiceCash(): float |
|
254
|
|
|
{ |
|
255
|
|
|
return $this->serviceCash; |
|
256
|
|
|
} |
|
257
|
|
|
|
|
258
|
|
|
/** |
|
259
|
|
|
* @param string $accountIM |
|
260
|
|
|
* @return WalletBalanceAbstractResponse |
|
261
|
|
|
*/ |
|
262
|
|
|
private function setAccountIM(string $accountIM): self |
|
263
|
|
|
{ |
|
264
|
|
|
$this->accountIM = $accountIM; |
|
265
|
|
|
return $this; |
|
266
|
|
|
} |
|
267
|
|
|
|
|
268
|
|
|
/** |
|
269
|
|
|
* @return string |
|
270
|
|
|
*/ |
|
271
|
|
|
public function getAccountIM(): string |
|
272
|
|
|
{ |
|
273
|
|
|
return $this->accountIM; |
|
274
|
|
|
} |
|
275
|
|
|
|
|
276
|
|
|
/** |
|
277
|
|
|
* @param string $accountMM |
|
278
|
|
|
* @return WalletBalanceAbstractResponse |
|
279
|
|
|
*/ |
|
280
|
|
|
public function setAccountMM(string $accountMM): self |
|
281
|
|
|
{ |
|
282
|
|
|
$this->accountMM = $accountMM; |
|
283
|
|
|
return $this; |
|
284
|
|
|
} |
|
285
|
|
|
|
|
286
|
|
|
/** |
|
287
|
|
|
* @return string |
|
288
|
|
|
*/ |
|
289
|
|
|
public function getAccountMM(): string |
|
290
|
|
|
{ |
|
291
|
|
|
return $this->accountMM; |
|
292
|
|
|
} |
|
293
|
|
|
} |