@@ -32,7 +32,7 @@ List all supported currency pairs supported in margin trading
32
32
``` python
33
33
from __future__ import print_function
34
34
import gate_api
35
- from gate_api.exceptions import ApiException
35
+ from gate_api.exceptions import ApiException, GateApiException
36
36
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
37
37
# See configuration.py for a list of all supported configuration parameters.
38
38
configuration = gate_api.Configuration(
47
47
# List all supported currency pairs supported in margin trading
48
48
api_response = api_instance.list_margin_currency_pairs()
49
49
print (api_response)
50
+ except GateApiException as ex:
51
+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
50
52
except ApiException as e:
51
53
print (" Exception when calling MarginApi->list_margin_currency_pairs: %s \n " % e)
52
54
```
@@ -84,7 +86,7 @@ Order book of lending loans
84
86
``` python
85
87
from __future__ import print_function
86
88
import gate_api
87
- from gate_api.exceptions import ApiException
89
+ from gate_api.exceptions import ApiException, GateApiException
88
90
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
89
91
# See configuration.py for a list of all supported configuration parameters.
90
92
configuration = gate_api.Configuration(
100
102
# Order book of lending loans
101
103
api_response = api_instance.list_funding_book(currency)
102
104
print (api_response)
105
+ except GateApiException as ex:
106
+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
103
107
except ApiException as e:
104
108
print (" Exception when calling MarginApi->list_funding_book: %s \n " % e)
105
109
```
@@ -141,7 +145,7 @@ Margin account list
141
145
``` python
142
146
from __future__ import print_function
143
147
import gate_api
144
- from gate_api.exceptions import ApiException
148
+ from gate_api.exceptions import ApiException, GateApiException
145
149
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
146
150
# See configuration.py for a list of all supported configuration parameters.
147
151
# The client must configure the authentication and authorization parameters
165
169
# Margin account list
166
170
api_response = api_instance.list_margin_accounts(currency_pair = currency_pair)
167
171
print (api_response)
172
+ except GateApiException as ex:
173
+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
168
174
except ApiException as e:
169
175
print (" Exception when calling MarginApi->list_margin_accounts: %s \n " % e)
170
176
```
@@ -208,7 +214,7 @@ Only transferring from or to margin account are provided for now. Time range all
208
214
``` python
209
215
from __future__ import print_function
210
216
import gate_api
211
- from gate_api.exceptions import ApiException
217
+ from gate_api.exceptions import ApiException, GateApiException
212
218
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
213
219
# See configuration.py for a list of all supported configuration parameters.
214
220
# The client must configure the authentication and authorization parameters
237
243
# List margin account balance change history
238
244
api_response = api_instance.list_margin_account_book(currency = currency, currency_pair = currency_pair, _from = _from, to = to, page = page, limit = limit)
239
245
print (api_response)
246
+ except GateApiException as ex:
247
+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
240
248
except ApiException as e:
241
249
print (" Exception when calling MarginApi->list_margin_account_book: %s \n " % e)
242
250
```
@@ -283,7 +291,7 @@ Funding account list
283
291
``` python
284
292
from __future__ import print_function
285
293
import gate_api
286
- from gate_api.exceptions import ApiException
294
+ from gate_api.exceptions import ApiException, GateApiException
287
295
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
288
296
# See configuration.py for a list of all supported configuration parameters.
289
297
# The client must configure the authentication and authorization parameters
307
315
# Funding account list
308
316
api_response = api_instance.list_funding_accounts(currency = currency)
309
317
print (api_response)
318
+ except GateApiException as ex:
319
+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
310
320
except ApiException as e:
311
321
print (" Exception when calling MarginApi->list_funding_accounts: %s \n " % e)
312
322
```
@@ -348,7 +358,7 @@ List all loans
348
358
``` python
349
359
from __future__ import print_function
350
360
import gate_api
351
- from gate_api.exceptions import ApiException
361
+ from gate_api.exceptions import ApiException, GateApiException
352
362
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
353
363
# See configuration.py for a list of all supported configuration parameters.
354
364
# The client must configure the authentication and authorization parameters
379
389
# List all loans
380
390
api_response = api_instance.list_loans(status, side, currency = currency, currency_pair = currency_pair, sort_by = sort_by, reverse_sort = reverse_sort, page = page, limit = limit)
381
391
print (api_response)
392
+ except GateApiException as ex:
393
+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
382
394
except ApiException as e:
383
395
print (" Exception when calling MarginApi->list_loans: %s \n " % e)
384
396
```
@@ -427,7 +439,7 @@ Lend or borrow
427
439
``` python
428
440
from __future__ import print_function
429
441
import gate_api
430
- from gate_api.exceptions import ApiException
442
+ from gate_api.exceptions import ApiException, GateApiException
431
443
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
432
444
# See configuration.py for a list of all supported configuration parameters.
433
445
# The client must configure the authentication and authorization parameters
451
463
# Lend or borrow
452
464
api_response = api_instance.create_loan(loan)
453
465
print (api_response)
466
+ except GateApiException as ex:
467
+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
454
468
except ApiException as e:
455
469
print (" Exception when calling MarginApi->create_loan: %s \n " % e)
456
470
```
@@ -492,7 +506,7 @@ Merge multiple lending loans
492
506
``` python
493
507
from __future__ import print_function
494
508
import gate_api
495
- from gate_api.exceptions import ApiException
509
+ from gate_api.exceptions import ApiException, GateApiException
496
510
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
497
511
# See configuration.py for a list of all supported configuration parameters.
498
512
# The client must configure the authentication and authorization parameters
517
531
# Merge multiple lending loans
518
532
api_response = api_instance.merge_loans(currency, ids)
519
533
print (api_response)
534
+ except GateApiException as ex:
535
+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
520
536
except ApiException as e:
521
537
print (" Exception when calling MarginApi->merge_loans: %s \n " % e)
522
538
```
@@ -559,7 +575,7 @@ Retrieve one single loan detail
559
575
``` python
560
576
from __future__ import print_function
561
577
import gate_api
562
- from gate_api.exceptions import ApiException
578
+ from gate_api.exceptions import ApiException, GateApiException
563
579
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
564
580
# See configuration.py for a list of all supported configuration parameters.
565
581
# The client must configure the authentication and authorization parameters
584
600
# Retrieve one single loan detail
585
601
api_response = api_instance.get_loan(loan_id, side)
586
602
print (api_response)
603
+ except GateApiException as ex:
604
+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
587
605
except ApiException as e:
588
606
print (" Exception when calling MarginApi->get_loan: %s \n " % e)
589
607
```
@@ -628,7 +646,7 @@ Only lending loans can be cancelled
628
646
``` python
629
647
from __future__ import print_function
630
648
import gate_api
631
- from gate_api.exceptions import ApiException
649
+ from gate_api.exceptions import ApiException, GateApiException
632
650
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
633
651
# See configuration.py for a list of all supported configuration parameters.
634
652
# The client must configure the authentication and authorization parameters
653
671
# Cancel lending loan
654
672
api_response = api_instance.cancel_loan(loan_id, currency)
655
673
print (api_response)
674
+ except GateApiException as ex:
675
+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
656
676
except ApiException as e:
657
677
print (" Exception when calling MarginApi->cancel_loan: %s \n " % e)
658
678
```
@@ -697,7 +717,7 @@ Only `auto_renew` modification is supported currently
697
717
``` python
698
718
from __future__ import print_function
699
719
import gate_api
700
- from gate_api.exceptions import ApiException
720
+ from gate_api.exceptions import ApiException, GateApiException
701
721
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
702
722
# See configuration.py for a list of all supported configuration parameters.
703
723
# The client must configure the authentication and authorization parameters
722
742
# Modify a loan
723
743
api_response = api_instance.update_loan(loan_id, loan_patch)
724
744
print (api_response)
745
+ except GateApiException as ex:
746
+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
725
747
except ApiException as e:
726
748
print (" Exception when calling MarginApi->update_loan: %s \n " % e)
727
749
```
@@ -764,7 +786,7 @@ List loan repayment records
764
786
``` python
765
787
from __future__ import print_function
766
788
import gate_api
767
- from gate_api.exceptions import ApiException
789
+ from gate_api.exceptions import ApiException, GateApiException
768
790
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
769
791
# See configuration.py for a list of all supported configuration parameters.
770
792
# The client must configure the authentication and authorization parameters
788
810
# List loan repayment records
789
811
api_response = api_instance.list_loan_repayments(loan_id)
790
812
print (api_response)
813
+ except GateApiException as ex:
814
+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
791
815
except ApiException as e:
792
816
print (" Exception when calling MarginApi->list_loan_repayments: %s \n " % e)
793
817
```
@@ -829,7 +853,7 @@ Repay a loan
829
853
``` python
830
854
from __future__ import print_function
831
855
import gate_api
832
- from gate_api.exceptions import ApiException
856
+ from gate_api.exceptions import ApiException, GateApiException
833
857
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
834
858
# See configuration.py for a list of all supported configuration parameters.
835
859
# The client must configure the authentication and authorization parameters
854
878
# Repay a loan
855
879
api_response = api_instance.repay_loan(loan_id, repay_request)
856
880
print (api_response)
881
+ except GateApiException as ex:
882
+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
857
883
except ApiException as e:
858
884
print (" Exception when calling MarginApi->repay_loan: %s \n " % e)
859
885
```
@@ -896,7 +922,7 @@ List repayment records of specified loan
896
922
``` python
897
923
from __future__ import print_function
898
924
import gate_api
899
- from gate_api.exceptions import ApiException
925
+ from gate_api.exceptions import ApiException, GateApiException
900
926
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
901
927
# See configuration.py for a list of all supported configuration parameters.
902
928
# The client must configure the authentication and authorization parameters
923
949
# List repayment records of specified loan
924
950
api_response = api_instance.list_loan_records(loan_id, status = status, page = page, limit = limit)
925
951
print (api_response)
952
+ except GateApiException as ex:
953
+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
926
954
except ApiException as e:
927
955
print (" Exception when calling MarginApi->list_loan_records: %s \n " % e)
928
956
```
@@ -967,7 +995,7 @@ Get one single loan record
967
995
``` python
968
996
from __future__ import print_function
969
997
import gate_api
970
- from gate_api.exceptions import ApiException
998
+ from gate_api.exceptions import ApiException, GateApiException
971
999
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
972
1000
# See configuration.py for a list of all supported configuration parameters.
973
1001
# The client must configure the authentication and authorization parameters
@@ -992,6 +1020,8 @@ try:
992
1020
# Get one single loan record
993
1021
api_response = api_instance.get_loan_record(loan_record_id, loan_id)
994
1022
print (api_response)
1023
+ except GateApiException as ex:
1024
+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
995
1025
except ApiException as e:
996
1026
print (" Exception when calling MarginApi->get_loan_record: %s \n " % e)
997
1027
```
@@ -1036,7 +1066,7 @@ Only `auto_renew` modification is supported currently
1036
1066
``` python
1037
1067
from __future__ import print_function
1038
1068
import gate_api
1039
- from gate_api.exceptions import ApiException
1069
+ from gate_api.exceptions import ApiException, GateApiException
1040
1070
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
1041
1071
# See configuration.py for a list of all supported configuration parameters.
1042
1072
# The client must configure the authentication and authorization parameters
@@ -1061,6 +1091,8 @@ try:
1061
1091
# Modify a loan record
1062
1092
api_response = api_instance.update_loan_record(loan_record_id, loan_patch)
1063
1093
print (api_response)
1094
+ except GateApiException as ex:
1095
+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
1064
1096
except ApiException as e:
1065
1097
print (" Exception when calling MarginApi->update_loan_record: %s \n " % e)
1066
1098
```
0 commit comments