diff --git a/README.md b/README.md index a8a202d..1f1e6e4 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ APIv4 provides spot, margin and futures trading operations. There are public API This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 4.20.1 -- Package version: 4.20.1 +- API version: 4.21.2 +- Package version: 4.21.2 - Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit [https://www.gate.io/page/contacts](https://www.gate.io/page/contacts) @@ -189,6 +189,14 @@ Class | Method | HTTP request | Description *MarginApi* | [**update_loan_record**](docs/MarginApi.md#update_loan_record) | **PATCH** /margin/loan_records/{loan_record_id} | Modify a loan record *MarginApi* | [**get_auto_repay_status**](docs/MarginApi.md#get_auto_repay_status) | **GET** /margin/auto_repay | Retrieve user auto repayment setting *MarginApi* | [**set_auto_repay**](docs/MarginApi.md#set_auto_repay) | **POST** /margin/auto_repay | Update user's auto repayment setting +*MarginApi* | [**list_cross_margin_currencies**](docs/MarginApi.md#list_cross_margin_currencies) | **GET** /margin/cross/currencies | Currencies supported by cross margin. +*MarginApi* | [**get_cross_margin_currency**](docs/MarginApi.md#get_cross_margin_currency) | **GET** /margin/cross/currencies/{currency} | Retrieve detail of one single currency supported by cross margin +*MarginApi* | [**get_cross_margin_account**](docs/MarginApi.md#get_cross_margin_account) | **GET** /margin/cross/accounts | Retrieve cross margin account +*MarginApi* | [**list_cross_margin_loans**](docs/MarginApi.md#list_cross_margin_loans) | **GET** /margin/cross/loans | List cross margin borrow history +*MarginApi* | [**create_cross_margin_loan**](docs/MarginApi.md#create_cross_margin_loan) | **POST** /margin/cross/loans | Create a cross margin borrow loan +*MarginApi* | [**get_cross_margin_loan**](docs/MarginApi.md#get_cross_margin_loan) | **GET** /margin/cross/loans/{loan_id} | Retrieve single borrow loan detail +*MarginApi* | [**list_cross_margin_repayments**](docs/MarginApi.md#list_cross_margin_repayments) | **GET** /margin/cross/repayments | Retrieve cross margin repayments +*MarginApi* | [**repay_cross_margin_loan**](docs/MarginApi.md#repay_cross_margin_loan) | **POST** /margin/cross/repayments | Repay cross margin loan *SpotApi* | [**list_currencies**](docs/SpotApi.md#list_currencies) | **GET** /spot/currencies | List all currencies' detail *SpotApi* | [**get_currency**](docs/SpotApi.md#get_currency) | **GET** /spot/currencies/{currency} | Get detail of one particular currency *SpotApi* | [**list_currency_pairs**](docs/SpotApi.md#list_currency_pairs) | **GET** /spot/currency_pairs | List all currency pairs supported @@ -223,6 +231,7 @@ Class | Method | HTTP request | Description *WalletApi* | [**list_sub_account_balances**](docs/WalletApi.md#list_sub_account_balances) | **GET** /wallet/sub_account_balances | Retrieve sub account balances *WalletApi* | [**get_trade_fee**](docs/WalletApi.md#get_trade_fee) | **GET** /wallet/fee | Retrieve personal trading fee *WithdrawalApi* | [**withdraw**](docs/WithdrawalApi.md#withdraw) | **POST** /withdrawals | Withdraw +*WithdrawalApi* | [**cancel_withdrawal**](docs/WithdrawalApi.md#cancel_withdrawal) | **DELETE** /withdrawals/{withdrawal_id} | Cancel withdrawal with specified ID ## Documentation For Models @@ -233,6 +242,12 @@ Class | Method | HTTP request | Description - [CancelOrderResult](docs/CancelOrderResult.md) - [Contract](docs/Contract.md) - [ContractStat](docs/ContractStat.md) + - [CrossMarginAccount](docs/CrossMarginAccount.md) + - [CrossMarginBalance](docs/CrossMarginBalance.md) + - [CrossMarginCurrency](docs/CrossMarginCurrency.md) + - [CrossMarginLoan](docs/CrossMarginLoan.md) + - [CrossMarginRepayRequest](docs/CrossMarginRepayRequest.md) + - [CrossMarginRepayment](docs/CrossMarginRepayment.md) - [Currency](docs/Currency.md) - [CurrencyPair](docs/CurrencyPair.md) - [DeliveryContract](docs/DeliveryContract.md) diff --git a/docs/BatchOrder.md b/docs/BatchOrder.md index 59a4748..310a1a9 100644 --- a/docs/BatchOrder.md +++ b/docs/BatchOrder.md @@ -11,16 +11,19 @@ Name | Type | Description | Notes **id** | **str** | Order ID | [optional] [readonly] **create_time** | **str** | Order creation time | [optional] [readonly] **update_time** | **str** | Order last modification time | [optional] [readonly] +**create_time_ms** | **int** | Order creation time in milliseconds | [optional] [readonly] +**update_time_ms** | **int** | Order last modification time in milliseconds | [optional] [readonly] **status** | **str** | Order status - `open`: to be filled - `closed`: filled - `cancelled`: cancelled | [optional] [readonly] **currency_pair** | **str** | Currency pair | [optional] **type** | **str** | Order type. limit - limit order | [optional] [default to 'limit'] -**account** | **str** | Account type. spot - use spot account; margin - use margin account | [optional] [default to 'spot'] +**account** | **str** | Account type. spot - use spot account; margin - use margin account; cross_margin - use cross margin account | [optional] [default to 'spot'] **side** | **str** | Order side | [optional] **amount** | **str** | Trade amount | [optional] **price** | **str** | Order price | [optional] **time_in_force** | **str** | Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee | [optional] [default to 'gtc'] **iceberg** | **str** | Amount to display for the iceberg order. Null or 0 for normal orders. Set to -1 to hide the amount totally | [optional] -**auto_borrow** | **bool** | Used in margin trading(i.e. `account` is `margin`) to allow automatic loan of insufficient part if balance is not enough. | [optional] +**auto_borrow** | **bool** | Used in margin or cross margin trading to allow automatic loan of insufficient amount if balance is not enough. | [optional] +**auto_repay** | **bool** | Enable or disable automatic repayment for automatic borrow loan generated by cross margin order. Default is disabled. Note that: 1. This field is only effective for cross margin orders. Margin account does not support setting auto repayment for orders. 2. `auto_borrow` and `auto_repay` cannot be both set to true in one order. | [optional] **left** | **str** | Amount left to fill | [optional] [readonly] **fill_price** | **str** | Total filled in quote currency. Deprecated in favor of `filled_total` | [optional] [readonly] **filled_total** | **str** | Total filled in quote currency | [optional] [readonly] diff --git a/docs/CancelOrder.md b/docs/CancelOrder.md index e4ad12e..1ef6414 100644 --- a/docs/CancelOrder.md +++ b/docs/CancelOrder.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **currency_pair** | **str** | Order currency pair | **id** | **str** | Order ID or user custom ID. Custom ID are accepted only within 30 minutes after order creation | +**account** | **str** | If cancelled order is cross margin order, this field must be set and can only be `cross_margin` | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/CancelOrderResult.md b/docs/CancelOrderResult.md index 7a0d514..d5cb671 100644 --- a/docs/CancelOrderResult.md +++ b/docs/CancelOrderResult.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **succeeded** | **bool** | Whether cancellation succeeded | [optional] **label** | **str** | Error label when failed to cancel the order; emtpy if succeeded | [optional] **message** | **str** | Error message when failed to cancel the order; empty if succeeded | [optional] +**account** | **str** | Empty by default. If cancelled order is cross margin order, this field is set to `cross_margin` | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/Contract.md b/docs/Contract.md index 5e0e432..3398c76 100644 --- a/docs/Contract.md +++ b/docs/Contract.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **str** | Futures contract | [optional] **type** | **str** | Futures contract type | [optional] -**quanto_multiplier** | **str** | Multiplier used in converting from invoicing to settlement currency in quanto futures | [optional] +**quanto_multiplier** | **str** | Multiplier used in converting from invoicing to settlement currency | [optional] **leverage_min** | **str** | Minimum leverage | [optional] **leverage_max** | **str** | Maximum leverage | [optional] **maintenance_rate** | **str** | Maintenance rate of margin | [optional] diff --git a/docs/CrossMarginAccount.md b/docs/CrossMarginAccount.md new file mode 100644 index 0000000..c4bef2d --- /dev/null +++ b/docs/CrossMarginAccount.md @@ -0,0 +1,16 @@ +# CrossMarginAccount + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**user_id** | **int** | User ID | [optional] +**locked** | **bool** | Whether account is locked | [optional] +**balances** | [**dict(str, CrossMarginBalance)**](CrossMarginBalance.md) | | [optional] +**total** | **str** | Total account value in USDT, i.e., the sum of all currencies' `(available+freeze)*price*discount` | [optional] +**borrowed** | **str** | Total borrowed value in USDT, i.e., the sum of all currencies' `borrowed*price*discount` | [optional] +**interest** | **str** | Total unpaid interests in USDT, i.e., the sum of all currencies' `interest*price*discount` | [optional] +**risk** | **str** | Risk rate. When it belows 110%, liquidation will be triggered. Calculation formula: `total / (borrowed+interest)` | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CrossMarginBalance.md b/docs/CrossMarginBalance.md new file mode 100644 index 0000000..336dd88 --- /dev/null +++ b/docs/CrossMarginBalance.md @@ -0,0 +1,13 @@ +# CrossMarginBalance + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**available** | **str** | Available amount | [optional] +**freeze** | **str** | Locked amount | [optional] +**borrowed** | **str** | Borrowed amount | [optional] +**interest** | **str** | Interests unpaid | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CrossMarginCurrency.md b/docs/CrossMarginCurrency.md new file mode 100644 index 0000000..7f47bce --- /dev/null +++ b/docs/CrossMarginCurrency.md @@ -0,0 +1,17 @@ +# CrossMarginCurrency + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | Currency name | [optional] +**rate** | **str** | Loan rate | [optional] +**prec** | **str** | Currency precision | [optional] +**discount** | **str** | Currency value discount, which is used in total value calculation | [optional] +**min_borrow_amount** | **str** | Minimum currency borrow amount. Unit is currency itself | [optional] +**user_max_borrow_amount** | **str** | Maximum borrow value allowed per user, in USDT | [optional] +**total_max_borrow_amount** | **str** | Maximum borrow value allowed for this currency, in USDT | [optional] +**price** | **str** | Price change between this currency and USDT | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CrossMarginLoan.md b/docs/CrossMarginLoan.md new file mode 100644 index 0000000..f899b93 --- /dev/null +++ b/docs/CrossMarginLoan.md @@ -0,0 +1,19 @@ +# CrossMarginLoan + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Borrow loan ID | [optional] [readonly] +**create_time** | **int** | Creation timestamp, in milliseconds | [optional] [readonly] +**update_time** | **int** | Update timestamp, in milliseconds | [optional] [readonly] +**currency** | **str** | Currency name | +**amount** | **str** | Borrowed amount | +**text** | **str** | User defined custom ID | [optional] +**status** | **int** | Borrow loan status, which includes: - 1: failed to borrow - 2: borrowed but not repaid - 3: repayment complete | [optional] [readonly] +**repaid** | **str** | Repaid amount | [optional] [readonly] +**repaid_interest** | **str** | Repaid interest | [optional] [readonly] +**unpaid_interest** | **str** | Interest not repaid | [optional] [readonly] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CrossMarginRepayRequest.md b/docs/CrossMarginRepayRequest.md new file mode 100644 index 0000000..9c1ca05 --- /dev/null +++ b/docs/CrossMarginRepayRequest.md @@ -0,0 +1,11 @@ +# CrossMarginRepayRequest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**currency** | **str** | Repayment currency | +**amount** | **str** | Repayment amount | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CrossMarginRepayment.md b/docs/CrossMarginRepayment.md new file mode 100644 index 0000000..96813ac --- /dev/null +++ b/docs/CrossMarginRepayment.md @@ -0,0 +1,15 @@ +# CrossMarginRepayment + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Loan record ID | [optional] +**create_time** | **int** | Repayment time | [optional] +**loan_id** | **str** | Borrow loan ID | [optional] +**currency** | **str** | Currency name | [optional] +**principal** | **str** | Repaid principal | [optional] +**interest** | **str** | Repaid interest | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/DeliveryContract.md b/docs/DeliveryContract.md index 79b47fb..4f1abf3 100644 --- a/docs/DeliveryContract.md +++ b/docs/DeliveryContract.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **underlying** | **str** | Underlying | [optional] **cycle** | **str** | Cycle type, e.g. WEEKLY, QUARTERLY | [optional] **type** | **str** | Futures contract type | [optional] -**quanto_multiplier** | **str** | Multiplier used in converting from invoicing to settlement currency in quanto futures | [optional] +**quanto_multiplier** | **str** | Multiplier used in converting from invoicing to settlement currency | [optional] **leverage_min** | **str** | Minimum leverage | [optional] **leverage_max** | **str** | Maximum leverage | [optional] **maintenance_rate** | **str** | Maintenance rate of margin | [optional] diff --git a/docs/FuturesApi.md b/docs/FuturesApi.md index 36afcfe..3478947 100644 --- a/docs/FuturesApi.md +++ b/docs/FuturesApi.md @@ -1031,7 +1031,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **update_position_leverage** -> Position update_position_leverage(settle, contract, leverage) +> Position update_position_leverage(settle, contract, leverage, cross_leverage_limit=cross_leverage_limit) Update position leverage @@ -1062,10 +1062,11 @@ api_instance = gate_api.FuturesApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT' # str | Futures contract leverage = '10' # str | New position leverage +cross_leverage_limit = '10' # str | Cross margin leverage(valid only when `leverage` is 0) (optional) try: # Update position leverage - api_response = api_instance.update_position_leverage(settle, contract, leverage) + api_response = api_instance.update_position_leverage(settle, contract, leverage, cross_leverage_limit=cross_leverage_limit) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) @@ -1080,6 +1081,7 @@ Name | Type | Description | Notes **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | **leverage** | **str**| New position leverage | + **cross_leverage_limit** | **str**| Cross margin leverage(valid only when `leverage` is 0) | [optional] ### Return type @@ -1313,7 +1315,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **update_dual_mode_position_margin** -> list[Position] update_dual_mode_position_margin(settle, contract, change) +> list[Position] update_dual_mode_position_margin(settle, contract, change, dual_side) Update position margin in dual mode @@ -1344,10 +1346,11 @@ api_instance = gate_api.FuturesApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT' # str | Futures contract change = '0.01' # str | Margin change. Use positive number to increase margin, negative number otherwise. +dual_side = 'dual_long' # str | Long or short position try: # Update position margin in dual mode - api_response = api_instance.update_dual_mode_position_margin(settle, contract, change) + api_response = api_instance.update_dual_mode_position_margin(settle, contract, change, dual_side) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) @@ -1362,6 +1365,7 @@ Name | Type | Description | Notes **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | **change** | **str**| Margin change. Use positive number to increase margin, negative number otherwise. | + **dual_side** | **str**| Long or short position | ### Return type diff --git a/docs/FuturesOrder.md b/docs/FuturesOrder.md index 51eb628..46eede3 100644 --- a/docs/FuturesOrder.md +++ b/docs/FuturesOrder.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **user** | **int** | User ID | [optional] [readonly] **create_time** | **float** | Order creation time | [optional] [readonly] **finish_time** | **float** | Order finished time. Not returned if order is open | [optional] [readonly] -**finish_as** | **str** | How the order is finished. - filled: all filled - cancelled: manually cancelled - liquidated: cancelled because of liquidation - ioc: time in force is `IOC`, finish immediately - auto_deleveraged: finished by ADL - reduce_only: cancelled because of increasing position while `reduce-only` set | [optional] [readonly] +**finish_as** | **str** | How the order is finished. - filled: all filled - cancelled: manually cancelled - liquidated: cancelled because of liquidation - ioc: time in force is `IOC`, finish immediately - auto_deleveraged: finished by ADL - reduce_only: cancelled because of increasing position while `reduce-only` set- position_closed: cancelled because of position close | [optional] [readonly] **status** | **str** | Order status - `open`: waiting to be traded - `finished`: finished | [optional] [readonly] **contract** | **str** | Futures contract | **size** | **int** | Order size. Specify positive number to make a bid, and negative number to ask | diff --git a/docs/MarginAccountCurrency.md b/docs/MarginAccountCurrency.md index 74f3224..cc87009 100644 --- a/docs/MarginAccountCurrency.md +++ b/docs/MarginAccountCurrency.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **available** | **str** | Amount suitable for margin trading. | [optional] **locked** | **str** | Locked amount, used in margin trading | [optional] **borrowed** | **str** | Borrowed amount | [optional] +**interest** | **str** | Interests unpaid | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/MarginApi.md b/docs/MarginApi.md index 1fdb41b..098a54d 100644 --- a/docs/MarginApi.md +++ b/docs/MarginApi.md @@ -23,6 +23,14 @@ Method | HTTP request | Description [**update_loan_record**](MarginApi.md#update_loan_record) | **PATCH** /margin/loan_records/{loan_record_id} | Modify a loan record [**get_auto_repay_status**](MarginApi.md#get_auto_repay_status) | **GET** /margin/auto_repay | Retrieve user auto repayment setting [**set_auto_repay**](MarginApi.md#set_auto_repay) | **POST** /margin/auto_repay | Update user's auto repayment setting +[**list_cross_margin_currencies**](MarginApi.md#list_cross_margin_currencies) | **GET** /margin/cross/currencies | Currencies supported by cross margin. +[**get_cross_margin_currency**](MarginApi.md#get_cross_margin_currency) | **GET** /margin/cross/currencies/{currency} | Retrieve detail of one single currency supported by cross margin +[**get_cross_margin_account**](MarginApi.md#get_cross_margin_account) | **GET** /margin/cross/accounts | Retrieve cross margin account +[**list_cross_margin_loans**](MarginApi.md#list_cross_margin_loans) | **GET** /margin/cross/loans | List cross margin borrow history +[**create_cross_margin_loan**](MarginApi.md#create_cross_margin_loan) | **POST** /margin/cross/loans | Create a cross margin borrow loan +[**get_cross_margin_loan**](MarginApi.md#get_cross_margin_loan) | **GET** /margin/cross/loans/{loan_id} | Retrieve single borrow loan detail +[**list_cross_margin_repayments**](MarginApi.md#list_cross_margin_repayments) | **GET** /margin/cross/repayments | Retrieve cross margin repayments +[**repay_cross_margin_loan**](MarginApi.md#repay_cross_margin_loan) | **POST** /margin/cross/repayments | Repay cross margin loan # **list_margin_currency_pairs** @@ -1315,3 +1323,535 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **list_cross_margin_currencies** +> list[CrossMarginCurrency] list_cross_margin_currencies() + +Currencies supported by cross margin. + +### Example + +```python +from __future__ import print_function +import gate_api +from gate_api.exceptions import ApiException, GateApiException +# Defining the host is optional and defaults to https://api.gateio.ws/api/v4 +# See configuration.py for a list of all supported configuration parameters. +configuration = gate_api.Configuration( + host = "https://api.gateio.ws/api/v4" +) + +api_client = gate_api.ApiClient(configuration) +# Create an instance of the API class +api_instance = gate_api.MarginApi(api_client) + +try: + # Currencies supported by cross margin. + api_response = api_instance.list_cross_margin_currencies() + print(api_response) +except GateApiException as ex: + print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) +except ApiException as e: + print("Exception when calling MarginApi->list_cross_margin_currencies: %s\n" % e) +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**list[CrossMarginCurrency]**](CrossMarginCurrency.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List retrieved | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_cross_margin_currency** +> CrossMarginCurrency get_cross_margin_currency(currency) + +Retrieve detail of one single currency supported by cross margin + +### Example + +```python +from __future__ import print_function +import gate_api +from gate_api.exceptions import ApiException, GateApiException +# Defining the host is optional and defaults to https://api.gateio.ws/api/v4 +# See configuration.py for a list of all supported configuration parameters. +configuration = gate_api.Configuration( + host = "https://api.gateio.ws/api/v4" +) + +api_client = gate_api.ApiClient(configuration) +# Create an instance of the API class +api_instance = gate_api.MarginApi(api_client) +currency = 'BTC' # str | Currency name + +try: + # Retrieve detail of one single currency supported by cross margin + api_response = api_instance.get_cross_margin_currency(currency) + print(api_response) +except GateApiException as ex: + print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) +except ApiException as e: + print("Exception when calling MarginApi->get_cross_margin_currency: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **currency** | **str**| Currency name | + +### Return type + +[**CrossMarginCurrency**](CrossMarginCurrency.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successfully retrieved | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_cross_margin_account** +> CrossMarginAccount get_cross_margin_account() + +Retrieve cross margin account + +### Example + +* Api Key Authentication (apiv4): +```python +from __future__ import print_function +import gate_api +from gate_api.exceptions import ApiException, GateApiException +# Defining the host is optional and defaults to https://api.gateio.ws/api/v4 +# See configuration.py for a list of all supported configuration parameters. +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure APIv4 key authorization +configuration = gate_api.Configuration( + host = "https://api.gateio.ws/api/v4", + key = "YOU_API_KEY", + secret = "YOUR_API_SECRET" +) + +api_client = gate_api.ApiClient(configuration) +# Create an instance of the API class +api_instance = gate_api.MarginApi(api_client) + +try: + # Retrieve cross margin account + api_response = api_instance.get_cross_margin_account() + print(api_response) +except GateApiException as ex: + print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) +except ApiException as e: + print("Exception when calling MarginApi->get_cross_margin_account: %s\n" % e) +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**CrossMarginAccount**](CrossMarginAccount.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successfully retrieved | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **list_cross_margin_loans** +> list[CrossMarginLoan] list_cross_margin_loans(status, currency=currency, limit=limit, offset=offset, reverse=reverse) + +List cross margin borrow history + +Sort by creation time in descending order by default. Set `reverse=false` to return ascending results. + +### Example + +* Api Key Authentication (apiv4): +```python +from __future__ import print_function +import gate_api +from gate_api.exceptions import ApiException, GateApiException +# Defining the host is optional and defaults to https://api.gateio.ws/api/v4 +# See configuration.py for a list of all supported configuration parameters. +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure APIv4 key authorization +configuration = gate_api.Configuration( + host = "https://api.gateio.ws/api/v4", + key = "YOU_API_KEY", + secret = "YOUR_API_SECRET" +) + +api_client = gate_api.ApiClient(configuration) +# Create an instance of the API class +api_instance = gate_api.MarginApi(api_client) +status = 56 # int | Filter by status. Supported values are 2 and 3. +currency = 'currency_example' # str | Filter by currency (optional) +limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) +offset = 0 # int | List offset, starting from 0 (optional) (default to 0) +reverse = True # bool | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional) (default to True) + +try: + # List cross margin borrow history + api_response = api_instance.list_cross_margin_loans(status, currency=currency, limit=limit, offset=offset, reverse=reverse) + print(api_response) +except GateApiException as ex: + print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) +except ApiException as e: + print("Exception when calling MarginApi->list_cross_margin_loans: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | **int**| Filter by status. Supported values are 2 and 3. | + **currency** | **str**| Filter by currency | [optional] + **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] + **reverse** | **bool**| Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results | [optional] [default to True] + +### Return type + +[**list[CrossMarginLoan]**](CrossMarginLoan.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successfully retrieved | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **create_cross_margin_loan** +> CrossMarginLoan create_cross_margin_loan(cross_margin_loan) + +Create a cross margin borrow loan + +Borrow amount cannot be less than currency minimum borrow amount + +### Example + +* Api Key Authentication (apiv4): +```python +from __future__ import print_function +import gate_api +from gate_api.exceptions import ApiException, GateApiException +# Defining the host is optional and defaults to https://api.gateio.ws/api/v4 +# See configuration.py for a list of all supported configuration parameters. +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure APIv4 key authorization +configuration = gate_api.Configuration( + host = "https://api.gateio.ws/api/v4", + key = "YOU_API_KEY", + secret = "YOUR_API_SECRET" +) + +api_client = gate_api.ApiClient(configuration) +# Create an instance of the API class +api_instance = gate_api.MarginApi(api_client) +cross_margin_loan = gate_api.CrossMarginLoan() # CrossMarginLoan | + +try: + # Create a cross margin borrow loan + api_response = api_instance.create_cross_margin_loan(cross_margin_loan) + print(api_response) +except GateApiException as ex: + print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) +except ApiException as e: + print("Exception when calling MarginApi->create_cross_margin_loan: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **cross_margin_loan** | [**CrossMarginLoan**](CrossMarginLoan.md)| | + +### Return type + +[**CrossMarginLoan**](CrossMarginLoan.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successfully borrowed | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_cross_margin_loan** +> CrossMarginLoan get_cross_margin_loan(loan_id) + +Retrieve single borrow loan detail + +### Example + +* Api Key Authentication (apiv4): +```python +from __future__ import print_function +import gate_api +from gate_api.exceptions import ApiException, GateApiException +# Defining the host is optional and defaults to https://api.gateio.ws/api/v4 +# See configuration.py for a list of all supported configuration parameters. +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure APIv4 key authorization +configuration = gate_api.Configuration( + host = "https://api.gateio.ws/api/v4", + key = "YOU_API_KEY", + secret = "YOUR_API_SECRET" +) + +api_client = gate_api.ApiClient(configuration) +# Create an instance of the API class +api_instance = gate_api.MarginApi(api_client) +loan_id = '12345' # str | Borrow loan ID + +try: + # Retrieve single borrow loan detail + api_response = api_instance.get_cross_margin_loan(loan_id) + print(api_response) +except GateApiException as ex: + print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) +except ApiException as e: + print("Exception when calling MarginApi->get_cross_margin_loan: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **loan_id** | **str**| Borrow loan ID | + +### Return type + +[**CrossMarginLoan**](CrossMarginLoan.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successfully retrieved | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **list_cross_margin_repayments** +> list[CrossMarginRepayment] list_cross_margin_repayments(currency=currency, loan_id=loan_id, limit=limit, offset=offset, reverse=reverse) + +Retrieve cross margin repayments + +Sort by creation time in descending order by default. Set `reverse=false` to return ascending results. + +### Example + +* Api Key Authentication (apiv4): +```python +from __future__ import print_function +import gate_api +from gate_api.exceptions import ApiException, GateApiException +# Defining the host is optional and defaults to https://api.gateio.ws/api/v4 +# See configuration.py for a list of all supported configuration parameters. +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure APIv4 key authorization +configuration = gate_api.Configuration( + host = "https://api.gateio.ws/api/v4", + key = "YOU_API_KEY", + secret = "YOUR_API_SECRET" +) + +api_client = gate_api.ApiClient(configuration) +# Create an instance of the API class +api_instance = gate_api.MarginApi(api_client) +currency = 'BTC' # str | (optional) +loan_id = '12345' # str | (optional) +limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) +offset = 0 # int | List offset, starting from 0 (optional) (default to 0) +reverse = True # bool | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results (optional) (default to True) + +try: + # Retrieve cross margin repayments + api_response = api_instance.list_cross_margin_repayments(currency=currency, loan_id=loan_id, limit=limit, offset=offset, reverse=reverse) + print(api_response) +except GateApiException as ex: + print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) +except ApiException as e: + print("Exception when calling MarginApi->list_cross_margin_repayments: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **currency** | **str**| | [optional] + **loan_id** | **str**| | [optional] + **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] + **reverse** | **bool**| Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results | [optional] [default to True] + +### Return type + +[**list[CrossMarginRepayment]**](CrossMarginRepayment.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | List retrieved | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **repay_cross_margin_loan** +> list[CrossMarginLoan] repay_cross_margin_loan(cross_margin_repay_request) + +Repay cross margin loan + +### Example + +* Api Key Authentication (apiv4): +```python +from __future__ import print_function +import gate_api +from gate_api.exceptions import ApiException, GateApiException +# Defining the host is optional and defaults to https://api.gateio.ws/api/v4 +# See configuration.py for a list of all supported configuration parameters. +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure APIv4 key authorization +configuration = gate_api.Configuration( + host = "https://api.gateio.ws/api/v4", + key = "YOU_API_KEY", + secret = "YOUR_API_SECRET" +) + +api_client = gate_api.ApiClient(configuration) +# Create an instance of the API class +api_instance = gate_api.MarginApi(api_client) +cross_margin_repay_request = gate_api.CrossMarginRepayRequest() # CrossMarginRepayRequest | + +try: + # Repay cross margin loan + api_response = api_instance.repay_cross_margin_loan(cross_margin_repay_request) + print(api_response) +except GateApiException as ex: + print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) +except ApiException as e: + print("Exception when calling MarginApi->repay_cross_margin_loan: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **cross_margin_repay_request** | [**CrossMarginRepayRequest**](CrossMarginRepayRequest.md)| | + +### Return type + +[**list[CrossMarginLoan]**](CrossMarginLoan.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Loan repaid | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/Order.md b/docs/Order.md index 5e0b736..ebf0bce 100644 --- a/docs/Order.md +++ b/docs/Order.md @@ -8,16 +8,19 @@ Name | Type | Description | Notes **text** | **str** | 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(.) | [optional] **create_time** | **str** | Order creation time | [optional] [readonly] **update_time** | **str** | Order last modification time | [optional] [readonly] +**create_time_ms** | **int** | Order creation time in milliseconds | [optional] [readonly] +**update_time_ms** | **int** | Order last modification time in milliseconds | [optional] [readonly] **status** | **str** | Order status - `open`: to be filled - `closed`: filled - `cancelled`: cancelled | [optional] [readonly] **currency_pair** | **str** | Currency pair | **type** | **str** | Order type. limit - limit order | [optional] [default to 'limit'] -**account** | **str** | Account type. spot - use spot account; margin - use margin account | [optional] [default to 'spot'] +**account** | **str** | Account type. spot - use spot account; margin - use margin account; cross_margin - use cross margin account | [optional] [default to 'spot'] **side** | **str** | Order side | **amount** | **str** | Trade amount | **price** | **str** | Order price | **time_in_force** | **str** | Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee | [optional] [default to 'gtc'] **iceberg** | **str** | Amount to display for the iceberg order. Null or 0 for normal orders. Set to -1 to hide the amount totally | [optional] -**auto_borrow** | **bool** | Used in margin trading(i.e. `account` is `margin`) to allow automatic loan of insufficient part if balance is not enough. | [optional] +**auto_borrow** | **bool** | Used in margin or cross margin trading to allow automatic loan of insufficient amount if balance is not enough. | [optional] +**auto_repay** | **bool** | Enable or disable automatic repayment for automatic borrow loan generated by cross margin order. Default is disabled. Note that: 1. This field is only effective for cross margin orders. Margin account does not support setting auto repayment for orders. 2. `auto_borrow` and `auto_repay` cannot be both set to true in one order. | [optional] **left** | **str** | Amount left to fill | [optional] [readonly] **fill_price** | **str** | Total filled in quote currency. Deprecated in favor of `filled_total` | [optional] [readonly] **filled_total** | **str** | Total filled in quote currency | [optional] [readonly] diff --git a/docs/Position.md b/docs/Position.md index 4df4a9e..3076724 100644 --- a/docs/Position.md +++ b/docs/Position.md @@ -26,6 +26,7 @@ Name | Type | Description | Notes **pending_orders** | **int** | Current open orders | [optional] [readonly] **close_order** | [**PositionCloseOrder**](PositionCloseOrder.md) | | [optional] **mode** | **str** | Position mode, including: - `single`: dual mode is not enabled- `dual_long`: long position in dual mode- `dual_short`: short position in dual mode | [optional] +**cross_leverage_limit** | **str** | Cross margin leverage(valid only when `leverage` is 0) | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/SpotApi.md b/docs/SpotApi.md index 8246389..35051ae 100644 --- a/docs/SpotApi.md +++ b/docs/SpotApi.md @@ -718,11 +718,11 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_all_open_orders** -> list[OpenOrders] list_all_open_orders(page=page, limit=limit) +> list[OpenOrders] list_all_open_orders(page=page, limit=limit, account=account) List all open orders -List open orders in all currency pairs. Note that pagination parameters affect record number in each currency pair's open order list. No pagination is applied to the number of currency pairs returned. All currency pairs with open orders will be returned +List open orders in all currency pairs. Note that pagination parameters affect record number in each currency pair's open order list. No pagination is applied to the number of currency pairs returned. All currency pairs with open orders will be returned. Spot and margin orders are returned by default. To list cross margin orders, `account` must be set to `cross_margin` ### Example @@ -750,10 +750,11 @@ api_client = gate_api.ApiClient(configuration) api_instance = gate_api.SpotApi(api_client) page = 1 # int | Page number (optional) (default to 1) limit = 100 # int | Maximum number of records returned in one page in each currency pair (optional) (default to 100) +account = 'cross_margin' # str | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) try: # List all open orders - api_response = api_instance.list_all_open_orders(page=page, limit=limit) + api_response = api_instance.list_all_open_orders(page=page, limit=limit, account=account) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) @@ -767,6 +768,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **page** | **int**| Page number | [optional] [default to 1] **limit** | **int**| Maximum number of records returned in one page in each currency pair | [optional] [default to 100] + **account** | **str**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account | [optional] ### Return type @@ -789,10 +791,12 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_orders** -> list[Order] list_orders(currency_pair, status, page=page, limit=limit) +> list[Order] list_orders(currency_pair, status, page=page, limit=limit, account=account) List orders +Spot and margin orders are returned by default. If cross margin orders are needed, `account` must be set to `cross_margin` + ### Example * Api Key Authentication (apiv4): @@ -821,10 +825,11 @@ currency_pair = 'BTC_USDT' # str | Currency pair status = 'open' # str | List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled page = 1 # int | Page number (optional) (default to 1) limit = 100 # int | Maximum number of records returned. If `status` is `open`, maximum of `limit` is 100 (optional) (default to 100) +account = 'cross_margin' # str | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) try: # List orders - api_response = api_instance.list_orders(currency_pair, status, page=page, limit=limit) + api_response = api_instance.list_orders(currency_pair, status, page=page, limit=limit, account=account) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) @@ -840,6 +845,7 @@ Name | Type | Description | Notes **status** | **str**| List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled | **page** | **int**| Page number | [optional] [default to 1] **limit** | **int**| Maximum number of records returned. If `status` is `open`, maximum of `limit` is 100 | [optional] [default to 100] + **account** | **str**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account | [optional] ### Return type @@ -866,6 +872,8 @@ Name | Type | Description | Notes Create an order +You can place orders with spot, margin or cross margin account through setting the `account `field. It defaults to `spot`, which means spot account is used to place orders. When margin account is used, i.e., `account` is `margin`, `auto_borrow` field can be set to `true` to enable the server to borrow the amount lacked using `POST /margin/loans` when your account's balance is not enough. Whether margin orders' fill will be used to repay margin loans automatically is determined by the auto repayment setting in your **margin account**, which can be updated or queried using `/margin/auto_repay` API. When cross margin account is used, i.e., `account` is `cross_margin`, `auto_borrow` can also be enabled to achieve borrowing the insufficient amount automatically if cross account's balance is not enough. But it differs from margin account that automatic repayment is determined by order's `auto_repay` field and only current order's fill will be used to repay cross margin loans. Automatic repayment will be triggered when the order is finished, i.e., its status is either `cancelled` or `closed`. **Order status** An order waiting to be filled is `open`, and it stays `open` until it is filled totally. If fully filled, order is finished and its status turns to `closed`.If the order is cancelled before it is totally filled, whether or not partially filled, its status is `cancelled`. **Iceberg order** `iceberg` field can be used to set the amount shown. Set to `-1` to hide totally. Note that the hidden part's fee will be charged using taker's fee rate. + ### Example * Api Key Authentication (apiv4): @@ -933,6 +941,8 @@ Name | Type | Description | Notes Cancel all `open` orders in specified currency pair +If `account` is not set, all open orders, including spot, margin and cross margin ones, will be cancelled. You can set `account` to cancel only orders within the specified account + ### Example * Api Key Authentication (apiv4): @@ -1069,10 +1079,12 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **get_order** -> Order get_order(order_id, currency_pair) +> Order get_order(order_id, currency_pair, account=account) Get a single order +Spot and margin orders are queried by default. If cross margin orders are needed, `account` must be set to `cross_margin` + ### Example * Api Key Authentication (apiv4): @@ -1099,10 +1111,11 @@ api_client = gate_api.ApiClient(configuration) api_instance = gate_api.SpotApi(api_client) order_id = '12345' # str | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. currency_pair = 'BTC_USDT' # str | Currency pair +account = 'cross_margin' # str | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) try: # Get a single order - api_response = api_instance.get_order(order_id, currency_pair) + api_response = api_instance.get_order(order_id, currency_pair, account=account) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) @@ -1116,6 +1129,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **order_id** | **str**| Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. | **currency_pair** | **str**| Currency pair | + **account** | **str**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account | [optional] ### Return type @@ -1138,10 +1152,12 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **cancel_order** -> Order cancel_order(order_id, currency_pair) +> Order cancel_order(order_id, currency_pair, account=account) Cancel a single order +Spot and margin orders are cancelled by default. If trying to cancel cross margin orders, `account` must be set to `cross_margin` + ### Example * Api Key Authentication (apiv4): @@ -1168,10 +1184,11 @@ api_client = gate_api.ApiClient(configuration) api_instance = gate_api.SpotApi(api_client) order_id = '12345' # str | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. currency_pair = 'BTC_USDT' # str | Currency pair +account = 'cross_margin' # str | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) try: # Cancel a single order - api_response = api_instance.cancel_order(order_id, currency_pair) + api_response = api_instance.cancel_order(order_id, currency_pair, account=account) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) @@ -1185,6 +1202,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **order_id** | **str**| Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. | **currency_pair** | **str**| Currency pair | + **account** | **str**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account | [optional] ### Return type @@ -1207,10 +1225,12 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_my_trades** -> list[Trade] list_my_trades(currency_pair, limit=limit, page=page, order_id=order_id) +> list[Trade] list_my_trades(currency_pair, limit=limit, page=page, order_id=order_id, account=account) List personal trading history +Spot and margin trades are queried by default. If cross margin trades are needed, `account` must be set to `cross_margin` + ### Example * Api Key Authentication (apiv4): @@ -1239,10 +1259,11 @@ currency_pair = 'BTC_USDT' # str | Currency pair limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) page = 1 # int | Page number (optional) (default to 1) order_id = '12345' # str | List all trades of specified order (optional) +account = 'cross_margin' # str | Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account (optional) try: # List personal trading history - api_response = api_instance.list_my_trades(currency_pair, limit=limit, page=page, order_id=order_id) + api_response = api_instance.list_my_trades(currency_pair, limit=limit, page=page, order_id=order_id, account=account) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) @@ -1258,6 +1279,7 @@ Name | Type | Description | Notes **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] **page** | **int**| Page number | [optional] [default to 1] **order_id** | **str**| List all trades of specified order | [optional] + **account** | **str**| Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account | [optional] ### Return type diff --git a/docs/Transfer.md b/docs/Transfer.md index 2c7e018..be5c0a7 100644 --- a/docs/Transfer.md +++ b/docs/Transfer.md @@ -1,6 +1,6 @@ # Transfer -Accounts available to transfer: - `spot`: spot account - `margin`: margin account - `futures`: perpetual futures account - `delivery`: delivery futures account +Accounts available to transfer: - `spot`: spot account - `margin`: margin account - `futures`: perpetual futures account - `delivery`: delivery futures account - `cross_margin`: cross margin account ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/docs/WalletApi.md b/docs/WalletApi.md index 67a43ac..14a7b2d 100644 --- a/docs/WalletApi.md +++ b/docs/WalletApi.md @@ -241,7 +241,7 @@ Name | Type | Description | Notes Transfer between trading accounts -Transfer between different accounts. Currently support transfers between the following: 1. spot - margin 2. spot - futures(perpetual) 3. spot - delivery +Transfer between different accounts. Currently support transfers between the following: 1. spot - margin 2. spot - futures(perpetual) 3. spot - delivery 4. spot - cross margin ### Example diff --git a/docs/WithdrawalApi.md b/docs/WithdrawalApi.md index c9ea8b6..eedfba4 100644 --- a/docs/WithdrawalApi.md +++ b/docs/WithdrawalApi.md @@ -5,6 +5,7 @@ All URIs are relative to *https://api.gateio.ws/api/v4* Method | HTTP request | Description ------------- | ------------- | ------------- [**withdraw**](WithdrawalApi.md#withdraw) | **POST** /withdrawals | Withdraw +[**cancel_withdrawal**](WithdrawalApi.md#cancel_withdrawal) | **DELETE** /withdrawals/{withdrawal_id} | Cancel withdrawal with specified ID # **withdraw** @@ -74,3 +75,70 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **cancel_withdrawal** +> LedgerRecord cancel_withdrawal(withdrawal_id) + +Cancel withdrawal with specified ID + +### Example + +* Api Key Authentication (apiv4): +```python +from __future__ import print_function +import gate_api +from gate_api.exceptions import ApiException, GateApiException +# Defining the host is optional and defaults to https://api.gateio.ws/api/v4 +# See configuration.py for a list of all supported configuration parameters. +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure APIv4 key authorization +configuration = gate_api.Configuration( + host = "https://api.gateio.ws/api/v4", + key = "YOU_API_KEY", + secret = "YOUR_API_SECRET" +) + +api_client = gate_api.ApiClient(configuration) +# Create an instance of the API class +api_instance = gate_api.WithdrawalApi(api_client) +withdrawal_id = '210496' # str | + +try: + # Cancel withdrawal with specified ID + api_response = api_instance.cancel_withdrawal(withdrawal_id) + print(api_response) +except GateApiException as ex: + print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) +except ApiException as e: + print("Exception when calling WithdrawalApi->cancel_withdrawal: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **withdrawal_id** | **str**| | + +### Return type + +[**LedgerRecord**](LedgerRecord.md) + +### Authorization + +[apiv4](../README.md#apiv4) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**202** | Cancellation accepted. Refer to record status for the cancellation result | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/gate_api/__init__.py b/gate_api/__init__.py index 190d8be..f291ea2 100644 --- a/gate_api/__init__.py +++ b/gate_api/__init__.py @@ -14,7 +14,7 @@ from __future__ import absolute_import -__version__ = "4.20.1" +__version__ = "4.21.2" # import apis into sdk package from gate_api.api.delivery_api import DeliveryApi @@ -40,6 +40,12 @@ from gate_api.models.cancel_order_result import CancelOrderResult from gate_api.models.contract import Contract from gate_api.models.contract_stat import ContractStat +from gate_api.models.cross_margin_account import CrossMarginAccount +from gate_api.models.cross_margin_balance import CrossMarginBalance +from gate_api.models.cross_margin_currency import CrossMarginCurrency +from gate_api.models.cross_margin_loan import CrossMarginLoan +from gate_api.models.cross_margin_repay_request import CrossMarginRepayRequest +from gate_api.models.cross_margin_repayment import CrossMarginRepayment from gate_api.models.currency import Currency from gate_api.models.currency_pair import CurrencyPair from gate_api.models.delivery_contract import DeliveryContract diff --git a/gate_api/api/futures_api.py b/gate_api/api/futures_api.py index 7f882e6..04cca3c 100644 --- a/gate_api/api/futures_api.py +++ b/gate_api/api/futures_api.py @@ -1898,6 +1898,7 @@ def update_position_leverage(self, settle, contract, leverage, **kwargs): # noq :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str leverage: New position leverage (required) + :param str cross_leverage_limit: Cross margin leverage(valid only when `leverage` is 0) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1924,6 +1925,7 @@ def update_position_leverage_with_http_info(self, settle, contract, leverage, ** :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str leverage: New position leverage (required) + :param str cross_leverage_limit: Cross margin leverage(valid only when `leverage` is 0) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1940,7 +1942,7 @@ def update_position_leverage_with_http_info(self, settle, contract, leverage, ** local_var_params = locals() - all_params = ['settle', 'contract', 'leverage'] + all_params = ['settle', 'contract', 'leverage', 'cross_leverage_limit'] all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for k, v in six.iteritems(local_var_params['kwargs']): @@ -1981,6 +1983,10 @@ def update_position_leverage_with_http_info(self, settle, contract, leverage, ** query_params = [] if 'leverage' in local_var_params and local_var_params['leverage'] is not None: # noqa: E501 query_params.append(('leverage', local_var_params['leverage'])) # noqa: E501 + if ( + 'cross_leverage_limit' in local_var_params and local_var_params['cross_leverage_limit'] is not None + ): # noqa: E501 + query_params.append(('cross_leverage_limit', local_var_params['cross_leverage_limit'])) # noqa: E501 header_params = {} @@ -2368,18 +2374,19 @@ def get_dual_mode_position_with_http_info(self, settle, contract, **kwargs): # collection_formats=collection_formats, ) - def update_dual_mode_position_margin(self, settle, contract, change, **kwargs): # noqa: E501 + def update_dual_mode_position_margin(self, settle, contract, change, dual_side, **kwargs): # noqa: E501 """Update position margin in dual mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_dual_mode_position_margin(settle, contract, change, async_req=True) + >>> thread = api.update_dual_mode_position_margin(settle, contract, change, dual_side, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str change: Margin change. Use positive number to increase margin, negative number otherwise. (required) + :param str dual_side: Long or short position (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -2392,20 +2399,25 @@ def update_dual_mode_position_margin(self, settle, contract, change, **kwargs): returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.update_dual_mode_position_margin_with_http_info(settle, contract, change, **kwargs) # noqa: E501 + return self.update_dual_mode_position_margin_with_http_info( + settle, contract, change, dual_side, **kwargs + ) # noqa: E501 - def update_dual_mode_position_margin_with_http_info(self, settle, contract, change, **kwargs): # noqa: E501 + def update_dual_mode_position_margin_with_http_info( + self, settle, contract, change, dual_side, **kwargs + ): # noqa: E501 """Update position margin in dual mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_dual_mode_position_margin_with_http_info(settle, contract, change, async_req=True) + >>> thread = api.update_dual_mode_position_margin_with_http_info(settle, contract, change, dual_side, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str change: Margin change. Use positive number to increase margin, negative number otherwise. (required) + :param str dual_side: Long or short position (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -2422,7 +2434,7 @@ def update_dual_mode_position_margin_with_http_info(self, settle, contract, chan local_var_params = locals() - all_params = ['settle', 'contract', 'change'] + all_params = ['settle', 'contract', 'change', 'dual_side'] all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for k, v in six.iteritems(local_var_params['kwargs']): @@ -2453,6 +2465,13 @@ def update_dual_mode_position_margin_with_http_info(self, settle, contract, chan raise ApiValueError( "Missing the required parameter `change` when calling `update_dual_mode_position_margin`" ) # noqa: E501 + # verify the required parameter 'dual_side' is set + if self.api_client.client_side_validation and ( + 'dual_side' not in local_var_params or local_var_params['dual_side'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `dual_side` when calling `update_dual_mode_position_margin`" + ) # noqa: E501 collection_formats = {} @@ -2465,6 +2484,8 @@ def update_dual_mode_position_margin_with_http_info(self, settle, contract, chan query_params = [] if 'change' in local_var_params and local_var_params['change'] is not None: # noqa: E501 query_params.append(('change', local_var_params['change'])) # noqa: E501 + if 'dual_side' in local_var_params and local_var_params['dual_side'] is not None: # noqa: E501 + query_params.append(('dual_side', local_var_params['dual_side'])) # noqa: E501 header_params = {} diff --git a/gate_api/api/margin_api.py b/gate_api/api/margin_api.py index a8f0aba..a31f3bf 100644 --- a/gate_api/api/margin_api.py +++ b/gate_api/api/margin_api.py @@ -2165,3 +2165,895 @@ def set_auto_repay_with_http_info(self, status, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats, ) + + def list_cross_margin_currencies(self, **kwargs): # noqa: E501 + """Currencies supported by cross margin. # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_cross_margin_currencies(async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: list[gate_api.CrossMarginCurrency] + :return: If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.list_cross_margin_currencies_with_http_info(**kwargs) # noqa: E501 + + def list_cross_margin_currencies_with_http_info(self, **kwargs): # noqa: E501 + """Currencies supported by cross margin. # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_cross_margin_currencies_with_http_info(async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: tuple(list[gate_api.CrossMarginCurrency], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) + + for k, v in six.iteritems(local_var_params['kwargs']): + if k not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" " to method list_cross_margin_currencies" % k + ) + local_var_params[k] = v + del local_var_params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/margin/cross/currencies', + 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[CrossMarginCurrency]', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + ) + + def get_cross_margin_currency(self, currency, **kwargs): # noqa: E501 + """Retrieve detail of one single currency supported by cross margin # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_cross_margin_currency(currency, async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param str currency: Currency name (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: gate_api.CrossMarginCurrency + :return: If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.get_cross_margin_currency_with_http_info(currency, **kwargs) # noqa: E501 + + def get_cross_margin_currency_with_http_info(self, currency, **kwargs): # noqa: E501 + """Retrieve detail of one single currency supported by cross margin # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_cross_margin_currency_with_http_info(currency, async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param str currency: Currency name (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: tuple(gate_api.CrossMarginCurrency, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = ['currency'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) + + for k, v in six.iteritems(local_var_params['kwargs']): + if k not in all_params: + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_cross_margin_currency" % k) + local_var_params[k] = v + del local_var_params['kwargs'] + # verify the required parameter 'currency' is set + if self.api_client.client_side_validation and ( + 'currency' not in local_var_params or local_var_params['currency'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `currency` when calling `get_cross_margin_currency`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'currency' in local_var_params: + path_params['currency'] = local_var_params['currency'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/margin/cross/currencies/{currency}', + 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CrossMarginCurrency', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + ) + + def get_cross_margin_account(self, **kwargs): # noqa: E501 + """Retrieve cross margin account # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_cross_margin_account(async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: gate_api.CrossMarginAccount + :return: If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.get_cross_margin_account_with_http_info(**kwargs) # noqa: E501 + + def get_cross_margin_account_with_http_info(self, **kwargs): # noqa: E501 + """Retrieve cross margin account # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_cross_margin_account_with_http_info(async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: tuple(gate_api.CrossMarginAccount, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) + + for k, v in six.iteritems(local_var_params['kwargs']): + if k not in all_params: + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_cross_margin_account" % k) + local_var_params[k] = v + del local_var_params['kwargs'] + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['apiv4'] # noqa: E501 + + return self.api_client.call_api( + '/margin/cross/accounts', + 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CrossMarginAccount', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + ) + + def list_cross_margin_loans(self, status, **kwargs): # noqa: E501 + """List cross margin borrow history # noqa: E501 + + Sort by creation time in descending order by default. Set `reverse=false` to return ascending results. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_cross_margin_loans(status, async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param int status: Filter by status. Supported values are 2 and 3. (required) + :param str currency: Filter by currency + :param int limit: Maximum number of records returned in one list + :param int offset: List offset, starting from 0 + :param bool reverse: Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: list[gate_api.CrossMarginLoan] + :return: If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.list_cross_margin_loans_with_http_info(status, **kwargs) # noqa: E501 + + def list_cross_margin_loans_with_http_info(self, status, **kwargs): # noqa: E501 + """List cross margin borrow history # noqa: E501 + + Sort by creation time in descending order by default. Set `reverse=false` to return ascending results. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_cross_margin_loans_with_http_info(status, async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param int status: Filter by status. Supported values are 2 and 3. (required) + :param str currency: Filter by currency + :param int limit: Maximum number of records returned in one list + :param int offset: List offset, starting from 0 + :param bool reverse: Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: tuple(list[gate_api.CrossMarginLoan], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = ['status', 'currency', 'limit', 'offset', 'reverse'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) + + for k, v in six.iteritems(local_var_params['kwargs']): + if k not in all_params: + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_cross_margin_loans" % k) + local_var_params[k] = v + del local_var_params['kwargs'] + # verify the required parameter 'status' is set + if self.api_client.client_side_validation and ( + 'status' not in local_var_params or local_var_params['status'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `status` when calling `list_cross_margin_loans`" + ) # noqa: E501 + + if ( + self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `limit` when calling `list_cross_margin_loans`, must be a value less than or equal to `1000`" + ) # noqa: E501 + if ( + self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `limit` when calling `list_cross_margin_loans`, must be a value greater than or equal to `1`" + ) # noqa: E501 + if ( + self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `offset` when calling `list_cross_margin_loans`, must be a value greater than or equal to `0`" + ) # noqa: E501 + collection_formats = {} + + path_params = {} + + query_params = [] + if 'status' in local_var_params and local_var_params['status'] is not None: # noqa: E501 + query_params.append(('status', local_var_params['status'])) # noqa: E501 + if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501 + query_params.append(('currency', local_var_params['currency'])) # noqa: E501 + if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 + query_params.append(('limit', local_var_params['limit'])) # noqa: E501 + if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 + query_params.append(('offset', local_var_params['offset'])) # noqa: E501 + if 'reverse' in local_var_params and local_var_params['reverse'] is not None: # noqa: E501 + query_params.append(('reverse', local_var_params['reverse'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['apiv4'] # noqa: E501 + + return self.api_client.call_api( + '/margin/cross/loans', + 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[CrossMarginLoan]', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + ) + + def create_cross_margin_loan(self, cross_margin_loan, **kwargs): # noqa: E501 + """Create a cross margin borrow loan # noqa: E501 + + Borrow amount cannot be less than currency minimum borrow amount # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_cross_margin_loan(cross_margin_loan, async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param CrossMarginLoan cross_margin_loan: (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: gate_api.CrossMarginLoan + :return: If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.create_cross_margin_loan_with_http_info(cross_margin_loan, **kwargs) # noqa: E501 + + def create_cross_margin_loan_with_http_info(self, cross_margin_loan, **kwargs): # noqa: E501 + """Create a cross margin borrow loan # noqa: E501 + + Borrow amount cannot be less than currency minimum borrow amount # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.create_cross_margin_loan_with_http_info(cross_margin_loan, async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param CrossMarginLoan cross_margin_loan: (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: tuple(gate_api.CrossMarginLoan, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = ['cross_margin_loan'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) + + for k, v in six.iteritems(local_var_params['kwargs']): + if k not in all_params: + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_cross_margin_loan" % k) + local_var_params[k] = v + del local_var_params['kwargs'] + # verify the required parameter 'cross_margin_loan' is set + if self.api_client.client_side_validation and ( + 'cross_margin_loan' not in local_var_params or local_var_params['cross_margin_loan'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `cross_margin_loan` when calling `create_cross_margin_loan`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'cross_margin_loan' in local_var_params: + body_params = local_var_params['cross_margin_loan'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json'] + ) # noqa: E501 + + # Authentication setting + auth_settings = ['apiv4'] # noqa: E501 + + return self.api_client.call_api( + '/margin/cross/loans', + 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CrossMarginLoan', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + ) + + def get_cross_margin_loan(self, loan_id, **kwargs): # noqa: E501 + """Retrieve single borrow loan detail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_cross_margin_loan(loan_id, async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param str loan_id: Borrow loan ID (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: gate_api.CrossMarginLoan + :return: If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.get_cross_margin_loan_with_http_info(loan_id, **kwargs) # noqa: E501 + + def get_cross_margin_loan_with_http_info(self, loan_id, **kwargs): # noqa: E501 + """Retrieve single borrow loan detail # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_cross_margin_loan_with_http_info(loan_id, async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param str loan_id: Borrow loan ID (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: tuple(gate_api.CrossMarginLoan, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = ['loan_id'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) + + for k, v in six.iteritems(local_var_params['kwargs']): + if k not in all_params: + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_cross_margin_loan" % k) + local_var_params[k] = v + del local_var_params['kwargs'] + # verify the required parameter 'loan_id' is set + if self.api_client.client_side_validation and ( + 'loan_id' not in local_var_params or local_var_params['loan_id'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `loan_id` when calling `get_cross_margin_loan`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'loan_id' in local_var_params: + path_params['loan_id'] = local_var_params['loan_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['apiv4'] # noqa: E501 + + return self.api_client.call_api( + '/margin/cross/loans/{loan_id}', + 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='CrossMarginLoan', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + ) + + def list_cross_margin_repayments(self, **kwargs): # noqa: E501 + """Retrieve cross margin repayments # noqa: E501 + + Sort by creation time in descending order by default. Set `reverse=false` to return ascending results. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_cross_margin_repayments(async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param str currency: + :param str loan_id: + :param int limit: Maximum number of records returned in one list + :param int offset: List offset, starting from 0 + :param bool reverse: Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: list[gate_api.CrossMarginRepayment] + :return: If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.list_cross_margin_repayments_with_http_info(**kwargs) # noqa: E501 + + def list_cross_margin_repayments_with_http_info(self, **kwargs): # noqa: E501 + """Retrieve cross margin repayments # noqa: E501 + + Sort by creation time in descending order by default. Set `reverse=false` to return ascending results. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.list_cross_margin_repayments_with_http_info(async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param str currency: + :param str loan_id: + :param int limit: Maximum number of records returned in one list + :param int offset: List offset, starting from 0 + :param bool reverse: Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: tuple(list[gate_api.CrossMarginRepayment], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = ['currency', 'loan_id', 'limit', 'offset', 'reverse'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) + + for k, v in six.iteritems(local_var_params['kwargs']): + if k not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" " to method list_cross_margin_repayments" % k + ) + local_var_params[k] = v + del local_var_params['kwargs'] + + if ( + self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `limit` when calling `list_cross_margin_repayments`, must be a value less than or equal to `1000`" + ) # noqa: E501 + if ( + self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `limit` when calling `list_cross_margin_repayments`, must be a value greater than or equal to `1`" + ) # noqa: E501 + if ( + self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `offset` when calling `list_cross_margin_repayments`, must be a value greater than or equal to `0`" + ) # noqa: E501 + collection_formats = {} + + path_params = {} + + query_params = [] + if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501 + query_params.append(('currency', local_var_params['currency'])) # noqa: E501 + if 'loan_id' in local_var_params and local_var_params['loan_id'] is not None: # noqa: E501 + query_params.append(('loan_id', local_var_params['loan_id'])) # noqa: E501 + if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 + query_params.append(('limit', local_var_params['limit'])) # noqa: E501 + if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 + query_params.append(('offset', local_var_params['offset'])) # noqa: E501 + if 'reverse' in local_var_params and local_var_params['reverse'] is not None: # noqa: E501 + query_params.append(('reverse', local_var_params['reverse'])) # noqa: E501 + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['apiv4'] # noqa: E501 + + return self.api_client.call_api( + '/margin/cross/repayments', + 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[CrossMarginRepayment]', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + ) + + def repay_cross_margin_loan(self, cross_margin_repay_request, **kwargs): # noqa: E501 + """Repay cross margin loan # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.repay_cross_margin_loan(cross_margin_repay_request, async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param CrossMarginRepayRequest cross_margin_repay_request: (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: list[gate_api.CrossMarginLoan] + :return: If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.repay_cross_margin_loan_with_http_info(cross_margin_repay_request, **kwargs) # noqa: E501 + + def repay_cross_margin_loan_with_http_info(self, cross_margin_repay_request, **kwargs): # noqa: E501 + """Repay cross margin loan # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.repay_cross_margin_loan_with_http_info(cross_margin_repay_request, async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param CrossMarginRepayRequest cross_margin_repay_request: (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: tuple(list[gate_api.CrossMarginLoan], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = ['cross_margin_repay_request'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) + + for k, v in six.iteritems(local_var_params['kwargs']): + if k not in all_params: + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method repay_cross_margin_loan" % k) + local_var_params[k] = v + del local_var_params['kwargs'] + # verify the required parameter 'cross_margin_repay_request' is set + if self.api_client.client_side_validation and ( + 'cross_margin_repay_request' not in local_var_params + or local_var_params['cross_margin_repay_request'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `cross_margin_repay_request` when calling `repay_cross_margin_loan`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'cross_margin_repay_request' in local_var_params: + body_params = local_var_params['cross_margin_repay_request'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json'] + ) # noqa: E501 + + # Authentication setting + auth_settings = ['apiv4'] # noqa: E501 + + return self.api_client.call_api( + '/margin/cross/repayments', + 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='list[CrossMarginLoan]', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + ) diff --git a/gate_api/api/spot_api.py b/gate_api/api/spot_api.py index c98cc9d..efc2f58 100644 --- a/gate_api/api/spot_api.py +++ b/gate_api/api/spot_api.py @@ -1220,7 +1220,7 @@ def create_batch_orders_with_http_info(self, order, **kwargs): # noqa: E501 def list_all_open_orders(self, **kwargs): # noqa: E501 """List all open orders # noqa: E501 - List open orders in all currency pairs. Note that pagination parameters affect record number in each currency pair's open order list. No pagination is applied to the number of currency pairs returned. All currency pairs with open orders will be returned # noqa: E501 + List open orders in all currency pairs. Note that pagination parameters affect record number in each currency pair's open order list. No pagination is applied to the number of currency pairs returned. All currency pairs with open orders will be returned. Spot and margin orders are returned by default. To list cross margin orders, `account` must be set to `cross_margin` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_all_open_orders(async_req=True) @@ -1229,6 +1229,7 @@ def list_all_open_orders(self, **kwargs): # noqa: E501 :param bool async_req: execute request asynchronously :param int page: Page number :param int limit: Maximum number of records returned in one page in each currency pair + :param str account: Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1246,7 +1247,7 @@ def list_all_open_orders(self, **kwargs): # noqa: E501 def list_all_open_orders_with_http_info(self, **kwargs): # noqa: E501 """List all open orders # noqa: E501 - List open orders in all currency pairs. Note that pagination parameters affect record number in each currency pair's open order list. No pagination is applied to the number of currency pairs returned. All currency pairs with open orders will be returned # noqa: E501 + List open orders in all currency pairs. Note that pagination parameters affect record number in each currency pair's open order list. No pagination is applied to the number of currency pairs returned. All currency pairs with open orders will be returned. Spot and margin orders are returned by default. To list cross margin orders, `account` must be set to `cross_margin` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_all_open_orders_with_http_info(async_req=True) @@ -1255,6 +1256,7 @@ def list_all_open_orders_with_http_info(self, **kwargs): # noqa: E501 :param bool async_req: execute request asynchronously :param int page: Page number :param int limit: Maximum number of records returned in one page in each currency pair + :param str account: Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1271,7 +1273,7 @@ def list_all_open_orders_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ['page', 'limit'] + all_params = ['page', 'limit', 'account'] all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for k, v in six.iteritems(local_var_params['kwargs']): @@ -1307,6 +1309,8 @@ def list_all_open_orders_with_http_info(self, **kwargs): # noqa: E501 query_params.append(('page', local_var_params['page'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 + if 'account' in local_var_params and local_var_params['account'] is not None: # noqa: E501 + query_params.append(('account', local_var_params['account'])) # noqa: E501 header_params = {} @@ -1341,6 +1345,7 @@ def list_all_open_orders_with_http_info(self, **kwargs): # noqa: E501 def list_orders(self, currency_pair, status, **kwargs): # noqa: E501 """List orders # noqa: E501 + Spot and margin orders are returned by default. If cross margin orders are needed, `account` must be set to `cross_margin` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_orders(currency_pair, status, async_req=True) @@ -1351,6 +1356,7 @@ def list_orders(self, currency_pair, status, **kwargs): # noqa: E501 :param str status: List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled (required) :param int page: Page number :param int limit: Maximum number of records returned. If `status` is `open`, maximum of `limit` is 100 + :param str account: Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1368,6 +1374,7 @@ def list_orders(self, currency_pair, status, **kwargs): # noqa: E501 def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: E501 """List orders # noqa: E501 + Spot and margin orders are returned by default. If cross margin orders are needed, `account` must be set to `cross_margin` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_orders_with_http_info(currency_pair, status, async_req=True) @@ -1378,6 +1385,7 @@ def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: :param str status: List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled (required) :param int page: Page number :param int limit: Maximum number of records returned. If `status` is `open`, maximum of `limit` is 100 + :param str account: Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1394,7 +1402,7 @@ def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: local_var_params = locals() - all_params = ['currency_pair', 'status', 'page', 'limit'] + all_params = ['currency_pair', 'status', 'page', 'limit', 'account'] all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for k, v in six.iteritems(local_var_params['kwargs']): @@ -1446,6 +1454,8 @@ def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: query_params.append(('page', local_var_params['page'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 + if 'account' in local_var_params and local_var_params['account'] is not None: # noqa: E501 + query_params.append(('account', local_var_params['account'])) # noqa: E501 header_params = {} @@ -1480,6 +1490,7 @@ def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: def create_order(self, order, **kwargs): # noqa: E501 """Create an order # noqa: E501 + You can place orders with spot, margin or cross margin account through setting the `account `field. It defaults to `spot`, which means spot account is used to place orders. When margin account is used, i.e., `account` is `margin`, `auto_borrow` field can be set to `true` to enable the server to borrow the amount lacked using `POST /margin/loans` when your account's balance is not enough. Whether margin orders' fill will be used to repay margin loans automatically is determined by the auto repayment setting in your **margin account**, which can be updated or queried using `/margin/auto_repay` API. When cross margin account is used, i.e., `account` is `cross_margin`, `auto_borrow` can also be enabled to achieve borrowing the insufficient amount automatically if cross account's balance is not enough. But it differs from margin account that automatic repayment is determined by order's `auto_repay` field and only current order's fill will be used to repay cross margin loans. Automatic repayment will be triggered when the order is finished, i.e., its status is either `cancelled` or `closed`. **Order status** An order waiting to be filled is `open`, and it stays `open` until it is filled totally. If fully filled, order is finished and its status turns to `closed`.If the order is cancelled before it is totally filled, whether or not partially filled, its status is `cancelled`. **Iceberg order** `iceberg` field can be used to set the amount shown. Set to `-1` to hide totally. Note that the hidden part's fee will be charged using taker's fee rate. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_order(order, async_req=True) @@ -1504,6 +1515,7 @@ def create_order(self, order, **kwargs): # noqa: E501 def create_order_with_http_info(self, order, **kwargs): # noqa: E501 """Create an order # noqa: E501 + You can place orders with spot, margin or cross margin account through setting the `account `field. It defaults to `spot`, which means spot account is used to place orders. When margin account is used, i.e., `account` is `margin`, `auto_borrow` field can be set to `true` to enable the server to borrow the amount lacked using `POST /margin/loans` when your account's balance is not enough. Whether margin orders' fill will be used to repay margin loans automatically is determined by the auto repayment setting in your **margin account**, which can be updated or queried using `/margin/auto_repay` API. When cross margin account is used, i.e., `account` is `cross_margin`, `auto_borrow` can also be enabled to achieve borrowing the insufficient amount automatically if cross account's balance is not enough. But it differs from margin account that automatic repayment is determined by order's `auto_repay` field and only current order's fill will be used to repay cross margin loans. Automatic repayment will be triggered when the order is finished, i.e., its status is either `cancelled` or `closed`. **Order status** An order waiting to be filled is `open`, and it stays `open` until it is filled totally. If fully filled, order is finished and its status turns to `closed`.If the order is cancelled before it is totally filled, whether or not partially filled, its status is `cancelled`. **Iceberg order** `iceberg` field can be used to set the amount shown. Set to `-1` to hide totally. Note that the hidden part's fee will be charged using taker's fee rate. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_order_with_http_info(order, async_req=True) @@ -1587,6 +1599,7 @@ def create_order_with_http_info(self, order, **kwargs): # noqa: E501 def cancel_orders(self, currency_pair, **kwargs): # noqa: E501 """Cancel all `open` orders in specified currency pair # noqa: E501 + If `account` is not set, all open orders, including spot, margin and cross margin ones, will be cancelled. You can set `account` to cancel only orders within the specified account # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.cancel_orders(currency_pair, async_req=True) @@ -1613,6 +1626,7 @@ def cancel_orders(self, currency_pair, **kwargs): # noqa: E501 def cancel_orders_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """Cancel all `open` orders in specified currency pair # noqa: E501 + If `account` is not set, all open orders, including spot, margin and cross margin ones, will be cancelled. You can set `account` to cancel only orders within the specified account # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.cancel_orders_with_http_info(currency_pair, async_req=True) @@ -1810,6 +1824,7 @@ def cancel_batch_orders_with_http_info(self, cancel_order, **kwargs): # noqa: E def get_order(self, order_id, currency_pair, **kwargs): # noqa: E501 """Get a single order # noqa: E501 + Spot and margin orders are queried by default. If cross margin orders are needed, `account` must be set to `cross_margin` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_order(order_id, currency_pair, async_req=True) @@ -1818,6 +1833,7 @@ def get_order(self, order_id, currency_pair, **kwargs): # noqa: E501 :param bool async_req: execute request asynchronously :param str order_id: Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) :param str currency_pair: Currency pair (required) + :param str account: Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1835,6 +1851,7 @@ def get_order(self, order_id, currency_pair, **kwargs): # noqa: E501 def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: E501 """Get a single order # noqa: E501 + Spot and margin orders are queried by default. If cross margin orders are needed, `account` must be set to `cross_margin` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_order_with_http_info(order_id, currency_pair, async_req=True) @@ -1843,6 +1860,7 @@ def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: :param bool async_req: execute request asynchronously :param str order_id: Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) :param str currency_pair: Currency pair (required) + :param str account: Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1859,7 +1877,7 @@ def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: local_var_params = locals() - all_params = ['order_id', 'currency_pair'] + all_params = ['order_id', 'currency_pair', 'account'] all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for k, v in six.iteritems(local_var_params['kwargs']): @@ -1887,6 +1905,8 @@ def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501 + if 'account' in local_var_params and local_var_params['account'] is not None: # noqa: E501 + query_params.append(('account', local_var_params['account'])) # noqa: E501 header_params = {} @@ -1921,6 +1941,7 @@ def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: def cancel_order(self, order_id, currency_pair, **kwargs): # noqa: E501 """Cancel a single order # noqa: E501 + Spot and margin orders are cancelled by default. If trying to cancel cross margin orders, `account` must be set to `cross_margin` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.cancel_order(order_id, currency_pair, async_req=True) @@ -1929,6 +1950,7 @@ def cancel_order(self, order_id, currency_pair, **kwargs): # noqa: E501 :param bool async_req: execute request asynchronously :param str order_id: Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) :param str currency_pair: Currency pair (required) + :param str account: Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1946,6 +1968,7 @@ def cancel_order(self, order_id, currency_pair, **kwargs): # noqa: E501 def cancel_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: E501 """Cancel a single order # noqa: E501 + Spot and margin orders are cancelled by default. If trying to cancel cross margin orders, `account` must be set to `cross_margin` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.cancel_order_with_http_info(order_id, currency_pair, async_req=True) @@ -1954,6 +1977,7 @@ def cancel_order_with_http_info(self, order_id, currency_pair, **kwargs): # noq :param bool async_req: execute request asynchronously :param str order_id: Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID are accepted only in the first 30 minutes after order creation.After that, only order ID is accepted. (required) :param str currency_pair: Currency pair (required) + :param str account: Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1970,7 +1994,7 @@ def cancel_order_with_http_info(self, order_id, currency_pair, **kwargs): # noq local_var_params = locals() - all_params = ['order_id', 'currency_pair'] + all_params = ['order_id', 'currency_pair', 'account'] all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for k, v in six.iteritems(local_var_params['kwargs']): @@ -2000,6 +2024,8 @@ def cancel_order_with_http_info(self, order_id, currency_pair, **kwargs): # noq query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501 + if 'account' in local_var_params and local_var_params['account'] is not None: # noqa: E501 + query_params.append(('account', local_var_params['account'])) # noqa: E501 header_params = {} @@ -2034,6 +2060,7 @@ def cancel_order_with_http_info(self, order_id, currency_pair, **kwargs): # noq def list_my_trades(self, currency_pair, **kwargs): # noqa: E501 """List personal trading history # noqa: E501 + Spot and margin trades are queried by default. If cross margin trades are needed, `account` must be set to `cross_margin` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_my_trades(currency_pair, async_req=True) @@ -2044,6 +2071,7 @@ def list_my_trades(self, currency_pair, **kwargs): # noqa: E501 :param int limit: Maximum number of records returned in one list :param int page: Page number :param str order_id: List all trades of specified order + :param str account: Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -2061,6 +2089,7 @@ def list_my_trades(self, currency_pair, **kwargs): # noqa: E501 def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """List personal trading history # noqa: E501 + Spot and margin trades are queried by default. If cross margin trades are needed, `account` must be set to `cross_margin` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_my_trades_with_http_info(currency_pair, async_req=True) @@ -2071,6 +2100,7 @@ def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 :param int limit: Maximum number of records returned in one list :param int page: Page number :param str order_id: List all trades of specified order + :param str account: Specify operation account. Default to spot and margin account if not specified. Set to `cross_margin` to operate against margin account :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -2087,7 +2117,7 @@ def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ['currency_pair', 'limit', 'page', 'order_id'] + all_params = ['currency_pair', 'limit', 'page', 'order_id', 'account'] all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for k, v in six.iteritems(local_var_params['kwargs']): @@ -2134,6 +2164,8 @@ def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 query_params.append(('page', local_var_params['page'])) # noqa: E501 if 'order_id' in local_var_params and local_var_params['order_id'] is not None: # noqa: E501 query_params.append(('order_id', local_var_params['order_id'])) # noqa: E501 + if 'account' in local_var_params and local_var_params['account'] is not None: # noqa: E501 + query_params.append(('account', local_var_params['account'])) # noqa: E501 header_params = {} diff --git a/gate_api/api/wallet_api.py b/gate_api/api/wallet_api.py index 394f9eb..02cdf24 100644 --- a/gate_api/api/wallet_api.py +++ b/gate_api/api/wallet_api.py @@ -406,7 +406,7 @@ def list_deposits_with_http_info(self, **kwargs): # noqa: E501 def transfer(self, transfer, **kwargs): # noqa: E501 """Transfer between trading accounts # noqa: E501 - Transfer between different accounts. Currently support transfers between the following: 1. spot - margin 2. spot - futures(perpetual) 3. spot - delivery # noqa: E501 + Transfer between different accounts. Currently support transfers between the following: 1. spot - margin 2. spot - futures(perpetual) 3. spot - delivery 4. spot - cross margin # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.transfer(transfer, async_req=True) @@ -431,7 +431,7 @@ def transfer(self, transfer, **kwargs): # noqa: E501 def transfer_with_http_info(self, transfer, **kwargs): # noqa: E501 """Transfer between trading accounts # noqa: E501 - Transfer between different accounts. Currently support transfers between the following: 1. spot - margin 2. spot - futures(perpetual) 3. spot - delivery # noqa: E501 + Transfer between different accounts. Currently support transfers between the following: 1. spot - margin 2. spot - futures(perpetual) 3. spot - delivery 4. spot - cross margin # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.transfer_with_http_info(transfer, async_req=True) diff --git a/gate_api/api/withdrawal_api.py b/gate_api/api/withdrawal_api.py index 7310bf1..4b9ba17 100644 --- a/gate_api/api/withdrawal_api.py +++ b/gate_api/api/withdrawal_api.py @@ -139,3 +139,107 @@ def withdraw_with_http_info(self, ledger_record, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats, ) + + def cancel_withdrawal(self, withdrawal_id, **kwargs): # noqa: E501 + """Cancel withdrawal with specified ID # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.cancel_withdrawal(withdrawal_id, async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param str withdrawal_id: (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: gate_api.LedgerRecord + :return: If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.cancel_withdrawal_with_http_info(withdrawal_id, **kwargs) # noqa: E501 + + def cancel_withdrawal_with_http_info(self, withdrawal_id, **kwargs): # noqa: E501 + """Cancel withdrawal with specified ID # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.cancel_withdrawal_with_http_info(withdrawal_id, async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param str withdrawal_id: (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :rtype: tuple(gate_api.LedgerRecord, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = ['withdrawal_id'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) + + for k, v in six.iteritems(local_var_params['kwargs']): + if k not in all_params: + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method cancel_withdrawal" % k) + local_var_params[k] = v + del local_var_params['kwargs'] + # verify the required parameter 'withdrawal_id' is set + if self.api_client.client_side_validation and ( + 'withdrawal_id' not in local_var_params or local_var_params['withdrawal_id'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `withdrawal_id` when calling `cancel_withdrawal`" + ) # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'withdrawal_id' in local_var_params: + path_params['withdrawal_id'] = local_var_params['withdrawal_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = ['apiv4'] # noqa: E501 + + return self.api_client.call_api( + '/withdrawals/{withdrawal_id}', + 'DELETE', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='LedgerRecord', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats, + ) diff --git a/gate_api/api_client.py b/gate_api/api_client.py index 23a4935..cefaeed 100644 --- a/gate_api/api_client.py +++ b/gate_api/api_client.py @@ -82,7 +82,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None, cook self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/4.20.1/python' + self.user_agent = 'OpenAPI-Generator/4.21.2/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/gate_api/configuration.py b/gate_api/configuration.py index 4497f5d..a9042e8 100644 --- a/gate_api/configuration.py +++ b/gate_api/configuration.py @@ -316,8 +316,8 @@ def to_debug_report(self): "Python SDK Debug Report:\n" "OS: {env}\n" "Python Version: {pyversion}\n" - "Version of the API: 4.20.1\n" - "SDK Package Version: 4.20.1".format(env=sys.platform, pyversion=sys.version) + "Version of the API: 4.21.2\n" + "SDK Package Version: 4.21.2".format(env=sys.platform, pyversion=sys.version) ) def get_host_settings(self): diff --git a/gate_api/models/__init__.py b/gate_api/models/__init__.py index f4d2b22..d64fa3e 100644 --- a/gate_api/models/__init__.py +++ b/gate_api/models/__init__.py @@ -20,6 +20,12 @@ from gate_api.models.cancel_order_result import CancelOrderResult from gate_api.models.contract import Contract from gate_api.models.contract_stat import ContractStat +from gate_api.models.cross_margin_account import CrossMarginAccount +from gate_api.models.cross_margin_balance import CrossMarginBalance +from gate_api.models.cross_margin_currency import CrossMarginCurrency +from gate_api.models.cross_margin_loan import CrossMarginLoan +from gate_api.models.cross_margin_repay_request import CrossMarginRepayRequest +from gate_api.models.cross_margin_repayment import CrossMarginRepayment from gate_api.models.currency import Currency from gate_api.models.currency_pair import CurrencyPair from gate_api.models.delivery_contract import DeliveryContract diff --git a/gate_api/models/batch_order.py b/gate_api/models/batch_order.py index 6686cfd..b885430 100644 --- a/gate_api/models/batch_order.py +++ b/gate_api/models/batch_order.py @@ -40,6 +40,8 @@ class BatchOrder(object): 'id': 'str', 'create_time': 'str', 'update_time': 'str', + 'create_time_ms': 'int', + 'update_time_ms': 'int', 'status': 'str', 'currency_pair': 'str', 'type': 'str', @@ -50,6 +52,7 @@ class BatchOrder(object): 'time_in_force': 'str', 'iceberg': 'str', 'auto_borrow': 'bool', + 'auto_repay': 'bool', 'left': 'str', 'fill_price': 'str', 'filled_total': 'str', @@ -70,6 +73,8 @@ class BatchOrder(object): 'id': 'id', 'create_time': 'create_time', 'update_time': 'update_time', + 'create_time_ms': 'create_time_ms', + 'update_time_ms': 'update_time_ms', 'status': 'status', 'currency_pair': 'currency_pair', 'type': 'type', @@ -80,6 +85,7 @@ class BatchOrder(object): 'time_in_force': 'time_in_force', 'iceberg': 'iceberg', 'auto_borrow': 'auto_borrow', + 'auto_repay': 'auto_repay', 'left': 'left', 'fill_price': 'fill_price', 'filled_total': 'filled_total', @@ -101,6 +107,8 @@ def __init__( id=None, create_time=None, update_time=None, + create_time_ms=None, + update_time_ms=None, status=None, currency_pair=None, type='limit', @@ -111,6 +119,7 @@ def __init__( time_in_force='gtc', iceberg=None, auto_borrow=None, + auto_repay=None, left=None, fill_price=None, filled_total=None, @@ -123,7 +132,7 @@ def __init__( rebated_fee_currency=None, local_vars_configuration=None, ): # noqa: E501 - # type: (str, bool, str, str, str, str, str, str, str, str, str, str, str, str, str, str, bool, str, str, str, str, str, str, str, bool, str, str, Configuration) -> None + # type: (str, bool, str, str, str, str, str, int, int, str, str, str, str, str, str, str, str, str, bool, bool, str, str, str, str, str, str, str, bool, str, str, Configuration) -> None """BatchOrder - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -136,6 +145,8 @@ def __init__( self._id = None self._create_time = None self._update_time = None + self._create_time_ms = None + self._update_time_ms = None self._status = None self._currency_pair = None self._type = None @@ -146,6 +157,7 @@ def __init__( self._time_in_force = None self._iceberg = None self._auto_borrow = None + self._auto_repay = None self._left = None self._fill_price = None self._filled_total = None @@ -172,6 +184,10 @@ def __init__( self.create_time = create_time if update_time is not None: self.update_time = update_time + if create_time_ms is not None: + self.create_time_ms = create_time_ms + if update_time_ms is not None: + self.update_time_ms = update_time_ms if status is not None: self.status = status if currency_pair is not None: @@ -192,6 +208,8 @@ def __init__( self.iceberg = iceberg if auto_borrow is not None: self.auto_borrow = auto_borrow + if auto_repay is not None: + self.auto_repay = auto_repay if left is not None: self.left = left if fill_price is not None: @@ -374,6 +392,52 @@ def update_time(self, update_time): self._update_time = update_time + @property + def create_time_ms(self): + """Gets the create_time_ms of this BatchOrder. # noqa: E501 + + Order creation time in milliseconds # noqa: E501 + + :return: The create_time_ms of this BatchOrder. # noqa: E501 + :rtype: int + """ + return self._create_time_ms + + @create_time_ms.setter + def create_time_ms(self, create_time_ms): + """Sets the create_time_ms of this BatchOrder. + + Order creation time in milliseconds # noqa: E501 + + :param create_time_ms: The create_time_ms of this BatchOrder. # noqa: E501 + :type: int + """ + + self._create_time_ms = create_time_ms + + @property + def update_time_ms(self): + """Gets the update_time_ms of this BatchOrder. # noqa: E501 + + Order last modification time in milliseconds # noqa: E501 + + :return: The update_time_ms of this BatchOrder. # noqa: E501 + :rtype: int + """ + return self._update_time_ms + + @update_time_ms.setter + def update_time_ms(self, update_time_ms): + """Sets the update_time_ms of this BatchOrder. + + Order last modification time in milliseconds # noqa: E501 + + :param update_time_ms: The update_time_ms of this BatchOrder. # noqa: E501 + :type: int + """ + + self._update_time_ms = update_time_ms + @property def status(self): """Gets the status of this BatchOrder. # noqa: E501 @@ -457,7 +521,7 @@ def type(self, type): def account(self): """Gets the account of this BatchOrder. # noqa: E501 - Account type. spot - use spot account; margin - use margin account # noqa: E501 + Account type. spot - use spot account; margin - use margin account; cross_margin - use cross margin account # noqa: E501 :return: The account of this BatchOrder. # noqa: E501 :rtype: str @@ -468,12 +532,12 @@ def account(self): def account(self, account): """Sets the account of this BatchOrder. - Account type. spot - use spot account; margin - use margin account # noqa: E501 + Account type. spot - use spot account; margin - use margin account; cross_margin - use cross margin account # noqa: E501 :param account: The account of this BatchOrder. # noqa: E501 :type: str """ - allowed_values = ["spot", "margin"] # noqa: E501 + allowed_values = ["spot", "margin", "cross_margin"] # noqa: E501 if self.local_vars_configuration.client_side_validation and account not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `account` ({0}), must be one of {1}".format(account, allowed_values) # noqa: E501 @@ -612,7 +676,7 @@ def iceberg(self, iceberg): def auto_borrow(self): """Gets the auto_borrow of this BatchOrder. # noqa: E501 - Used in margin trading(i.e. `account` is `margin`) to allow automatic loan of insufficient part if balance is not enough. # noqa: E501 + Used in margin or cross margin trading to allow automatic loan of insufficient amount if balance is not enough. # noqa: E501 :return: The auto_borrow of this BatchOrder. # noqa: E501 :rtype: bool @@ -623,7 +687,7 @@ def auto_borrow(self): def auto_borrow(self, auto_borrow): """Sets the auto_borrow of this BatchOrder. - Used in margin trading(i.e. `account` is `margin`) to allow automatic loan of insufficient part if balance is not enough. # noqa: E501 + Used in margin or cross margin trading to allow automatic loan of insufficient amount if balance is not enough. # noqa: E501 :param auto_borrow: The auto_borrow of this BatchOrder. # noqa: E501 :type: bool @@ -631,6 +695,29 @@ def auto_borrow(self, auto_borrow): self._auto_borrow = auto_borrow + @property + def auto_repay(self): + """Gets the auto_repay of this BatchOrder. # noqa: E501 + + Enable or disable automatic repayment for automatic borrow loan generated by cross margin order. Default is disabled. Note that: 1. This field is only effective for cross margin orders. Margin account does not support setting auto repayment for orders. 2. `auto_borrow` and `auto_repay` cannot be both set to true in one order. # noqa: E501 + + :return: The auto_repay of this BatchOrder. # noqa: E501 + :rtype: bool + """ + return self._auto_repay + + @auto_repay.setter + def auto_repay(self, auto_repay): + """Sets the auto_repay of this BatchOrder. + + Enable or disable automatic repayment for automatic borrow loan generated by cross margin order. Default is disabled. Note that: 1. This field is only effective for cross margin orders. Margin account does not support setting auto repayment for orders. 2. `auto_borrow` and `auto_repay` cannot be both set to true in one order. # noqa: E501 + + :param auto_repay: The auto_repay of this BatchOrder. # noqa: E501 + :type: bool + """ + + self._auto_repay = auto_repay + @property def left(self): """Gets the left of this BatchOrder. # noqa: E501 diff --git a/gate_api/models/cancel_order.py b/gate_api/models/cancel_order.py index 20278d1..e969437 100644 --- a/gate_api/models/cancel_order.py +++ b/gate_api/models/cancel_order.py @@ -32,12 +32,12 @@ class CancelOrder(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'currency_pair': 'str', 'id': 'str'} + openapi_types = {'currency_pair': 'str', 'id': 'str', 'account': 'str'} - attribute_map = {'currency_pair': 'currency_pair', 'id': 'id'} + attribute_map = {'currency_pair': 'currency_pair', 'id': 'id', 'account': 'account'} - def __init__(self, currency_pair=None, id=None, local_vars_configuration=None): # noqa: E501 - # type: (str, str, Configuration) -> None + def __init__(self, currency_pair=None, id=None, account=None, local_vars_configuration=None): # noqa: E501 + # type: (str, str, str, Configuration) -> None """CancelOrder - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -45,10 +45,13 @@ def __init__(self, currency_pair=None, id=None, local_vars_configuration=None): self._currency_pair = None self._id = None + self._account = None self.discriminator = None self.currency_pair = currency_pair self.id = id + if account is not None: + self.account = account @property def currency_pair(self): @@ -100,6 +103,29 @@ def id(self, id): self._id = id + @property + def account(self): + """Gets the account of this CancelOrder. # noqa: E501 + + If cancelled order is cross margin order, this field must be set and can only be `cross_margin` # noqa: E501 + + :return: The account of this CancelOrder. # noqa: E501 + :rtype: str + """ + return self._account + + @account.setter + def account(self, account): + """Sets the account of this CancelOrder. + + If cancelled order is cross margin order, this field must be set and can only be `cross_margin` # noqa: E501 + + :param account: The account of this CancelOrder. # noqa: E501 + :type: str + """ + + self._account = account + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/gate_api/models/cancel_order_result.py b/gate_api/models/cancel_order_result.py index 349bb06..a349770 100644 --- a/gate_api/models/cancel_order_result.py +++ b/gate_api/models/cancel_order_result.py @@ -32,7 +32,14 @@ class CancelOrderResult(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'currency_pair': 'str', 'id': 'str', 'succeeded': 'bool', 'label': 'str', 'message': 'str'} + openapi_types = { + 'currency_pair': 'str', + 'id': 'str', + 'succeeded': 'bool', + 'label': 'str', + 'message': 'str', + 'account': 'str', + } attribute_map = { 'currency_pair': 'currency_pair', @@ -40,12 +47,20 @@ class CancelOrderResult(object): 'succeeded': 'succeeded', 'label': 'label', 'message': 'message', + 'account': 'account', } def __init__( - self, currency_pair=None, id=None, succeeded=None, label=None, message=None, local_vars_configuration=None + self, + currency_pair=None, + id=None, + succeeded=None, + label=None, + message=None, + account=None, + local_vars_configuration=None, ): # noqa: E501 - # type: (str, str, bool, str, str, Configuration) -> None + # type: (str, str, bool, str, str, str, Configuration) -> None """CancelOrderResult - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -56,6 +71,7 @@ def __init__( self._succeeded = None self._label = None self._message = None + self._account = None self.discriminator = None if currency_pair is not None: @@ -68,6 +84,8 @@ def __init__( self.label = label if message is not None: self.message = message + if account is not None: + self.account = account @property def currency_pair(self): @@ -184,6 +202,29 @@ def message(self, message): self._message = message + @property + def account(self): + """Gets the account of this CancelOrderResult. # noqa: E501 + + Empty by default. If cancelled order is cross margin order, this field is set to `cross_margin` # noqa: E501 + + :return: The account of this CancelOrderResult. # noqa: E501 + :rtype: str + """ + return self._account + + @account.setter + def account(self, account): + """Sets the account of this CancelOrderResult. + + Empty by default. If cancelled order is cross margin order, this field is set to `cross_margin` # noqa: E501 + + :param account: The account of this CancelOrderResult. # noqa: E501 + :type: str + """ + + self._account = account + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/gate_api/models/contract.py b/gate_api/models/contract.py index 1e7562c..e35f694 100644 --- a/gate_api/models/contract.py +++ b/gate_api/models/contract.py @@ -298,7 +298,7 @@ def type(self, type): def quanto_multiplier(self): """Gets the quanto_multiplier of this Contract. # noqa: E501 - Multiplier used in converting from invoicing to settlement currency in quanto futures # noqa: E501 + Multiplier used in converting from invoicing to settlement currency # noqa: E501 :return: The quanto_multiplier of this Contract. # noqa: E501 :rtype: str @@ -309,7 +309,7 @@ def quanto_multiplier(self): def quanto_multiplier(self, quanto_multiplier): """Sets the quanto_multiplier of this Contract. - Multiplier used in converting from invoicing to settlement currency in quanto futures # noqa: E501 + Multiplier used in converting from invoicing to settlement currency # noqa: E501 :param quanto_multiplier: The quanto_multiplier of this Contract. # noqa: E501 :type: str diff --git a/gate_api/models/cross_margin_account.py b/gate_api/models/cross_margin_account.py new file mode 100644 index 0000000..3819ae1 --- /dev/null +++ b/gate_api/models/cross_margin_account.py @@ -0,0 +1,297 @@ +# coding: utf-8 + +""" + Gate API v4 + + Welcome to Gate.io API 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. # noqa: E501 + + Contact: support@mail.gate.io + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from gate_api.configuration import Configuration + + +class CrossMarginAccount(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'user_id': 'int', + 'locked': 'bool', + 'balances': 'dict(str, CrossMarginBalance)', + 'total': 'str', + 'borrowed': 'str', + 'interest': 'str', + 'risk': 'str', + } + + attribute_map = { + 'user_id': 'user_id', + 'locked': 'locked', + 'balances': 'balances', + 'total': 'total', + 'borrowed': 'borrowed', + 'interest': 'interest', + 'risk': 'risk', + } + + def __init__( + self, + user_id=None, + locked=None, + balances=None, + total=None, + borrowed=None, + interest=None, + risk=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (int, bool, dict(str, CrossMarginBalance), str, str, str, str, Configuration) -> None + """CrossMarginAccount - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._user_id = None + self._locked = None + self._balances = None + self._total = None + self._borrowed = None + self._interest = None + self._risk = None + self.discriminator = None + + if user_id is not None: + self.user_id = user_id + if locked is not None: + self.locked = locked + if balances is not None: + self.balances = balances + if total is not None: + self.total = total + if borrowed is not None: + self.borrowed = borrowed + if interest is not None: + self.interest = interest + if risk is not None: + self.risk = risk + + @property + def user_id(self): + """Gets the user_id of this CrossMarginAccount. # noqa: E501 + + User ID # noqa: E501 + + :return: The user_id of this CrossMarginAccount. # noqa: E501 + :rtype: int + """ + return self._user_id + + @user_id.setter + def user_id(self, user_id): + """Sets the user_id of this CrossMarginAccount. + + User ID # noqa: E501 + + :param user_id: The user_id of this CrossMarginAccount. # noqa: E501 + :type: int + """ + + self._user_id = user_id + + @property + def locked(self): + """Gets the locked of this CrossMarginAccount. # noqa: E501 + + Whether account is locked # noqa: E501 + + :return: The locked of this CrossMarginAccount. # noqa: E501 + :rtype: bool + """ + return self._locked + + @locked.setter + def locked(self, locked): + """Sets the locked of this CrossMarginAccount. + + Whether account is locked # noqa: E501 + + :param locked: The locked of this CrossMarginAccount. # noqa: E501 + :type: bool + """ + + self._locked = locked + + @property + def balances(self): + """Gets the balances of this CrossMarginAccount. # noqa: E501 + + + :return: The balances of this CrossMarginAccount. # noqa: E501 + :rtype: dict(str, CrossMarginBalance) + """ + return self._balances + + @balances.setter + def balances(self, balances): + """Sets the balances of this CrossMarginAccount. + + + :param balances: The balances of this CrossMarginAccount. # noqa: E501 + :type: dict(str, CrossMarginBalance) + """ + + self._balances = balances + + @property + def total(self): + """Gets the total of this CrossMarginAccount. # noqa: E501 + + Total account value in USDT, i.e., the sum of all currencies' `(available+freeze)*price*discount` # noqa: E501 + + :return: The total of this CrossMarginAccount. # noqa: E501 + :rtype: str + """ + return self._total + + @total.setter + def total(self, total): + """Sets the total of this CrossMarginAccount. + + Total account value in USDT, i.e., the sum of all currencies' `(available+freeze)*price*discount` # noqa: E501 + + :param total: The total of this CrossMarginAccount. # noqa: E501 + :type: str + """ + + self._total = total + + @property + def borrowed(self): + """Gets the borrowed of this CrossMarginAccount. # noqa: E501 + + Total borrowed value in USDT, i.e., the sum of all currencies' `borrowed*price*discount` # noqa: E501 + + :return: The borrowed of this CrossMarginAccount. # noqa: E501 + :rtype: str + """ + return self._borrowed + + @borrowed.setter + def borrowed(self, borrowed): + """Sets the borrowed of this CrossMarginAccount. + + Total borrowed value in USDT, i.e., the sum of all currencies' `borrowed*price*discount` # noqa: E501 + + :param borrowed: The borrowed of this CrossMarginAccount. # noqa: E501 + :type: str + """ + + self._borrowed = borrowed + + @property + def interest(self): + """Gets the interest of this CrossMarginAccount. # noqa: E501 + + Total unpaid interests in USDT, i.e., the sum of all currencies' `interest*price*discount` # noqa: E501 + + :return: The interest of this CrossMarginAccount. # noqa: E501 + :rtype: str + """ + return self._interest + + @interest.setter + def interest(self, interest): + """Sets the interest of this CrossMarginAccount. + + Total unpaid interests in USDT, i.e., the sum of all currencies' `interest*price*discount` # noqa: E501 + + :param interest: The interest of this CrossMarginAccount. # noqa: E501 + :type: str + """ + + self._interest = interest + + @property + def risk(self): + """Gets the risk of this CrossMarginAccount. # noqa: E501 + + Risk rate. When it belows 110%, liquidation will be triggered. Calculation formula: `total / (borrowed+interest)` # noqa: E501 + + :return: The risk of this CrossMarginAccount. # noqa: E501 + :rtype: str + """ + return self._risk + + @risk.setter + def risk(self, risk): + """Sets the risk of this CrossMarginAccount. + + Risk rate. When it belows 110%, liquidation will be triggered. Calculation formula: `total / (borrowed+interest)` # noqa: E501 + + :param risk: The risk of this CrossMarginAccount. # noqa: E501 + :type: str + """ + + self._risk = risk + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value)) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, + value.items(), + ) + ) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CrossMarginAccount): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, CrossMarginAccount): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/cross_margin_balance.py b/gate_api/models/cross_margin_balance.py new file mode 100644 index 0000000..ef955ed --- /dev/null +++ b/gate_api/models/cross_margin_balance.py @@ -0,0 +1,197 @@ +# coding: utf-8 + +""" + Gate API v4 + + Welcome to Gate.io API 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. # noqa: E501 + + Contact: support@mail.gate.io + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from gate_api.configuration import Configuration + + +class CrossMarginBalance(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = {'available': 'str', 'freeze': 'str', 'borrowed': 'str', 'interest': 'str'} + + attribute_map = {'available': 'available', 'freeze': 'freeze', 'borrowed': 'borrowed', 'interest': 'interest'} + + def __init__( + self, available=None, freeze=None, borrowed=None, interest=None, local_vars_configuration=None + ): # noqa: E501 + # type: (str, str, str, str, Configuration) -> None + """CrossMarginBalance - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._available = None + self._freeze = None + self._borrowed = None + self._interest = None + self.discriminator = None + + if available is not None: + self.available = available + if freeze is not None: + self.freeze = freeze + if borrowed is not None: + self.borrowed = borrowed + if interest is not None: + self.interest = interest + + @property + def available(self): + """Gets the available of this CrossMarginBalance. # noqa: E501 + + Available amount # noqa: E501 + + :return: The available of this CrossMarginBalance. # noqa: E501 + :rtype: str + """ + return self._available + + @available.setter + def available(self, available): + """Sets the available of this CrossMarginBalance. + + Available amount # noqa: E501 + + :param available: The available of this CrossMarginBalance. # noqa: E501 + :type: str + """ + + self._available = available + + @property + def freeze(self): + """Gets the freeze of this CrossMarginBalance. # noqa: E501 + + Locked amount # noqa: E501 + + :return: The freeze of this CrossMarginBalance. # noqa: E501 + :rtype: str + """ + return self._freeze + + @freeze.setter + def freeze(self, freeze): + """Sets the freeze of this CrossMarginBalance. + + Locked amount # noqa: E501 + + :param freeze: The freeze of this CrossMarginBalance. # noqa: E501 + :type: str + """ + + self._freeze = freeze + + @property + def borrowed(self): + """Gets the borrowed of this CrossMarginBalance. # noqa: E501 + + Borrowed amount # noqa: E501 + + :return: The borrowed of this CrossMarginBalance. # noqa: E501 + :rtype: str + """ + return self._borrowed + + @borrowed.setter + def borrowed(self, borrowed): + """Sets the borrowed of this CrossMarginBalance. + + Borrowed amount # noqa: E501 + + :param borrowed: The borrowed of this CrossMarginBalance. # noqa: E501 + :type: str + """ + + self._borrowed = borrowed + + @property + def interest(self): + """Gets the interest of this CrossMarginBalance. # noqa: E501 + + Interests unpaid # noqa: E501 + + :return: The interest of this CrossMarginBalance. # noqa: E501 + :rtype: str + """ + return self._interest + + @interest.setter + def interest(self, interest): + """Sets the interest of this CrossMarginBalance. + + Interests unpaid # noqa: E501 + + :param interest: The interest of this CrossMarginBalance. # noqa: E501 + :type: str + """ + + self._interest = interest + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value)) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, + value.items(), + ) + ) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CrossMarginBalance): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, CrossMarginBalance): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/cross_margin_currency.py b/gate_api/models/cross_margin_currency.py new file mode 100644 index 0000000..9c4d1fb --- /dev/null +++ b/gate_api/models/cross_margin_currency.py @@ -0,0 +1,328 @@ +# coding: utf-8 + +""" + Gate API v4 + + Welcome to Gate.io API 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. # noqa: E501 + + Contact: support@mail.gate.io + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from gate_api.configuration import Configuration + + +class CrossMarginCurrency(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'name': 'str', + 'rate': 'str', + 'prec': 'str', + 'discount': 'str', + 'min_borrow_amount': 'str', + 'user_max_borrow_amount': 'str', + 'total_max_borrow_amount': 'str', + 'price': 'str', + } + + attribute_map = { + 'name': 'name', + 'rate': 'rate', + 'prec': 'prec', + 'discount': 'discount', + 'min_borrow_amount': 'min_borrow_amount', + 'user_max_borrow_amount': 'user_max_borrow_amount', + 'total_max_borrow_amount': 'total_max_borrow_amount', + 'price': 'price', + } + + def __init__( + self, + name=None, + rate=None, + prec=None, + discount=None, + min_borrow_amount=None, + user_max_borrow_amount=None, + total_max_borrow_amount=None, + price=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, str, str, str, str, str, str, str, Configuration) -> None + """CrossMarginCurrency - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._name = None + self._rate = None + self._prec = None + self._discount = None + self._min_borrow_amount = None + self._user_max_borrow_amount = None + self._total_max_borrow_amount = None + self._price = None + self.discriminator = None + + if name is not None: + self.name = name + if rate is not None: + self.rate = rate + if prec is not None: + self.prec = prec + if discount is not None: + self.discount = discount + if min_borrow_amount is not None: + self.min_borrow_amount = min_borrow_amount + if user_max_borrow_amount is not None: + self.user_max_borrow_amount = user_max_borrow_amount + if total_max_borrow_amount is not None: + self.total_max_borrow_amount = total_max_borrow_amount + if price is not None: + self.price = price + + @property + def name(self): + """Gets the name of this CrossMarginCurrency. # noqa: E501 + + Currency name # noqa: E501 + + :return: The name of this CrossMarginCurrency. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this CrossMarginCurrency. + + Currency name # noqa: E501 + + :param name: The name of this CrossMarginCurrency. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def rate(self): + """Gets the rate of this CrossMarginCurrency. # noqa: E501 + + Loan rate # noqa: E501 + + :return: The rate of this CrossMarginCurrency. # noqa: E501 + :rtype: str + """ + return self._rate + + @rate.setter + def rate(self, rate): + """Sets the rate of this CrossMarginCurrency. + + Loan rate # noqa: E501 + + :param rate: The rate of this CrossMarginCurrency. # noqa: E501 + :type: str + """ + + self._rate = rate + + @property + def prec(self): + """Gets the prec of this CrossMarginCurrency. # noqa: E501 + + Currency precision # noqa: E501 + + :return: The prec of this CrossMarginCurrency. # noqa: E501 + :rtype: str + """ + return self._prec + + @prec.setter + def prec(self, prec): + """Sets the prec of this CrossMarginCurrency. + + Currency precision # noqa: E501 + + :param prec: The prec of this CrossMarginCurrency. # noqa: E501 + :type: str + """ + + self._prec = prec + + @property + def discount(self): + """Gets the discount of this CrossMarginCurrency. # noqa: E501 + + Currency value discount, which is used in total value calculation # noqa: E501 + + :return: The discount of this CrossMarginCurrency. # noqa: E501 + :rtype: str + """ + return self._discount + + @discount.setter + def discount(self, discount): + """Sets the discount of this CrossMarginCurrency. + + Currency value discount, which is used in total value calculation # noqa: E501 + + :param discount: The discount of this CrossMarginCurrency. # noqa: E501 + :type: str + """ + + self._discount = discount + + @property + def min_borrow_amount(self): + """Gets the min_borrow_amount of this CrossMarginCurrency. # noqa: E501 + + Minimum currency borrow amount. Unit is currency itself # noqa: E501 + + :return: The min_borrow_amount of this CrossMarginCurrency. # noqa: E501 + :rtype: str + """ + return self._min_borrow_amount + + @min_borrow_amount.setter + def min_borrow_amount(self, min_borrow_amount): + """Sets the min_borrow_amount of this CrossMarginCurrency. + + Minimum currency borrow amount. Unit is currency itself # noqa: E501 + + :param min_borrow_amount: The min_borrow_amount of this CrossMarginCurrency. # noqa: E501 + :type: str + """ + + self._min_borrow_amount = min_borrow_amount + + @property + def user_max_borrow_amount(self): + """Gets the user_max_borrow_amount of this CrossMarginCurrency. # noqa: E501 + + Maximum borrow value allowed per user, in USDT # noqa: E501 + + :return: The user_max_borrow_amount of this CrossMarginCurrency. # noqa: E501 + :rtype: str + """ + return self._user_max_borrow_amount + + @user_max_borrow_amount.setter + def user_max_borrow_amount(self, user_max_borrow_amount): + """Sets the user_max_borrow_amount of this CrossMarginCurrency. + + Maximum borrow value allowed per user, in USDT # noqa: E501 + + :param user_max_borrow_amount: The user_max_borrow_amount of this CrossMarginCurrency. # noqa: E501 + :type: str + """ + + self._user_max_borrow_amount = user_max_borrow_amount + + @property + def total_max_borrow_amount(self): + """Gets the total_max_borrow_amount of this CrossMarginCurrency. # noqa: E501 + + Maximum borrow value allowed for this currency, in USDT # noqa: E501 + + :return: The total_max_borrow_amount of this CrossMarginCurrency. # noqa: E501 + :rtype: str + """ + return self._total_max_borrow_amount + + @total_max_borrow_amount.setter + def total_max_borrow_amount(self, total_max_borrow_amount): + """Sets the total_max_borrow_amount of this CrossMarginCurrency. + + Maximum borrow value allowed for this currency, in USDT # noqa: E501 + + :param total_max_borrow_amount: The total_max_borrow_amount of this CrossMarginCurrency. # noqa: E501 + :type: str + """ + + self._total_max_borrow_amount = total_max_borrow_amount + + @property + def price(self): + """Gets the price of this CrossMarginCurrency. # noqa: E501 + + Price change between this currency and USDT # noqa: E501 + + :return: The price of this CrossMarginCurrency. # noqa: E501 + :rtype: str + """ + return self._price + + @price.setter + def price(self, price): + """Sets the price of this CrossMarginCurrency. + + Price change between this currency and USDT # noqa: E501 + + :param price: The price of this CrossMarginCurrency. # noqa: E501 + :type: str + """ + + self._price = price + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value)) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, + value.items(), + ) + ) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CrossMarginCurrency): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, CrossMarginCurrency): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/cross_margin_loan.py b/gate_api/models/cross_margin_loan.py new file mode 100644 index 0000000..04450ca --- /dev/null +++ b/gate_api/models/cross_margin_loan.py @@ -0,0 +1,393 @@ +# coding: utf-8 + +""" + Gate API v4 + + Welcome to Gate.io API 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. # noqa: E501 + + Contact: support@mail.gate.io + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from gate_api.configuration import Configuration + + +class CrossMarginLoan(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'id': 'str', + 'create_time': 'int', + 'update_time': 'int', + 'currency': 'str', + 'amount': 'str', + 'text': 'str', + 'status': 'int', + 'repaid': 'str', + 'repaid_interest': 'str', + 'unpaid_interest': 'str', + } + + attribute_map = { + 'id': 'id', + 'create_time': 'create_time', + 'update_time': 'update_time', + 'currency': 'currency', + 'amount': 'amount', + 'text': 'text', + 'status': 'status', + 'repaid': 'repaid', + 'repaid_interest': 'repaid_interest', + 'unpaid_interest': 'unpaid_interest', + } + + def __init__( + self, + id=None, + create_time=None, + update_time=None, + currency=None, + amount=None, + text=None, + status=None, + repaid=None, + repaid_interest=None, + unpaid_interest=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, int, int, str, str, str, int, str, str, str, Configuration) -> None + """CrossMarginLoan - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._id = None + self._create_time = None + self._update_time = None + self._currency = None + self._amount = None + self._text = None + self._status = None + self._repaid = None + self._repaid_interest = None + self._unpaid_interest = None + self.discriminator = None + + if id is not None: + self.id = id + if create_time is not None: + self.create_time = create_time + if update_time is not None: + self.update_time = update_time + self.currency = currency + self.amount = amount + if text is not None: + self.text = text + if status is not None: + self.status = status + if repaid is not None: + self.repaid = repaid + if repaid_interest is not None: + self.repaid_interest = repaid_interest + if unpaid_interest is not None: + self.unpaid_interest = unpaid_interest + + @property + def id(self): + """Gets the id of this CrossMarginLoan. # noqa: E501 + + Borrow loan ID # noqa: E501 + + :return: The id of this CrossMarginLoan. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this CrossMarginLoan. + + Borrow loan ID # noqa: E501 + + :param id: The id of this CrossMarginLoan. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def create_time(self): + """Gets the create_time of this CrossMarginLoan. # noqa: E501 + + Creation timestamp, in milliseconds # noqa: E501 + + :return: The create_time of this CrossMarginLoan. # noqa: E501 + :rtype: int + """ + return self._create_time + + @create_time.setter + def create_time(self, create_time): + """Sets the create_time of this CrossMarginLoan. + + Creation timestamp, in milliseconds # noqa: E501 + + :param create_time: The create_time of this CrossMarginLoan. # noqa: E501 + :type: int + """ + + self._create_time = create_time + + @property + def update_time(self): + """Gets the update_time of this CrossMarginLoan. # noqa: E501 + + Update timestamp, in milliseconds # noqa: E501 + + :return: The update_time of this CrossMarginLoan. # noqa: E501 + :rtype: int + """ + return self._update_time + + @update_time.setter + def update_time(self, update_time): + """Sets the update_time of this CrossMarginLoan. + + Update timestamp, in milliseconds # noqa: E501 + + :param update_time: The update_time of this CrossMarginLoan. # noqa: E501 + :type: int + """ + + self._update_time = update_time + + @property + def currency(self): + """Gets the currency of this CrossMarginLoan. # noqa: E501 + + Currency name # noqa: E501 + + :return: The currency of this CrossMarginLoan. # noqa: E501 + :rtype: str + """ + return self._currency + + @currency.setter + def currency(self, currency): + """Sets the currency of this CrossMarginLoan. + + Currency name # noqa: E501 + + :param currency: The currency of this CrossMarginLoan. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and currency is None: # noqa: E501 + raise ValueError("Invalid value for `currency`, must not be `None`") # noqa: E501 + + self._currency = currency + + @property + def amount(self): + """Gets the amount of this CrossMarginLoan. # noqa: E501 + + Borrowed amount # noqa: E501 + + :return: The amount of this CrossMarginLoan. # noqa: E501 + :rtype: str + """ + return self._amount + + @amount.setter + def amount(self, amount): + """Sets the amount of this CrossMarginLoan. + + Borrowed amount # noqa: E501 + + :param amount: The amount of this CrossMarginLoan. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and amount is None: # noqa: E501 + raise ValueError("Invalid value for `amount`, must not be `None`") # noqa: E501 + + self._amount = amount + + @property + def text(self): + """Gets the text of this CrossMarginLoan. # noqa: E501 + + User defined custom ID # noqa: E501 + + :return: The text of this CrossMarginLoan. # noqa: E501 + :rtype: str + """ + return self._text + + @text.setter + def text(self, text): + """Sets the text of this CrossMarginLoan. + + User defined custom ID # noqa: E501 + + :param text: The text of this CrossMarginLoan. # noqa: E501 + :type: str + """ + + self._text = text + + @property + def status(self): + """Gets the status of this CrossMarginLoan. # noqa: E501 + + Borrow loan status, which includes: - 1: failed to borrow - 2: borrowed but not repaid - 3: repayment complete # noqa: E501 + + :return: The status of this CrossMarginLoan. # noqa: E501 + :rtype: int + """ + return self._status + + @status.setter + def status(self, status): + """Sets the status of this CrossMarginLoan. + + Borrow loan status, which includes: - 1: failed to borrow - 2: borrowed but not repaid - 3: repayment complete # noqa: E501 + + :param status: The status of this CrossMarginLoan. # noqa: E501 + :type: int + """ + allowed_values = [1, 2, 3] # noqa: E501 + if self.local_vars_configuration.client_side_validation and status not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `status` ({0}), must be one of {1}".format(status, allowed_values) # noqa: E501 + ) + + self._status = status + + @property + def repaid(self): + """Gets the repaid of this CrossMarginLoan. # noqa: E501 + + Repaid amount # noqa: E501 + + :return: The repaid of this CrossMarginLoan. # noqa: E501 + :rtype: str + """ + return self._repaid + + @repaid.setter + def repaid(self, repaid): + """Sets the repaid of this CrossMarginLoan. + + Repaid amount # noqa: E501 + + :param repaid: The repaid of this CrossMarginLoan. # noqa: E501 + :type: str + """ + + self._repaid = repaid + + @property + def repaid_interest(self): + """Gets the repaid_interest of this CrossMarginLoan. # noqa: E501 + + Repaid interest # noqa: E501 + + :return: The repaid_interest of this CrossMarginLoan. # noqa: E501 + :rtype: str + """ + return self._repaid_interest + + @repaid_interest.setter + def repaid_interest(self, repaid_interest): + """Sets the repaid_interest of this CrossMarginLoan. + + Repaid interest # noqa: E501 + + :param repaid_interest: The repaid_interest of this CrossMarginLoan. # noqa: E501 + :type: str + """ + + self._repaid_interest = repaid_interest + + @property + def unpaid_interest(self): + """Gets the unpaid_interest of this CrossMarginLoan. # noqa: E501 + + Interest not repaid # noqa: E501 + + :return: The unpaid_interest of this CrossMarginLoan. # noqa: E501 + :rtype: str + """ + return self._unpaid_interest + + @unpaid_interest.setter + def unpaid_interest(self, unpaid_interest): + """Sets the unpaid_interest of this CrossMarginLoan. + + Interest not repaid # noqa: E501 + + :param unpaid_interest: The unpaid_interest of this CrossMarginLoan. # noqa: E501 + :type: str + """ + + self._unpaid_interest = unpaid_interest + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value)) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, + value.items(), + ) + ) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CrossMarginLoan): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, CrossMarginLoan): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/cross_margin_repay_request.py b/gate_api/models/cross_margin_repay_request.py new file mode 100644 index 0000000..078dcbd --- /dev/null +++ b/gate_api/models/cross_margin_repay_request.py @@ -0,0 +1,145 @@ +# coding: utf-8 + +""" + Gate API v4 + + Welcome to Gate.io API 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. # noqa: E501 + + Contact: support@mail.gate.io + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from gate_api.configuration import Configuration + + +class CrossMarginRepayRequest(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = {'currency': 'str', 'amount': 'str'} + + attribute_map = {'currency': 'currency', 'amount': 'amount'} + + def __init__(self, currency=None, amount=None, local_vars_configuration=None): # noqa: E501 + # type: (str, str, Configuration) -> None + """CrossMarginRepayRequest - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._currency = None + self._amount = None + self.discriminator = None + + self.currency = currency + self.amount = amount + + @property + def currency(self): + """Gets the currency of this CrossMarginRepayRequest. # noqa: E501 + + Repayment currency # noqa: E501 + + :return: The currency of this CrossMarginRepayRequest. # noqa: E501 + :rtype: str + """ + return self._currency + + @currency.setter + def currency(self, currency): + """Sets the currency of this CrossMarginRepayRequest. + + Repayment currency # noqa: E501 + + :param currency: The currency of this CrossMarginRepayRequest. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and currency is None: # noqa: E501 + raise ValueError("Invalid value for `currency`, must not be `None`") # noqa: E501 + + self._currency = currency + + @property + def amount(self): + """Gets the amount of this CrossMarginRepayRequest. # noqa: E501 + + Repayment amount # noqa: E501 + + :return: The amount of this CrossMarginRepayRequest. # noqa: E501 + :rtype: str + """ + return self._amount + + @amount.setter + def amount(self, amount): + """Sets the amount of this CrossMarginRepayRequest. + + Repayment amount # noqa: E501 + + :param amount: The amount of this CrossMarginRepayRequest. # noqa: E501 + :type: str + """ + if self.local_vars_configuration.client_side_validation and amount is None: # noqa: E501 + raise ValueError("Invalid value for `amount`, must not be `None`") # noqa: E501 + + self._amount = amount + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value)) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, + value.items(), + ) + ) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CrossMarginRepayRequest): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, CrossMarginRepayRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/cross_margin_repayment.py b/gate_api/models/cross_margin_repayment.py new file mode 100644 index 0000000..fa0d028 --- /dev/null +++ b/gate_api/models/cross_margin_repayment.py @@ -0,0 +1,270 @@ +# coding: utf-8 + +""" + Gate API v4 + + Welcome to Gate.io API 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. # noqa: E501 + + Contact: support@mail.gate.io + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from gate_api.configuration import Configuration + + +class CrossMarginRepayment(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'id': 'str', + 'create_time': 'int', + 'loan_id': 'str', + 'currency': 'str', + 'principal': 'str', + 'interest': 'str', + } + + attribute_map = { + 'id': 'id', + 'create_time': 'create_time', + 'loan_id': 'loan_id', + 'currency': 'currency', + 'principal': 'principal', + 'interest': 'interest', + } + + def __init__( + self, + id=None, + create_time=None, + loan_id=None, + currency=None, + principal=None, + interest=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, int, str, str, str, str, Configuration) -> None + """CrossMarginRepayment - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._id = None + self._create_time = None + self._loan_id = None + self._currency = None + self._principal = None + self._interest = None + self.discriminator = None + + if id is not None: + self.id = id + if create_time is not None: + self.create_time = create_time + if loan_id is not None: + self.loan_id = loan_id + if currency is not None: + self.currency = currency + if principal is not None: + self.principal = principal + if interest is not None: + self.interest = interest + + @property + def id(self): + """Gets the id of this CrossMarginRepayment. # noqa: E501 + + Loan record ID # noqa: E501 + + :return: The id of this CrossMarginRepayment. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this CrossMarginRepayment. + + Loan record ID # noqa: E501 + + :param id: The id of this CrossMarginRepayment. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def create_time(self): + """Gets the create_time of this CrossMarginRepayment. # noqa: E501 + + Repayment time # noqa: E501 + + :return: The create_time of this CrossMarginRepayment. # noqa: E501 + :rtype: int + """ + return self._create_time + + @create_time.setter + def create_time(self, create_time): + """Sets the create_time of this CrossMarginRepayment. + + Repayment time # noqa: E501 + + :param create_time: The create_time of this CrossMarginRepayment. # noqa: E501 + :type: int + """ + + self._create_time = create_time + + @property + def loan_id(self): + """Gets the loan_id of this CrossMarginRepayment. # noqa: E501 + + Borrow loan ID # noqa: E501 + + :return: The loan_id of this CrossMarginRepayment. # noqa: E501 + :rtype: str + """ + return self._loan_id + + @loan_id.setter + def loan_id(self, loan_id): + """Sets the loan_id of this CrossMarginRepayment. + + Borrow loan ID # noqa: E501 + + :param loan_id: The loan_id of this CrossMarginRepayment. # noqa: E501 + :type: str + """ + + self._loan_id = loan_id + + @property + def currency(self): + """Gets the currency of this CrossMarginRepayment. # noqa: E501 + + Currency name # noqa: E501 + + :return: The currency of this CrossMarginRepayment. # noqa: E501 + :rtype: str + """ + return self._currency + + @currency.setter + def currency(self, currency): + """Sets the currency of this CrossMarginRepayment. + + Currency name # noqa: E501 + + :param currency: The currency of this CrossMarginRepayment. # noqa: E501 + :type: str + """ + + self._currency = currency + + @property + def principal(self): + """Gets the principal of this CrossMarginRepayment. # noqa: E501 + + Repaid principal # noqa: E501 + + :return: The principal of this CrossMarginRepayment. # noqa: E501 + :rtype: str + """ + return self._principal + + @principal.setter + def principal(self, principal): + """Sets the principal of this CrossMarginRepayment. + + Repaid principal # noqa: E501 + + :param principal: The principal of this CrossMarginRepayment. # noqa: E501 + :type: str + """ + + self._principal = principal + + @property + def interest(self): + """Gets the interest of this CrossMarginRepayment. # noqa: E501 + + Repaid interest # noqa: E501 + + :return: The interest of this CrossMarginRepayment. # noqa: E501 + :rtype: str + """ + return self._interest + + @interest.setter + def interest(self, interest): + """Sets the interest of this CrossMarginRepayment. + + Repaid interest # noqa: E501 + + :param interest: The interest of this CrossMarginRepayment. # noqa: E501 + :type: str + """ + + self._interest = interest + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value)) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict( + map( + lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, + value.items(), + ) + ) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, CrossMarginRepayment): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, CrossMarginRepayment): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/delivery_contract.py b/gate_api/models/delivery_contract.py index 0e1ad0e..8977e95 100644 --- a/gate_api/models/delivery_contract.py +++ b/gate_api/models/delivery_contract.py @@ -385,7 +385,7 @@ def type(self, type): def quanto_multiplier(self): """Gets the quanto_multiplier of this DeliveryContract. # noqa: E501 - Multiplier used in converting from invoicing to settlement currency in quanto futures # noqa: E501 + Multiplier used in converting from invoicing to settlement currency # noqa: E501 :return: The quanto_multiplier of this DeliveryContract. # noqa: E501 :rtype: str @@ -396,7 +396,7 @@ def quanto_multiplier(self): def quanto_multiplier(self, quanto_multiplier): """Sets the quanto_multiplier of this DeliveryContract. - Multiplier used in converting from invoicing to settlement currency in quanto futures # noqa: E501 + Multiplier used in converting from invoicing to settlement currency # noqa: E501 :param quanto_multiplier: The quanto_multiplier of this DeliveryContract. # noqa: E501 :type: str diff --git a/gate_api/models/futures_order.py b/gate_api/models/futures_order.py index 9605b0e..98f092a 100644 --- a/gate_api/models/futures_order.py +++ b/gate_api/models/futures_order.py @@ -277,7 +277,7 @@ def finish_time(self, finish_time): def finish_as(self): """Gets the finish_as of this FuturesOrder. # noqa: E501 - How the order is finished. - filled: all filled - cancelled: manually cancelled - liquidated: cancelled because of liquidation - ioc: time in force is `IOC`, finish immediately - auto_deleveraged: finished by ADL - reduce_only: cancelled because of increasing position while `reduce-only` set # noqa: E501 + How the order is finished. - filled: all filled - cancelled: manually cancelled - liquidated: cancelled because of liquidation - ioc: time in force is `IOC`, finish immediately - auto_deleveraged: finished by ADL - reduce_only: cancelled because of increasing position while `reduce-only` set- position_closed: cancelled because of position close # noqa: E501 :return: The finish_as of this FuturesOrder. # noqa: E501 :rtype: str @@ -288,12 +288,21 @@ def finish_as(self): def finish_as(self, finish_as): """Sets the finish_as of this FuturesOrder. - How the order is finished. - filled: all filled - cancelled: manually cancelled - liquidated: cancelled because of liquidation - ioc: time in force is `IOC`, finish immediately - auto_deleveraged: finished by ADL - reduce_only: cancelled because of increasing position while `reduce-only` set # noqa: E501 + How the order is finished. - filled: all filled - cancelled: manually cancelled - liquidated: cancelled because of liquidation - ioc: time in force is `IOC`, finish immediately - auto_deleveraged: finished by ADL - reduce_only: cancelled because of increasing position while `reduce-only` set- position_closed: cancelled because of position close # noqa: E501 :param finish_as: The finish_as of this FuturesOrder. # noqa: E501 :type: str """ - allowed_values = ["filled", "cancelled", "liquidated", "ioc", "auto_deleveraged", "reduce_only"] # noqa: E501 + allowed_values = [ + "filled", + "cancelled", + "liquidated", + "ioc", + "auto_deleveraged", + "reduce_only", + "position_closed", + "reduce_out", + ] # noqa: E501 if self.local_vars_configuration.client_side_validation and finish_as not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `finish_as` ({0}), must be one of {1}".format( # noqa: E501 diff --git a/gate_api/models/margin_account_currency.py b/gate_api/models/margin_account_currency.py index 354ae14..937643c 100644 --- a/gate_api/models/margin_account_currency.py +++ b/gate_api/models/margin_account_currency.py @@ -32,14 +32,20 @@ class MarginAccountCurrency(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'currency': 'str', 'available': 'str', 'locked': 'str', 'borrowed': 'str'} + openapi_types = {'currency': 'str', 'available': 'str', 'locked': 'str', 'borrowed': 'str', 'interest': 'str'} - attribute_map = {'currency': 'currency', 'available': 'available', 'locked': 'locked', 'borrowed': 'borrowed'} + attribute_map = { + 'currency': 'currency', + 'available': 'available', + 'locked': 'locked', + 'borrowed': 'borrowed', + 'interest': 'interest', + } def __init__( - self, currency=None, available=None, locked=None, borrowed=None, local_vars_configuration=None + self, currency=None, available=None, locked=None, borrowed=None, interest=None, local_vars_configuration=None ): # noqa: E501 - # type: (str, str, str, str, Configuration) -> None + # type: (str, str, str, str, str, Configuration) -> None """MarginAccountCurrency - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -49,6 +55,7 @@ def __init__( self._available = None self._locked = None self._borrowed = None + self._interest = None self.discriminator = None if currency is not None: @@ -59,6 +66,8 @@ def __init__( self.locked = locked if borrowed is not None: self.borrowed = borrowed + if interest is not None: + self.interest = interest @property def currency(self): @@ -152,6 +161,29 @@ def borrowed(self, borrowed): self._borrowed = borrowed + @property + def interest(self): + """Gets the interest of this MarginAccountCurrency. # noqa: E501 + + Interests unpaid # noqa: E501 + + :return: The interest of this MarginAccountCurrency. # noqa: E501 + :rtype: str + """ + return self._interest + + @interest.setter + def interest(self, interest): + """Sets the interest of this MarginAccountCurrency. + + Interests unpaid # noqa: E501 + + :param interest: The interest of this MarginAccountCurrency. # noqa: E501 + :type: str + """ + + self._interest = interest + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/gate_api/models/order.py b/gate_api/models/order.py index 84ee75f..a8050a7 100644 --- a/gate_api/models/order.py +++ b/gate_api/models/order.py @@ -37,6 +37,8 @@ class Order(object): 'text': 'str', 'create_time': 'str', 'update_time': 'str', + 'create_time_ms': 'int', + 'update_time_ms': 'int', 'status': 'str', 'currency_pair': 'str', 'type': 'str', @@ -47,6 +49,7 @@ class Order(object): 'time_in_force': 'str', 'iceberg': 'str', 'auto_borrow': 'bool', + 'auto_repay': 'bool', 'left': 'str', 'fill_price': 'str', 'filled_total': 'str', @@ -64,6 +67,8 @@ class Order(object): 'text': 'text', 'create_time': 'create_time', 'update_time': 'update_time', + 'create_time_ms': 'create_time_ms', + 'update_time_ms': 'update_time_ms', 'status': 'status', 'currency_pair': 'currency_pair', 'type': 'type', @@ -74,6 +79,7 @@ class Order(object): 'time_in_force': 'time_in_force', 'iceberg': 'iceberg', 'auto_borrow': 'auto_borrow', + 'auto_repay': 'auto_repay', 'left': 'left', 'fill_price': 'fill_price', 'filled_total': 'filled_total', @@ -92,6 +98,8 @@ def __init__( text=None, create_time=None, update_time=None, + create_time_ms=None, + update_time_ms=None, status=None, currency_pair=None, type='limit', @@ -102,6 +110,7 @@ def __init__( time_in_force='gtc', iceberg=None, auto_borrow=None, + auto_repay=None, left=None, fill_price=None, filled_total=None, @@ -114,7 +123,7 @@ def __init__( rebated_fee_currency=None, local_vars_configuration=None, ): # noqa: E501 - # type: (str, str, str, str, str, str, str, str, str, str, str, str, str, bool, str, str, str, str, str, str, str, bool, str, str, Configuration) -> None + # type: (str, str, str, str, int, int, str, str, str, str, str, str, str, str, str, bool, bool, str, str, str, str, str, str, str, bool, str, str, Configuration) -> None """Order - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -124,6 +133,8 @@ def __init__( self._text = None self._create_time = None self._update_time = None + self._create_time_ms = None + self._update_time_ms = None self._status = None self._currency_pair = None self._type = None @@ -134,6 +145,7 @@ def __init__( self._time_in_force = None self._iceberg = None self._auto_borrow = None + self._auto_repay = None self._left = None self._fill_price = None self._filled_total = None @@ -154,6 +166,10 @@ def __init__( self.create_time = create_time if update_time is not None: self.update_time = update_time + if create_time_ms is not None: + self.create_time_ms = create_time_ms + if update_time_ms is not None: + self.update_time_ms = update_time_ms if status is not None: self.status = status self.currency_pair = currency_pair @@ -170,6 +186,8 @@ def __init__( self.iceberg = iceberg if auto_borrow is not None: self.auto_borrow = auto_borrow + if auto_repay is not None: + self.auto_repay = auto_repay if left is not None: self.left = left if fill_price is not None: @@ -283,6 +301,52 @@ def update_time(self, update_time): self._update_time = update_time + @property + def create_time_ms(self): + """Gets the create_time_ms of this Order. # noqa: E501 + + Order creation time in milliseconds # noqa: E501 + + :return: The create_time_ms of this Order. # noqa: E501 + :rtype: int + """ + return self._create_time_ms + + @create_time_ms.setter + def create_time_ms(self, create_time_ms): + """Sets the create_time_ms of this Order. + + Order creation time in milliseconds # noqa: E501 + + :param create_time_ms: The create_time_ms of this Order. # noqa: E501 + :type: int + """ + + self._create_time_ms = create_time_ms + + @property + def update_time_ms(self): + """Gets the update_time_ms of this Order. # noqa: E501 + + Order last modification time in milliseconds # noqa: E501 + + :return: The update_time_ms of this Order. # noqa: E501 + :rtype: int + """ + return self._update_time_ms + + @update_time_ms.setter + def update_time_ms(self, update_time_ms): + """Sets the update_time_ms of this Order. + + Order last modification time in milliseconds # noqa: E501 + + :param update_time_ms: The update_time_ms of this Order. # noqa: E501 + :type: int + """ + + self._update_time_ms = update_time_ms + @property def status(self): """Gets the status of this Order. # noqa: E501 @@ -368,7 +432,7 @@ def type(self, type): def account(self): """Gets the account of this Order. # noqa: E501 - Account type. spot - use spot account; margin - use margin account # noqa: E501 + Account type. spot - use spot account; margin - use margin account; cross_margin - use cross margin account # noqa: E501 :return: The account of this Order. # noqa: E501 :rtype: str @@ -379,12 +443,12 @@ def account(self): def account(self, account): """Sets the account of this Order. - Account type. spot - use spot account; margin - use margin account # noqa: E501 + Account type. spot - use spot account; margin - use margin account; cross_margin - use cross margin account # noqa: E501 :param account: The account of this Order. # noqa: E501 :type: str """ - allowed_values = ["spot", "margin"] # noqa: E501 + allowed_values = ["spot", "margin", "cross_margin"] # noqa: E501 if self.local_vars_configuration.client_side_validation and account not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `account` ({0}), must be one of {1}".format(account, allowed_values) # noqa: E501 @@ -529,7 +593,7 @@ def iceberg(self, iceberg): def auto_borrow(self): """Gets the auto_borrow of this Order. # noqa: E501 - Used in margin trading(i.e. `account` is `margin`) to allow automatic loan of insufficient part if balance is not enough. # noqa: E501 + Used in margin or cross margin trading to allow automatic loan of insufficient amount if balance is not enough. # noqa: E501 :return: The auto_borrow of this Order. # noqa: E501 :rtype: bool @@ -540,7 +604,7 @@ def auto_borrow(self): def auto_borrow(self, auto_borrow): """Sets the auto_borrow of this Order. - Used in margin trading(i.e. `account` is `margin`) to allow automatic loan of insufficient part if balance is not enough. # noqa: E501 + Used in margin or cross margin trading to allow automatic loan of insufficient amount if balance is not enough. # noqa: E501 :param auto_borrow: The auto_borrow of this Order. # noqa: E501 :type: bool @@ -548,6 +612,29 @@ def auto_borrow(self, auto_borrow): self._auto_borrow = auto_borrow + @property + def auto_repay(self): + """Gets the auto_repay of this Order. # noqa: E501 + + Enable or disable automatic repayment for automatic borrow loan generated by cross margin order. Default is disabled. Note that: 1. This field is only effective for cross margin orders. Margin account does not support setting auto repayment for orders. 2. `auto_borrow` and `auto_repay` cannot be both set to true in one order. # noqa: E501 + + :return: The auto_repay of this Order. # noqa: E501 + :rtype: bool + """ + return self._auto_repay + + @auto_repay.setter + def auto_repay(self, auto_repay): + """Sets the auto_repay of this Order. + + Enable or disable automatic repayment for automatic borrow loan generated by cross margin order. Default is disabled. Note that: 1. This field is only effective for cross margin orders. Margin account does not support setting auto repayment for orders. 2. `auto_borrow` and `auto_repay` cannot be both set to true in one order. # noqa: E501 + + :param auto_repay: The auto_repay of this Order. # noqa: E501 + :type: bool + """ + + self._auto_repay = auto_repay + @property def left(self): """Gets the left of this Order. # noqa: E501 diff --git a/gate_api/models/position.py b/gate_api/models/position.py index 02361f6..d81ef73 100644 --- a/gate_api/models/position.py +++ b/gate_api/models/position.py @@ -55,6 +55,7 @@ class Position(object): 'pending_orders': 'int', 'close_order': 'PositionCloseOrder', 'mode': 'str', + 'cross_leverage_limit': 'str', } attribute_map = { @@ -80,6 +81,7 @@ class Position(object): 'pending_orders': 'pending_orders', 'close_order': 'close_order', 'mode': 'mode', + 'cross_leverage_limit': 'cross_leverage_limit', } def __init__( @@ -106,9 +108,10 @@ def __init__( pending_orders=None, close_order=None, mode=None, + cross_leverage_limit=None, local_vars_configuration=None, ): # noqa: E501 - # type: (int, str, int, str, str, str, str, str, str, str, str, str, str, str, str, str, str, str, int, int, PositionCloseOrder, str, Configuration) -> None + # type: (int, str, int, str, str, str, str, str, str, str, str, str, str, str, str, str, str, str, int, int, PositionCloseOrder, str, str, Configuration) -> None """Position - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -136,6 +139,7 @@ def __init__( self._pending_orders = None self._close_order = None self._mode = None + self._cross_leverage_limit = None self.discriminator = None if user is not None: @@ -178,10 +182,11 @@ def __init__( self.adl_ranking = adl_ranking if pending_orders is not None: self.pending_orders = pending_orders - if close_order is not None: - self.close_order = close_order + self.close_order = close_order if mode is not None: self.mode = mode + if cross_leverage_limit is not None: + self.cross_leverage_limit = cross_leverage_limit @property def user(self): @@ -692,6 +697,29 @@ def mode(self, mode): self._mode = mode + @property + def cross_leverage_limit(self): + """Gets the cross_leverage_limit of this Position. # noqa: E501 + + Cross margin leverage(valid only when `leverage` is 0) # noqa: E501 + + :return: The cross_leverage_limit of this Position. # noqa: E501 + :rtype: str + """ + return self._cross_leverage_limit + + @cross_leverage_limit.setter + def cross_leverage_limit(self, cross_leverage_limit): + """Sets the cross_leverage_limit of this Position. + + Cross margin leverage(valid only when `leverage` is 0) # noqa: E501 + + :param cross_leverage_limit: The cross_leverage_limit of this Position. # noqa: E501 + :type: str + """ + + self._cross_leverage_limit = cross_leverage_limit + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/gate_api/models/transfer.py b/gate_api/models/transfer.py index d39c9c1..7f510a0 100644 --- a/gate_api/models/transfer.py +++ b/gate_api/models/transfer.py @@ -130,7 +130,7 @@ def _from(self, _from): """ if self.local_vars_configuration.client_side_validation and _from is None: # noqa: E501 raise ValueError("Invalid value for `_from`, must not be `None`") # noqa: E501 - allowed_values = ["spot", "margin", "futures", "delivery"] # noqa: E501 + allowed_values = ["spot", "margin", "futures", "delivery", "cross_margin"] # noqa: E501 if self.local_vars_configuration.client_side_validation and _from not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `_from` ({0}), must be one of {1}".format(_from, allowed_values) # noqa: E501 @@ -160,7 +160,7 @@ def to(self, to): """ if self.local_vars_configuration.client_side_validation and to is None: # noqa: E501 raise ValueError("Invalid value for `to`, must not be `None`") # noqa: E501 - allowed_values = ["spot", "margin", "futures", "delivery"] # noqa: E501 + allowed_values = ["spot", "margin", "futures", "delivery", "cross_margin"] # noqa: E501 if self.local_vars_configuration.client_side_validation and to not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `to` ({0}), must be one of {1}".format(to, allowed_values) # noqa: E501 diff --git a/setup.cfg b/setup.cfg index f1da9d0..4d8daf3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ long_description = file: README.md long_description_content_type = text/markdown classifiers: - License :: OSI Approved :: Apache-2.0 + License :: OSI Approved :: Apache Software License Programming Language :: Python :: 2 Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 diff --git a/setup.py b/setup.py index d4b6669..5677e09 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "gate-api" -VERSION = "4.20.1" +VERSION = "4.21.2" # To install the library, run the following # # python setup.py install