forked from gateio/gateapi-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrder.java
More file actions
754 lines (602 loc) · 21.3 KB
/
Copy pathOrder.java
File metadata and controls
754 lines (602 loc) · 21.3 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
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
/*
* 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;
/**
* Spot order details
*/
public class Order {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)
private String id;
public static final String SERIALIZED_NAME_TEXT = "text";
@SerializedName(SERIALIZED_NAME_TEXT)
private String text;
public static final String SERIALIZED_NAME_CREATE_TIME = "create_time";
@SerializedName(SERIALIZED_NAME_CREATE_TIME)
private String createTime;
public static final String SERIALIZED_NAME_UPDATE_TIME = "update_time";
@SerializedName(SERIALIZED_NAME_UPDATE_TIME)
private String updateTime;
/**
* Order status - `open`: to be filled - `closed`: filled - `cancelled`: cancelled
*/
@JsonAdapter(StatusEnum.Adapter.class)
public enum StatusEnum {
OPEN("open"),
CLOSED("closed"),
CANCELLED("cancelled");
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;
public static final String SERIALIZED_NAME_CURRENCY_PAIR = "currency_pair";
@SerializedName(SERIALIZED_NAME_CURRENCY_PAIR)
private String currencyPair;
/**
* Order type. limit - limit order
*/
@JsonAdapter(TypeEnum.Adapter.class)
public enum TypeEnum {
LIMIT("limit");
private String value;
TypeEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static TypeEnum fromValue(String value) {
for (TypeEnum b : TypeEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<TypeEnum> {
@Override
public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public TypeEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return TypeEnum.fromValue(value);
}
}
}
public static final String SERIALIZED_NAME_TYPE = "type";
@SerializedName(SERIALIZED_NAME_TYPE)
private TypeEnum type = TypeEnum.LIMIT;
/**
* Account type. spot - use spot account; margin - use margin account
*/
@JsonAdapter(AccountEnum.Adapter.class)
public enum AccountEnum {
SPOT("spot"),
MARGIN("margin");
private String value;
AccountEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static AccountEnum fromValue(String value) {
for (AccountEnum b : AccountEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<AccountEnum> {
@Override
public void write(final JsonWriter jsonWriter, final AccountEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public AccountEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return AccountEnum.fromValue(value);
}
}
}
public static final String SERIALIZED_NAME_ACCOUNT = "account";
@SerializedName(SERIALIZED_NAME_ACCOUNT)
private AccountEnum account = AccountEnum.SPOT;
/**
* Order side
*/
@JsonAdapter(SideEnum.Adapter.class)
public enum SideEnum {
BUY("buy"),
SELL("sell");
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_AMOUNT = "amount";
@SerializedName(SERIALIZED_NAME_AMOUNT)
private String amount;
public static final String SERIALIZED_NAME_PRICE = "price";
@SerializedName(SERIALIZED_NAME_PRICE)
private String price;
/**
* Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee
*/
@JsonAdapter(TimeInForceEnum.Adapter.class)
public enum TimeInForceEnum {
GTC("gtc"),
IOC("ioc"),
POC("poc");
private String value;
TimeInForceEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static TimeInForceEnum fromValue(String value) {
for (TimeInForceEnum b : TimeInForceEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter<TimeInForceEnum> {
@Override
public void write(final JsonWriter jsonWriter, final TimeInForceEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public TimeInForceEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return TimeInForceEnum.fromValue(value);
}
}
}
public static final String SERIALIZED_NAME_TIME_IN_FORCE = "time_in_force";
@SerializedName(SERIALIZED_NAME_TIME_IN_FORCE)
private TimeInForceEnum timeInForce = TimeInForceEnum.GTC;
public static final String SERIALIZED_NAME_AUTO_BORROW = "auto_borrow";
@SerializedName(SERIALIZED_NAME_AUTO_BORROW)
private Boolean autoBorrow;
public static final String SERIALIZED_NAME_LEFT = "left";
@SerializedName(SERIALIZED_NAME_LEFT)
private String left;
public static final String SERIALIZED_NAME_FILL_PRICE = "fill_price";
@SerializedName(SERIALIZED_NAME_FILL_PRICE)
private String fillPrice;
public static final String SERIALIZED_NAME_FILLED_TOTAL = "filled_total";
@SerializedName(SERIALIZED_NAME_FILLED_TOTAL)
private String filledTotal;
public static final String SERIALIZED_NAME_FEE = "fee";
@SerializedName(SERIALIZED_NAME_FEE)
private String fee;
public static final String SERIALIZED_NAME_FEE_CURRENCY = "fee_currency";
@SerializedName(SERIALIZED_NAME_FEE_CURRENCY)
private String feeCurrency;
public static final String SERIALIZED_NAME_POINT_FEE = "point_fee";
@SerializedName(SERIALIZED_NAME_POINT_FEE)
private String pointFee;
public static final String SERIALIZED_NAME_GT_FEE = "gt_fee";
@SerializedName(SERIALIZED_NAME_GT_FEE)
private String gtFee;
public static final String SERIALIZED_NAME_GT_DISCOUNT = "gt_discount";
@SerializedName(SERIALIZED_NAME_GT_DISCOUNT)
private Boolean gtDiscount;
public static final String SERIALIZED_NAME_REBATED_FEE = "rebated_fee";
@SerializedName(SERIALIZED_NAME_REBATED_FEE)
private String rebatedFee;
public static final String SERIALIZED_NAME_REBATED_FEE_CURRENCY = "rebated_fee_currency";
@SerializedName(SERIALIZED_NAME_REBATED_FEE_CURRENCY)
private String rebatedFeeCurrency;
/**
* Order ID
* @return id
**/
@javax.annotation.Nullable
public String getId() {
return id;
}
public Order text(String text) {
this.text = text;
return this;
}
/**
* User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 28 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.)
* @return text
**/
@javax.annotation.Nullable
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
/**
* Order creation time
* @return createTime
**/
@javax.annotation.Nullable
public String getCreateTime() {
return createTime;
}
/**
* Order last modification time
* @return updateTime
**/
@javax.annotation.Nullable
public String getUpdateTime() {
return updateTime;
}
/**
* Order status - `open`: to be filled - `closed`: filled - `cancelled`: cancelled
* @return status
**/
@javax.annotation.Nullable
public StatusEnum getStatus() {
return status;
}
public Order currencyPair(String currencyPair) {
this.currencyPair = currencyPair;
return this;
}
/**
* Currency pair
* @return currencyPair
**/
public String getCurrencyPair() {
return currencyPair;
}
public void setCurrencyPair(String currencyPair) {
this.currencyPair = currencyPair;
}
public Order type(TypeEnum type) {
this.type = type;
return this;
}
/**
* Order type. limit - limit order
* @return type
**/
@javax.annotation.Nullable
public TypeEnum getType() {
return type;
}
public void setType(TypeEnum type) {
this.type = type;
}
public Order account(AccountEnum account) {
this.account = account;
return this;
}
/**
* Account type. spot - use spot account; margin - use margin account
* @return account
**/
@javax.annotation.Nullable
public AccountEnum getAccount() {
return account;
}
public void setAccount(AccountEnum account) {
this.account = account;
}
public Order side(SideEnum side) {
this.side = side;
return this;
}
/**
* Order side
* @return side
**/
public SideEnum getSide() {
return side;
}
public void setSide(SideEnum side) {
this.side = side;
}
public Order amount(String amount) {
this.amount = amount;
return this;
}
/**
* Trade amount
* @return amount
**/
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public Order price(String price) {
this.price = price;
return this;
}
/**
* Order price
* @return price
**/
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public Order timeInForce(TimeInForceEnum timeInForce) {
this.timeInForce = timeInForce;
return this;
}
/**
* Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee
* @return timeInForce
**/
@javax.annotation.Nullable
public TimeInForceEnum getTimeInForce() {
return timeInForce;
}
public void setTimeInForce(TimeInForceEnum timeInForce) {
this.timeInForce = timeInForce;
}
public Order autoBorrow(Boolean autoBorrow) {
this.autoBorrow = autoBorrow;
return this;
}
/**
* Used in margin trading(i.e. `account` is `margin`) to allow automatic loan of insufficient part if balance is not enough.
* @return autoBorrow
**/
@javax.annotation.Nullable
public Boolean getAutoBorrow() {
return autoBorrow;
}
public void setAutoBorrow(Boolean autoBorrow) {
this.autoBorrow = autoBorrow;
}
/**
* Amount left to fill
* @return left
**/
@javax.annotation.Nullable
public String getLeft() {
return left;
}
/**
* Total filled in quote currency. Deprecated in favor of `filled_total`
* @return fillPrice
**/
@javax.annotation.Nullable
public String getFillPrice() {
return fillPrice;
}
/**
* Total filled in quote currency
* @return filledTotal
**/
@javax.annotation.Nullable
public String getFilledTotal() {
return filledTotal;
}
/**
* Fee deducted
* @return fee
**/
@javax.annotation.Nullable
public String getFee() {
return fee;
}
/**
* Fee currency unit
* @return feeCurrency
**/
@javax.annotation.Nullable
public String getFeeCurrency() {
return feeCurrency;
}
/**
* Point used to deduct fee
* @return pointFee
**/
@javax.annotation.Nullable
public String getPointFee() {
return pointFee;
}
/**
* GT used to deduct fee
* @return gtFee
**/
@javax.annotation.Nullable
public String getGtFee() {
return gtFee;
}
/**
* Whether GT fee discount is used
* @return gtDiscount
**/
@javax.annotation.Nullable
public Boolean getGtDiscount() {
return gtDiscount;
}
/**
* Rebated fee
* @return rebatedFee
**/
@javax.annotation.Nullable
public String getRebatedFee() {
return rebatedFee;
}
/**
* Rebated fee currency unit
* @return rebatedFeeCurrency
**/
@javax.annotation.Nullable
public String getRebatedFeeCurrency() {
return rebatedFeeCurrency;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Order order = (Order) o;
return Objects.equals(this.id, order.id) &&
Objects.equals(this.text, order.text) &&
Objects.equals(this.createTime, order.createTime) &&
Objects.equals(this.updateTime, order.updateTime) &&
Objects.equals(this.status, order.status) &&
Objects.equals(this.currencyPair, order.currencyPair) &&
Objects.equals(this.type, order.type) &&
Objects.equals(this.account, order.account) &&
Objects.equals(this.side, order.side) &&
Objects.equals(this.amount, order.amount) &&
Objects.equals(this.price, order.price) &&
Objects.equals(this.timeInForce, order.timeInForce) &&
Objects.equals(this.autoBorrow, order.autoBorrow) &&
Objects.equals(this.left, order.left) &&
Objects.equals(this.fillPrice, order.fillPrice) &&
Objects.equals(this.filledTotal, order.filledTotal) &&
Objects.equals(this.fee, order.fee) &&
Objects.equals(this.feeCurrency, order.feeCurrency) &&
Objects.equals(this.pointFee, order.pointFee) &&
Objects.equals(this.gtFee, order.gtFee) &&
Objects.equals(this.gtDiscount, order.gtDiscount) &&
Objects.equals(this.rebatedFee, order.rebatedFee) &&
Objects.equals(this.rebatedFeeCurrency, order.rebatedFeeCurrency);
}
@Override
public int hashCode() {
return Objects.hash(id, text, createTime, updateTime, status, currencyPair, type, account, side, amount, price, timeInForce, autoBorrow, left, fillPrice, filledTotal, fee, feeCurrency, pointFee, gtFee, gtDiscount, rebatedFee, rebatedFeeCurrency);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Order {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" text: ").append(toIndentedString(text)).append("\n");
sb.append(" createTime: ").append(toIndentedString(createTime)).append("\n");
sb.append(" updateTime: ").append(toIndentedString(updateTime)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
sb.append(" currencyPair: ").append(toIndentedString(currencyPair)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" account: ").append(toIndentedString(account)).append("\n");
sb.append(" side: ").append(toIndentedString(side)).append("\n");
sb.append(" amount: ").append(toIndentedString(amount)).append("\n");
sb.append(" price: ").append(toIndentedString(price)).append("\n");
sb.append(" timeInForce: ").append(toIndentedString(timeInForce)).append("\n");
sb.append(" autoBorrow: ").append(toIndentedString(autoBorrow)).append("\n");
sb.append(" left: ").append(toIndentedString(left)).append("\n");
sb.append(" fillPrice: ").append(toIndentedString(fillPrice)).append("\n");
sb.append(" filledTotal: ").append(toIndentedString(filledTotal)).append("\n");
sb.append(" fee: ").append(toIndentedString(fee)).append("\n");
sb.append(" feeCurrency: ").append(toIndentedString(feeCurrency)).append("\n");
sb.append(" pointFee: ").append(toIndentedString(pointFee)).append("\n");
sb.append(" gtFee: ").append(toIndentedString(gtFee)).append("\n");
sb.append(" gtDiscount: ").append(toIndentedString(gtDiscount)).append("\n");
sb.append(" rebatedFee: ").append(toIndentedString(rebatedFee)).append("\n");
sb.append(" rebatedFeeCurrency: ").append(toIndentedString(rebatedFeeCurrency)).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 ");
}
}