@@ -32,7 +32,7 @@ List all supported currency pairs supported in margin trading
3232``` python
3333from __future__ import print_function
3434import gate_api
35- from gate_api.exceptions import ApiException
35+ from gate_api.exceptions import ApiException, GateApiException
3636# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
3737# See configuration.py for a list of all supported configuration parameters.
3838configuration = gate_api.Configuration(
4747 # List all supported currency pairs supported in margin trading
4848 api_response = api_instance.list_margin_currency_pairs()
4949 print (api_response)
50+ except GateApiException as ex:
51+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
5052except ApiException as e:
5153 print (" Exception when calling MarginApi->list_margin_currency_pairs: %s \n " % e)
5254```
@@ -84,7 +86,7 @@ Order book of lending loans
8486``` python
8587from __future__ import print_function
8688import gate_api
87- from gate_api.exceptions import ApiException
89+ from gate_api.exceptions import ApiException, GateApiException
8890# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
8991# See configuration.py for a list of all supported configuration parameters.
9092configuration = gate_api.Configuration(
100102 # Order book of lending loans
101103 api_response = api_instance.list_funding_book(currency)
102104 print (api_response)
105+ except GateApiException as ex:
106+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
103107except ApiException as e:
104108 print (" Exception when calling MarginApi->list_funding_book: %s \n " % e)
105109```
@@ -141,7 +145,7 @@ Margin account list
141145``` python
142146from __future__ import print_function
143147import gate_api
144- from gate_api.exceptions import ApiException
148+ from gate_api.exceptions import ApiException, GateApiException
145149# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
146150# See configuration.py for a list of all supported configuration parameters.
147151# The client must configure the authentication and authorization parameters
165169 # Margin account list
166170 api_response = api_instance.list_margin_accounts(currency_pair = currency_pair)
167171 print (api_response)
172+ except GateApiException as ex:
173+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
168174except ApiException as e:
169175 print (" Exception when calling MarginApi->list_margin_accounts: %s \n " % e)
170176```
@@ -208,7 +214,7 @@ Only transferring from or to margin account are provided for now. Time range all
208214``` python
209215from __future__ import print_function
210216import gate_api
211- from gate_api.exceptions import ApiException
217+ from gate_api.exceptions import ApiException, GateApiException
212218# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
213219# See configuration.py for a list of all supported configuration parameters.
214220# The client must configure the authentication and authorization parameters
237243 # List margin account balance change history
238244 api_response = api_instance.list_margin_account_book(currency = currency, currency_pair = currency_pair, _from = _from, to = to, page = page, limit = limit)
239245 print (api_response)
246+ except GateApiException as ex:
247+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
240248except ApiException as e:
241249 print (" Exception when calling MarginApi->list_margin_account_book: %s \n " % e)
242250```
@@ -283,7 +291,7 @@ Funding account list
283291``` python
284292from __future__ import print_function
285293import gate_api
286- from gate_api.exceptions import ApiException
294+ from gate_api.exceptions import ApiException, GateApiException
287295# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
288296# See configuration.py for a list of all supported configuration parameters.
289297# The client must configure the authentication and authorization parameters
307315 # Funding account list
308316 api_response = api_instance.list_funding_accounts(currency = currency)
309317 print (api_response)
318+ except GateApiException as ex:
319+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
310320except ApiException as e:
311321 print (" Exception when calling MarginApi->list_funding_accounts: %s \n " % e)
312322```
@@ -348,7 +358,7 @@ List all loans
348358``` python
349359from __future__ import print_function
350360import gate_api
351- from gate_api.exceptions import ApiException
361+ from gate_api.exceptions import ApiException, GateApiException
352362# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
353363# See configuration.py for a list of all supported configuration parameters.
354364# The client must configure the authentication and authorization parameters
379389 # List all loans
380390 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)
381391 print (api_response)
392+ except GateApiException as ex:
393+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
382394except ApiException as e:
383395 print (" Exception when calling MarginApi->list_loans: %s \n " % e)
384396```
@@ -427,7 +439,7 @@ Lend or borrow
427439``` python
428440from __future__ import print_function
429441import gate_api
430- from gate_api.exceptions import ApiException
442+ from gate_api.exceptions import ApiException, GateApiException
431443# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
432444# See configuration.py for a list of all supported configuration parameters.
433445# The client must configure the authentication and authorization parameters
451463 # Lend or borrow
452464 api_response = api_instance.create_loan(loan)
453465 print (api_response)
466+ except GateApiException as ex:
467+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
454468except ApiException as e:
455469 print (" Exception when calling MarginApi->create_loan: %s \n " % e)
456470```
@@ -492,7 +506,7 @@ Merge multiple lending loans
492506``` python
493507from __future__ import print_function
494508import gate_api
495- from gate_api.exceptions import ApiException
509+ from gate_api.exceptions import ApiException, GateApiException
496510# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
497511# See configuration.py for a list of all supported configuration parameters.
498512# The client must configure the authentication and authorization parameters
517531 # Merge multiple lending loans
518532 api_response = api_instance.merge_loans(currency, ids)
519533 print (api_response)
534+ except GateApiException as ex:
535+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
520536except ApiException as e:
521537 print (" Exception when calling MarginApi->merge_loans: %s \n " % e)
522538```
@@ -559,7 +575,7 @@ Retrieve one single loan detail
559575``` python
560576from __future__ import print_function
561577import gate_api
562- from gate_api.exceptions import ApiException
578+ from gate_api.exceptions import ApiException, GateApiException
563579# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
564580# See configuration.py for a list of all supported configuration parameters.
565581# The client must configure the authentication and authorization parameters
584600 # Retrieve one single loan detail
585601 api_response = api_instance.get_loan(loan_id, side)
586602 print (api_response)
603+ except GateApiException as ex:
604+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
587605except ApiException as e:
588606 print (" Exception when calling MarginApi->get_loan: %s \n " % e)
589607```
@@ -628,7 +646,7 @@ Only lending loans can be cancelled
628646``` python
629647from __future__ import print_function
630648import gate_api
631- from gate_api.exceptions import ApiException
649+ from gate_api.exceptions import ApiException, GateApiException
632650# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
633651# See configuration.py for a list of all supported configuration parameters.
634652# The client must configure the authentication and authorization parameters
653671 # Cancel lending loan
654672 api_response = api_instance.cancel_loan(loan_id, currency)
655673 print (api_response)
674+ except GateApiException as ex:
675+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
656676except ApiException as e:
657677 print (" Exception when calling MarginApi->cancel_loan: %s \n " % e)
658678```
@@ -697,7 +717,7 @@ Only `auto_renew` modification is supported currently
697717``` python
698718from __future__ import print_function
699719import gate_api
700- from gate_api.exceptions import ApiException
720+ from gate_api.exceptions import ApiException, GateApiException
701721# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
702722# See configuration.py for a list of all supported configuration parameters.
703723# The client must configure the authentication and authorization parameters
722742 # Modify a loan
723743 api_response = api_instance.update_loan(loan_id, loan_patch)
724744 print (api_response)
745+ except GateApiException as ex:
746+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
725747except ApiException as e:
726748 print (" Exception when calling MarginApi->update_loan: %s \n " % e)
727749```
@@ -764,7 +786,7 @@ List loan repayment records
764786``` python
765787from __future__ import print_function
766788import gate_api
767- from gate_api.exceptions import ApiException
789+ from gate_api.exceptions import ApiException, GateApiException
768790# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
769791# See configuration.py for a list of all supported configuration parameters.
770792# The client must configure the authentication and authorization parameters
788810 # List loan repayment records
789811 api_response = api_instance.list_loan_repayments(loan_id)
790812 print (api_response)
813+ except GateApiException as ex:
814+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
791815except ApiException as e:
792816 print (" Exception when calling MarginApi->list_loan_repayments: %s \n " % e)
793817```
@@ -829,7 +853,7 @@ Repay a loan
829853``` python
830854from __future__ import print_function
831855import gate_api
832- from gate_api.exceptions import ApiException
856+ from gate_api.exceptions import ApiException, GateApiException
833857# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
834858# See configuration.py for a list of all supported configuration parameters.
835859# The client must configure the authentication and authorization parameters
854878 # Repay a loan
855879 api_response = api_instance.repay_loan(loan_id, repay_request)
856880 print (api_response)
881+ except GateApiException as ex:
882+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
857883except ApiException as e:
858884 print (" Exception when calling MarginApi->repay_loan: %s \n " % e)
859885```
@@ -896,7 +922,7 @@ List repayment records of specified loan
896922``` python
897923from __future__ import print_function
898924import gate_api
899- from gate_api.exceptions import ApiException
925+ from gate_api.exceptions import ApiException, GateApiException
900926# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
901927# See configuration.py for a list of all supported configuration parameters.
902928# The client must configure the authentication and authorization parameters
923949 # List repayment records of specified loan
924950 api_response = api_instance.list_loan_records(loan_id, status = status, page = page, limit = limit)
925951 print (api_response)
952+ except GateApiException as ex:
953+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
926954except ApiException as e:
927955 print (" Exception when calling MarginApi->list_loan_records: %s \n " % e)
928956```
@@ -967,7 +995,7 @@ Get one single loan record
967995``` python
968996from __future__ import print_function
969997import gate_api
970- from gate_api.exceptions import ApiException
998+ from gate_api.exceptions import ApiException, GateApiException
971999# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
9721000# See configuration.py for a list of all supported configuration parameters.
9731001# The client must configure the authentication and authorization parameters
@@ -992,6 +1020,8 @@ try:
9921020 # Get one single loan record
9931021 api_response = api_instance.get_loan_record(loan_record_id, loan_id)
9941022 print (api_response)
1023+ except GateApiException as ex:
1024+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
9951025except ApiException as e:
9961026 print (" Exception when calling MarginApi->get_loan_record: %s \n " % e)
9971027```
@@ -1036,7 +1066,7 @@ Only `auto_renew` modification is supported currently
10361066``` python
10371067from __future__ import print_function
10381068import gate_api
1039- from gate_api.exceptions import ApiException
1069+ from gate_api.exceptions import ApiException, GateApiException
10401070# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
10411071# See configuration.py for a list of all supported configuration parameters.
10421072# The client must configure the authentication and authorization parameters
@@ -1061,6 +1091,8 @@ try:
10611091 # Modify a loan record
10621092 api_response = api_instance.update_loan_record(loan_record_id, loan_patch)
10631093 print (api_response)
1094+ except GateApiException as ex:
1095+ print (" Gate api exception, label: %s , message: %s \n " % (ex.label, ex.message))
10641096except ApiException as e:
10651097 print (" Exception when calling MarginApi->update_loan_record: %s \n " % e)
10661098```
0 commit comments