forked from gateio/gateapi-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoan.java
More file actions
519 lines (411 loc) · 14.1 KB
/
Copy pathLoan.java
File metadata and controls
519 lines (411 loc) · 14.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
/*
* Gate API v4
* APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf.
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package io.gate.gateapi.models;
import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
/**
* Margin loan details
*/
public class Loan {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
private String id;
public static final String SERIALIZED_NAME_CREATE_TIME = "create_time";
@SerializedName(SERIALIZED_NAME_CREATE_TIME)
private String createTime;
public static final String SERIALIZED_NAME_EXPIRE_TIME = "expire_time";
@SerializedName(SERIALIZED_NAME_EXPIRE_TIME)
private String expireTime;
/**
* Loan status open - not fully loaned loaned - all loaned out for lending loan; loaned in for borrowing side finished - loan is finished, either being all repaid or cancelled by the lender auto_repaid - automatically repaid by the system
*/
@JsonAdapter(StatusEnum.Adapter.class)
public enum StatusEnum {
OPEN("open"),
LOANED("loaned"),
FINISHED("finished"),
AUTO_REPAID("auto_repaid");
private String value;
StatusEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static StatusEnum fromValue(String value) {
for (StatusEnum b : StatusEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<StatusEnum> {
@Override
public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public StatusEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return StatusEnum.fromValue(value);
}
}
}
public static final String SERIALIZED_NAME_STATUS = "status";
@SerializedName(SERIALIZED_NAME_STATUS)
private StatusEnum status;
/**
* Loan side
*/
@JsonAdapter(SideEnum.Adapter.class)
public enum SideEnum {
LEND("lend"),
BORROW("borrow");
private String value;
SideEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static SideEnum fromValue(String value) {
for (SideEnum b : SideEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<SideEnum> {
@Override
public void write(final JsonWriter jsonWriter, final SideEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public SideEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return SideEnum.fromValue(value);
}
}
}
public static final String SERIALIZED_NAME_SIDE = "side";
@SerializedName(SERIALIZED_NAME_SIDE)
private SideEnum side;
public static final String SERIALIZED_NAME_CURRENCY = "currency";
@SerializedName(SERIALIZED_NAME_CURRENCY)
private String currency;
public static final String SERIALIZED_NAME_RATE = "rate";
@SerializedName(SERIALIZED_NAME_RATE)
private String rate;
public static final String SERIALIZED_NAME_AMOUNT = "amount";
@SerializedName(SERIALIZED_NAME_AMOUNT)
private String amount;
public static final String SERIALIZED_NAME_DAYS = "days";
@SerializedName(SERIALIZED_NAME_DAYS)
private Integer days;
public static final String SERIALIZED_NAME_AUTO_RENEW = "auto_renew";
@SerializedName(SERIALIZED_NAME_AUTO_RENEW)
private Boolean autoRenew = false;
public static final String SERIALIZED_NAME_CURRENCY_PAIR = "currency_pair";
@SerializedName(SERIALIZED_NAME_CURRENCY_PAIR)
private String currencyPair;
public static final String SERIALIZED_NAME_LEFT = "left";
@SerializedName(SERIALIZED_NAME_LEFT)
private String left;
public static final String SERIALIZED_NAME_REPAID = "repaid";
@SerializedName(SERIALIZED_NAME_REPAID)
private String repaid;
public static final String SERIALIZED_NAME_PAID_INTEREST = "paid_interest";
@SerializedName(SERIALIZED_NAME_PAID_INTEREST)
private String paidInterest;
public static final String SERIALIZED_NAME_UNPAID_INTEREST = "unpaid_interest";
@SerializedName(SERIALIZED_NAME_UNPAID_INTEREST)
private String unpaidInterest;
public static final String SERIALIZED_NAME_FEE_RATE = "fee_rate";
@SerializedName(SERIALIZED_NAME_FEE_RATE)
private String feeRate;
public static final String SERIALIZED_NAME_ORIG_ID = "orig_id";
@SerializedName(SERIALIZED_NAME_ORIG_ID)
private String origId;
/**
* Loan ID
* @return id
**/
@javax.annotation.Nullable
public String getId() {
return id;
}
/**
* Creation time
* @return createTime
**/
@javax.annotation.Nullable
public String getCreateTime() {
return createTime;
}
/**
* Repay time of the loan. No value will be returned for lending loan
* @return expireTime
**/
@javax.annotation.Nullable
public String getExpireTime() {
return expireTime;
}
/**
* Loan status open - not fully loaned loaned - all loaned out for lending loan; loaned in for borrowing side finished - loan is finished, either being all repaid or cancelled by the lender auto_repaid - automatically repaid by the system
* @return status
**/
@javax.annotation.Nullable
public StatusEnum getStatus() {
return status;
}
public Loan side(SideEnum side) {
this.side = side;
return this;
}
/**
* Loan side
* @return side
**/
public SideEnum getSide() {
return side;
}
public void setSide(SideEnum side) {
this.side = side;
}
public Loan currency(String currency) {
this.currency = currency;
return this;
}
/**
* Loan currency
* @return currency
**/
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public Loan rate(String rate) {
this.rate = rate;
return this;
}
/**
* Loan rate. Only rates in [0.0002, 0.002] are supported. Not required in lending. Market rate calculated from recent rates will be used if not set
* @return rate
**/
@javax.annotation.Nullable
public String getRate() {
return rate;
}
public void setRate(String rate) {
this.rate = rate;
}
public Loan amount(String amount) {
this.amount = amount;
return this;
}
/**
* Loan amount
* @return amount
**/
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public Loan days(Integer days) {
this.days = days;
return this;
}
/**
* Loan days
* @return days
**/
public Integer getDays() {
return days;
}
public void setDays(Integer days) {
this.days = days;
}
public Loan autoRenew(Boolean autoRenew) {
this.autoRenew = autoRenew;
return this;
}
/**
* Auto renew the loan on expiration
* @return autoRenew
**/
@javax.annotation.Nullable
public Boolean getAutoRenew() {
return autoRenew;
}
public void setAutoRenew(Boolean autoRenew) {
this.autoRenew = autoRenew;
}
public Loan currencyPair(String currencyPair) {
this.currencyPair = currencyPair;
return this;
}
/**
* Currency pair. Required for borrowing side
* @return currencyPair
**/
@javax.annotation.Nullable
public String getCurrencyPair() {
return currencyPair;
}
public void setCurrencyPair(String currencyPair) {
this.currencyPair = currencyPair;
}
/**
* Amount not lending out
* @return left
**/
@javax.annotation.Nullable
public String getLeft() {
return left;
}
/**
* Repaid amount
* @return repaid
**/
@javax.annotation.Nullable
public String getRepaid() {
return repaid;
}
/**
* Repaid interest
* @return paidInterest
**/
@javax.annotation.Nullable
public String getPaidInterest() {
return paidInterest;
}
/**
* Interest not repaid
* @return unpaidInterest
**/
@javax.annotation.Nullable
public String getUnpaidInterest() {
return unpaidInterest;
}
public Loan feeRate(String feeRate) {
this.feeRate = feeRate;
return this;
}
/**
* Loan fee rate
* @return feeRate
**/
@javax.annotation.Nullable
public String getFeeRate() {
return feeRate;
}
public void setFeeRate(String feeRate) {
this.feeRate = feeRate;
}
public Loan origId(String origId) {
this.origId = origId;
return this;
}
/**
* Original loan ID if the loan is auto-renewed. Equal to `id` if not
* @return origId
**/
@javax.annotation.Nullable
public String getOrigId() {
return origId;
}
public void setOrigId(String origId) {
this.origId = origId;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Loan loan = (Loan) o;
return Objects.equals(this.id, loan.id) &&
Objects.equals(this.createTime, loan.createTime) &&
Objects.equals(this.expireTime, loan.expireTime) &&
Objects.equals(this.status, loan.status) &&
Objects.equals(this.side, loan.side) &&
Objects.equals(this.currency, loan.currency) &&
Objects.equals(this.rate, loan.rate) &&
Objects.equals(this.amount, loan.amount) &&
Objects.equals(this.days, loan.days) &&
Objects.equals(this.autoRenew, loan.autoRenew) &&
Objects.equals(this.currencyPair, loan.currencyPair) &&
Objects.equals(this.left, loan.left) &&
Objects.equals(this.repaid, loan.repaid) &&
Objects.equals(this.paidInterest, loan.paidInterest) &&
Objects.equals(this.unpaidInterest, loan.unpaidInterest) &&
Objects.equals(this.feeRate, loan.feeRate) &&
Objects.equals(this.origId, loan.origId);
}
@Override
public int hashCode() {
return Objects.hash(id, createTime, expireTime, status, side, currency, rate, amount, days, autoRenew, currencyPair, left, repaid, paidInterest, unpaidInterest, feeRate, origId);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Loan {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" createTime: ").append(toIndentedString(createTime)).append("\n");
sb.append(" expireTime: ").append(toIndentedString(expireTime)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" side: ").append(toIndentedString(side)).append("\n");
sb.append(" currency: ").append(toIndentedString(currency)).append("\n");
sb.append(" rate: ").append(toIndentedString(rate)).append("\n");
sb.append(" amount: ").append(toIndentedString(amount)).append("\n");
sb.append(" days: ").append(toIndentedString(days)).append("\n");
sb.append(" autoRenew: ").append(toIndentedString(autoRenew)).append("\n");
sb.append(" currencyPair: ").append(toIndentedString(currencyPair)).append("\n");
sb.append(" left: ").append(toIndentedString(left)).append("\n");
sb.append(" repaid: ").append(toIndentedString(repaid)).append("\n");
sb.append(" paidInterest: ").append(toIndentedString(paidInterest)).append("\n");
sb.append(" unpaidInterest: ").append(toIndentedString(unpaidInterest)).append("\n");
sb.append(" feeRate: ").append(toIndentedString(feeRate)).append("\n");
sb.append(" origId: ").append(toIndentedString(origId)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}