From 54f310c07d5fe99164a537ed9fa8acafbd96ccea Mon Sep 17 00:00:00 2001 From: Revil Wang Date: Thu, 9 Jul 2020 11:17:01 +0800 Subject: [PATCH 1/3] upgrade codegen cli to v4 --- README.md | 67 +- docs/BatchOrder.md | 31 +- docs/CancelOrder.md | 1 + docs/CancelOrderResult.md | 1 + docs/Contract.md | 1 + docs/CurrencyPair.md | 1 + docs/DeliveryApi.md | 851 ++++++-- docs/DeliveryContract.md | 1 + docs/DeliverySettlement.md | 18 +- docs/FuturesApi.md | 836 ++++++-- docs/FuturesCandlestick.md | 1 + docs/FuturesInitialOrder.md | 4 +- docs/FuturesLiquidate.md | 24 +- docs/FuturesOrder.md | 31 +- docs/FuturesPriceTriggeredOrder.md | 17 +- docs/GateErrorResponse.md | 1 + docs/LedgerRecord.md | 8 +- docs/Loan.md | 17 +- docs/LoanRecord.md | 5 +- docs/MarginAccount.md | 1 + docs/MarginAccountCurrency.md | 1 + docs/MarginApi.md | 488 +++-- docs/Order.md | 31 +- docs/Position.md | 35 +- docs/PositionClose.md | 10 +- docs/PositionCloseOrder.md | 1 + docs/SpotApi.md | 424 +++- docs/SubAccountTransfer.md | 6 +- docs/Transfer.md | 1 + docs/WalletApi.md | 208 +- docs/WithdrawalApi.md | 36 +- gate_api/__init__.py | 8 +- gate_api/api/delivery_api.py | 1860 ++++++++++------ gate_api/api/futures_api.py | 1869 +++++++++++------ gate_api/api/margin_api.py | 898 +++++--- gate_api/api/spot_api.py | 905 +++++--- gate_api/api/wallet_api.py | 374 ++-- gate_api/api/withdrawal_api.py | 56 +- gate_api/api_client.py | 199 +- gate_api/configuration.py | 298 ++- gate_api/exceptions.py | 120 ++ gate_api/models/batch_order.py | 28 +- gate_api/models/cancel_order.py | 18 +- gate_api/models/cancel_order_result.py | 14 +- gate_api/models/contract.py | 18 +- gate_api/models/currency_pair.py | 16 +- gate_api/models/delivery_contract.py | 20 +- gate_api/models/delivery_settlement.py | 14 +- gate_api/models/deposit_address.py | 18 +- gate_api/models/funding_account.py | 14 +- gate_api/models/funding_book_item.py | 14 +- gate_api/models/funding_rate_record.py | 14 +- gate_api/models/futures_account.py | 14 +- gate_api/models/futures_account_book.py | 16 +- gate_api/models/futures_candlestick.py | 14 +- gate_api/models/futures_initial_order.py | 20 +- gate_api/models/futures_liquidate.py | 14 +- gate_api/models/futures_order.py | 26 +- gate_api/models/futures_order_book.py | 18 +- gate_api/models/futures_order_book_item.py | 14 +- gate_api/models/futures_price_trigger.py | 20 +- .../models/futures_price_triggered_order.py | 22 +- gate_api/models/futures_ticker.py | 14 +- gate_api/models/futures_trade.py | 14 +- gate_api/models/gate_error_response.py | 14 +- gate_api/models/insurance_record.py | 14 +- gate_api/models/ledger_record.py | 20 +- gate_api/models/loan.py | 26 +- gate_api/models/loan_patch.py | 22 +- gate_api/models/loan_record.py | 16 +- gate_api/models/margin_account.py | 14 +- gate_api/models/margin_account_currency.py | 14 +- gate_api/models/margin_currency_pair.py | 14 +- gate_api/models/my_futures_trade.py | 16 +- gate_api/models/order.py | 36 +- gate_api/models/order_book.py | 18 +- gate_api/models/position.py | 14 +- gate_api/models/position_close.py | 16 +- gate_api/models/position_close_order.py | 14 +- gate_api/models/repay_request.py | 22 +- gate_api/models/repayment.py | 14 +- gate_api/models/spot_account.py | 14 +- gate_api/models/sub_account_transfer.py | 24 +- gate_api/models/ticker.py | 14 +- gate_api/models/trade.py | 18 +- gate_api/models/transfer.py | 26 +- gate_api/models/trigger_order_response.py | 14 +- gate_api/rest.py | 117 +- git_push.sh | 16 +- requirements.txt | 1 + setup.cfg | 2 + setup.py | 6 +- test-requirements.txt | 8 +- tox.ini | 3 +- 94 files changed, 7290 insertions(+), 3416 deletions(-) create mode 100644 gate_api/exceptions.py create mode 100644 setup.cfg diff --git a/README.md b/README.md index be2d914..3353d99 100644 --- a/README.md +++ b/README.md @@ -3,25 +3,11 @@ 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.14.0 -- Package version: 4.14.0 +- API version: 4.15.0 +- Package version: 4.15.0 - Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit [https://www.gate.io/page/contacts](https://www.gate.io/page/contacts) -## Specific note for 4.8.0 - -**BREAKING** change: - -4.8.0 add new support with different settle currency for futures API(BTC is the only one allowed before), which makes ALL methods in FuturesApi REQUIRE an additional `settle` parameter. - -But previous `/futures/xxx` APIs are still preserved for compatibility usage(will be treated as BTC), so if one of the following condition is met: - -- Changing all your futures method call to include `settle` is not a big issue for you -- You need to use futures settled in non-BTC currency - -then you'd better move to 4.8.0 and changes all your futures method call to pass in `settle` parameter. Otherwise, you can stick to version<=4.7.3, -but will not receive any future API upgrade support - ## Requirements. Python 2.7 and 3.4+ @@ -29,7 +15,7 @@ Python 2.7 and 3.4+ ## Installation & Usage ### pip install -If the python package is hosted on Github, you can install directly from Github +If the python package is hosted on a repository, you can install directly using: ```sh pip install git+https://github.com/gateio/gateapi-python.git @@ -38,7 +24,7 @@ pip install git+https://github.com/gateio/gateapi-python.git Then import the package: ```python -import gate_api +import gate_api ``` ### Setuptools @@ -61,20 +47,28 @@ Please follow the [installation procedure](#installation--usage) and then run th ```python from __future__ import print_function + import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' -# uncomment the next line if using the API with another host -# configuration.host = 'https://some-other-host' -# configuration.proxy = 'http://localhost:1080' # uncomment to proxy through a http proxy -# configuration.verify_ssl = False # uncomment to turn off ssl verification -# More connection configuration is available in `Configuration` model. - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException + +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency order_id = '12345' # str | ID returned on order successfully being created @@ -238,6 +232,17 @@ Class | Method | HTTP request | Description - [TriggerOrderResponse](docs/TriggerOrderResponse.md) +## Documentation For Authorization + + +## apiv4 + +Authentication with APIv4 key and secret + +For details, refer to: +[APIv4 signed request requirements](https://www.gate.io/docs/apiv4/en/index.html#apiv4-signed-request-requirements) + + ## Author support@mail.gate.io diff --git a/docs/BatchOrder.md b/docs/BatchOrder.md index b9e3160..b6dce80 100644 --- a/docs/BatchOrder.md +++ b/docs/BatchOrder.md @@ -1,16 +1,17 @@ # BatchOrder +Batch order details ## Properties 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 16 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) | [optional] +**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] **succeeded** | **bool** | Whether order succeeds | [optional] **label** | **str** | Error label, empty string if order succeeds | [optional] **message** | **str** | Detailed error message, empty string if order succeeds | [optional] -**id** | **str** | Order ID | [optional] -**create_time** | **str** | Order creation time | [optional] -**update_time** | **str** | Order last modification time | [optional] -**status** | **str** | Order status - `open`: to be filled - `closed`: filled - `cancelled`: cancelled | [optional] +**id** | **str** | Order ID | [optional] [readonly] +**create_time** | **str** | Order creation time | [optional] [readonly] +**update_time** | **str** | Order last modification time | [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'] @@ -19,16 +20,16 @@ Name | Type | Description | Notes **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'] **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] -**left** | **str** | Amount left to fill | [optional] -**fill_price** | **str** | Total filled in quote currency. Deprecated in favor of `filled_total` | [optional] -**filled_total** | **str** | Total filled in quote currency | [optional] -**fee** | **str** | Fee deducted | [optional] -**fee_currency** | **str** | Fee currency unit | [optional] -**point_fee** | **str** | Point used to deduct fee | [optional] -**gt_fee** | **str** | GT used to deduct fee | [optional] -**gt_discount** | **bool** | Whether GT fee discount is used | [optional] -**rebated_fee** | **str** | Rebated fee | [optional] -**rebated_fee_currency** | **str** | Rebated fee currency unit | [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] +**fee** | **str** | Fee deducted | [optional] [readonly] +**fee_currency** | **str** | Fee currency unit | [optional] [readonly] +**point_fee** | **str** | Point used to deduct fee | [optional] [readonly] +**gt_fee** | **str** | GT used to deduct fee | [optional] [readonly] +**gt_discount** | **bool** | Whether GT fee discount is used | [optional] [readonly] +**rebated_fee** | **str** | Rebated fee | [optional] [readonly] +**rebated_fee_currency** | **str** | Rebated fee currency unit | [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/CancelOrder.md b/docs/CancelOrder.md index bd7bb48..40c482e 100644 --- a/docs/CancelOrder.md +++ b/docs/CancelOrder.md @@ -1,5 +1,6 @@ # CancelOrder +Info of order to be cancelled ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/docs/CancelOrderResult.md b/docs/CancelOrderResult.md index 3ebaa54..7a0d514 100644 --- a/docs/CancelOrderResult.md +++ b/docs/CancelOrderResult.md @@ -1,5 +1,6 @@ # CancelOrderResult +Order cancellation result ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/docs/Contract.md b/docs/Contract.md index 9ee2f6a..207b653 100644 --- a/docs/Contract.md +++ b/docs/Contract.md @@ -1,5 +1,6 @@ # Contract +Futures contract details ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/docs/CurrencyPair.md b/docs/CurrencyPair.md index 40bf7a0..58dd3e0 100644 --- a/docs/CurrencyPair.md +++ b/docs/CurrencyPair.md @@ -1,5 +1,6 @@ # CurrencyPair +Spot currency pair ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/docs/DeliveryApi.md b/docs/DeliveryApi.md index c28f7e9..23cecc6 100644 --- a/docs/DeliveryApi.md +++ b/docs/DeliveryApi.md @@ -41,17 +41,28 @@ Cancel a single order ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency order_id = '12345' # str | ID returned on order successfully being created @@ -76,13 +87,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Order details | - | + [[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_delivery_orders** @@ -94,17 +110,28 @@ Zero-fill order cannot be retrieved 60 seconds after cancellation ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract side = 'ask' # str | All bids or asks. Both included in not specified (optional) @@ -131,13 +158,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | All orders matched cancelled | - | + [[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_price_triggered_delivery_order** @@ -147,17 +179,28 @@ Cancel a single order ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency order_id = 'order_id_example' # str | ID returned on order successfully being created @@ -182,13 +225,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Auto order detail | - | + [[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_price_triggered_delivery_order_list** @@ -198,17 +246,28 @@ Cancel all open orders ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USD' # str | Futures contract @@ -233,13 +292,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Batch cancellation request accepted. Query order status by listing orders | - | + [[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_delivery_order** @@ -251,19 +315,30 @@ Zero-fill order cannot be retrieved 60 seconds after cancellation ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -futures_order = gate_api.FuturesOrder() # FuturesOrder | +futures_order = {"id":15675394,"user":100000,"contract":"BTC_USD","create_time":1546569968,"size":6024,"iceberg":0,"left":6024,"price":"3765","fill_price":"0","mkfr":"-0.00025","tkfr":"0.00075","tif":"gtc","refu":0,"is_reduce_only":false,"is_close":false,"is_liq":false,"text":"t-my-custom-id","status":"finished","finish_time":1514764900,"finish_as":"cancelled"} # FuturesOrder | try: # Create a futures order @@ -286,13 +361,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Order details | - | + [[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_price_triggered_delivery_order** @@ -302,19 +382,30 @@ Create a price-triggered order ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -futures_price_triggered_order = gate_api.FuturesPriceTriggeredOrder() # FuturesPriceTriggeredOrder | +futures_price_triggered_order = {"initial":{"contract":"BTC_USD","size":100,"price":"5.03","close":false,"tif":"gtc","text":"web"},"trigger":{"strategy_type":0,"price_type":0,"price":"3000","rule":1,"expiration":86400},"id":1283293,"user":1234,"create_time":1514764800,"finish_time":1514764900,"trade_id":13566,"status":"finished","finish_as":"cancelled","reason":""} # FuturesPriceTriggeredOrder | try: # Create a price-triggered order @@ -337,13 +428,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Order created | - | + [[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_delivery_contract** @@ -356,10 +452,16 @@ Get a single contract ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.DeliveryApi() +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract @@ -391,6 +493,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Contract information | - | + [[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_delivery_order** @@ -402,17 +509,28 @@ Zero-fill order cannot be retrieved 60 seconds after cancellation ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency order_id = '12345' # str | ID returned on order successfully being created @@ -437,13 +555,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Order details | - | + [[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_delivery_position** @@ -453,17 +576,28 @@ Get single position ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract @@ -488,13 +622,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Position information | - | + [[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_my_delivery_trades** @@ -504,17 +643,28 @@ List personal trading history ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) order = 12345 # int | Futures order ID, return related data only if specified (optional) @@ -549,13 +699,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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 | * X-Pagination-Limit - Request limit specified
* X-Pagination-Offset - Request offset specified
* X-Pagination-Total - Total number matched. Only returned on `count_total` set to 1
| + [[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_price_triggered_delivery_order** @@ -565,17 +720,28 @@ Get a single order ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency order_id = 'order_id_example' # str | ID returned on order successfully being created @@ -600,13 +766,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Auto order detail | - | + [[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_delivery_account_book** @@ -616,17 +787,28 @@ Query account book ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) _from = 1547706332 # int | Start timestamp (optional) @@ -657,13 +839,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_delivery_accounts** @@ -673,17 +860,28 @@ Query futures account ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency try: @@ -706,13 +904,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_delivery_candlesticks** @@ -727,10 +930,16 @@ Return specified contract candlesticks. If prefix `contract` with `mark_`, the c ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.DeliveryApi() +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract _from = 1546905600 # float | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) @@ -770,6 +979,11 @@ No authorization required - **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_delivery_contracts** @@ -782,10 +996,16 @@ List all futures contracts ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.DeliveryApi() +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency try: @@ -815,6 +1035,11 @@ No authorization required - **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) # **list_delivery_insurance_ledger** @@ -827,10 +1052,16 @@ Futures insurance balance history ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.DeliveryApi() +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) @@ -862,6 +1093,11 @@ No authorization required - **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_delivery_liquidates** @@ -871,17 +1107,28 @@ List liquidation history ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) @@ -910,13 +1157,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_delivery_order_book** @@ -931,10 +1183,16 @@ Bids will be sorted by price from high to low, while asks sorted reversely ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.DeliveryApi() +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract interval = '0' # str | Order depth. 0 means no aggregation is applied. default to 0 (optional) (default to '0') @@ -970,6 +1228,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Order book 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_delivery_orders** @@ -981,17 +1244,28 @@ Zero-fill order cannot be retrieved 60 seconds after cancellation ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency status = 'open' # str | List orders based on status contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) @@ -1026,13 +1300,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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 | * X-Pagination-Limit - Request limit specified
* X-Pagination-Offset - Request offset specified
* X-Pagination-Total - Total number matched. Only returned on `count_total` set to 1
| + [[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_delivery_position_close** @@ -1042,17 +1321,28 @@ List position close history ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) @@ -1079,13 +1369,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_delivery_positions** @@ -1095,17 +1390,28 @@ List all positions of a user ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency try: @@ -1128,13 +1434,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_delivery_settlements** @@ -1144,17 +1455,28 @@ List settlement history ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) @@ -1183,13 +1505,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_delivery_tickers** @@ -1202,10 +1529,16 @@ List futures tickers ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.DeliveryApi() +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) @@ -1237,6 +1570,11 @@ No authorization required - **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_delivery_trades** @@ -1249,10 +1587,16 @@ Futures trading history ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.DeliveryApi() +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) @@ -1292,6 +1636,11 @@ No authorization required - **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) # **list_price_triggered_delivery_orders** @@ -1301,17 +1650,28 @@ List all auto orders ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency status = 'status_example' # str | List orders based on status contract = 'BTC_USD' # str | Futures contract, return related data only if specified (optional) @@ -1342,13 +1702,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **update_delivery_position_leverage** @@ -1358,17 +1723,28 @@ Update position leverage ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract leverage = '10' # str | New position leverage @@ -1395,13 +1771,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Position information | - | + [[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_delivery_position_margin** @@ -1411,17 +1792,28 @@ Update position margin ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract change = '0.01' # str | Margin change. Use positive number to increase margin, negative number otherwise. @@ -1448,13 +1840,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Position information | - | + [[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_delivery_position_risk_limit** @@ -1464,17 +1861,28 @@ Update position risk limit ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.DeliveryApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract risk_limit = '10' # str | New position risk limit @@ -1501,12 +1909,17 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Position information | - | + [[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/DeliveryContract.md b/docs/DeliveryContract.md index 15b709d..004f877 100644 --- a/docs/DeliveryContract.md +++ b/docs/DeliveryContract.md @@ -1,5 +1,6 @@ # DeliveryContract +Futures contract details ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/docs/DeliverySettlement.md b/docs/DeliverySettlement.md index 7b04e20..06a479a 100644 --- a/docs/DeliverySettlement.md +++ b/docs/DeliverySettlement.md @@ -3,15 +3,15 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**time** | **int** | Liquidation time | [optional] -**contract** | **str** | Futures contract | [optional] -**leverage** | **str** | Position leverage | [optional] -**size** | **int** | Position size | [optional] -**margin** | **str** | Position margin | [optional] -**entry_price** | **str** | Average entry price | [optional] -**settle_price** | **str** | Settled price | [optional] -**profit** | **str** | Profit | [optional] -**fee** | **str** | Fee deducted | [optional] +**time** | **int** | Liquidation time | [optional] [readonly] +**contract** | **str** | Futures contract | [optional] [readonly] +**leverage** | **str** | Position leverage | [optional] [readonly] +**size** | **int** | Position size | [optional] [readonly] +**margin** | **str** | Position margin | [optional] [readonly] +**entry_price** | **str** | Average entry price | [optional] [readonly] +**settle_price** | **str** | Settled price | [optional] [readonly] +**profit** | **str** | Profit | [optional] [readonly] +**fee** | **str** | Fee deducted | [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/FuturesApi.md b/docs/FuturesApi.md index adb8ee6..c8e0592 100644 --- a/docs/FuturesApi.md +++ b/docs/FuturesApi.md @@ -41,17 +41,28 @@ Cancel a single order ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') order_id = '12345' # str | ID returned on order successfully being created @@ -76,13 +87,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Order details | - | + [[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_futures_orders** @@ -94,17 +110,28 @@ Zero-fill order cannot be retrieved 60 seconds after cancellation ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract side = 'ask' # str | All bids or asks. Both included in not specified (optional) @@ -131,13 +158,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | All orders matched cancelled | - | + [[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_price_triggered_order** @@ -147,17 +179,28 @@ Cancel a single order ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') order_id = 'order_id_example' # str | ID returned on order successfully being created @@ -182,13 +225,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Auto order detail | - | + [[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_price_triggered_order_list** @@ -198,17 +246,28 @@ Cancel all open orders ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract @@ -233,13 +292,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Batch cancellation request accepted. Query order status by listing orders | - | + [[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_futures_order** @@ -251,19 +315,30 @@ Zero-fill order cannot be retrieved 60 seconds after cancellation ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -futures_order = gate_api.FuturesOrder() # FuturesOrder | +futures_order = {"id":15675394,"user":100000,"contract":"BTC_USD","create_time":1546569968,"size":6024,"iceberg":0,"left":6024,"price":"3765","fill_price":"0","mkfr":"-0.00025","tkfr":"0.00075","tif":"gtc","refu":0,"is_reduce_only":false,"is_close":false,"is_liq":false,"text":"t-my-custom-id","status":"finished","finish_time":1514764900,"finish_as":"cancelled"} # FuturesOrder | try: # Create a futures order @@ -286,13 +361,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Order details | - | + [[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_price_triggered_order** @@ -302,19 +382,30 @@ Create a price-triggered order ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -futures_price_triggered_order = gate_api.FuturesPriceTriggeredOrder() # FuturesPriceTriggeredOrder | +futures_price_triggered_order = {"initial":{"contract":"BTC_USD","size":100,"price":"5.03","close":false,"tif":"gtc","text":"web"},"trigger":{"strategy_type":0,"price_type":0,"price":"3000","rule":1,"expiration":86400},"id":1283293,"user":1234,"create_time":1514764800,"finish_time":1514764900,"trade_id":13566,"status":"finished","finish_as":"cancelled","reason":""} # FuturesPriceTriggeredOrder | try: # Create a price-triggered order @@ -337,13 +428,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Order created | - | + [[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_futures_contract** @@ -356,10 +452,16 @@ Get a single contract ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.FuturesApi() +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract @@ -391,6 +493,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Contract information | - | + [[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_futures_order** @@ -402,17 +509,28 @@ Zero-fill order cannot be retrieved 60 seconds after cancellation ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') order_id = '12345' # str | ID returned on order successfully being created @@ -437,13 +555,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Order details | - | + [[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_my_trades** @@ -453,17 +576,28 @@ List personal trading history ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract, return related data only if specified (optional) order = 12345 # int | Futures order ID, return related data only if specified (optional) @@ -498,13 +632,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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 | * X-Pagination-Limit - Request limit specified
* X-Pagination-Offset - Request offset specified
* X-Pagination-Total - Total number matched. Only returned on `count_total` set to 1
| + [[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_position** @@ -514,17 +653,28 @@ Get single position ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract @@ -549,13 +699,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Position information | - | + [[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_price_triggered_order** @@ -565,17 +720,28 @@ Get a single order ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') order_id = 'order_id_example' # str | ID returned on order successfully being created @@ -600,13 +766,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Auto order detail | - | + [[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_futures_account_book** @@ -616,17 +787,28 @@ Query account book ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) _from = 1547706332 # int | Start timestamp (optional) @@ -657,13 +839,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_futures_accounts** @@ -673,17 +860,28 @@ Query futures account ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') try: @@ -706,13 +904,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_futures_candlesticks** @@ -727,10 +930,16 @@ Return specified contract candlesticks. If prefix `contract` with `mark_`, the c ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.FuturesApi() +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract _from = 1546905600 # float | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) @@ -770,6 +979,11 @@ No authorization required - **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_futures_contracts** @@ -782,10 +996,16 @@ List all futures contracts ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.FuturesApi() +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') try: @@ -815,6 +1035,11 @@ No authorization required - **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) # **list_futures_funding_rate_history** @@ -827,10 +1052,16 @@ Funding rate history ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.FuturesApi() +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) @@ -864,6 +1095,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | History 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_futures_insurance_ledger** @@ -876,10 +1112,16 @@ Futures insurance balance history ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.FuturesApi() +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) @@ -911,6 +1153,11 @@ No authorization required - **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_futures_order_book** @@ -925,10 +1172,16 @@ Bids will be sorted by price from high to low, while asks sorted reversely ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.FuturesApi() +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract interval = '0' # str | Order depth. 0 means no aggregation is applied. default to 0 (optional) (default to '0') @@ -964,6 +1217,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Order book 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_futures_orders** @@ -975,17 +1233,28 @@ Zero-fill order cannot be retrieved 60 seconds after cancellation ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract status = 'open' # str | List orders based on status @@ -1020,13 +1289,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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 | * X-Pagination-Limit - Request limit specified
* X-Pagination-Offset - Request offset specified
* X-Pagination-Total - Total number matched. Only returned on `count_total` set to 1
| + [[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_futures_tickers** @@ -1039,10 +1313,16 @@ List futures tickers ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.FuturesApi() +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract, return related data only if specified (optional) @@ -1074,6 +1354,11 @@ No authorization required - **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_futures_trades** @@ -1086,10 +1371,16 @@ Futures trading history ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.FuturesApi() +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) @@ -1129,6 +1420,11 @@ No authorization required - **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) # **list_liquidates** @@ -1138,17 +1434,28 @@ List liquidation history ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract, return related data only if specified (optional) limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) @@ -1177,13 +1484,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_position_close** @@ -1193,17 +1505,28 @@ List position close history ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract, return related data only if specified (optional) limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) @@ -1230,13 +1553,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_positions** @@ -1246,17 +1574,28 @@ List all positions of a user ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') try: @@ -1279,13 +1618,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_price_triggered_orders** @@ -1295,17 +1639,28 @@ List all auto orders ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') status = 'status_example' # str | List orders based on status contract = 'BTC_USD' # str | Futures contract, return related data only if specified (optional) @@ -1336,13 +1691,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **update_position_leverage** @@ -1352,17 +1712,28 @@ Update position leverage ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract leverage = '10' # str | New position leverage @@ -1389,13 +1760,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Position information | - | + [[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_margin** @@ -1405,17 +1781,28 @@ Update position margin ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract change = '0.01' # str | Margin change. Use positive number to increase margin, negative number otherwise. @@ -1442,13 +1829,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Position information | - | + [[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_risk_limit** @@ -1458,17 +1850,28 @@ Update position risk limit ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.FuturesApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract risk_limit = '10' # str | New position risk limit @@ -1495,12 +1898,17 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Position information | - | + [[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/FuturesCandlestick.md b/docs/FuturesCandlestick.md index 9602dfb..5d73a6b 100644 --- a/docs/FuturesCandlestick.md +++ b/docs/FuturesCandlestick.md @@ -1,5 +1,6 @@ # FuturesCandlestick +data point in every timestamp ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/docs/FuturesInitialOrder.md b/docs/FuturesInitialOrder.md index e40508e..07521e7 100644 --- a/docs/FuturesInitialOrder.md +++ b/docs/FuturesInitialOrder.md @@ -10,8 +10,8 @@ Name | Type | Description | Notes **tif** | **str** | Time in force. If using market price, only `ioc` is supported. - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled | [optional] [default to 'gtc'] **text** | **str** | How the order is created. Possible values are: web, api and app | [optional] **reduce_only** | **bool** | Set to true to create an reduce-only order | [optional] [default to False] -**is_reduce_only** | **bool** | Is the order reduce-only | [optional] -**is_close** | **bool** | Is the order to close position | [optional] +**is_reduce_only** | **bool** | Is the order reduce-only | [optional] [readonly] +**is_close** | **bool** | Is the order to close position | [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/FuturesLiquidate.md b/docs/FuturesLiquidate.md index da65736..fc66f59 100644 --- a/docs/FuturesLiquidate.md +++ b/docs/FuturesLiquidate.md @@ -3,18 +3,18 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**time** | **int** | Liquidation time | [optional] -**contract** | **str** | Futures contract | [optional] -**leverage** | **str** | Position leverage | [optional] -**size** | **int** | Position size | [optional] -**margin** | **str** | Position margin | [optional] -**entry_price** | **str** | Average entry price | [optional] -**liq_price** | **str** | Liquidation price | [optional] -**mark_price** | **str** | Mark price | [optional] -**order_id** | **int** | Liquidation order ID | [optional] -**order_price** | **str** | Liquidation order price | [optional] -**fill_price** | **str** | Liquidation order average taker price | [optional] -**left** | **int** | Liquidation order maker size | [optional] +**time** | **int** | Liquidation time | [optional] [readonly] +**contract** | **str** | Futures contract | [optional] [readonly] +**leverage** | **str** | Position leverage | [optional] [readonly] +**size** | **int** | Position size | [optional] [readonly] +**margin** | **str** | Position margin | [optional] [readonly] +**entry_price** | **str** | Average entry price | [optional] [readonly] +**liq_price** | **str** | Liquidation price | [optional] [readonly] +**mark_price** | **str** | Mark price | [optional] [readonly] +**order_id** | **int** | Liquidation order ID | [optional] [readonly] +**order_price** | **str** | Liquidation order price | [optional] [readonly] +**fill_price** | **str** | Liquidation order average taker price | [optional] [readonly] +**left** | **int** | Liquidation order maker size | [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/FuturesOrder.md b/docs/FuturesOrder.md index a58fc57..9953129 100644 --- a/docs/FuturesOrder.md +++ b/docs/FuturesOrder.md @@ -1,30 +1,31 @@ # FuturesOrder +Futures order details ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | Futures order ID | [optional] -**user** | **int** | User ID | [optional] -**create_time** | **float** | Order creation time | [optional] -**finish_time** | **float** | Order finished time. Not returned if order is open | [optional] -**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] -**status** | **str** | Order status - `open`: waiting to be traded - `finished`: finished | [optional] +**id** | **int** | Futures order ID | [optional] [readonly] +**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] +**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 | [optional] **iceberg** | **int** | Display size for iceberg order. 0 for non-iceberg. Note that you would pay the taker fee for the hidden size | [optional] **price** | **str** | Order price. 0 for market order with `tif` set as `ioc` | [optional] **close** | **bool** | Set as `true` to close the position, with `size` set to 0 | [optional] [default to False] -**is_close** | **bool** | Is the order to close position | [optional] +**is_close** | **bool** | Is the order to close position | [optional] [readonly] **reduce_only** | **bool** | Set as `true` to be reduce-only order | [optional] [default to False] -**is_reduce_only** | **bool** | Is the order reduce-only | [optional] -**is_liq** | **bool** | Is the order for liquidation | [optional] +**is_reduce_only** | **bool** | Is the order reduce-only | [optional] [readonly] +**is_liq** | **bool** | Is the order for liquidation | [optional] [readonly] **tif** | **str** | Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, reduce-only | [optional] [default to 'gtc'] -**left** | **int** | Size left to be traded | [optional] -**fill_price** | **str** | Fill price of the order | [optional] -**text** | **str** | User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 16 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) Besides user defined information, reserved contents are listed below, denoting how the order is created: - web: from web - api: from API - app: from mobile phones - auto_deleveraging: from ADL - liquidation: from liquidation - insurance: from insurance | [optional] -**tkfr** | **str** | Taker fee | [optional] -**mkfr** | **str** | Maker fee | [optional] -**refu** | **int** | Reference user ID | [optional] +**left** | **int** | Size left to be traded | [optional] [readonly] +**fill_price** | **str** | Fill price of the order | [optional] [readonly] +**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(.) Besides user defined information, reserved contents are listed below, denoting how the order is created: - web: from web - api: from API - app: from mobile phones - auto_deleveraging: from ADL - liquidation: from liquidation - insurance: from insurance | [optional] +**tkfr** | **str** | Taker fee | [optional] [readonly] +**mkfr** | **str** | Maker fee | [optional] [readonly] +**refu** | **int** | Reference user ID | [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/FuturesPriceTriggeredOrder.md b/docs/FuturesPriceTriggeredOrder.md index 308b196..f018dc7 100644 --- a/docs/FuturesPriceTriggeredOrder.md +++ b/docs/FuturesPriceTriggeredOrder.md @@ -1,18 +1,19 @@ # FuturesPriceTriggeredOrder +Futures order details ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **initial** | [**FuturesInitialOrder**](FuturesInitialOrder.md) | | **trigger** | [**FuturesPriceTrigger**](FuturesPriceTrigger.md) | | -**id** | **int** | Auto order ID | [optional] -**user** | **int** | User ID | [optional] -**create_time** | **float** | Creation time | [optional] -**finish_time** | **float** | Finished time | [optional] -**trade_id** | **int** | ID of the newly created order on condition triggered | [optional] -**status** | **str** | Order status. | [optional] -**finish_as** | **str** | How order is finished | [optional] -**reason** | **str** | Extra messages of how order is finished | [optional] +**id** | **int** | Auto order ID | [optional] [readonly] +**user** | **int** | User ID | [optional] [readonly] +**create_time** | **float** | Creation time | [optional] [readonly] +**finish_time** | **float** | Finished time | [optional] [readonly] +**trade_id** | **int** | ID of the newly created order on condition triggered | [optional] [readonly] +**status** | **str** | Order status. | [optional] [readonly] +**finish_as** | **str** | How order is finished | [optional] [readonly] +**reason** | **str** | Extra messages of how order is finished | [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/GateErrorResponse.md b/docs/GateErrorResponse.md index 9cb36b0..1fc4dbe 100644 --- a/docs/GateErrorResponse.md +++ b/docs/GateErrorResponse.md @@ -1,5 +1,6 @@ # GateErrorResponse +error response body format when status code is non-2xx ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/docs/LedgerRecord.md b/docs/LedgerRecord.md index a5ba712..b584342 100644 --- a/docs/LedgerRecord.md +++ b/docs/LedgerRecord.md @@ -3,14 +3,14 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **str** | Record ID | [optional] -**txid** | **str** | Hash record of the withdrawal | [optional] -**timestamp** | **str** | Record time | [optional] +**id** | **str** | Record ID | [optional] [readonly] +**txid** | **str** | Hash record of the withdrawal | [optional] [readonly] +**timestamp** | **str** | Record time | [optional] [readonly] **amount** | **str** | Trade amount | **currency** | **str** | Record currency | **address** | **str** | Withdrawal address. Required for withdrawals | [optional] **memo** | **str** | Extra withdrawal memo | [optional] -**status** | **str** | Record status. - DONE: done - CANCEL: cancelled - REQUEST: requesting - MANUAL: waiting for manual approval - BCODE: GateCode operation | [optional] +**status** | **str** | Record status. - DONE: done - CANCEL: cancelled - REQUEST: requesting - MANUAL: waiting for manual approval - BCODE: GateCode operation | [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/Loan.md b/docs/Loan.md index 00afde2..6b291a6 100644 --- a/docs/Loan.md +++ b/docs/Loan.md @@ -1,12 +1,13 @@ # Loan +Margin loan details ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **str** | Loan ID | [optional] -**create_time** | **str** | Creation time | [optional] -**expire_time** | **str** | Repay time of the loan. No value will be returned for lending loan | [optional] -**status** | **str** | Loan status open - not fully loaned loaned - all loaned out for lending loan; loaned in for borrowing side finished - loan is finished, either being all repaid or cancelled by the lender auto_repaid - automatically repaid by the system | [optional] +**id** | **str** | Loan ID | [optional] [readonly] +**create_time** | **str** | Creation time | [optional] [readonly] +**expire_time** | **str** | Repay time of the loan. No value will be returned for lending loan | [optional] [readonly] +**status** | **str** | Loan status open - not fully loaned loaned - all loaned out for lending loan; loaned in for borrowing side finished - loan is finished, either being all repaid or cancelled by the lender auto_repaid - automatically repaid by the system | [optional] [readonly] **side** | **str** | Loan side | **currency** | **str** | Loan currency | **rate** | **str** | Loan rate. Only rates in [0.0002, 0.002] are supported. Not required in lending. Market rate calculated from recent rates will be used if not set | [optional] @@ -14,10 +15,10 @@ Name | Type | Description | Notes **days** | **int** | Loan days | **auto_renew** | **bool** | Auto renew the loan on expiration | [optional] [default to False] **currency_pair** | **str** | Currency pair. Required for borrowing side | [optional] -**left** | **str** | Amount not lending out | [optional] -**repaid** | **str** | Repaid amount | [optional] -**paid_interest** | **str** | Repaid interest | [optional] -**unpaid_interest** | **str** | Interest not repaid | [optional] +**left** | **str** | Amount not lending out | [optional] [readonly] +**repaid** | **str** | Repaid amount | [optional] [readonly] +**paid_interest** | **str** | Repaid interest | [optional] [readonly] +**unpaid_interest** | **str** | Interest not repaid | [optional] [readonly] **fee_rate** | **str** | Loan fee rate | [optional] **orig_id** | **str** | Original loan ID if the loan is auto-renewed. Equal to `id` if not | [optional] diff --git a/docs/LoanRecord.md b/docs/LoanRecord.md index 370ebb6..fe8214b 100644 --- a/docs/LoanRecord.md +++ b/docs/LoanRecord.md @@ -1,5 +1,6 @@ # LoanRecord +Margin loaned record details ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- @@ -15,8 +16,8 @@ Name | Type | Description | Notes **days** | **int** | Loan days | [optional] **auto_renew** | **bool** | Whether the record will auto renew on expiration | [optional] [default to False] **repaid** | **str** | Repaid amount | [optional] -**paid_interest** | **str** | Repaid interest | [optional] -**unpaid_interest** | **str** | Interest not repaid | [optional] +**paid_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/MarginAccount.md b/docs/MarginAccount.md index 945e489..313e1b2 100644 --- a/docs/MarginAccount.md +++ b/docs/MarginAccount.md @@ -1,5 +1,6 @@ # MarginAccount +Margin account detail. `base` refers to base currency, while `quotes to quote currency ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/docs/MarginAccountCurrency.md b/docs/MarginAccountCurrency.md index 56c4e2f..74f3224 100644 --- a/docs/MarginAccountCurrency.md +++ b/docs/MarginAccountCurrency.md @@ -1,5 +1,6 @@ # MarginAccountCurrency +Account currency detail ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/docs/MarginApi.md b/docs/MarginApi.md index cb34ef5..acd2fa7 100644 --- a/docs/MarginApi.md +++ b/docs/MarginApi.md @@ -30,17 +30,28 @@ Only lending loans can be cancelled ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.MarginApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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 | Loan ID currency = 'BTC' # str | Retrieved specified currency related data @@ -65,13 +76,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Order cancelled | - | + [[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_loan** @@ -81,18 +97,29 @@ Lend or borrow ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.MarginApi(gate_api.ApiClient(configuration)) -loan = gate_api.Loan() # Loan | +from gate_api.exceptions import ApiException +# 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":"123435","create_time":"1548000000","expire_time":"1548100000","side":"borrow","status":"loaned","currency":"BTC","rate":"0.002","amount":"1.5","days":10,"auto_renew":true,"currency_pair":"ETH_BTC","left":"0","repaid":"0","paid_interest":"0","unpaid_interest":"0","fee_rate":"0.18","orig_id":"123424"} # Loan | try: # Lend or borrow @@ -114,13 +141,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Loan created | - | + [[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_loan** @@ -130,17 +162,28 @@ Retrieve one single loan detail ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.MarginApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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 | Loan ID side = 'lend' # str | Lend or borrow @@ -165,13 +208,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **get_loan_record** @@ -181,17 +229,28 @@ Get one single loan record ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.MarginApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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_record_id = '12345' # str | Loan record ID loan_id = '12345' # str | Loan ID @@ -216,13 +275,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Detail 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_funding_accounts** @@ -232,17 +296,28 @@ Funding account list ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.MarginApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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 | Retrieved specified currency related data (optional) try: @@ -265,13 +340,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_funding_book** @@ -284,10 +364,16 @@ Order book of lending loans ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.MarginApi() +from gate_api.exceptions import ApiException +# 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 | Retrieved specified currency related data try: @@ -317,6 +403,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Order book 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_loan_records** @@ -326,17 +417,28 @@ List repayment records of specified loan ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.MarginApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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 | Loan ID status = 'loaned' # str | Loan record status (optional) page = 1 # int | Page number (optional) (default to 1) @@ -365,13 +467,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_loan_repayments** @@ -381,17 +488,28 @@ List loan repayment records ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.MarginApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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 | Loan ID try: @@ -414,13 +532,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_loans** @@ -430,23 +553,34 @@ List all loans ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.MarginApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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 = 'open' # str | Loan status side = 'lend' # str | Lend or borrow currency = 'BTC' # str | Retrieved specified currency related data (optional) currency_pair = 'BTC_USDT' # str | Currency pair (optional) sort_by = 'rate' # str | Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` (optional) -reverse_sort = True # bool | Whether to sort in descending order. Default to `true` (optional) +reverse_sort = false # bool | Whether to sort in descending order. Default to `true` (optional) page = 1 # int | Page number (optional) (default to 1) limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) @@ -477,13 +611,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_margin_accounts** @@ -493,17 +632,28 @@ Margin account list ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.MarginApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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_pair = 'BTC_USDT' # str | Currency pair (optional) try: @@ -526,13 +676,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_margin_currency_pairs** @@ -545,10 +700,16 @@ List all supported currency pairs supported in margin trading ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException +from gate_api.exceptions import ApiException +# 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" +) -# create an instance of the API class -api_instance = gate_api.MarginApi() +api_client = gate_api.ApiClient(configuration) +# Create an instance of the API class +api_instance = gate_api.MarginApi(api_client) try: # List all supported currency pairs supported in margin trading @@ -574,6 +735,11 @@ No authorization required - **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) # **merge_loans** @@ -583,17 +749,28 @@ Merge multiple lending loans ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.MarginApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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 | Retrieved specified currency related data ids = '123,234,345' # str | Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request @@ -618,13 +795,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Loans merged | - | + [[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_loan** @@ -634,19 +816,30 @@ Repay a loan ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.MarginApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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 | Loan ID -repay_request = gate_api.RepayRequest() # RepayRequest | +repay_request = {"currency_pair":"ETH_BTC","currency":"ETH","mode":"partial","amount":"100"} # RepayRequest | try: # Repay a loan @@ -669,13 +862,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **update_loan** @@ -687,19 +885,30 @@ Only `auto_renew` modification is supported currently ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.MarginApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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 | Loan ID -loan_patch = gate_api.LoanPatch() # LoanPatch | +loan_patch = {"currency":"BTC","side":"borrow","currency_pair":"BTC_USDT","auto_renew":false} # LoanPatch | try: # Modify a loan @@ -722,13 +931,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Updated | - | + [[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_loan_record** @@ -740,19 +954,30 @@ Only `auto_renew` modification is supported currently ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.MarginApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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_record_id = '12345' # str | Loan record ID -loan_patch = gate_api.LoanPatch() # LoanPatch | +loan_patch = {"currency":"BTC","side":"borrow","currency_pair":"BTC_USDT","auto_renew":false} # LoanPatch | try: # Modify a loan record @@ -775,12 +1000,17 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Loan record updated | - | + [[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 5994852..5a4b242 100644 --- a/docs/Order.md +++ b/docs/Order.md @@ -1,13 +1,14 @@ # Order +Spot order details ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **str** | Order ID | [optional] -**text** | **str** | User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 16 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] -**update_time** | **str** | Order last modification time | [optional] -**status** | **str** | Order status - `open`: to be filled - `closed`: filled - `cancelled`: cancelled | [optional] +**id** | **str** | Order ID | [optional] [readonly] +**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] +**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'] @@ -16,16 +17,16 @@ Name | Type | Description | Notes **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'] **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] -**left** | **str** | Amount left to fill | [optional] -**fill_price** | **str** | Total filled in quote currency. Deprecated in favor of `filled_total` | [optional] -**filled_total** | **str** | Total filled in quote currency | [optional] -**fee** | **str** | Fee deducted | [optional] -**fee_currency** | **str** | Fee currency unit | [optional] -**point_fee** | **str** | Point used to deduct fee | [optional] -**gt_fee** | **str** | GT used to deduct fee | [optional] -**gt_discount** | **bool** | Whether GT fee discount is used | [optional] -**rebated_fee** | **str** | Rebated fee | [optional] -**rebated_fee_currency** | **str** | Rebated fee currency unit | [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] +**fee** | **str** | Fee deducted | [optional] [readonly] +**fee_currency** | **str** | Fee currency unit | [optional] [readonly] +**point_fee** | **str** | Point used to deduct fee | [optional] [readonly] +**gt_fee** | **str** | GT used to deduct fee | [optional] [readonly] +**gt_discount** | **bool** | Whether GT fee discount is used | [optional] [readonly] +**rebated_fee** | **str** | Rebated fee | [optional] [readonly] +**rebated_fee_currency** | **str** | Rebated fee currency unit | [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/Position.md b/docs/Position.md index e35007d..5ca6ba6 100644 --- a/docs/Position.md +++ b/docs/Position.md @@ -1,28 +1,29 @@ # Position +Futures position details ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**user** | **int** | User ID | [optional] -**contract** | **str** | Futures contract | [optional] -**size** | **int** | Position size | [optional] +**user** | **int** | User ID | [optional] [readonly] +**contract** | **str** | Futures contract | [optional] [readonly] +**size** | **int** | Position size | [optional] [readonly] **leverage** | **str** | Position leverage. 0 means cross margin; positive number means isolated margin | [optional] **risk_limit** | **str** | Position risk limit | [optional] -**leverage_max** | **str** | Maximum leverage under current risk limit | [optional] -**maintenance_rate** | **str** | Maintenance rate under current risk limit | [optional] -**value** | **str** | Position value calculated in settlement currency | [optional] +**leverage_max** | **str** | Maximum leverage under current risk limit | [optional] [readonly] +**maintenance_rate** | **str** | Maintenance rate under current risk limit | [optional] [readonly] +**value** | **str** | Position value calculated in settlement currency | [optional] [readonly] **margin** | **str** | Position margin | [optional] -**entry_price** | **str** | Entry price | [optional] -**liq_price** | **str** | Liquidation price | [optional] -**mark_price** | **str** | Current mark price | [optional] -**unrealised_pnl** | **str** | Unrealized PNL | [optional] -**realised_pnl** | **str** | Realized PNL | [optional] -**history_pnl** | **str** | History realized PNL | [optional] -**last_close_pnl** | **str** | PNL of last position close | [optional] -**realised_point** | **str** | Realized POINT PNL | [optional] -**history_point** | **str** | History realized POINT PNL | [optional] -**adl_ranking** | **int** | ADL ranking, range from 1 to 5 | [optional] -**pending_orders** | **int** | Current open orders | [optional] +**entry_price** | **str** | Entry price | [optional] [readonly] +**liq_price** | **str** | Liquidation price | [optional] [readonly] +**mark_price** | **str** | Current mark price | [optional] [readonly] +**unrealised_pnl** | **str** | Unrealized PNL | [optional] [readonly] +**realised_pnl** | **str** | Realized PNL | [optional] [readonly] +**history_pnl** | **str** | History realized PNL | [optional] [readonly] +**last_close_pnl** | **str** | PNL of last position close | [optional] [readonly] +**realised_point** | **str** | Realized POINT PNL | [optional] [readonly] +**history_point** | **str** | History realized POINT PNL | [optional] [readonly] +**adl_ranking** | **int** | ADL ranking, range from 1 to 5 | [optional] [readonly] +**pending_orders** | **int** | Current open orders | [optional] [readonly] **close_order** | [**PositionCloseOrder**](PositionCloseOrder.md) | | [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/PositionClose.md b/docs/PositionClose.md index 0641a31..2573f6b 100644 --- a/docs/PositionClose.md +++ b/docs/PositionClose.md @@ -3,11 +3,11 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**time** | **float** | Position close time | [optional] -**contract** | **str** | Futures contract | [optional] -**side** | **str** | Position side, long or short | [optional] -**pnl** | **str** | PNL | [optional] -**text** | **str** | Text of close order | [optional] +**time** | **float** | Position close time | [optional] [readonly] +**contract** | **str** | Futures contract | [optional] [readonly] +**side** | **str** | Position side, long or short | [optional] [readonly] +**pnl** | **str** | PNL | [optional] [readonly] +**text** | **str** | Text of close order | [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/PositionCloseOrder.md b/docs/PositionCloseOrder.md index 43883ed..6f5540d 100644 --- a/docs/PositionCloseOrder.md +++ b/docs/PositionCloseOrder.md @@ -1,5 +1,6 @@ # PositionCloseOrder +Current close order if any, or `null` ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/docs/SpotApi.md b/docs/SpotApi.md index d78b256..869fc00 100644 --- a/docs/SpotApi.md +++ b/docs/SpotApi.md @@ -30,18 +30,29 @@ Multiple currency pairs can be specified, but maximum 20 orders are allowed per ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.SpotApi(gate_api.ApiClient(configuration)) -cancel_order = [gate_api.CancelOrder()] # list[CancelOrder] | +from gate_api.exceptions import ApiException +# 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.SpotApi(api_client) +cancel_order = [{"currency_pair":"BTC_USDT","id":"123456"}] # list[CancelOrder] | try: # Cancel a batch of orders with an ID list @@ -63,13 +74,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Batch cancellation completed | - | + [[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** @@ -79,17 +95,28 @@ Cancel a single order ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.SpotApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.SpotApi(api_client) order_id = '12345' # str | ID returned on order successfully being created currency_pair = 'BTC_USDT' # str | Currency pair @@ -114,13 +141,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Order cancelled | - | + [[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_orders** @@ -130,17 +162,28 @@ Cancel all `open` orders in specified currency pair ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.SpotApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.SpotApi(api_client) currency_pair = 'BTC_USDT' # str | Currency pair side = 'sell' # str | All bids or asks. Both included in not specified (optional) account = 'spot' # str | Specify account type. Default to all account types being included (optional) @@ -167,13 +210,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Batch cancellation request accepted. Query order status by listing orders | - | + [[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_batch_orders** @@ -185,18 +233,29 @@ Batch orders requirements: 1. custom order field `text` is required 2. At most ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.SpotApi(gate_api.ApiClient(configuration)) -order = [gate_api.Order()] # list[Order] | +from gate_api.exceptions import ApiException +# 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.SpotApi(api_client) +order = [{"id":"12332324","text":"t-123456","create_time":"1548000000","update_time":"1548000100","currency_pair":"ETH_BTC","status":"cancelled","type":"limit","account":"spot","side":"buy","amount":"1","price":"5.00032","time_in_force":"gtc","auto_borrow":false,"left":"0.5","filled_total":"2.50016","fee":"0.005","fee_currency":"ETH","point_fee":"0","gt_fee":"0","gt_discount":false,"rebated_fee":"0","rebated_fee_currency":"BTC"}] # list[Order] | try: # Create a batch of orders @@ -218,13 +277,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Request is completed | - | + [[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_order** @@ -234,18 +298,29 @@ Create an order ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.SpotApi(gate_api.ApiClient(configuration)) -order = gate_api.Order() # Order | +from gate_api.exceptions import ApiException +# 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.SpotApi(api_client) +order = {"id":"12332324","text":"t-123456","create_time":"1548000000","update_time":"1548000100","currency_pair":"ETH_BTC","status":"cancelled","type":"limit","account":"spot","side":"buy","amount":"1","price":"5.00032","time_in_force":"gtc","auto_borrow":false,"left":"0.5","filled_total":"2.50016","fee":"0.005","fee_currency":"ETH","point_fee":"0","gt_fee":"0","gt_discount":false,"rebated_fee":"0","rebated_fee_currency":"BTC"} # Order | try: # Create an order @@ -267,13 +342,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Order created. | - | + [[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_currency_pair** @@ -286,10 +366,16 @@ Get detail of one single order ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.SpotApi() +from gate_api.exceptions import ApiException +# 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.SpotApi(api_client) currency_pair = 'ETH_BTC' # str | Currency pair try: @@ -319,6 +405,11 @@ No authorization required - **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_order** @@ -328,17 +419,28 @@ Get a single order ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.SpotApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.SpotApi(api_client) order_id = '12345' # str | ID returned on order successfully being created currency_pair = 'BTC_USDT' # str | Currency pair @@ -363,13 +465,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Detail 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_candlesticks** @@ -384,10 +491,16 @@ Maximum of 1000 points are returned in one query. Be sure not to exceed the limi ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.SpotApi() +from gate_api.exceptions import ApiException +# 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.SpotApi(api_client) currency_pair = 'BTC_USDT' # str | Currency pair limit = 100 # int | Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional) (default to 100) _from = 1546905600 # int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) @@ -425,6 +538,11 @@ No authorization required - **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_currency_pairs** @@ -437,10 +555,16 @@ List all currency pairs supported ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException +from gate_api.exceptions import ApiException +# 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" +) -# create an instance of the API class -api_instance = gate_api.SpotApi() +api_client = gate_api.ApiClient(configuration) +# Create an instance of the API class +api_instance = gate_api.SpotApi(api_client) try: # List all currency pairs supported @@ -466,6 +590,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | All currency pairs 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_my_trades** @@ -475,17 +604,28 @@ List personal trading history ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.SpotApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.SpotApi(api_client) 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) @@ -514,13 +654,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_order_book** @@ -535,10 +680,16 @@ Order book will be sorted by price from high to low on bids; reversed on asks ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.SpotApi() +from gate_api.exceptions import ApiException +# 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.SpotApi(api_client) currency_pair = 'BTC_USDT' # str | Currency pair interval = '0' # str | Order depth. 0 means no aggregation is applied. default to 0 (optional) (default to '0') limit = 10 # int | Maximum number of order depth data in asks or bids (optional) (default to 10) @@ -572,6 +723,11 @@ No authorization required - **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_orders** @@ -581,17 +737,28 @@ List orders ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.SpotApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.SpotApi(api_client) 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) @@ -620,13 +787,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_spot_accounts** @@ -636,17 +808,28 @@ List spot accounts ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.SpotApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.SpotApi(api_client) currency = 'BTC' # str | Retrieved specified currency related data (optional) try: @@ -669,13 +852,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_tickers** @@ -690,10 +878,16 @@ Return only related data if `currency_pair` is specified; otherwise return all o ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.SpotApi() +from gate_api.exceptions import ApiException +# 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.SpotApi(api_client) currency_pair = 'BTC_USDT' # str | Currency pair (optional) try: @@ -723,6 +917,11 @@ No authorization required - **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_trades** @@ -735,10 +934,16 @@ Retrieve market trades ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -# create an instance of the API class -api_instance = gate_api.SpotApi() +from gate_api.exceptions import ApiException +# 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.SpotApi(api_client) currency_pair = 'BTC_USDT' # str | Currency pair limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) last_id = '12345' # str | Specify list staring point using the `id` of last record in previous list-query results (optional) @@ -772,5 +977,10 @@ No authorization required - **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) diff --git a/docs/SubAccountTransfer.md b/docs/SubAccountTransfer.md index 7c772d5..36a35d8 100644 --- a/docs/SubAccountTransfer.md +++ b/docs/SubAccountTransfer.md @@ -7,9 +7,9 @@ Name | Type | Description | Notes **sub_account** | **str** | Sub account user ID | **direction** | **str** | Transfer direction. to - transfer into sub account; from - transfer out from sub account | **amount** | **str** | Transfer amount | -**uid** | **str** | Main account user ID | [optional] -**timest** | **str** | Transfer timestamp | [optional] -**source** | **str** | Where the operation is initiated from | [optional] +**uid** | **str** | Main account user ID | [optional] [readonly] +**timest** | **str** | Transfer timestamp | [optional] [readonly] +**source** | **str** | Where the operation is initiated from | [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/Transfer.md b/docs/Transfer.md index d01aac0..2c7e018 100644 --- a/docs/Transfer.md +++ b/docs/Transfer.md @@ -1,5 +1,6 @@ # Transfer +Accounts available to transfer: - `spot`: spot account - `margin`: margin account - `futures`: perpetual futures account - `delivery`: delivery futures account ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/docs/WalletApi.md b/docs/WalletApi.md index 70af80e..d2114f3 100644 --- a/docs/WalletApi.md +++ b/docs/WalletApi.md @@ -19,17 +19,28 @@ Generate currency deposit address ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.WalletApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.WalletApi(api_client) currency = 'currency_example' # str | Currency name try: @@ -52,13 +63,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Address successfully generated | - | + [[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_deposits** @@ -70,17 +86,28 @@ Record time range cannot exceed 30 days ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.WalletApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.WalletApi(api_client) currency = 'BTC' # str | Filter by currency. Return all currency records if not specified (optional) _from = 56 # int | Time range beginning, default to 7 days before current time (optional) to = 56 # int | Time range ending, default to current time (optional) @@ -111,13 +138,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_sub_account_transfers** @@ -129,17 +161,28 @@ Record time range cannot exceed 30 days > Note: only records after 2020-04-10 c ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.WalletApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.WalletApi(api_client) sub_uid = '10003' # str | Sub account user ID. Return records related to all sub accounts if not specified (optional) _from = 56 # int | Time range beginning, default to 7 days before current time (optional) to = 56 # int | Time range ending, default to current time (optional) @@ -170,13 +213,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **list_withdrawals** @@ -188,17 +236,28 @@ Record time range cannot exceed 30 days ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.WalletApi(gate_api.ApiClient(configuration)) +from gate_api.exceptions import ApiException +# 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.WalletApi(api_client) currency = 'BTC' # str | Filter by currency. Return all currency records if not specified (optional) _from = 56 # int | Time range beginning, default to 7 days before current time (optional) to = 56 # int | Time range ending, default to current time (optional) @@ -229,13 +288,18 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[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) # **transfer** @@ -247,18 +311,29 @@ Transfer between different accounts. Currently support transfers between the fol ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.WalletApi(gate_api.ApiClient(configuration)) -transfer = gate_api.Transfer() # Transfer | +from gate_api.exceptions import ApiException +# 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.WalletApi(api_client) +transfer = {"currency":"BTC","from":"spot","to":"margin","amount":"1","currency_pair":"BTC_USDT"} # Transfer | try: # Transfer between accounts @@ -279,13 +354,18 @@ void (empty response body) ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Balance transferred | - | + [[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) # **transfer_with_sub_account** @@ -295,18 +375,29 @@ Transfer between main and sub accounts ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.WalletApi(gate_api.ApiClient(configuration)) -sub_account_transfer = gate_api.SubAccountTransfer() # SubAccountTransfer | +from gate_api.exceptions import ApiException +# 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.WalletApi(api_client) +sub_account_transfer = {"uid":"10001","timest":"1592809000","source":"web","currency":"BTC","sub_account":"10002","direction":"to","amount":"1"} # SubAccountTransfer | try: # Transfer between main and sub accounts @@ -327,12 +418,17 @@ void (empty response body) ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | Balance transferred | - | + [[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/WithdrawalApi.md b/docs/WithdrawalApi.md index 0d71702..c62d280 100644 --- a/docs/WithdrawalApi.md +++ b/docs/WithdrawalApi.md @@ -14,18 +14,29 @@ Withdraw ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api -from gate_api.rest import ApiException - -configuration = gate_api.Configuration() -configuration.key = 'YOUR_API_KEY' -configuration.secret = 'YOUR_API_SECRET' - -# create an instance of the API class -api_instance = gate_api.WithdrawalApi(gate_api.ApiClient(configuration)) -ledger_record = gate_api.LedgerRecord() # LedgerRecord | +from gate_api.exceptions import ApiException +# 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) +ledger_record = {"id":"210496","timestamp":"1542000000","currency":"ETH","address":"1HkxtBAMrA3tP5ENnYY2CZortjZvFDH5Cs","txid":"128988928203223323290","amount":"222.61","memo":"","status":"DONE"} # LedgerRecord | try: # Withdraw @@ -47,12 +58,17 @@ Name | Type | Description | Notes ### Authorization -Authentication with API key and secret is required +[apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**202** | Withdraw request is accepted. Refer to withdrawal records for status | - | + [[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 5f3a376..33d593e 100644 --- a/gate_api/__init__.py +++ b/gate_api/__init__.py @@ -14,7 +14,7 @@ from __future__ import absolute_import -__version__ = "4.14.0" +__version__ = "4.15.0" # import apis into sdk package from gate_api.api.delivery_api import DeliveryApi @@ -27,6 +27,11 @@ # import ApiClient from gate_api.api_client import ApiClient from gate_api.configuration import Configuration +from gate_api.exceptions import OpenApiException +from gate_api.exceptions import ApiTypeError +from gate_api.exceptions import ApiValueError +from gate_api.exceptions import ApiKeyError +from gate_api.exceptions import ApiException # import models into sdk package from gate_api.models.batch_order import BatchOrder from gate_api.models.cancel_order import CancelOrder @@ -74,3 +79,4 @@ from gate_api.models.trade import Trade from gate_api.models.transfer import Transfer from gate_api.models.trigger_order_response import TriggerOrderResponse + diff --git a/gate_api/api/delivery_api.py b/gate_api/api/delivery_api.py index b97f488..2335185 100644 --- a/gate_api/api/delivery_api.py +++ b/gate_api/api/delivery_api.py @@ -18,6 +18,10 @@ import six from gate_api.api_client import ApiClient +from gate_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) class DeliveryApi(object): @@ -40,19 +44,22 @@ def cancel_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 >>> thread = api.cancel_delivery_order(settle, order_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: ID returned on order successfully being created (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. :return: FuturesOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.cancel_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - else: - (data) = self.cancel_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - return data + return self.cancel_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 def cancel_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 """Cancel a single order # noqa: E501 @@ -62,38 +69,54 @@ def cancel_delivery_order_with_http_info(self, settle, order_id, **kwargs): # n >>> thread = api.cancel_delivery_order_with_http_info(settle, order_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: ID returned on order successfully being created (required) - :return: FuturesOrder + :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. + :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'order_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'order_id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_delivery_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `cancel_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `cancel_delivery_order`") # noqa: E501 # verify the required parameter 'order_id' is set - if ('order_id' not in local_var_params or - local_var_params['order_id'] is None): - raise ValueError("Missing the required parameter `order_id` when calling `cancel_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_delivery_order`") # noqa: E501 collection_formats = {} @@ -143,20 +166,23 @@ def cancel_delivery_orders(self, settle, contract, **kwargs): # noqa: E501 >>> thread = api.cancel_delivery_orders(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str side: All bids or asks. Both included in not specified + :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. :return: list[FuturesOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.cancel_delivery_orders_with_http_info(settle, contract, **kwargs) # noqa: E501 - else: - (data) = self.cancel_delivery_orders_with_http_info(settle, contract, **kwargs) # noqa: E501 - return data + return self.cancel_delivery_orders_with_http_info(settle, contract, **kwargs) # noqa: E501 def cancel_delivery_orders_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Cancel all `open` orders matched # noqa: E501 @@ -167,39 +193,56 @@ def cancel_delivery_orders_with_http_info(self, settle, contract, **kwargs): # >>> thread = api.cancel_delivery_orders_with_http_info(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str side: All bids or asks. Both included in not specified - :return: list[FuturesOrder] + :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. + :return: tuple(list[FuturesOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'side'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'side' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_delivery_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `cancel_delivery_orders`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `cancel_delivery_orders`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `cancel_delivery_orders`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `cancel_delivery_orders`") # noqa: E501 collection_formats = {} @@ -208,9 +251,9 @@ def cancel_delivery_orders_with_http_info(self, settle, contract, **kwargs): # path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'side' in local_var_params: + if 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 query_params.append(('side', local_var_params['side'])) # noqa: E501 header_params = {} @@ -250,19 +293,22 @@ def cancel_price_triggered_delivery_order(self, settle, order_id, **kwargs): # >>> thread = api.cancel_price_triggered_delivery_order(settle, order_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: ID returned on order successfully being created (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. :return: FuturesPriceTriggeredOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.cancel_price_triggered_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - else: - (data) = self.cancel_price_triggered_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - return data + return self.cancel_price_triggered_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 def cancel_price_triggered_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 """Cancel a single order # noqa: E501 @@ -272,38 +318,54 @@ def cancel_price_triggered_delivery_order_with_http_info(self, settle, order_id, >>> thread = api.cancel_price_triggered_delivery_order_with_http_info(settle, order_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: ID returned on order successfully being created (required) - :return: FuturesPriceTriggeredOrder + :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. + :return: tuple(FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'order_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'order_id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_price_triggered_delivery_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_delivery_order`") # noqa: E501 # verify the required parameter 'order_id' is set - if ('order_id' not in local_var_params or - local_var_params['order_id'] is None): - raise ValueError("Missing the required parameter `order_id` when calling `cancel_price_triggered_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_price_triggered_delivery_order`") # noqa: E501 collection_formats = {} @@ -352,19 +414,22 @@ def cancel_price_triggered_delivery_order_list(self, settle, contract, **kwargs) >>> thread = api.cancel_price_triggered_delivery_order_list(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (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. :return: list[FuturesPriceTriggeredOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.cancel_price_triggered_delivery_order_list_with_http_info(settle, contract, **kwargs) # noqa: E501 - else: - (data) = self.cancel_price_triggered_delivery_order_list_with_http_info(settle, contract, **kwargs) # noqa: E501 - return data + return self.cancel_price_triggered_delivery_order_list_with_http_info(settle, contract, **kwargs) # noqa: E501 def cancel_price_triggered_delivery_order_list_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Cancel all open orders # noqa: E501 @@ -374,38 +439,54 @@ def cancel_price_triggered_delivery_order_list_with_http_info(self, settle, cont >>> thread = api.cancel_price_triggered_delivery_order_list_with_http_info(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) - :return: list[FuturesPriceTriggeredOrder] + :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. + :return: tuple(list[FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_price_triggered_delivery_order_list" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_delivery_order_list`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_delivery_order_list`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `cancel_price_triggered_delivery_order_list`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `cancel_price_triggered_delivery_order_list`") # noqa: E501 collection_formats = {} @@ -414,7 +495,7 @@ def cancel_price_triggered_delivery_order_list_with_http_info(self, settle, cont path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 header_params = {} @@ -455,19 +536,22 @@ def create_delivery_order(self, settle, futures_order, **kwargs): # noqa: E501 >>> thread = api.create_delivery_order(settle, futures_order, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesOrder futures_order: (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. :return: FuturesOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.create_delivery_order_with_http_info(settle, futures_order, **kwargs) # noqa: E501 - else: - (data) = self.create_delivery_order_with_http_info(settle, futures_order, **kwargs) # noqa: E501 - return data + return self.create_delivery_order_with_http_info(settle, futures_order, **kwargs) # noqa: E501 def create_delivery_order_with_http_info(self, settle, futures_order, **kwargs): # noqa: E501 """Create a futures order # noqa: E501 @@ -478,38 +562,54 @@ def create_delivery_order_with_http_info(self, settle, futures_order, **kwargs): >>> thread = api.create_delivery_order_with_http_info(settle, futures_order, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesOrder futures_order: (required) - :return: FuturesOrder + :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. + :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'futures_order'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'futures_order' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method create_delivery_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `create_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `create_delivery_order`") # noqa: E501 # verify the required parameter 'futures_order' is set - if ('futures_order' not in local_var_params or - local_var_params['futures_order'] is None): - raise ValueError("Missing the required parameter `futures_order` when calling `create_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ('futures_order' not in local_var_params or # noqa: E501 + local_var_params['futures_order'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `futures_order` when calling `create_delivery_order`") # noqa: E501 collection_formats = {} @@ -562,19 +662,22 @@ def create_price_triggered_delivery_order(self, settle, futures_price_triggered_ >>> thread = api.create_price_triggered_delivery_order(settle, futures_price_triggered_order, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesPriceTriggeredOrder futures_price_triggered_order: (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. :return: TriggerOrderResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.create_price_triggered_delivery_order_with_http_info(settle, futures_price_triggered_order, **kwargs) # noqa: E501 - else: - (data) = self.create_price_triggered_delivery_order_with_http_info(settle, futures_price_triggered_order, **kwargs) # noqa: E501 - return data + return self.create_price_triggered_delivery_order_with_http_info(settle, futures_price_triggered_order, **kwargs) # noqa: E501 def create_price_triggered_delivery_order_with_http_info(self, settle, futures_price_triggered_order, **kwargs): # noqa: E501 """Create a price-triggered order # noqa: E501 @@ -584,38 +687,54 @@ def create_price_triggered_delivery_order_with_http_info(self, settle, futures_p >>> thread = api.create_price_triggered_delivery_order_with_http_info(settle, futures_price_triggered_order, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesPriceTriggeredOrder futures_price_triggered_order: (required) - :return: TriggerOrderResponse + :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. + :return: tuple(TriggerOrderResponse, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'futures_price_triggered_order'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'futures_price_triggered_order' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method create_price_triggered_delivery_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `create_price_triggered_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `create_price_triggered_delivery_order`") # noqa: E501 # verify the required parameter 'futures_price_triggered_order' is set - if ('futures_price_triggered_order' not in local_var_params or - local_var_params['futures_price_triggered_order'] is None): - raise ValueError("Missing the required parameter `futures_price_triggered_order` when calling `create_price_triggered_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ('futures_price_triggered_order' not in local_var_params or # noqa: E501 + local_var_params['futures_price_triggered_order'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `futures_price_triggered_order` when calling `create_price_triggered_delivery_order`") # noqa: E501 collection_formats = {} @@ -668,19 +787,22 @@ def get_delivery_contract(self, settle, contract, **kwargs): # noqa: E501 >>> thread = api.get_delivery_contract(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (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. :return: DeliveryContract If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_delivery_contract_with_http_info(settle, contract, **kwargs) # noqa: E501 - else: - (data) = self.get_delivery_contract_with_http_info(settle, contract, **kwargs) # noqa: E501 - return data + return self.get_delivery_contract_with_http_info(settle, contract, **kwargs) # noqa: E501 def get_delivery_contract_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Get a single contract # noqa: E501 @@ -690,38 +812,54 @@ def get_delivery_contract_with_http_info(self, settle, contract, **kwargs): # n >>> thread = api.get_delivery_contract_with_http_info(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) - :return: DeliveryContract + :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. + :return: tuple(DeliveryContract, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_delivery_contract" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `get_delivery_contract`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_delivery_contract`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `get_delivery_contract`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `get_delivery_contract`") # noqa: E501 collection_formats = {} @@ -771,19 +909,22 @@ def get_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 >>> thread = api.get_delivery_order(settle, order_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: ID returned on order successfully being created (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. :return: FuturesOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - else: - (data) = self.get_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - return data + return self.get_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 def get_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 """Get a single order # noqa: E501 @@ -794,38 +935,54 @@ def get_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa >>> thread = api.get_delivery_order_with_http_info(settle, order_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: ID returned on order successfully being created (required) - :return: FuturesOrder + :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. + :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'order_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'order_id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_delivery_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `get_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_delivery_order`") # noqa: E501 # verify the required parameter 'order_id' is set - if ('order_id' not in local_var_params or - local_var_params['order_id'] is None): - raise ValueError("Missing the required parameter `order_id` when calling `get_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `get_delivery_order`") # noqa: E501 collection_formats = {} @@ -874,19 +1031,22 @@ def get_delivery_position(self, settle, contract, **kwargs): # noqa: E501 >>> thread = api.get_delivery_position(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (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. :return: Position If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_delivery_position_with_http_info(settle, contract, **kwargs) # noqa: E501 - else: - (data) = self.get_delivery_position_with_http_info(settle, contract, **kwargs) # noqa: E501 - return data + return self.get_delivery_position_with_http_info(settle, contract, **kwargs) # noqa: E501 def get_delivery_position_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Get single position # noqa: E501 @@ -896,38 +1056,54 @@ def get_delivery_position_with_http_info(self, settle, contract, **kwargs): # n >>> thread = api.get_delivery_position_with_http_info(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) - :return: Position + :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. + :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_delivery_position" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `get_delivery_position`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_delivery_position`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `get_delivery_position`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `get_delivery_position`") # noqa: E501 collection_formats = {} @@ -976,7 +1152,7 @@ def get_my_delivery_trades(self, settle, **kwargs): # noqa: E501 >>> thread = api.get_my_delivery_trades(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract :param int order: Futures order ID, return related data only if specified @@ -984,16 +1160,19 @@ def get_my_delivery_trades(self, settle, **kwargs): # noqa: E501 :param int offset: List offset, starting from 0 :param str last_id: Specify list staring point using the `id` of last record in previous list-query results :param int count_total: Whether to return total number matched. Default to 0(no return) + :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. :return: list[MyFuturesTrade] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_my_delivery_trades_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.get_my_delivery_trades_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.get_my_delivery_trades_with_http_info(settle, **kwargs) # noqa: E501 def get_my_delivery_trades_with_http_info(self, settle, **kwargs): # noqa: E501 """List personal trading history # noqa: E501 @@ -1003,7 +1182,7 @@ def get_my_delivery_trades_with_http_info(self, settle, **kwargs): # noqa: E501 >>> thread = api.get_my_delivery_trades_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract :param int order: Futures order ID, return related data only if specified @@ -1011,38 +1190,59 @@ def get_my_delivery_trades_with_http_info(self, settle, **kwargs): # noqa: E501 :param int offset: List offset, starting from 0 :param str last_id: Specify list staring point using the `id` of last record in previous list-query results :param int count_total: Whether to return total number matched. Default to 0(no return) - :return: list[MyFuturesTrade] + :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. + :return: tuple(list[MyFuturesTrade], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'order', 'limit', 'offset', 'last_id', 'count_total'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'order', + 'limit', + 'offset', + 'last_id', + 'count_total' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_my_delivery_trades" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `get_my_delivery_trades`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `get_my_delivery_trades`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `get_my_delivery_trades`, must be a value greater than or equal to `1`") # noqa: E501 - if 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 - raise ValueError("Invalid value for parameter `offset` when calling `get_my_delivery_trades`, must be a value greater than or equal to `0`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_my_delivery_trades`") # 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 `get_my_delivery_trades`, 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 `get_my_delivery_trades`, 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 `get_my_delivery_trades`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} @@ -1050,17 +1250,17 @@ def get_my_delivery_trades_with_http_info(self, settle, **kwargs): # noqa: E501 path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'order' in local_var_params: + if 'order' in local_var_params and local_var_params['order'] is not None: # noqa: E501 query_params.append(('order', local_var_params['order'])) # noqa: E501 - if 'limit' in local_var_params: + 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: + 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 'last_id' in local_var_params: + if 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 - if 'count_total' in local_var_params: + if 'count_total' in local_var_params and local_var_params['count_total'] is not None: # noqa: E501 query_params.append(('count_total', local_var_params['count_total'])) # noqa: E501 header_params = {} @@ -1100,19 +1300,22 @@ def get_price_triggered_delivery_order(self, settle, order_id, **kwargs): # noq >>> thread = api.get_price_triggered_delivery_order(settle, order_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: ID returned on order successfully being created (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. :return: FuturesPriceTriggeredOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_price_triggered_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - else: - (data) = self.get_price_triggered_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - return data + return self.get_price_triggered_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 def get_price_triggered_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 """Get a single order # noqa: E501 @@ -1122,38 +1325,54 @@ def get_price_triggered_delivery_order_with_http_info(self, settle, order_id, ** >>> thread = api.get_price_triggered_delivery_order_with_http_info(settle, order_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: ID returned on order successfully being created (required) - :return: FuturesPriceTriggeredOrder + :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. + :return: tuple(FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'order_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'order_id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_price_triggered_delivery_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `get_price_triggered_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_price_triggered_delivery_order`") # noqa: E501 # verify the required parameter 'order_id' is set - if ('order_id' not in local_var_params or - local_var_params['order_id'] is None): - raise ValueError("Missing the required parameter `order_id` when calling `get_price_triggered_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `get_price_triggered_delivery_order`") # noqa: E501 collection_formats = {} @@ -1202,22 +1421,25 @@ def list_delivery_account_book(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_delivery_account_book(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int limit: Maximum number of records returned in one list :param int _from: Start timestamp :param int to: End timestamp :param str type: Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate + :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. :return: list[FuturesAccountBook] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_delivery_account_book_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.list_delivery_account_book_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.list_delivery_account_book_with_http_info(settle, **kwargs) # noqa: E501 def list_delivery_account_book_with_http_info(self, settle, **kwargs): # noqa: E501 """Query account book # noqa: E501 @@ -1227,42 +1449,61 @@ def list_delivery_account_book_with_http_info(self, settle, **kwargs): # noqa: >>> thread = api.list_delivery_account_book_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int limit: Maximum number of records returned in one list :param int _from: Start timestamp :param int to: End timestamp :param str type: Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate - :return: list[FuturesAccountBook] + :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. + :return: tuple(list[FuturesAccountBook], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'limit', '_from', 'to', 'type'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'limit', + '_from', + 'to', + 'type' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_delivery_account_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_delivery_account_book`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_delivery_account_book`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_delivery_account_book`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_account_book`") # 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_delivery_account_book`, 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_delivery_account_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -1270,13 +1511,13 @@ def list_delivery_account_book_with_http_info(self, settle, **kwargs): # noqa: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'limit' in local_var_params: + 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 '_from' in local_var_params: + if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params: + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 - if 'type' in local_var_params: + if 'type' in local_var_params and local_var_params['type'] is not None: # noqa: E501 query_params.append(('type', local_var_params['type'])) # noqa: E501 header_params = {} @@ -1316,18 +1557,21 @@ def list_delivery_accounts(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_delivery_accounts(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (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. :return: FuturesAccount If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_delivery_accounts_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.list_delivery_accounts_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.list_delivery_accounts_with_http_info(settle, **kwargs) # noqa: E501 def list_delivery_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 """Query futures account # noqa: E501 @@ -1337,33 +1581,48 @@ def list_delivery_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_delivery_accounts_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :return: FuturesAccount + :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. + :return: tuple(FuturesAccount, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_delivery_accounts" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_delivery_accounts`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_accounts`") # noqa: E501 collection_formats = {} @@ -1411,23 +1670,26 @@ def list_delivery_candlesticks(self, settle, contract, **kwargs): # noqa: E501 >>> thread = api.list_delivery_candlesticks(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param float _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified :param float to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. :param str interval: Interval time between data points + :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. :return: list[FuturesCandlestick] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_delivery_candlesticks_with_http_info(settle, contract, **kwargs) # noqa: E501 - else: - (data) = self.list_delivery_candlesticks_with_http_info(settle, contract, **kwargs) # noqa: E501 - return data + return self.list_delivery_candlesticks_with_http_info(settle, contract, **kwargs) # noqa: E501 def list_delivery_candlesticks_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Get futures candlesticks # noqa: E501 @@ -1438,45 +1700,65 @@ def list_delivery_candlesticks_with_http_info(self, settle, contract, **kwargs): >>> thread = api.list_delivery_candlesticks_with_http_info(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param float _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified :param float to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. :param str interval: Interval time between data points - :return: list[FuturesCandlestick] + :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. + :return: tuple(list[FuturesCandlestick], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', '_from', 'to', 'limit', 'interval'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + '_from', + 'to', + 'limit', + 'interval' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_delivery_candlesticks" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_delivery_candlesticks`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_candlesticks`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `list_delivery_candlesticks`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `list_delivery_candlesticks`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] > 2000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_delivery_candlesticks`, must be a value less than or equal to `2000`") # noqa: E501 + if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 2000: # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_delivery_candlesticks`, must be a value less than or equal to `2000`") # noqa: E501 collection_formats = {} path_params = {} @@ -1484,15 +1766,15 @@ def list_delivery_candlesticks_with_http_info(self, settle, contract, **kwargs): path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if '_from' in local_var_params: + if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params: + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 - if 'limit' in local_var_params: + 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 'interval' in local_var_params: + if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 query_params.append(('interval', local_var_params['interval'])) # noqa: E501 header_params = {} @@ -1532,18 +1814,21 @@ def list_delivery_contracts(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_delivery_contracts(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (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. :return: list[DeliveryContract] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_delivery_contracts_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.list_delivery_contracts_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.list_delivery_contracts_with_http_info(settle, **kwargs) # noqa: E501 def list_delivery_contracts_with_http_info(self, settle, **kwargs): # noqa: E501 """List all futures contracts # noqa: E501 @@ -1553,33 +1838,48 @@ def list_delivery_contracts_with_http_info(self, settle, **kwargs): # noqa: E50 >>> thread = api.list_delivery_contracts_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :return: list[DeliveryContract] + :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. + :return: tuple(list[DeliveryContract], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_delivery_contracts" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_delivery_contracts`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_contracts`") # noqa: E501 collection_formats = {} @@ -1626,19 +1926,22 @@ def list_delivery_insurance_ledger(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_delivery_insurance_ledger(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int limit: Maximum number of records returned in one list + :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. :return: list[InsuranceRecord] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_delivery_insurance_ledger_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.list_delivery_insurance_ledger_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.list_delivery_insurance_ledger_with_http_info(settle, **kwargs) # noqa: E501 def list_delivery_insurance_ledger_with_http_info(self, settle, **kwargs): # noqa: E501 """Futures insurance balance history # noqa: E501 @@ -1648,39 +1951,55 @@ def list_delivery_insurance_ledger_with_http_info(self, settle, **kwargs): # no >>> thread = api.list_delivery_insurance_ledger_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int limit: Maximum number of records returned in one list - :return: list[InsuranceRecord] + :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. + :return: tuple(list[InsuranceRecord], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'limit'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'limit' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_delivery_insurance_ledger" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_delivery_insurance_ledger`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_delivery_insurance_ledger`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_delivery_insurance_ledger`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_insurance_ledger`") # 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_delivery_insurance_ledger`, 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_delivery_insurance_ledger`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -1688,7 +2007,7 @@ def list_delivery_insurance_ledger_with_http_info(self, settle, **kwargs): # no path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'limit' in local_var_params: + 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 header_params = {} @@ -1728,21 +2047,24 @@ def list_delivery_liquidates(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_delivery_liquidates(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract :param int limit: Maximum number of records returned in one list :param int at: Specify a liquidation timestamp + :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. :return: list[FuturesLiquidate] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_delivery_liquidates_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.list_delivery_liquidates_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.list_delivery_liquidates_with_http_info(settle, **kwargs) # noqa: E501 def list_delivery_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 """List liquidation history # noqa: E501 @@ -1752,41 +2074,59 @@ def list_delivery_liquidates_with_http_info(self, settle, **kwargs): # noqa: E5 >>> thread = api.list_delivery_liquidates_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract :param int limit: Maximum number of records returned in one list :param int at: Specify a liquidation timestamp - :return: list[FuturesLiquidate] + :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. + :return: tuple(list[FuturesLiquidate], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'limit', 'at'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'limit', + 'at' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_delivery_liquidates" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_delivery_liquidates`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_delivery_liquidates`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_delivery_liquidates`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_liquidates`") # 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_delivery_liquidates`, 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_delivery_liquidates`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -1794,11 +2134,11 @@ def list_delivery_liquidates_with_http_info(self, settle, **kwargs): # noqa: E5 path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'limit' in local_var_params: + 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 'at' in local_var_params: + if 'at' in local_var_params and local_var_params['at'] is not None: # noqa: E501 query_params.append(('at', local_var_params['at'])) # noqa: E501 header_params = {} @@ -1839,21 +2179,24 @@ def list_delivery_order_book(self, settle, contract, **kwargs): # noqa: E501 >>> thread = api.list_delivery_order_book(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str interval: Order depth. 0 means no aggregation is applied. default to 0 :param int limit: Maximum number of order depth data in asks or bids + :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. :return: FuturesOrderBook If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_delivery_order_book_with_http_info(settle, contract, **kwargs) # noqa: E501 - else: - (data) = self.list_delivery_order_book_with_http_info(settle, contract, **kwargs) # noqa: E501 - return data + return self.list_delivery_order_book_with_http_info(settle, contract, **kwargs) # noqa: E501 def list_delivery_order_book_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Futures order book # noqa: E501 @@ -1864,45 +2207,63 @@ def list_delivery_order_book_with_http_info(self, settle, contract, **kwargs): >>> thread = api.list_delivery_order_book_with_http_info(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str interval: Order depth. 0 means no aggregation is applied. default to 0 :param int limit: Maximum number of order depth data in asks or bids - :return: FuturesOrderBook + :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. + :return: tuple(FuturesOrderBook, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'interval', 'limit'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'interval', + 'limit' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_delivery_order_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_delivery_order_book`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_order_book`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `list_delivery_order_book`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 20: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_delivery_order_book`, must be a value less than or equal to `20`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_delivery_order_book`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `list_delivery_order_book`") # noqa: E501 + + if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 20: # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_delivery_order_book`, must be a value less than or equal to `20`") # 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_delivery_order_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -1910,11 +2271,11 @@ def list_delivery_order_book_with_http_info(self, settle, contract, **kwargs): path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'interval' in local_var_params: + if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 query_params.append(('interval', local_var_params['interval'])) # noqa: E501 - if 'limit' in local_var_params: + 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 header_params = {} @@ -1955,7 +2316,7 @@ def list_delivery_orders(self, settle, status, **kwargs): # noqa: E501 >>> thread = api.list_delivery_orders(settle, status, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str status: List orders based on status (required) :param str contract: Futures contract @@ -1963,16 +2324,19 @@ def list_delivery_orders(self, settle, status, **kwargs): # noqa: E501 :param int offset: List offset, starting from 0 :param str last_id: Specify list staring point using the `id` of last record in previous list-query results :param int count_total: Whether to return total number matched. Default to 0(no return) + :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. :return: list[FuturesOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_delivery_orders_with_http_info(settle, status, **kwargs) # noqa: E501 - else: - (data) = self.list_delivery_orders_with_http_info(settle, status, **kwargs) # noqa: E501 - return data + return self.list_delivery_orders_with_http_info(settle, status, **kwargs) # noqa: E501 def list_delivery_orders_with_http_info(self, settle, status, **kwargs): # noqa: E501 """List futures orders # noqa: E501 @@ -1983,7 +2347,7 @@ def list_delivery_orders_with_http_info(self, settle, status, **kwargs): # noqa >>> thread = api.list_delivery_orders_with_http_info(settle, status, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str status: List orders based on status (required) :param str contract: Futures contract @@ -1991,42 +2355,63 @@ def list_delivery_orders_with_http_info(self, settle, status, **kwargs): # noqa :param int offset: List offset, starting from 0 :param str last_id: Specify list staring point using the `id` of last record in previous list-query results :param int count_total: Whether to return total number matched. Default to 0(no return) - :return: list[FuturesOrder] + :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. + :return: tuple(list[FuturesOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'status', 'contract', 'limit', 'offset', 'last_id', 'count_total'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'status', + 'contract', + 'limit', + 'offset', + 'last_id', + 'count_total' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_delivery_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_delivery_orders`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_orders`") # noqa: E501 # verify the required parameter 'status' is set - if ('status' not in local_var_params or - local_var_params['status'] is None): - raise ValueError("Missing the required parameter `status` when calling `list_delivery_orders`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_delivery_orders`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_delivery_orders`, must be a value greater than or equal to `1`") # noqa: E501 - if 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 - raise ValueError("Invalid value for parameter `offset` when calling `list_delivery_orders`, must be a value greater than or equal to `0`") # noqa: E501 + if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 + local_var_params['status'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `status` when calling `list_delivery_orders`") # 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_delivery_orders`, 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_delivery_orders`, 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_delivery_orders`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} @@ -2034,17 +2419,17 @@ def list_delivery_orders_with_http_info(self, settle, status, **kwargs): # noqa path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'status' in local_var_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 'limit' in local_var_params: + 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: + 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 'last_id' in local_var_params: + if 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 - if 'count_total' in local_var_params: + if 'count_total' in local_var_params and local_var_params['count_total'] is not None: # noqa: E501 query_params.append(('count_total', local_var_params['count_total'])) # noqa: E501 header_params = {} @@ -2084,20 +2469,23 @@ def list_delivery_position_close(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_delivery_position_close(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract :param int limit: Maximum number of records returned in one list + :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. :return: list[PositionClose] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_delivery_position_close_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.list_delivery_position_close_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.list_delivery_position_close_with_http_info(settle, **kwargs) # noqa: E501 def list_delivery_position_close_with_http_info(self, settle, **kwargs): # noqa: E501 """List position close history # noqa: E501 @@ -2107,40 +2495,57 @@ def list_delivery_position_close_with_http_info(self, settle, **kwargs): # noqa >>> thread = api.list_delivery_position_close_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract :param int limit: Maximum number of records returned in one list - :return: list[PositionClose] + :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. + :return: tuple(list[PositionClose], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'limit'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'limit' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_delivery_position_close" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_delivery_position_close`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_delivery_position_close`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_delivery_position_close`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_position_close`") # 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_delivery_position_close`, 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_delivery_position_close`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -2148,9 +2553,9 @@ def list_delivery_position_close_with_http_info(self, settle, **kwargs): # noqa path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'limit' in local_var_params: + 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 header_params = {} @@ -2190,18 +2595,21 @@ def list_delivery_positions(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_delivery_positions(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (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. :return: list[Position] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_delivery_positions_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.list_delivery_positions_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.list_delivery_positions_with_http_info(settle, **kwargs) # noqa: E501 def list_delivery_positions_with_http_info(self, settle, **kwargs): # noqa: E501 """List all positions of a user # noqa: E501 @@ -2211,33 +2619,48 @@ def list_delivery_positions_with_http_info(self, settle, **kwargs): # noqa: E50 >>> thread = api.list_delivery_positions_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :return: list[Position] + :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. + :return: tuple(list[Position], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_delivery_positions" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_delivery_positions`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_positions`") # noqa: E501 collection_formats = {} @@ -2284,21 +2707,24 @@ def list_delivery_settlements(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_delivery_settlements(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract :param int limit: Maximum number of records returned in one list :param int at: Specify a settlement timestamp + :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. :return: list[DeliverySettlement] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_delivery_settlements_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.list_delivery_settlements_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.list_delivery_settlements_with_http_info(settle, **kwargs) # noqa: E501 def list_delivery_settlements_with_http_info(self, settle, **kwargs): # noqa: E501 """List settlement history # noqa: E501 @@ -2308,41 +2734,59 @@ def list_delivery_settlements_with_http_info(self, settle, **kwargs): # noqa: E >>> thread = api.list_delivery_settlements_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract :param int limit: Maximum number of records returned in one list :param int at: Specify a settlement timestamp - :return: list[DeliverySettlement] + :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. + :return: tuple(list[DeliverySettlement], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'limit', 'at'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'limit', + 'at' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_delivery_settlements" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_delivery_settlements`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_delivery_settlements`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_delivery_settlements`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_settlements`") # 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_delivery_settlements`, 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_delivery_settlements`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -2350,11 +2794,11 @@ def list_delivery_settlements_with_http_info(self, settle, **kwargs): # noqa: E path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'limit' in local_var_params: + 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 'at' in local_var_params: + if 'at' in local_var_params and local_var_params['at'] is not None: # noqa: E501 query_params.append(('at', local_var_params['at'])) # noqa: E501 header_params = {} @@ -2394,19 +2838,22 @@ def list_delivery_tickers(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_delivery_tickers(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract + :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. :return: list[FuturesTicker] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_delivery_tickers_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.list_delivery_tickers_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.list_delivery_tickers_with_http_info(settle, **kwargs) # noqa: E501 def list_delivery_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 """List futures tickers # noqa: E501 @@ -2416,34 +2863,50 @@ def list_delivery_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_delivery_tickers_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract - :return: list[FuturesTicker] + :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. + :return: tuple(list[FuturesTicker], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_delivery_tickers" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_delivery_tickers`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_tickers`") # noqa: E501 collection_formats = {} @@ -2452,7 +2915,7 @@ def list_delivery_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 header_params = {} @@ -2492,23 +2955,26 @@ def list_delivery_trades(self, settle, contract, **kwargs): # noqa: E501 >>> thread = api.list_delivery_trades(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int limit: Maximum number of records returned in one list :param str last_id: Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range :param float _from: Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. :param float to: Specify end time in Unix seconds, default to current time + :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. :return: list[FuturesTrade] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_delivery_trades_with_http_info(settle, contract, **kwargs) # noqa: E501 - else: - (data) = self.list_delivery_trades_with_http_info(settle, contract, **kwargs) # noqa: E501 - return data + return self.list_delivery_trades_with_http_info(settle, contract, **kwargs) # noqa: E501 def list_delivery_trades_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Futures trading history # noqa: E501 @@ -2518,47 +2984,67 @@ def list_delivery_trades_with_http_info(self, settle, contract, **kwargs): # no >>> thread = api.list_delivery_trades_with_http_info(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int limit: Maximum number of records returned in one list :param str last_id: Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range :param float _from: Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. :param float to: Specify end time in Unix seconds, default to current time - :return: list[FuturesTrade] + :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. + :return: tuple(list[FuturesTrade], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'limit', 'last_id', '_from', 'to'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'limit', + 'last_id', + '_from', + 'to' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_delivery_trades" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_delivery_trades`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_trades`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `list_delivery_trades`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_delivery_trades`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_delivery_trades`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `list_delivery_trades`") # 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_delivery_trades`, 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_delivery_trades`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -2566,15 +3052,15 @@ def list_delivery_trades_with_http_info(self, settle, contract, **kwargs): # no path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'limit' in local_var_params: + 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 'last_id' in local_var_params: + if 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 - if '_from' in local_var_params: + if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params: + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 header_params = {} @@ -2614,22 +3100,25 @@ def list_price_triggered_delivery_orders(self, settle, status, **kwargs): # noq >>> thread = api.list_price_triggered_delivery_orders(settle, status, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str status: List orders based on status (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in one list :param int offset: List offset, starting from 0 + :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. :return: list[FuturesPriceTriggeredOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_price_triggered_delivery_orders_with_http_info(settle, status, **kwargs) # noqa: E501 - else: - (data) = self.list_price_triggered_delivery_orders_with_http_info(settle, status, **kwargs) # noqa: E501 - return data + return self.list_price_triggered_delivery_orders_with_http_info(settle, status, **kwargs) # noqa: E501 def list_price_triggered_delivery_orders_with_http_info(self, settle, status, **kwargs): # noqa: E501 """List all auto orders # noqa: E501 @@ -2639,48 +3128,67 @@ def list_price_triggered_delivery_orders_with_http_info(self, settle, status, ** >>> thread = api.list_price_triggered_delivery_orders_with_http_info(settle, status, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str status: List orders based on status (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in one list :param int offset: List offset, starting from 0 - :return: list[FuturesPriceTriggeredOrder] + :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. + :return: tuple(list[FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'status', 'contract', 'limit', 'offset'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'status', + 'contract', + 'limit', + 'offset' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_price_triggered_delivery_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_price_triggered_delivery_orders`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_price_triggered_delivery_orders`") # noqa: E501 # verify the required parameter 'status' is set - if ('status' not in local_var_params or - local_var_params['status'] is None): - raise ValueError("Missing the required parameter `status` when calling `list_price_triggered_delivery_orders`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_price_triggered_delivery_orders`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_price_triggered_delivery_orders`, must be a value greater than or equal to `1`") # noqa: E501 - if 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 - raise ValueError("Invalid value for parameter `offset` when calling `list_price_triggered_delivery_orders`, must be a value greater than or equal to `0`") # noqa: E501 + if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 + local_var_params['status'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `status` when calling `list_price_triggered_delivery_orders`") # 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_price_triggered_delivery_orders`, 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_price_triggered_delivery_orders`, 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_price_triggered_delivery_orders`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} @@ -2688,13 +3196,13 @@ def list_price_triggered_delivery_orders_with_http_info(self, settle, status, ** path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'status' in local_var_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 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'limit' in local_var_params: + 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: + 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 header_params = {} @@ -2734,20 +3242,23 @@ def update_delivery_position_leverage(self, settle, contract, leverage, **kwargs >>> thread = api.update_delivery_position_leverage(settle, contract, leverage, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str leverage: New position leverage (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. :return: Position If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_delivery_position_leverage_with_http_info(settle, contract, leverage, **kwargs) # noqa: E501 - else: - (data) = self.update_delivery_position_leverage_with_http_info(settle, contract, leverage, **kwargs) # noqa: E501 - return data + return self.update_delivery_position_leverage_with_http_info(settle, contract, leverage, **kwargs) # noqa: E501 def update_delivery_position_leverage_with_http_info(self, settle, contract, leverage, **kwargs): # noqa: E501 """Update position leverage # noqa: E501 @@ -2757,43 +3268,60 @@ def update_delivery_position_leverage_with_http_info(self, settle, contract, lev >>> thread = api.update_delivery_position_leverage_with_http_info(settle, contract, leverage, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str leverage: New position leverage (required) - :return: Position + :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. + :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'leverage'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'leverage' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_delivery_position_leverage" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `update_delivery_position_leverage`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `update_delivery_position_leverage`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `update_delivery_position_leverage`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `update_delivery_position_leverage`") # noqa: E501 # verify the required parameter 'leverage' is set - if ('leverage' not in local_var_params or - local_var_params['leverage'] is None): - raise ValueError("Missing the required parameter `leverage` when calling `update_delivery_position_leverage`") # noqa: E501 + if self.api_client.client_side_validation and ('leverage' not in local_var_params or # noqa: E501 + local_var_params['leverage'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `leverage` when calling `update_delivery_position_leverage`") # noqa: E501 collection_formats = {} @@ -2804,7 +3332,7 @@ def update_delivery_position_leverage_with_http_info(self, settle, contract, lev path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] - if 'leverage' in local_var_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 header_params = {} @@ -2844,20 +3372,23 @@ def update_delivery_position_margin(self, settle, contract, change, **kwargs): >>> thread = api.update_delivery_position_margin(settle, contract, change, async_req=True) >>> result = thread.get() - :param async_req bool + :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 _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. :return: Position If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_delivery_position_margin_with_http_info(settle, contract, change, **kwargs) # noqa: E501 - else: - (data) = self.update_delivery_position_margin_with_http_info(settle, contract, change, **kwargs) # noqa: E501 - return data + return self.update_delivery_position_margin_with_http_info(settle, contract, change, **kwargs) # noqa: E501 def update_delivery_position_margin_with_http_info(self, settle, contract, change, **kwargs): # noqa: E501 """Update position margin # noqa: E501 @@ -2867,43 +3398,60 @@ def update_delivery_position_margin_with_http_info(self, settle, contract, chang >>> thread = api.update_delivery_position_margin_with_http_info(settle, contract, change, async_req=True) >>> result = thread.get() - :param async_req bool + :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) - :return: Position + :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. + :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'change'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'change' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_delivery_position_margin" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `update_delivery_position_margin`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `update_delivery_position_margin`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `update_delivery_position_margin`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `update_delivery_position_margin`") # noqa: E501 # verify the required parameter 'change' is set - if ('change' not in local_var_params or - local_var_params['change'] is None): - raise ValueError("Missing the required parameter `change` when calling `update_delivery_position_margin`") # noqa: E501 + if self.api_client.client_side_validation and ('change' not in local_var_params or # noqa: E501 + local_var_params['change'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `change` when calling `update_delivery_position_margin`") # noqa: E501 collection_formats = {} @@ -2914,7 +3462,7 @@ def update_delivery_position_margin_with_http_info(self, settle, contract, chang path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] - if 'change' in local_var_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 header_params = {} @@ -2954,20 +3502,23 @@ def update_delivery_position_risk_limit(self, settle, contract, risk_limit, **kw >>> thread = api.update_delivery_position_risk_limit(settle, contract, risk_limit, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str risk_limit: New position risk limit (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. :return: Position If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_delivery_position_risk_limit_with_http_info(settle, contract, risk_limit, **kwargs) # noqa: E501 - else: - (data) = self.update_delivery_position_risk_limit_with_http_info(settle, contract, risk_limit, **kwargs) # noqa: E501 - return data + return self.update_delivery_position_risk_limit_with_http_info(settle, contract, risk_limit, **kwargs) # noqa: E501 def update_delivery_position_risk_limit_with_http_info(self, settle, contract, risk_limit, **kwargs): # noqa: E501 """Update position risk limit # noqa: E501 @@ -2977,43 +3528,60 @@ def update_delivery_position_risk_limit_with_http_info(self, settle, contract, r >>> thread = api.update_delivery_position_risk_limit_with_http_info(settle, contract, risk_limit, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str risk_limit: New position risk limit (required) - :return: Position + :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. + :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'risk_limit'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'risk_limit' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_delivery_position_risk_limit" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `update_delivery_position_risk_limit`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `update_delivery_position_risk_limit`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `update_delivery_position_risk_limit`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `update_delivery_position_risk_limit`") # noqa: E501 # verify the required parameter 'risk_limit' is set - if ('risk_limit' not in local_var_params or - local_var_params['risk_limit'] is None): - raise ValueError("Missing the required parameter `risk_limit` when calling `update_delivery_position_risk_limit`") # noqa: E501 + if self.api_client.client_side_validation and ('risk_limit' not in local_var_params or # noqa: E501 + local_var_params['risk_limit'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `risk_limit` when calling `update_delivery_position_risk_limit`") # noqa: E501 collection_formats = {} @@ -3024,7 +3592,7 @@ def update_delivery_position_risk_limit_with_http_info(self, settle, contract, r path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] - if 'risk_limit' in local_var_params: + if 'risk_limit' in local_var_params and local_var_params['risk_limit'] is not None: # noqa: E501 query_params.append(('risk_limit', local_var_params['risk_limit'])) # noqa: E501 header_params = {} diff --git a/gate_api/api/futures_api.py b/gate_api/api/futures_api.py index 6f43c28..e6d7a16 100644 --- a/gate_api/api/futures_api.py +++ b/gate_api/api/futures_api.py @@ -18,6 +18,10 @@ import six from gate_api.api_client import ApiClient +from gate_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) class FuturesApi(object): @@ -40,19 +44,22 @@ def cancel_futures_order(self, settle, order_id, **kwargs): # noqa: E501 >>> thread = api.cancel_futures_order(settle, order_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: ID returned on order successfully being created (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. :return: FuturesOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.cancel_futures_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - else: - (data) = self.cancel_futures_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - return data + return self.cancel_futures_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 def cancel_futures_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 """Cancel a single order # noqa: E501 @@ -62,38 +69,54 @@ def cancel_futures_order_with_http_info(self, settle, order_id, **kwargs): # no >>> thread = api.cancel_futures_order_with_http_info(settle, order_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: ID returned on order successfully being created (required) - :return: FuturesOrder + :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. + :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'order_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'order_id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_futures_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `cancel_futures_order`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `cancel_futures_order`") # noqa: E501 # verify the required parameter 'order_id' is set - if ('order_id' not in local_var_params or - local_var_params['order_id'] is None): - raise ValueError("Missing the required parameter `order_id` when calling `cancel_futures_order`") # noqa: E501 + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_futures_order`") # noqa: E501 collection_formats = {} @@ -143,20 +166,23 @@ def cancel_futures_orders(self, settle, contract, **kwargs): # noqa: E501 >>> thread = api.cancel_futures_orders(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str side: All bids or asks. Both included in not specified + :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. :return: list[FuturesOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.cancel_futures_orders_with_http_info(settle, contract, **kwargs) # noqa: E501 - else: - (data) = self.cancel_futures_orders_with_http_info(settle, contract, **kwargs) # noqa: E501 - return data + return self.cancel_futures_orders_with_http_info(settle, contract, **kwargs) # noqa: E501 def cancel_futures_orders_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Cancel all `open` orders matched # noqa: E501 @@ -167,39 +193,56 @@ def cancel_futures_orders_with_http_info(self, settle, contract, **kwargs): # n >>> thread = api.cancel_futures_orders_with_http_info(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str side: All bids or asks. Both included in not specified - :return: list[FuturesOrder] + :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. + :return: tuple(list[FuturesOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'side'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'side' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_futures_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `cancel_futures_orders`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `cancel_futures_orders`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `cancel_futures_orders`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `cancel_futures_orders`") # noqa: E501 collection_formats = {} @@ -208,9 +251,9 @@ def cancel_futures_orders_with_http_info(self, settle, contract, **kwargs): # n path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'side' in local_var_params: + if 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 query_params.append(('side', local_var_params['side'])) # noqa: E501 header_params = {} @@ -250,19 +293,22 @@ def cancel_price_triggered_order(self, settle, order_id, **kwargs): # noqa: E50 >>> thread = api.cancel_price_triggered_order(settle, order_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: ID returned on order successfully being created (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. :return: FuturesPriceTriggeredOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.cancel_price_triggered_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - else: - (data) = self.cancel_price_triggered_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - return data + return self.cancel_price_triggered_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 def cancel_price_triggered_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 """Cancel a single order # noqa: E501 @@ -272,38 +318,54 @@ def cancel_price_triggered_order_with_http_info(self, settle, order_id, **kwargs >>> thread = api.cancel_price_triggered_order_with_http_info(settle, order_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: ID returned on order successfully being created (required) - :return: FuturesPriceTriggeredOrder + :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. + :return: tuple(FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'order_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'order_id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_price_triggered_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_order`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_order`") # noqa: E501 # verify the required parameter 'order_id' is set - if ('order_id' not in local_var_params or - local_var_params['order_id'] is None): - raise ValueError("Missing the required parameter `order_id` when calling `cancel_price_triggered_order`") # noqa: E501 + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_price_triggered_order`") # noqa: E501 collection_formats = {} @@ -352,19 +414,22 @@ def cancel_price_triggered_order_list(self, settle, contract, **kwargs): # noqa >>> thread = api.cancel_price_triggered_order_list(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (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. :return: list[FuturesPriceTriggeredOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.cancel_price_triggered_order_list_with_http_info(settle, contract, **kwargs) # noqa: E501 - else: - (data) = self.cancel_price_triggered_order_list_with_http_info(settle, contract, **kwargs) # noqa: E501 - return data + return self.cancel_price_triggered_order_list_with_http_info(settle, contract, **kwargs) # noqa: E501 def cancel_price_triggered_order_list_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Cancel all open orders # noqa: E501 @@ -374,38 +439,54 @@ def cancel_price_triggered_order_list_with_http_info(self, settle, contract, **k >>> thread = api.cancel_price_triggered_order_list_with_http_info(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) - :return: list[FuturesPriceTriggeredOrder] + :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. + :return: tuple(list[FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_price_triggered_order_list" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_order_list`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_order_list`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `cancel_price_triggered_order_list`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `cancel_price_triggered_order_list`") # noqa: E501 collection_formats = {} @@ -414,7 +495,7 @@ def cancel_price_triggered_order_list_with_http_info(self, settle, contract, **k path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 header_params = {} @@ -455,19 +536,22 @@ def create_futures_order(self, settle, futures_order, **kwargs): # noqa: E501 >>> thread = api.create_futures_order(settle, futures_order, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesOrder futures_order: (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. :return: FuturesOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.create_futures_order_with_http_info(settle, futures_order, **kwargs) # noqa: E501 - else: - (data) = self.create_futures_order_with_http_info(settle, futures_order, **kwargs) # noqa: E501 - return data + return self.create_futures_order_with_http_info(settle, futures_order, **kwargs) # noqa: E501 def create_futures_order_with_http_info(self, settle, futures_order, **kwargs): # noqa: E501 """Create a futures order # noqa: E501 @@ -478,38 +562,54 @@ def create_futures_order_with_http_info(self, settle, futures_order, **kwargs): >>> thread = api.create_futures_order_with_http_info(settle, futures_order, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesOrder futures_order: (required) - :return: FuturesOrder + :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. + :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'futures_order'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'futures_order' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method create_futures_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `create_futures_order`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `create_futures_order`") # noqa: E501 # verify the required parameter 'futures_order' is set - if ('futures_order' not in local_var_params or - local_var_params['futures_order'] is None): - raise ValueError("Missing the required parameter `futures_order` when calling `create_futures_order`") # noqa: E501 + if self.api_client.client_side_validation and ('futures_order' not in local_var_params or # noqa: E501 + local_var_params['futures_order'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `futures_order` when calling `create_futures_order`") # noqa: E501 collection_formats = {} @@ -562,19 +662,22 @@ def create_price_triggered_order(self, settle, futures_price_triggered_order, ** >>> thread = api.create_price_triggered_order(settle, futures_price_triggered_order, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesPriceTriggeredOrder futures_price_triggered_order: (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. :return: TriggerOrderResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.create_price_triggered_order_with_http_info(settle, futures_price_triggered_order, **kwargs) # noqa: E501 - else: - (data) = self.create_price_triggered_order_with_http_info(settle, futures_price_triggered_order, **kwargs) # noqa: E501 - return data + return self.create_price_triggered_order_with_http_info(settle, futures_price_triggered_order, **kwargs) # noqa: E501 def create_price_triggered_order_with_http_info(self, settle, futures_price_triggered_order, **kwargs): # noqa: E501 """Create a price-triggered order # noqa: E501 @@ -584,38 +687,54 @@ def create_price_triggered_order_with_http_info(self, settle, futures_price_trig >>> thread = api.create_price_triggered_order_with_http_info(settle, futures_price_triggered_order, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesPriceTriggeredOrder futures_price_triggered_order: (required) - :return: TriggerOrderResponse + :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. + :return: tuple(TriggerOrderResponse, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'futures_price_triggered_order'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'futures_price_triggered_order' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method create_price_triggered_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `create_price_triggered_order`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `create_price_triggered_order`") # noqa: E501 # verify the required parameter 'futures_price_triggered_order' is set - if ('futures_price_triggered_order' not in local_var_params or - local_var_params['futures_price_triggered_order'] is None): - raise ValueError("Missing the required parameter `futures_price_triggered_order` when calling `create_price_triggered_order`") # noqa: E501 + if self.api_client.client_side_validation and ('futures_price_triggered_order' not in local_var_params or # noqa: E501 + local_var_params['futures_price_triggered_order'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `futures_price_triggered_order` when calling `create_price_triggered_order`") # noqa: E501 collection_formats = {} @@ -668,19 +787,22 @@ def get_futures_contract(self, settle, contract, **kwargs): # noqa: E501 >>> thread = api.get_futures_contract(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (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. :return: Contract If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_futures_contract_with_http_info(settle, contract, **kwargs) # noqa: E501 - else: - (data) = self.get_futures_contract_with_http_info(settle, contract, **kwargs) # noqa: E501 - return data + return self.get_futures_contract_with_http_info(settle, contract, **kwargs) # noqa: E501 def get_futures_contract_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Get a single contract # noqa: E501 @@ -690,38 +812,54 @@ def get_futures_contract_with_http_info(self, settle, contract, **kwargs): # no >>> thread = api.get_futures_contract_with_http_info(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) - :return: Contract + :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. + :return: tuple(Contract, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_futures_contract" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `get_futures_contract`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_futures_contract`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `get_futures_contract`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `get_futures_contract`") # noqa: E501 collection_formats = {} @@ -771,19 +909,22 @@ def get_futures_order(self, settle, order_id, **kwargs): # noqa: E501 >>> thread = api.get_futures_order(settle, order_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: ID returned on order successfully being created (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. :return: FuturesOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_futures_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - else: - (data) = self.get_futures_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - return data + return self.get_futures_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 def get_futures_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 """Get a single order # noqa: E501 @@ -794,38 +935,54 @@ def get_futures_order_with_http_info(self, settle, order_id, **kwargs): # noqa: >>> thread = api.get_futures_order_with_http_info(settle, order_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: ID returned on order successfully being created (required) - :return: FuturesOrder + :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. + :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'order_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'order_id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_futures_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `get_futures_order`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_futures_order`") # noqa: E501 # verify the required parameter 'order_id' is set - if ('order_id' not in local_var_params or - local_var_params['order_id'] is None): - raise ValueError("Missing the required parameter `order_id` when calling `get_futures_order`") # noqa: E501 + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `get_futures_order`") # noqa: E501 collection_formats = {} @@ -874,7 +1031,7 @@ def get_my_trades(self, settle, **kwargs): # noqa: E501 >>> thread = api.get_my_trades(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int order: Futures order ID, return related data only if specified @@ -882,16 +1039,19 @@ def get_my_trades(self, settle, **kwargs): # noqa: E501 :param int offset: List offset, starting from 0 :param str last_id: Specify list staring point using the `id` of last record in previous list-query results :param int count_total: Whether to return total number matched. Default to 0(no return) + :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. :return: list[MyFuturesTrade] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_my_trades_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.get_my_trades_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.get_my_trades_with_http_info(settle, **kwargs) # noqa: E501 def get_my_trades_with_http_info(self, settle, **kwargs): # noqa: E501 """List personal trading history # noqa: E501 @@ -901,7 +1061,7 @@ def get_my_trades_with_http_info(self, settle, **kwargs): # noqa: E501 >>> thread = api.get_my_trades_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int order: Futures order ID, return related data only if specified @@ -909,38 +1069,59 @@ def get_my_trades_with_http_info(self, settle, **kwargs): # noqa: E501 :param int offset: List offset, starting from 0 :param str last_id: Specify list staring point using the `id` of last record in previous list-query results :param int count_total: Whether to return total number matched. Default to 0(no return) - :return: list[MyFuturesTrade] + :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. + :return: tuple(list[MyFuturesTrade], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'order', 'limit', 'offset', 'last_id', 'count_total'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'order', + 'limit', + 'offset', + 'last_id', + 'count_total' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_my_trades" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `get_my_trades`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `get_my_trades`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `get_my_trades`, must be a value greater than or equal to `1`") # noqa: E501 - if 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 - raise ValueError("Invalid value for parameter `offset` when calling `get_my_trades`, must be a value greater than or equal to `0`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_my_trades`") # 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 `get_my_trades`, 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 `get_my_trades`, 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 `get_my_trades`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} @@ -948,17 +1129,17 @@ def get_my_trades_with_http_info(self, settle, **kwargs): # noqa: E501 path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'order' in local_var_params: + if 'order' in local_var_params and local_var_params['order'] is not None: # noqa: E501 query_params.append(('order', local_var_params['order'])) # noqa: E501 - if 'limit' in local_var_params: + 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: + 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 'last_id' in local_var_params: + if 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 - if 'count_total' in local_var_params: + if 'count_total' in local_var_params and local_var_params['count_total'] is not None: # noqa: E501 query_params.append(('count_total', local_var_params['count_total'])) # noqa: E501 header_params = {} @@ -998,19 +1179,22 @@ def get_position(self, settle, contract, **kwargs): # noqa: E501 >>> thread = api.get_position(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (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. :return: Position If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_position_with_http_info(settle, contract, **kwargs) # noqa: E501 - else: - (data) = self.get_position_with_http_info(settle, contract, **kwargs) # noqa: E501 - return data + return self.get_position_with_http_info(settle, contract, **kwargs) # noqa: E501 def get_position_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Get single position # noqa: E501 @@ -1020,38 +1204,54 @@ def get_position_with_http_info(self, settle, contract, **kwargs): # noqa: E501 >>> thread = api.get_position_with_http_info(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) - :return: Position + :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. + :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_position" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `get_position`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_position`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `get_position`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `get_position`") # noqa: E501 collection_formats = {} @@ -1100,19 +1300,22 @@ def get_price_triggered_order(self, settle, order_id, **kwargs): # noqa: E501 >>> thread = api.get_price_triggered_order(settle, order_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: ID returned on order successfully being created (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. :return: FuturesPriceTriggeredOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_price_triggered_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - else: - (data) = self.get_price_triggered_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - return data + return self.get_price_triggered_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 def get_price_triggered_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 """Get a single order # noqa: E501 @@ -1122,38 +1325,54 @@ def get_price_triggered_order_with_http_info(self, settle, order_id, **kwargs): >>> thread = api.get_price_triggered_order_with_http_info(settle, order_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: ID returned on order successfully being created (required) - :return: FuturesPriceTriggeredOrder + :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. + :return: tuple(FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'order_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'order_id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_price_triggered_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `get_price_triggered_order`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_price_triggered_order`") # noqa: E501 # verify the required parameter 'order_id' is set - if ('order_id' not in local_var_params or - local_var_params['order_id'] is None): - raise ValueError("Missing the required parameter `order_id` when calling `get_price_triggered_order`") # noqa: E501 + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `get_price_triggered_order`") # noqa: E501 collection_formats = {} @@ -1202,22 +1421,25 @@ def list_futures_account_book(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_futures_account_book(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int limit: Maximum number of records returned in one list :param int _from: Start timestamp :param int to: End timestamp :param str type: Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate + :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. :return: list[FuturesAccountBook] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_futures_account_book_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.list_futures_account_book_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.list_futures_account_book_with_http_info(settle, **kwargs) # noqa: E501 def list_futures_account_book_with_http_info(self, settle, **kwargs): # noqa: E501 """Query account book # noqa: E501 @@ -1227,42 +1449,61 @@ def list_futures_account_book_with_http_info(self, settle, **kwargs): # noqa: E >>> thread = api.list_futures_account_book_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int limit: Maximum number of records returned in one list :param int _from: Start timestamp :param int to: End timestamp :param str type: Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate - :return: list[FuturesAccountBook] + :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. + :return: tuple(list[FuturesAccountBook], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'limit', '_from', 'to', 'type'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'limit', + '_from', + 'to', + 'type' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_account_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_futures_account_book`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_futures_account_book`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_futures_account_book`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_account_book`") # 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_futures_account_book`, 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_futures_account_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -1270,13 +1511,13 @@ def list_futures_account_book_with_http_info(self, settle, **kwargs): # noqa: E path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'limit' in local_var_params: + 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 '_from' in local_var_params: + if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params: + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 - if 'type' in local_var_params: + if 'type' in local_var_params and local_var_params['type'] is not None: # noqa: E501 query_params.append(('type', local_var_params['type'])) # noqa: E501 header_params = {} @@ -1316,18 +1557,21 @@ def list_futures_accounts(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_futures_accounts(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (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. :return: FuturesAccount If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_futures_accounts_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.list_futures_accounts_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.list_futures_accounts_with_http_info(settle, **kwargs) # noqa: E501 def list_futures_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 """Query futures account # noqa: E501 @@ -1337,33 +1581,48 @@ def list_futures_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_futures_accounts_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :return: FuturesAccount + :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. + :return: tuple(FuturesAccount, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_accounts" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_futures_accounts`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_accounts`") # noqa: E501 collection_formats = {} @@ -1411,23 +1670,26 @@ def list_futures_candlesticks(self, settle, contract, **kwargs): # noqa: E501 >>> thread = api.list_futures_candlesticks(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param float _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified :param float to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. :param str interval: Interval time between data points + :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. :return: list[FuturesCandlestick] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_futures_candlesticks_with_http_info(settle, contract, **kwargs) # noqa: E501 - else: - (data) = self.list_futures_candlesticks_with_http_info(settle, contract, **kwargs) # noqa: E501 - return data + return self.list_futures_candlesticks_with_http_info(settle, contract, **kwargs) # noqa: E501 def list_futures_candlesticks_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Get futures candlesticks # noqa: E501 @@ -1438,45 +1700,65 @@ def list_futures_candlesticks_with_http_info(self, settle, contract, **kwargs): >>> thread = api.list_futures_candlesticks_with_http_info(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param float _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified :param float to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. :param str interval: Interval time between data points - :return: list[FuturesCandlestick] + :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. + :return: tuple(list[FuturesCandlestick], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', '_from', 'to', 'limit', 'interval'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + '_from', + 'to', + 'limit', + 'interval' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_candlesticks" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_futures_candlesticks`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_candlesticks`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `list_futures_candlesticks`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_candlesticks`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] > 2000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_futures_candlesticks`, must be a value less than or equal to `2000`") # noqa: E501 + if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 2000: # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_candlesticks`, must be a value less than or equal to `2000`") # noqa: E501 collection_formats = {} path_params = {} @@ -1484,15 +1766,15 @@ def list_futures_candlesticks_with_http_info(self, settle, contract, **kwargs): path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if '_from' in local_var_params: + if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params: + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 - if 'limit' in local_var_params: + 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 'interval' in local_var_params: + if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 query_params.append(('interval', local_var_params['interval'])) # noqa: E501 header_params = {} @@ -1532,18 +1814,21 @@ def list_futures_contracts(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_futures_contracts(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (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. :return: list[Contract] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_futures_contracts_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.list_futures_contracts_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.list_futures_contracts_with_http_info(settle, **kwargs) # noqa: E501 def list_futures_contracts_with_http_info(self, settle, **kwargs): # noqa: E501 """List all futures contracts # noqa: E501 @@ -1553,33 +1838,48 @@ def list_futures_contracts_with_http_info(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_futures_contracts_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :return: list[Contract] + :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. + :return: tuple(list[Contract], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_contracts" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_futures_contracts`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_contracts`") # noqa: E501 collection_formats = {} @@ -1626,20 +1926,23 @@ def list_futures_funding_rate_history(self, settle, contract, **kwargs): # noqa >>> thread = api.list_futures_funding_rate_history(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int limit: Maximum number of records returned in one list + :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. :return: list[FundingRateRecord] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_futures_funding_rate_history_with_http_info(settle, contract, **kwargs) # noqa: E501 - else: - (data) = self.list_futures_funding_rate_history_with_http_info(settle, contract, **kwargs) # noqa: E501 - return data + return self.list_futures_funding_rate_history_with_http_info(settle, contract, **kwargs) # noqa: E501 def list_futures_funding_rate_history_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Funding rate history # noqa: E501 @@ -1649,44 +1952,61 @@ def list_futures_funding_rate_history_with_http_info(self, settle, contract, **k >>> thread = api.list_futures_funding_rate_history_with_http_info(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int limit: Maximum number of records returned in one list - :return: list[FundingRateRecord] + :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. + :return: tuple(list[FundingRateRecord], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'limit'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'limit' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_funding_rate_history" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_futures_funding_rate_history`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_funding_rate_history`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `list_futures_funding_rate_history`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_futures_funding_rate_history`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_futures_funding_rate_history`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_funding_rate_history`") # 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_futures_funding_rate_history`, 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_futures_funding_rate_history`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -1694,9 +2014,9 @@ def list_futures_funding_rate_history_with_http_info(self, settle, contract, **k path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'limit' in local_var_params: + 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 header_params = {} @@ -1736,19 +2056,22 @@ def list_futures_insurance_ledger(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_futures_insurance_ledger(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int limit: Maximum number of records returned in one list + :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. :return: list[InsuranceRecord] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_futures_insurance_ledger_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.list_futures_insurance_ledger_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.list_futures_insurance_ledger_with_http_info(settle, **kwargs) # noqa: E501 def list_futures_insurance_ledger_with_http_info(self, settle, **kwargs): # noqa: E501 """Futures insurance balance history # noqa: E501 @@ -1758,39 +2081,55 @@ def list_futures_insurance_ledger_with_http_info(self, settle, **kwargs): # noq >>> thread = api.list_futures_insurance_ledger_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int limit: Maximum number of records returned in one list - :return: list[InsuranceRecord] + :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. + :return: tuple(list[InsuranceRecord], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'limit'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'limit' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_insurance_ledger" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_futures_insurance_ledger`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_futures_insurance_ledger`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_futures_insurance_ledger`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_insurance_ledger`") # 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_futures_insurance_ledger`, 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_futures_insurance_ledger`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -1798,7 +2137,7 @@ def list_futures_insurance_ledger_with_http_info(self, settle, **kwargs): # noq path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'limit' in local_var_params: + 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 header_params = {} @@ -1839,21 +2178,24 @@ def list_futures_order_book(self, settle, contract, **kwargs): # noqa: E501 >>> thread = api.list_futures_order_book(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str interval: Order depth. 0 means no aggregation is applied. default to 0 :param int limit: Maximum number of order depth data in asks or bids + :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. :return: FuturesOrderBook If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_futures_order_book_with_http_info(settle, contract, **kwargs) # noqa: E501 - else: - (data) = self.list_futures_order_book_with_http_info(settle, contract, **kwargs) # noqa: E501 - return data + return self.list_futures_order_book_with_http_info(settle, contract, **kwargs) # noqa: E501 def list_futures_order_book_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Futures order book # noqa: E501 @@ -1864,45 +2206,63 @@ def list_futures_order_book_with_http_info(self, settle, contract, **kwargs): # >>> thread = api.list_futures_order_book_with_http_info(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str interval: Order depth. 0 means no aggregation is applied. default to 0 :param int limit: Maximum number of order depth data in asks or bids - :return: FuturesOrderBook + :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. + :return: tuple(FuturesOrderBook, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'interval', 'limit'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'interval', + 'limit' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_order_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_futures_order_book`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_order_book`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `list_futures_order_book`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 20: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_futures_order_book`, must be a value less than or equal to `20`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_futures_order_book`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_order_book`") # noqa: E501 + + if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 20: # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_order_book`, must be a value less than or equal to `20`") # 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_futures_order_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -1910,11 +2270,11 @@ def list_futures_order_book_with_http_info(self, settle, contract, **kwargs): # path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'interval' in local_var_params: + if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 query_params.append(('interval', local_var_params['interval'])) # noqa: E501 - if 'limit' in local_var_params: + 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 header_params = {} @@ -1955,7 +2315,7 @@ def list_futures_orders(self, settle, contract, status, **kwargs): # noqa: E501 >>> thread = api.list_futures_orders(settle, contract, status, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str status: List orders based on status (required) @@ -1963,16 +2323,19 @@ def list_futures_orders(self, settle, contract, status, **kwargs): # noqa: E501 :param int offset: List offset, starting from 0 :param str last_id: Specify list staring point using the `id` of last record in previous list-query results :param int count_total: Whether to return total number matched. Default to 0(no return) + :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. :return: list[FuturesOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_futures_orders_with_http_info(settle, contract, status, **kwargs) # noqa: E501 - else: - (data) = self.list_futures_orders_with_http_info(settle, contract, status, **kwargs) # noqa: E501 - return data + return self.list_futures_orders_with_http_info(settle, contract, status, **kwargs) # noqa: E501 def list_futures_orders_with_http_info(self, settle, contract, status, **kwargs): # noqa: E501 """List futures orders # noqa: E501 @@ -1983,7 +2346,7 @@ def list_futures_orders_with_http_info(self, settle, contract, status, **kwargs) >>> thread = api.list_futures_orders_with_http_info(settle, contract, status, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str status: List orders based on status (required) @@ -1991,46 +2354,67 @@ def list_futures_orders_with_http_info(self, settle, contract, status, **kwargs) :param int offset: List offset, starting from 0 :param str last_id: Specify list staring point using the `id` of last record in previous list-query results :param int count_total: Whether to return total number matched. Default to 0(no return) - :return: list[FuturesOrder] + :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. + :return: tuple(list[FuturesOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'status', 'limit', 'offset', 'last_id', 'count_total'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'status', + 'limit', + 'offset', + 'last_id', + 'count_total' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_futures_orders`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_orders`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `list_futures_orders`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_orders`") # noqa: E501 # verify the required parameter 'status' is set - if ('status' not in local_var_params or - local_var_params['status'] is None): - raise ValueError("Missing the required parameter `status` when calling `list_futures_orders`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_futures_orders`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_futures_orders`, must be a value greater than or equal to `1`") # noqa: E501 - if 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 - raise ValueError("Invalid value for parameter `offset` when calling `list_futures_orders`, must be a value greater than or equal to `0`") # noqa: E501 + if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 + local_var_params['status'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `status` when calling `list_futures_orders`") # 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_futures_orders`, 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_futures_orders`, 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_futures_orders`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} @@ -2038,17 +2422,17 @@ def list_futures_orders_with_http_info(self, settle, contract, status, **kwargs) path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'status' in local_var_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 'limit' in local_var_params: + 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: + 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 'last_id' in local_var_params: + if 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 - if 'count_total' in local_var_params: + if 'count_total' in local_var_params and local_var_params['count_total'] is not None: # noqa: E501 query_params.append(('count_total', local_var_params['count_total'])) # noqa: E501 header_params = {} @@ -2088,19 +2472,22 @@ def list_futures_tickers(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_futures_tickers(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified + :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. :return: list[FuturesTicker] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_futures_tickers_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.list_futures_tickers_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.list_futures_tickers_with_http_info(settle, **kwargs) # noqa: E501 def list_futures_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 """List futures tickers # noqa: E501 @@ -2110,34 +2497,50 @@ def list_futures_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_futures_tickers_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified - :return: list[FuturesTicker] + :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. + :return: tuple(list[FuturesTicker], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_tickers" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_futures_tickers`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_tickers`") # noqa: E501 collection_formats = {} @@ -2146,7 +2549,7 @@ def list_futures_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 header_params = {} @@ -2186,23 +2589,26 @@ def list_futures_trades(self, settle, contract, **kwargs): # noqa: E501 >>> thread = api.list_futures_trades(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int limit: Maximum number of records returned in one list :param str last_id: Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range :param float _from: Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. :param float to: Specify end time in Unix seconds, default to current time + :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. :return: list[FuturesTrade] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_futures_trades_with_http_info(settle, contract, **kwargs) # noqa: E501 - else: - (data) = self.list_futures_trades_with_http_info(settle, contract, **kwargs) # noqa: E501 - return data + return self.list_futures_trades_with_http_info(settle, contract, **kwargs) # noqa: E501 def list_futures_trades_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Futures trading history # noqa: E501 @@ -2212,47 +2618,67 @@ def list_futures_trades_with_http_info(self, settle, contract, **kwargs): # noq >>> thread = api.list_futures_trades_with_http_info(settle, contract, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int limit: Maximum number of records returned in one list :param str last_id: Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range :param float _from: Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. :param float to: Specify end time in Unix seconds, default to current time - :return: list[FuturesTrade] + :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. + :return: tuple(list[FuturesTrade], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'limit', 'last_id', '_from', 'to'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'limit', + 'last_id', + '_from', + 'to' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_trades" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_futures_trades`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_trades`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `list_futures_trades`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_futures_trades`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_futures_trades`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_trades`") # 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_futures_trades`, 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_futures_trades`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -2260,15 +2686,15 @@ def list_futures_trades_with_http_info(self, settle, contract, **kwargs): # noq path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'limit' in local_var_params: + 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 'last_id' in local_var_params: + if 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 - if '_from' in local_var_params: + if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params: + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 header_params = {} @@ -2308,21 +2734,24 @@ def list_liquidates(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_liquidates(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in one list :param int at: Specify a liquidation timestamp + :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. :return: list[FuturesLiquidate] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_liquidates_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.list_liquidates_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.list_liquidates_with_http_info(settle, **kwargs) # noqa: E501 def list_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 """List liquidation history # noqa: E501 @@ -2332,41 +2761,59 @@ def list_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_liquidates_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in one list :param int at: Specify a liquidation timestamp - :return: list[FuturesLiquidate] + :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. + :return: tuple(list[FuturesLiquidate], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'limit', 'at'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'limit', + 'at' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_liquidates" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_liquidates`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_liquidates`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_liquidates`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_liquidates`") # 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_liquidates`, 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_liquidates`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -2374,11 +2821,11 @@ def list_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'limit' in local_var_params: + 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 'at' in local_var_params: + if 'at' in local_var_params and local_var_params['at'] is not None: # noqa: E501 query_params.append(('at', local_var_params['at'])) # noqa: E501 header_params = {} @@ -2418,20 +2865,23 @@ def list_position_close(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_position_close(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in one list + :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. :return: list[PositionClose] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_position_close_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.list_position_close_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.list_position_close_with_http_info(settle, **kwargs) # noqa: E501 def list_position_close_with_http_info(self, settle, **kwargs): # noqa: E501 """List position close history # noqa: E501 @@ -2441,40 +2891,57 @@ def list_position_close_with_http_info(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_position_close_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in one list - :return: list[PositionClose] + :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. + :return: tuple(list[PositionClose], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'limit'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'limit' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_position_close" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_position_close`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_position_close`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_position_close`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_position_close`") # 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_position_close`, 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_position_close`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -2482,9 +2949,9 @@ def list_position_close_with_http_info(self, settle, **kwargs): # noqa: E501 path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'limit' in local_var_params: + 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 header_params = {} @@ -2524,18 +2991,21 @@ def list_positions(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_positions(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (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. :return: list[Position] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_positions_with_http_info(settle, **kwargs) # noqa: E501 - else: - (data) = self.list_positions_with_http_info(settle, **kwargs) # noqa: E501 - return data + return self.list_positions_with_http_info(settle, **kwargs) # noqa: E501 def list_positions_with_http_info(self, settle, **kwargs): # noqa: E501 """List all positions of a user # noqa: E501 @@ -2545,33 +3015,48 @@ def list_positions_with_http_info(self, settle, **kwargs): # noqa: E501 >>> thread = api.list_positions_with_http_info(settle, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :return: list[Position] + :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. + :return: tuple(list[Position], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_positions" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_positions`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_positions`") # noqa: E501 collection_formats = {} @@ -2618,22 +3103,25 @@ def list_price_triggered_orders(self, settle, status, **kwargs): # noqa: E501 >>> thread = api.list_price_triggered_orders(settle, status, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str status: List orders based on status (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in one list :param int offset: List offset, starting from 0 + :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. :return: list[FuturesPriceTriggeredOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_price_triggered_orders_with_http_info(settle, status, **kwargs) # noqa: E501 - else: - (data) = self.list_price_triggered_orders_with_http_info(settle, status, **kwargs) # noqa: E501 - return data + return self.list_price_triggered_orders_with_http_info(settle, status, **kwargs) # noqa: E501 def list_price_triggered_orders_with_http_info(self, settle, status, **kwargs): # noqa: E501 """List all auto orders # noqa: E501 @@ -2643,48 +3131,67 @@ def list_price_triggered_orders_with_http_info(self, settle, status, **kwargs): >>> thread = api.list_price_triggered_orders_with_http_info(settle, status, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str status: List orders based on status (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in one list :param int offset: List offset, starting from 0 - :return: list[FuturesPriceTriggeredOrder] + :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. + :return: tuple(list[FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'status', 'contract', 'limit', 'offset'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'status', + 'contract', + 'limit', + 'offset' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_price_triggered_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `list_price_triggered_orders`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_price_triggered_orders`") # noqa: E501 # verify the required parameter 'status' is set - if ('status' not in local_var_params or - local_var_params['status'] is None): - raise ValueError("Missing the required parameter `status` when calling `list_price_triggered_orders`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_price_triggered_orders`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_price_triggered_orders`, must be a value greater than or equal to `1`") # noqa: E501 - if 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 - raise ValueError("Invalid value for parameter `offset` when calling `list_price_triggered_orders`, must be a value greater than or equal to `0`") # noqa: E501 + if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 + local_var_params['status'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `status` when calling `list_price_triggered_orders`") # 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_price_triggered_orders`, 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_price_triggered_orders`, 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_price_triggered_orders`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} @@ -2692,13 +3199,13 @@ def list_price_triggered_orders_with_http_info(self, settle, status, **kwargs): path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'status' in local_var_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 'contract' in local_var_params: + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'limit' in local_var_params: + 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: + 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 header_params = {} @@ -2738,20 +3245,23 @@ def update_position_leverage(self, settle, contract, leverage, **kwargs): # noq >>> thread = api.update_position_leverage(settle, contract, leverage, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str leverage: New position leverage (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. :return: Position If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_position_leverage_with_http_info(settle, contract, leverage, **kwargs) # noqa: E501 - else: - (data) = self.update_position_leverage_with_http_info(settle, contract, leverage, **kwargs) # noqa: E501 - return data + return self.update_position_leverage_with_http_info(settle, contract, leverage, **kwargs) # noqa: E501 def update_position_leverage_with_http_info(self, settle, contract, leverage, **kwargs): # noqa: E501 """Update position leverage # noqa: E501 @@ -2761,43 +3271,60 @@ def update_position_leverage_with_http_info(self, settle, contract, leverage, ** >>> thread = api.update_position_leverage_with_http_info(settle, contract, leverage, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str leverage: New position leverage (required) - :return: Position + :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. + :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'leverage'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'leverage' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_position_leverage" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `update_position_leverage`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `update_position_leverage`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `update_position_leverage`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `update_position_leverage`") # noqa: E501 # verify the required parameter 'leverage' is set - if ('leverage' not in local_var_params or - local_var_params['leverage'] is None): - raise ValueError("Missing the required parameter `leverage` when calling `update_position_leverage`") # noqa: E501 + if self.api_client.client_side_validation and ('leverage' not in local_var_params or # noqa: E501 + local_var_params['leverage'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `leverage` when calling `update_position_leverage`") # noqa: E501 collection_formats = {} @@ -2808,7 +3335,7 @@ def update_position_leverage_with_http_info(self, settle, contract, leverage, ** path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] - if 'leverage' in local_var_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 header_params = {} @@ -2848,20 +3375,23 @@ def update_position_margin(self, settle, contract, change, **kwargs): # noqa: E >>> thread = api.update_position_margin(settle, contract, change, async_req=True) >>> result = thread.get() - :param async_req bool + :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 _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. :return: Position If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_position_margin_with_http_info(settle, contract, change, **kwargs) # noqa: E501 - else: - (data) = self.update_position_margin_with_http_info(settle, contract, change, **kwargs) # noqa: E501 - return data + return self.update_position_margin_with_http_info(settle, contract, change, **kwargs) # noqa: E501 def update_position_margin_with_http_info(self, settle, contract, change, **kwargs): # noqa: E501 """Update position margin # noqa: E501 @@ -2871,43 +3401,60 @@ def update_position_margin_with_http_info(self, settle, contract, change, **kwar >>> thread = api.update_position_margin_with_http_info(settle, contract, change, async_req=True) >>> result = thread.get() - :param async_req bool + :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) - :return: Position + :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. + :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'change'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'change' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_position_margin" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `update_position_margin`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `update_position_margin`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `update_position_margin`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `update_position_margin`") # noqa: E501 # verify the required parameter 'change' is set - if ('change' not in local_var_params or - local_var_params['change'] is None): - raise ValueError("Missing the required parameter `change` when calling `update_position_margin`") # noqa: E501 + if self.api_client.client_side_validation and ('change' not in local_var_params or # noqa: E501 + local_var_params['change'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `change` when calling `update_position_margin`") # noqa: E501 collection_formats = {} @@ -2918,7 +3465,7 @@ def update_position_margin_with_http_info(self, settle, contract, change, **kwar path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] - if 'change' in local_var_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 header_params = {} @@ -2958,20 +3505,23 @@ def update_position_risk_limit(self, settle, contract, risk_limit, **kwargs): # >>> thread = api.update_position_risk_limit(settle, contract, risk_limit, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str risk_limit: New position risk limit (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. :return: Position If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_position_risk_limit_with_http_info(settle, contract, risk_limit, **kwargs) # noqa: E501 - else: - (data) = self.update_position_risk_limit_with_http_info(settle, contract, risk_limit, **kwargs) # noqa: E501 - return data + return self.update_position_risk_limit_with_http_info(settle, contract, risk_limit, **kwargs) # noqa: E501 def update_position_risk_limit_with_http_info(self, settle, contract, risk_limit, **kwargs): # noqa: E501 """Update position risk limit # noqa: E501 @@ -2981,43 +3531,60 @@ def update_position_risk_limit_with_http_info(self, settle, contract, risk_limit >>> thread = api.update_position_risk_limit_with_http_info(settle, contract, risk_limit, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str risk_limit: New position risk limit (required) - :return: Position + :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. + :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['settle', 'contract', 'risk_limit'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'settle', + 'contract', + 'risk_limit' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_position_risk_limit" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if ('settle' not in local_var_params or - local_var_params['settle'] is None): - raise ValueError("Missing the required parameter `settle` when calling `update_position_risk_limit`") # noqa: E501 + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `update_position_risk_limit`") # noqa: E501 # verify the required parameter 'contract' is set - if ('contract' not in local_var_params or - local_var_params['contract'] is None): - raise ValueError("Missing the required parameter `contract` when calling `update_position_risk_limit`") # noqa: E501 + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `update_position_risk_limit`") # noqa: E501 # verify the required parameter 'risk_limit' is set - if ('risk_limit' not in local_var_params or - local_var_params['risk_limit'] is None): - raise ValueError("Missing the required parameter `risk_limit` when calling `update_position_risk_limit`") # noqa: E501 + if self.api_client.client_side_validation and ('risk_limit' not in local_var_params or # noqa: E501 + local_var_params['risk_limit'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `risk_limit` when calling `update_position_risk_limit`") # noqa: E501 collection_formats = {} @@ -3028,7 +3595,7 @@ def update_position_risk_limit_with_http_info(self, settle, contract, risk_limit path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] - if 'risk_limit' in local_var_params: + if 'risk_limit' in local_var_params and local_var_params['risk_limit'] is not None: # noqa: E501 query_params.append(('risk_limit', local_var_params['risk_limit'])) # noqa: E501 header_params = {} diff --git a/gate_api/api/margin_api.py b/gate_api/api/margin_api.py index 64f178a..ffb20c9 100644 --- a/gate_api/api/margin_api.py +++ b/gate_api/api/margin_api.py @@ -18,6 +18,10 @@ import six from gate_api.api_client import ApiClient +from gate_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) class MarginApi(object): @@ -41,19 +45,22 @@ def cancel_loan(self, loan_id, currency, **kwargs): # noqa: E501 >>> thread = api.cancel_loan(loan_id, currency, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str loan_id: Loan ID (required) :param str currency: Retrieved specified currency related data (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. :return: Loan If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.cancel_loan_with_http_info(loan_id, currency, **kwargs) # noqa: E501 - else: - (data) = self.cancel_loan_with_http_info(loan_id, currency, **kwargs) # noqa: E501 - return data + return self.cancel_loan_with_http_info(loan_id, currency, **kwargs) # noqa: E501 def cancel_loan_with_http_info(self, loan_id, currency, **kwargs): # noqa: E501 """Cancel lending loan # noqa: E501 @@ -64,38 +71,54 @@ def cancel_loan_with_http_info(self, loan_id, currency, **kwargs): # noqa: E501 >>> thread = api.cancel_loan_with_http_info(loan_id, currency, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str loan_id: Loan ID (required) :param str currency: Retrieved specified currency related data (required) - :return: Loan + :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. + :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['loan_id', 'currency'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'loan_id', + 'currency' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_loan" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'loan_id' is set - if ('loan_id' not in local_var_params or - local_var_params['loan_id'] is None): - raise ValueError("Missing the required parameter `loan_id` when calling `cancel_loan`") # noqa: E501 + if self.api_client.client_side_validation and ('loan_id' not in local_var_params or # noqa: E501 + local_var_params['loan_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_id` when calling `cancel_loan`") # noqa: E501 # verify the required parameter 'currency' is set - if ('currency' not in local_var_params or - local_var_params['currency'] is None): - raise ValueError("Missing the required parameter `currency` when calling `cancel_loan`") # noqa: E501 + if self.api_client.client_side_validation and ('currency' not in local_var_params or # noqa: E501 + local_var_params['currency'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency` when calling `cancel_loan`") # noqa: E501 collection_formats = {} @@ -104,7 +127,7 @@ def cancel_loan_with_http_info(self, loan_id, currency, **kwargs): # noqa: E501 path_params['loan_id'] = local_var_params['loan_id'] # noqa: E501 query_params = [] - if 'currency' in local_var_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 header_params = {} @@ -144,18 +167,21 @@ def create_loan(self, loan, **kwargs): # noqa: E501 >>> thread = api.create_loan(loan, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param Loan 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. :return: Loan If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.create_loan_with_http_info(loan, **kwargs) # noqa: E501 - else: - (data) = self.create_loan_with_http_info(loan, **kwargs) # noqa: E501 - return data + return self.create_loan_with_http_info(loan, **kwargs) # noqa: E501 def create_loan_with_http_info(self, loan, **kwargs): # noqa: E501 """Lend or borrow # noqa: E501 @@ -165,33 +191,48 @@ def create_loan_with_http_info(self, loan, **kwargs): # noqa: E501 >>> thread = api.create_loan_with_http_info(loan, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param Loan loan: (required) - :return: Loan + :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. + :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['loan'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'loan' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method create_loan" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'loan' is set - if ('loan' not in local_var_params or - local_var_params['loan'] is None): - raise ValueError("Missing the required parameter `loan` when calling `create_loan`") # noqa: E501 + if self.api_client.client_side_validation and ('loan' not in local_var_params or # noqa: E501 + local_var_params['loan'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan` when calling `create_loan`") # noqa: E501 collection_formats = {} @@ -242,19 +283,22 @@ def get_loan(self, loan_id, side, **kwargs): # noqa: E501 >>> thread = api.get_loan(loan_id, side, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str loan_id: Loan ID (required) :param str side: Lend or borrow (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. :return: Loan If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_loan_with_http_info(loan_id, side, **kwargs) # noqa: E501 - else: - (data) = self.get_loan_with_http_info(loan_id, side, **kwargs) # noqa: E501 - return data + return self.get_loan_with_http_info(loan_id, side, **kwargs) # noqa: E501 def get_loan_with_http_info(self, loan_id, side, **kwargs): # noqa: E501 """Retrieve one single loan detail # noqa: E501 @@ -264,38 +308,54 @@ def get_loan_with_http_info(self, loan_id, side, **kwargs): # noqa: E501 >>> thread = api.get_loan_with_http_info(loan_id, side, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str loan_id: Loan ID (required) :param str side: Lend or borrow (required) - :return: Loan + :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. + :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['loan_id', 'side'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'loan_id', + 'side' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_loan" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'loan_id' is set - if ('loan_id' not in local_var_params or - local_var_params['loan_id'] is None): - raise ValueError("Missing the required parameter `loan_id` when calling `get_loan`") # noqa: E501 + if self.api_client.client_side_validation and ('loan_id' not in local_var_params or # noqa: E501 + local_var_params['loan_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_id` when calling `get_loan`") # noqa: E501 # verify the required parameter 'side' is set - if ('side' not in local_var_params or - local_var_params['side'] is None): - raise ValueError("Missing the required parameter `side` when calling `get_loan`") # noqa: E501 + if self.api_client.client_side_validation and ('side' not in local_var_params or # noqa: E501 + local_var_params['side'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `side` when calling `get_loan`") # noqa: E501 collection_formats = {} @@ -304,7 +364,7 @@ def get_loan_with_http_info(self, loan_id, side, **kwargs): # noqa: E501 path_params['loan_id'] = local_var_params['loan_id'] # noqa: E501 query_params = [] - if 'side' in local_var_params: + if 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 query_params.append(('side', local_var_params['side'])) # noqa: E501 header_params = {} @@ -344,19 +404,22 @@ def get_loan_record(self, loan_record_id, loan_id, **kwargs): # noqa: E501 >>> thread = api.get_loan_record(loan_record_id, loan_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str loan_record_id: Loan record ID (required) :param str loan_id: 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. :return: LoanRecord If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_loan_record_with_http_info(loan_record_id, loan_id, **kwargs) # noqa: E501 - else: - (data) = self.get_loan_record_with_http_info(loan_record_id, loan_id, **kwargs) # noqa: E501 - return data + return self.get_loan_record_with_http_info(loan_record_id, loan_id, **kwargs) # noqa: E501 def get_loan_record_with_http_info(self, loan_record_id, loan_id, **kwargs): # noqa: E501 """Get one single loan record # noqa: E501 @@ -366,38 +429,54 @@ def get_loan_record_with_http_info(self, loan_record_id, loan_id, **kwargs): # >>> thread = api.get_loan_record_with_http_info(loan_record_id, loan_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str loan_record_id: Loan record ID (required) :param str loan_id: Loan ID (required) - :return: LoanRecord + :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. + :return: tuple(LoanRecord, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['loan_record_id', 'loan_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'loan_record_id', + 'loan_id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_loan_record" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'loan_record_id' is set - if ('loan_record_id' not in local_var_params or - local_var_params['loan_record_id'] is None): - raise ValueError("Missing the required parameter `loan_record_id` when calling `get_loan_record`") # noqa: E501 + if self.api_client.client_side_validation and ('loan_record_id' not in local_var_params or # noqa: E501 + local_var_params['loan_record_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_record_id` when calling `get_loan_record`") # noqa: E501 # verify the required parameter 'loan_id' is set - if ('loan_id' not in local_var_params or - local_var_params['loan_id'] is None): - raise ValueError("Missing the required parameter `loan_id` when calling `get_loan_record`") # noqa: E501 + if self.api_client.client_side_validation and ('loan_id' not in local_var_params or # noqa: E501 + local_var_params['loan_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_id` when calling `get_loan_record`") # noqa: E501 collection_formats = {} @@ -406,7 +485,7 @@ def get_loan_record_with_http_info(self, loan_record_id, loan_id, **kwargs): # path_params['loan_record_id'] = local_var_params['loan_record_id'] # noqa: E501 query_params = [] - if 'loan_id' in local_var_params: + 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 header_params = {} @@ -446,18 +525,21 @@ def list_funding_accounts(self, **kwargs): # noqa: E501 >>> thread = api.list_funding_accounts(async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency: Retrieved specified currency related data + :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. :return: list[FundingAccount] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_funding_accounts_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_funding_accounts_with_http_info(**kwargs) # noqa: E501 - return data + return self.list_funding_accounts_with_http_info(**kwargs) # noqa: E501 def list_funding_accounts_with_http_info(self, **kwargs): # noqa: E501 """Funding account list # noqa: E501 @@ -467,24 +549,39 @@ def list_funding_accounts_with_http_info(self, **kwargs): # noqa: E501 >>> thread = api.list_funding_accounts_with_http_info(async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency: Retrieved specified currency related data - :return: list[FundingAccount] + :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. + :return: tuple(list[FundingAccount], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['currency'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'currency' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_funding_accounts" % key ) @@ -496,7 +593,7 @@ def list_funding_accounts_with_http_info(self, **kwargs): # noqa: E501 path_params = {} query_params = [] - if 'currency' in local_var_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 header_params = {} @@ -536,18 +633,21 @@ def list_funding_book(self, currency, **kwargs): # noqa: E501 >>> thread = api.list_funding_book(currency, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency: Retrieved specified currency related data (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. :return: list[FundingBookItem] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_funding_book_with_http_info(currency, **kwargs) # noqa: E501 - else: - (data) = self.list_funding_book_with_http_info(currency, **kwargs) # noqa: E501 - return data + return self.list_funding_book_with_http_info(currency, **kwargs) # noqa: E501 def list_funding_book_with_http_info(self, currency, **kwargs): # noqa: E501 """Order book of lending loans # noqa: E501 @@ -557,40 +657,55 @@ def list_funding_book_with_http_info(self, currency, **kwargs): # noqa: E501 >>> thread = api.list_funding_book_with_http_info(currency, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency: Retrieved specified currency related data (required) - :return: list[FundingBookItem] + :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. + :return: tuple(list[FundingBookItem], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['currency'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'currency' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_funding_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency' is set - if ('currency' not in local_var_params or - local_var_params['currency'] is None): - raise ValueError("Missing the required parameter `currency` when calling `list_funding_book`") # noqa: E501 + if self.api_client.client_side_validation and ('currency' not in local_var_params or # noqa: E501 + local_var_params['currency'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency` when calling `list_funding_book`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if 'currency' in local_var_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 header_params = {} @@ -630,21 +745,24 @@ def list_loan_records(self, loan_id, **kwargs): # noqa: E501 >>> thread = api.list_loan_records(loan_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str loan_id: Loan ID (required) :param str status: Loan record status :param int page: Page number :param int limit: Maximum number of records returned in one list + :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. :return: list[LoanRecord] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_loan_records_with_http_info(loan_id, **kwargs) # noqa: E501 - else: - (data) = self.list_loan_records_with_http_info(loan_id, **kwargs) # noqa: E501 - return data + return self.list_loan_records_with_http_info(loan_id, **kwargs) # noqa: E501 def list_loan_records_with_http_info(self, loan_id, **kwargs): # noqa: E501 """List repayment records of specified loan # noqa: E501 @@ -654,55 +772,73 @@ def list_loan_records_with_http_info(self, loan_id, **kwargs): # noqa: E501 >>> thread = api.list_loan_records_with_http_info(loan_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str loan_id: Loan ID (required) :param str status: Loan record status :param int page: Page number :param int limit: Maximum number of records returned in one list - :return: list[LoanRecord] + :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. + :return: tuple(list[LoanRecord], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['loan_id', 'status', 'page', 'limit'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'loan_id', + 'status', + 'page', + 'limit' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_loan_records" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'loan_id' is set - if ('loan_id' not in local_var_params or - local_var_params['loan_id'] is None): - raise ValueError("Missing the required parameter `loan_id` when calling `list_loan_records`") # noqa: E501 - - if 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `page` when calling `list_loan_records`, must be a value greater than or equal to `1`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_loan_records`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_loan_records`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('loan_id' not in local_var_params or # noqa: E501 + local_var_params['loan_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_id` when calling `list_loan_records`") # noqa: E501 + + if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 + raise ApiValueError("Invalid value for parameter `page` when calling `list_loan_records`, must be a value greater than or equal to `1`") # 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_loan_records`, 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_loan_records`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if 'loan_id' in local_var_params: + 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 'status' in local_var_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 'page' in local_var_params: + if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 query_params.append(('page', local_var_params['page'])) # noqa: E501 - if 'limit' in local_var_params: + 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 header_params = {} @@ -742,18 +878,21 @@ def list_loan_repayments(self, loan_id, **kwargs): # noqa: E501 >>> thread = api.list_loan_repayments(loan_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str loan_id: 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. :return: list[Repayment] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_loan_repayments_with_http_info(loan_id, **kwargs) # noqa: E501 - else: - (data) = self.list_loan_repayments_with_http_info(loan_id, **kwargs) # noqa: E501 - return data + return self.list_loan_repayments_with_http_info(loan_id, **kwargs) # noqa: E501 def list_loan_repayments_with_http_info(self, loan_id, **kwargs): # noqa: E501 """List loan repayment records # noqa: E501 @@ -763,33 +902,48 @@ def list_loan_repayments_with_http_info(self, loan_id, **kwargs): # noqa: E501 >>> thread = api.list_loan_repayments_with_http_info(loan_id, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str loan_id: Loan ID (required) - :return: list[Repayment] + :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. + :return: tuple(list[Repayment], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['loan_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'loan_id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_loan_repayments" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'loan_id' is set - if ('loan_id' not in local_var_params or - local_var_params['loan_id'] is None): - raise ValueError("Missing the required parameter `loan_id` when calling `list_loan_repayments`") # noqa: E501 + if self.api_client.client_side_validation and ('loan_id' not in local_var_params or # noqa: E501 + local_var_params['loan_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_id` when calling `list_loan_repayments`") # noqa: E501 collection_formats = {} @@ -836,7 +990,7 @@ def list_loans(self, status, side, **kwargs): # noqa: E501 >>> thread = api.list_loans(status, side, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str status: Loan status (required) :param str side: Lend or borrow (required) :param str currency: Retrieved specified currency related data @@ -845,16 +999,19 @@ def list_loans(self, status, side, **kwargs): # noqa: E501 :param bool reverse_sort: Whether to sort in descending order. Default to `true` :param int page: Page number :param int limit: Maximum number of records returned in one list + :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. :return: list[Loan] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_loans_with_http_info(status, side, **kwargs) # noqa: E501 - else: - (data) = self.list_loans_with_http_info(status, side, **kwargs) # noqa: E501 - return data + return self.list_loans_with_http_info(status, side, **kwargs) # noqa: E501 def list_loans_with_http_info(self, status, side, **kwargs): # noqa: E501 """List all loans # noqa: E501 @@ -864,7 +1021,7 @@ def list_loans_with_http_info(self, status, side, **kwargs): # noqa: E501 >>> thread = api.list_loans_with_http_info(status, side, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str status: Loan status (required) :param str side: Lend or borrow (required) :param str currency: Retrieved specified currency related data @@ -873,62 +1030,84 @@ def list_loans_with_http_info(self, status, side, **kwargs): # noqa: E501 :param bool reverse_sort: Whether to sort in descending order. Default to `true` :param int page: Page number :param int limit: Maximum number of records returned in one list - :return: list[Loan] + :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. + :return: tuple(list[Loan], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['status', 'side', 'currency', 'currency_pair', 'sort_by', 'reverse_sort', 'page', 'limit'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'status', + 'side', + 'currency', + 'currency_pair', + 'sort_by', + 'reverse_sort', + 'page', + 'limit' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_loans" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'status' is set - if ('status' not in local_var_params or - local_var_params['status'] is None): - raise ValueError("Missing the required parameter `status` when calling `list_loans`") # noqa: E501 + if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 + local_var_params['status'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `status` when calling `list_loans`") # noqa: E501 # verify the required parameter 'side' is set - if ('side' not in local_var_params or - local_var_params['side'] is None): - raise ValueError("Missing the required parameter `side` when calling `list_loans`") # noqa: E501 - - if 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `page` when calling `list_loans`, must be a value greater than or equal to `1`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_loans`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_loans`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('side' not in local_var_params or # noqa: E501 + local_var_params['side'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `side` when calling `list_loans`") # noqa: E501 + + if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 + raise ApiValueError("Invalid value for parameter `page` when calling `list_loans`, must be a value greater than or equal to `1`") # 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_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_loans`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if 'status' in local_var_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 'side' in local_var_params: + if 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 query_params.append(('side', local_var_params['side'])) # noqa: E501 - if 'currency' in local_var_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 'currency_pair' in local_var_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 'sort_by' in local_var_params: + if 'sort_by' in local_var_params and local_var_params['sort_by'] is not None: # noqa: E501 query_params.append(('sort_by', local_var_params['sort_by'])) # noqa: E501 - if 'reverse_sort' in local_var_params: + if 'reverse_sort' in local_var_params and local_var_params['reverse_sort'] is not None: # noqa: E501 query_params.append(('reverse_sort', local_var_params['reverse_sort'])) # noqa: E501 - if 'page' in local_var_params: + if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 query_params.append(('page', local_var_params['page'])) # noqa: E501 - if 'limit' in local_var_params: + 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 header_params = {} @@ -968,18 +1147,21 @@ def list_margin_accounts(self, **kwargs): # noqa: E501 >>> thread = api.list_margin_accounts(async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair + :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. :return: list[MarginAccount] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_margin_accounts_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_margin_accounts_with_http_info(**kwargs) # noqa: E501 - return data + return self.list_margin_accounts_with_http_info(**kwargs) # noqa: E501 def list_margin_accounts_with_http_info(self, **kwargs): # noqa: E501 """Margin account list # noqa: E501 @@ -989,24 +1171,39 @@ def list_margin_accounts_with_http_info(self, **kwargs): # noqa: E501 >>> thread = api.list_margin_accounts_with_http_info(async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair - :return: list[MarginAccount] + :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. + :return: tuple(list[MarginAccount], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['currency_pair'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'currency_pair' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_margin_accounts" % key ) @@ -1018,7 +1215,7 @@ def list_margin_accounts_with_http_info(self, **kwargs): # noqa: E501 path_params = {} query_params = [] - if 'currency_pair' in local_var_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 header_params = {} @@ -1058,17 +1255,20 @@ def list_margin_currency_pairs(self, **kwargs): # noqa: E501 >>> thread = api.list_margin_currency_pairs(async_req=True) >>> result = thread.get() - :param async_req bool + :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. :return: list[MarginCurrencyPair] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_margin_currency_pairs_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_margin_currency_pairs_with_http_info(**kwargs) # noqa: E501 - return data + return self.list_margin_currency_pairs_with_http_info(**kwargs) # noqa: E501 def list_margin_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 """List all supported currency pairs supported in margin trading # noqa: E501 @@ -1078,23 +1278,37 @@ def list_margin_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 >>> thread = api.list_margin_currency_pairs_with_http_info(async_req=True) >>> result = thread.get() - :param async_req bool - :return: list[MarginCurrencyPair] + :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. + :return: tuple(list[MarginCurrencyPair], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_margin_currency_pairs" % key ) @@ -1144,19 +1358,22 @@ def merge_loans(self, currency, ids, **kwargs): # noqa: E501 >>> thread = api.merge_loans(currency, ids, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency: Retrieved specified currency related data (required) :param str ids: Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one 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. :return: Loan If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.merge_loans_with_http_info(currency, ids, **kwargs) # noqa: E501 - else: - (data) = self.merge_loans_with_http_info(currency, ids, **kwargs) # noqa: E501 - return data + return self.merge_loans_with_http_info(currency, ids, **kwargs) # noqa: E501 def merge_loans_with_http_info(self, currency, ids, **kwargs): # noqa: E501 """Merge multiple lending loans # noqa: E501 @@ -1166,47 +1383,63 @@ def merge_loans_with_http_info(self, currency, ids, **kwargs): # noqa: E501 >>> thread = api.merge_loans_with_http_info(currency, ids, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency: Retrieved specified currency related data (required) :param str ids: Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request (required) - :return: Loan + :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. + :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['currency', 'ids'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'currency', + 'ids' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method merge_loans" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency' is set - if ('currency' not in local_var_params or - local_var_params['currency'] is None): - raise ValueError("Missing the required parameter `currency` when calling `merge_loans`") # noqa: E501 + if self.api_client.client_side_validation and ('currency' not in local_var_params or # noqa: E501 + local_var_params['currency'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency` when calling `merge_loans`") # noqa: E501 # verify the required parameter 'ids' is set - if ('ids' not in local_var_params or - local_var_params['ids'] is None): - raise ValueError("Missing the required parameter `ids` when calling `merge_loans`") # noqa: E501 + if self.api_client.client_side_validation and ('ids' not in local_var_params or # noqa: E501 + local_var_params['ids'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `ids` when calling `merge_loans`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if 'currency' in local_var_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 'ids' in local_var_params: + if 'ids' in local_var_params and local_var_params['ids'] is not None: # noqa: E501 query_params.append(('ids', local_var_params['ids'])) # noqa: E501 header_params = {} @@ -1246,19 +1479,22 @@ def repay_loan(self, loan_id, repay_request, **kwargs): # noqa: E501 >>> thread = api.repay_loan(loan_id, repay_request, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str loan_id: Loan ID (required) :param RepayRequest 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. :return: Loan If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.repay_loan_with_http_info(loan_id, repay_request, **kwargs) # noqa: E501 - else: - (data) = self.repay_loan_with_http_info(loan_id, repay_request, **kwargs) # noqa: E501 - return data + return self.repay_loan_with_http_info(loan_id, repay_request, **kwargs) # noqa: E501 def repay_loan_with_http_info(self, loan_id, repay_request, **kwargs): # noqa: E501 """Repay a loan # noqa: E501 @@ -1268,38 +1504,54 @@ def repay_loan_with_http_info(self, loan_id, repay_request, **kwargs): # noqa: >>> thread = api.repay_loan_with_http_info(loan_id, repay_request, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str loan_id: Loan ID (required) :param RepayRequest repay_request: (required) - :return: Loan + :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. + :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['loan_id', 'repay_request'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'loan_id', + 'repay_request' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method repay_loan" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'loan_id' is set - if ('loan_id' not in local_var_params or - local_var_params['loan_id'] is None): - raise ValueError("Missing the required parameter `loan_id` when calling `repay_loan`") # noqa: E501 + if self.api_client.client_side_validation and ('loan_id' not in local_var_params or # noqa: E501 + local_var_params['loan_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_id` when calling `repay_loan`") # noqa: E501 # verify the required parameter 'repay_request' is set - if ('repay_request' not in local_var_params or - local_var_params['repay_request'] is None): - raise ValueError("Missing the required parameter `repay_request` when calling `repay_loan`") # noqa: E501 + if self.api_client.client_side_validation and ('repay_request' not in local_var_params or # noqa: E501 + local_var_params['repay_request'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `repay_request` when calling `repay_loan`") # noqa: E501 collection_formats = {} @@ -1353,19 +1605,22 @@ def update_loan(self, loan_id, loan_patch, **kwargs): # noqa: E501 >>> thread = api.update_loan(loan_id, loan_patch, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str loan_id: Loan ID (required) :param LoanPatch loan_patch: (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. :return: Loan If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_loan_with_http_info(loan_id, loan_patch, **kwargs) # noqa: E501 - else: - (data) = self.update_loan_with_http_info(loan_id, loan_patch, **kwargs) # noqa: E501 - return data + return self.update_loan_with_http_info(loan_id, loan_patch, **kwargs) # noqa: E501 def update_loan_with_http_info(self, loan_id, loan_patch, **kwargs): # noqa: E501 """Modify a loan # noqa: E501 @@ -1376,38 +1631,54 @@ def update_loan_with_http_info(self, loan_id, loan_patch, **kwargs): # noqa: E5 >>> thread = api.update_loan_with_http_info(loan_id, loan_patch, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str loan_id: Loan ID (required) :param LoanPatch loan_patch: (required) - :return: Loan + :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. + :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['loan_id', 'loan_patch'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'loan_id', + 'loan_patch' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_loan" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'loan_id' is set - if ('loan_id' not in local_var_params or - local_var_params['loan_id'] is None): - raise ValueError("Missing the required parameter `loan_id` when calling `update_loan`") # noqa: E501 + if self.api_client.client_side_validation and ('loan_id' not in local_var_params or # noqa: E501 + local_var_params['loan_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_id` when calling `update_loan`") # noqa: E501 # verify the required parameter 'loan_patch' is set - if ('loan_patch' not in local_var_params or - local_var_params['loan_patch'] is None): - raise ValueError("Missing the required parameter `loan_patch` when calling `update_loan`") # noqa: E501 + if self.api_client.client_side_validation and ('loan_patch' not in local_var_params or # noqa: E501 + local_var_params['loan_patch'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_patch` when calling `update_loan`") # noqa: E501 collection_formats = {} @@ -1461,19 +1732,22 @@ def update_loan_record(self, loan_record_id, loan_patch, **kwargs): # noqa: E50 >>> thread = api.update_loan_record(loan_record_id, loan_patch, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str loan_record_id: Loan record ID (required) :param LoanPatch loan_patch: (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. :return: LoanRecord If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_loan_record_with_http_info(loan_record_id, loan_patch, **kwargs) # noqa: E501 - else: - (data) = self.update_loan_record_with_http_info(loan_record_id, loan_patch, **kwargs) # noqa: E501 - return data + return self.update_loan_record_with_http_info(loan_record_id, loan_patch, **kwargs) # noqa: E501 def update_loan_record_with_http_info(self, loan_record_id, loan_patch, **kwargs): # noqa: E501 """Modify a loan record # noqa: E501 @@ -1484,38 +1758,54 @@ def update_loan_record_with_http_info(self, loan_record_id, loan_patch, **kwargs >>> thread = api.update_loan_record_with_http_info(loan_record_id, loan_patch, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str loan_record_id: Loan record ID (required) :param LoanPatch loan_patch: (required) - :return: LoanRecord + :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. + :return: tuple(LoanRecord, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['loan_record_id', 'loan_patch'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'loan_record_id', + 'loan_patch' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_loan_record" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'loan_record_id' is set - if ('loan_record_id' not in local_var_params or - local_var_params['loan_record_id'] is None): - raise ValueError("Missing the required parameter `loan_record_id` when calling `update_loan_record`") # noqa: E501 + if self.api_client.client_side_validation and ('loan_record_id' not in local_var_params or # noqa: E501 + local_var_params['loan_record_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_record_id` when calling `update_loan_record`") # noqa: E501 # verify the required parameter 'loan_patch' is set - if ('loan_patch' not in local_var_params or - local_var_params['loan_patch'] is None): - raise ValueError("Missing the required parameter `loan_patch` when calling `update_loan_record`") # noqa: E501 + if self.api_client.client_side_validation and ('loan_patch' not in local_var_params or # noqa: E501 + local_var_params['loan_patch'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_patch` when calling `update_loan_record`") # noqa: E501 collection_formats = {} diff --git a/gate_api/api/spot_api.py b/gate_api/api/spot_api.py index f7a95a3..22fabee 100644 --- a/gate_api/api/spot_api.py +++ b/gate_api/api/spot_api.py @@ -18,6 +18,10 @@ import six from gate_api.api_client import ApiClient +from gate_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) class SpotApi(object): @@ -41,18 +45,21 @@ def cancel_batch_orders(self, cancel_order, **kwargs): # noqa: E501 >>> thread = api.cancel_batch_orders(cancel_order, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param list[CancelOrder] cancel_order: (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. :return: list[CancelOrderResult] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.cancel_batch_orders_with_http_info(cancel_order, **kwargs) # noqa: E501 - else: - (data) = self.cancel_batch_orders_with_http_info(cancel_order, **kwargs) # noqa: E501 - return data + return self.cancel_batch_orders_with_http_info(cancel_order, **kwargs) # noqa: E501 def cancel_batch_orders_with_http_info(self, cancel_order, **kwargs): # noqa: E501 """Cancel a batch of orders with an ID list # noqa: E501 @@ -63,33 +70,48 @@ def cancel_batch_orders_with_http_info(self, cancel_order, **kwargs): # noqa: E >>> thread = api.cancel_batch_orders_with_http_info(cancel_order, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param list[CancelOrder] cancel_order: (required) - :return: list[CancelOrderResult] + :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. + :return: tuple(list[CancelOrderResult], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['cancel_order'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'cancel_order' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_batch_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'cancel_order' is set - if ('cancel_order' not in local_var_params or - local_var_params['cancel_order'] is None): - raise ValueError("Missing the required parameter `cancel_order` when calling `cancel_batch_orders`") # noqa: E501 + if self.api_client.client_side_validation and ('cancel_order' not in local_var_params or # noqa: E501 + local_var_params['cancel_order'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `cancel_order` when calling `cancel_batch_orders`") # noqa: E501 collection_formats = {} @@ -140,19 +162,22 @@ def cancel_order(self, order_id, currency_pair, **kwargs): # noqa: E501 >>> thread = api.cancel_order(order_id, currency_pair, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str order_id: ID returned on order successfully being created (required) :param str currency_pair: Currency pair (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. :return: Order If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.cancel_order_with_http_info(order_id, currency_pair, **kwargs) # noqa: E501 - else: - (data) = self.cancel_order_with_http_info(order_id, currency_pair, **kwargs) # noqa: E501 - return data + return self.cancel_order_with_http_info(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 @@ -162,38 +187,54 @@ def cancel_order_with_http_info(self, order_id, currency_pair, **kwargs): # noq >>> thread = api.cancel_order_with_http_info(order_id, currency_pair, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str order_id: ID returned on order successfully being created (required) :param str currency_pair: Currency pair (required) - :return: Order + :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. + :return: tuple(Order, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['order_id', 'currency_pair'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'order_id', + 'currency_pair' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'order_id' is set - if ('order_id' not in local_var_params or - local_var_params['order_id'] is None): - raise ValueError("Missing the required parameter `order_id` when calling `cancel_order`") # noqa: E501 + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_order`") # noqa: E501 # verify the required parameter 'currency_pair' is set - if ('currency_pair' not in local_var_params or - local_var_params['currency_pair'] is None): - raise ValueError("Missing the required parameter `currency_pair` when calling `cancel_order`") # noqa: E501 + if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 + local_var_params['currency_pair'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `cancel_order`") # noqa: E501 collection_formats = {} @@ -202,7 +243,7 @@ def cancel_order_with_http_info(self, order_id, currency_pair, **kwargs): # noq path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] - if 'currency_pair' in local_var_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 header_params = {} @@ -242,20 +283,23 @@ def cancel_orders(self, currency_pair, **kwargs): # noqa: E501 >>> thread = api.cancel_orders(currency_pair, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param str side: All bids or asks. Both included in not specified :param str account: Specify account type. Default to all account types being included + :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. :return: list[Order] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.cancel_orders_with_http_info(currency_pair, **kwargs) # noqa: E501 - else: - (data) = self.cancel_orders_with_http_info(currency_pair, **kwargs) # noqa: E501 - return data + return self.cancel_orders_with_http_info(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 @@ -265,46 +309,63 @@ def cancel_orders_with_http_info(self, currency_pair, **kwargs): # noqa: E501 >>> thread = api.cancel_orders_with_http_info(currency_pair, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param str side: All bids or asks. Both included in not specified :param str account: Specify account type. Default to all account types being included - :return: list[Order] + :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. + :return: tuple(list[Order], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['currency_pair', 'side', 'account'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'currency_pair', + 'side', + 'account' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set - if ('currency_pair' not in local_var_params or - local_var_params['currency_pair'] is None): - raise ValueError("Missing the required parameter `currency_pair` when calling `cancel_orders`") # noqa: E501 + if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 + local_var_params['currency_pair'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `cancel_orders`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if 'currency_pair' in local_var_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 'side' in local_var_params: + if 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 query_params.append(('side', local_var_params['side'])) # noqa: E501 - if 'account' in local_var_params: + 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 = {} @@ -345,18 +406,21 @@ def create_batch_orders(self, order, **kwargs): # noqa: E501 >>> thread = api.create_batch_orders(order, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param list[Order] order: (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. :return: list[BatchOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.create_batch_orders_with_http_info(order, **kwargs) # noqa: E501 - else: - (data) = self.create_batch_orders_with_http_info(order, **kwargs) # noqa: E501 - return data + return self.create_batch_orders_with_http_info(order, **kwargs) # noqa: E501 def create_batch_orders_with_http_info(self, order, **kwargs): # noqa: E501 """Create a batch of orders # noqa: E501 @@ -367,33 +431,48 @@ def create_batch_orders_with_http_info(self, order, **kwargs): # noqa: E501 >>> thread = api.create_batch_orders_with_http_info(order, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param list[Order] order: (required) - :return: list[BatchOrder] + :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. + :return: tuple(list[BatchOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['order'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'order' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method create_batch_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'order' is set - if ('order' not in local_var_params or - local_var_params['order'] is None): - raise ValueError("Missing the required parameter `order` when calling `create_batch_orders`") # noqa: E501 + if self.api_client.client_side_validation and ('order' not in local_var_params or # noqa: E501 + local_var_params['order'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order` when calling `create_batch_orders`") # noqa: E501 collection_formats = {} @@ -444,18 +523,21 @@ def create_order(self, order, **kwargs): # noqa: E501 >>> thread = api.create_order(order, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param Order order: (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. :return: Order If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.create_order_with_http_info(order, **kwargs) # noqa: E501 - else: - (data) = self.create_order_with_http_info(order, **kwargs) # noqa: E501 - return data + return self.create_order_with_http_info(order, **kwargs) # noqa: E501 def create_order_with_http_info(self, order, **kwargs): # noqa: E501 """Create an order # noqa: E501 @@ -465,33 +547,48 @@ def create_order_with_http_info(self, order, **kwargs): # noqa: E501 >>> thread = api.create_order_with_http_info(order, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param Order order: (required) - :return: Order + :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. + :return: tuple(Order, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['order'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'order' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method create_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'order' is set - if ('order' not in local_var_params or - local_var_params['order'] is None): - raise ValueError("Missing the required parameter `order` when calling `create_order`") # noqa: E501 + if self.api_client.client_side_validation and ('order' not in local_var_params or # noqa: E501 + local_var_params['order'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order` when calling `create_order`") # noqa: E501 collection_formats = {} @@ -542,18 +639,21 @@ def get_currency_pair(self, currency_pair, **kwargs): # noqa: E501 >>> thread = api.get_currency_pair(currency_pair, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (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. :return: CurrencyPair If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_currency_pair_with_http_info(currency_pair, **kwargs) # noqa: E501 - else: - (data) = self.get_currency_pair_with_http_info(currency_pair, **kwargs) # noqa: E501 - return data + return self.get_currency_pair_with_http_info(currency_pair, **kwargs) # noqa: E501 def get_currency_pair_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """Get detail of one single order # noqa: E501 @@ -563,33 +663,48 @@ def get_currency_pair_with_http_info(self, currency_pair, **kwargs): # noqa: E5 >>> thread = api.get_currency_pair_with_http_info(currency_pair, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) - :return: CurrencyPair + :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. + :return: tuple(CurrencyPair, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['currency_pair'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'currency_pair' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_currency_pair" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set - if ('currency_pair' not in local_var_params or - local_var_params['currency_pair'] is None): - raise ValueError("Missing the required parameter `currency_pair` when calling `get_currency_pair`") # noqa: E501 + if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 + local_var_params['currency_pair'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `get_currency_pair`") # noqa: E501 collection_formats = {} @@ -636,19 +751,22 @@ def get_order(self, order_id, currency_pair, **kwargs): # noqa: E501 >>> thread = api.get_order(order_id, currency_pair, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str order_id: ID returned on order successfully being created (required) :param str currency_pair: Currency pair (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. :return: Order If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_order_with_http_info(order_id, currency_pair, **kwargs) # noqa: E501 - else: - (data) = self.get_order_with_http_info(order_id, currency_pair, **kwargs) # noqa: E501 - return data + return self.get_order_with_http_info(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 @@ -658,38 +776,54 @@ def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: >>> thread = api.get_order_with_http_info(order_id, currency_pair, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str order_id: ID returned on order successfully being created (required) :param str currency_pair: Currency pair (required) - :return: Order + :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. + :return: tuple(Order, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['order_id', 'currency_pair'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'order_id', + 'currency_pair' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'order_id' is set - if ('order_id' not in local_var_params or - local_var_params['order_id'] is None): - raise ValueError("Missing the required parameter `order_id` when calling `get_order`") # noqa: E501 + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `get_order`") # noqa: E501 # verify the required parameter 'currency_pair' is set - if ('currency_pair' not in local_var_params or - local_var_params['currency_pair'] is None): - raise ValueError("Missing the required parameter `currency_pair` when calling `get_order`") # noqa: E501 + if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 + local_var_params['currency_pair'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `get_order`") # noqa: E501 collection_formats = {} @@ -698,7 +832,7 @@ def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] - if 'currency_pair' in local_var_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 header_params = {} @@ -739,22 +873,25 @@ def list_candlesticks(self, currency_pair, **kwargs): # noqa: E501 >>> thread = api.list_candlesticks(currency_pair, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. :param int _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified :param int to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time :param str interval: Interval time between data points + :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. :return: list[list[str]] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_candlesticks_with_http_info(currency_pair, **kwargs) # noqa: E501 - else: - (data) = self.list_candlesticks_with_http_info(currency_pair, **kwargs) # noqa: E501 - return data + return self.list_candlesticks_with_http_info(currency_pair, **kwargs) # noqa: E501 def list_candlesticks_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """Market candlesticks # noqa: E501 @@ -765,54 +902,73 @@ def list_candlesticks_with_http_info(self, currency_pair, **kwargs): # noqa: E5 >>> thread = api.list_candlesticks_with_http_info(currency_pair, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. :param int _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified :param int to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time :param str interval: Interval time between data points - :return: list[list[str]] + :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. + :return: tuple(list[list[str]], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['currency_pair', 'limit', '_from', 'to', 'interval'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'currency_pair', + 'limit', + '_from', + 'to', + 'interval' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_candlesticks" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set - if ('currency_pair' not in local_var_params or - local_var_params['currency_pair'] is None): - raise ValueError("Missing the required parameter `currency_pair` when calling `list_candlesticks`") # noqa: E501 + if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 + local_var_params['currency_pair'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_candlesticks`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_candlesticks`, 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'] > 1000: # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_candlesticks`, must be a value less than or equal to `1000`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if 'currency_pair' in local_var_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 'limit' in local_var_params: + 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 '_from' in local_var_params: + if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params: + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 - if 'interval' in local_var_params: + if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 query_params.append(('interval', local_var_params['interval'])) # noqa: E501 header_params = {} @@ -852,17 +1008,20 @@ def list_currency_pairs(self, **kwargs): # noqa: E501 >>> thread = api.list_currency_pairs(async_req=True) >>> result = thread.get() - :param async_req bool + :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. :return: list[CurrencyPair] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_currency_pairs_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_currency_pairs_with_http_info(**kwargs) # noqa: E501 - return data + return self.list_currency_pairs_with_http_info(**kwargs) # noqa: E501 def list_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 """List all currency pairs supported # noqa: E501 @@ -872,23 +1031,37 @@ def list_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 >>> thread = api.list_currency_pairs_with_http_info(async_req=True) >>> result = thread.get() - :param async_req bool - :return: list[CurrencyPair] + :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. + :return: tuple(list[CurrencyPair], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_currency_pairs" % key ) @@ -938,21 +1111,24 @@ def list_my_trades(self, currency_pair, **kwargs): # noqa: E501 >>> thread = api.list_my_trades(currency_pair, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :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 _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. :return: list[Trade] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_my_trades_with_http_info(currency_pair, **kwargs) # noqa: E501 - else: - (data) = self.list_my_trades_with_http_info(currency_pair, **kwargs) # noqa: E501 - return data + return self.list_my_trades_with_http_info(currency_pair, **kwargs) # noqa: E501 def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """List personal trading history # noqa: E501 @@ -962,55 +1138,73 @@ def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 >>> thread = api.list_my_trades_with_http_info(currency_pair, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :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 - :return: list[Trade] + :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. + :return: tuple(list[Trade], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['currency_pair', 'limit', 'page', 'order_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'currency_pair', + 'limit', + 'page', + 'order_id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_my_trades" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set - if ('currency_pair' not in local_var_params or - local_var_params['currency_pair'] is None): - raise ValueError("Missing the required parameter `currency_pair` when calling `list_my_trades`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_my_trades`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_my_trades`, must be a value greater than or equal to `1`") # noqa: E501 - if 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `page` when calling `list_my_trades`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 + local_var_params['currency_pair'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_my_trades`") # 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_my_trades`, 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_my_trades`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 + raise ApiValueError("Invalid value for parameter `page` when calling `list_my_trades`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if 'currency_pair' in local_var_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 'limit' in local_var_params: + 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 'page' in local_var_params: + if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 query_params.append(('page', local_var_params['page'])) # noqa: E501 - if 'order_id' in local_var_params: + 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 header_params = {} @@ -1051,20 +1245,23 @@ def list_order_book(self, currency_pair, **kwargs): # noqa: E501 >>> thread = api.list_order_book(currency_pair, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param str interval: Order depth. 0 means no aggregation is applied. default to 0 :param int limit: Maximum number of order depth data in asks or bids + :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. :return: OrderBook If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_order_book_with_http_info(currency_pair, **kwargs) # noqa: E501 - else: - (data) = self.list_order_book_with_http_info(currency_pair, **kwargs) # noqa: E501 - return data + return self.list_order_book_with_http_info(currency_pair, **kwargs) # noqa: E501 def list_order_book_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """Retrieve order book # noqa: E501 @@ -1075,50 +1272,67 @@ def list_order_book_with_http_info(self, currency_pair, **kwargs): # noqa: E501 >>> thread = api.list_order_book_with_http_info(currency_pair, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param str interval: Order depth. 0 means no aggregation is applied. default to 0 :param int limit: Maximum number of order depth data in asks or bids - :return: OrderBook + :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. + :return: tuple(OrderBook, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['currency_pair', 'interval', 'limit'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'currency_pair', + 'interval', + 'limit' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_order_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set - if ('currency_pair' not in local_var_params or - local_var_params['currency_pair'] is None): - raise ValueError("Missing the required parameter `currency_pair` when calling `list_order_book`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 30: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_order_book`, must be a value less than or equal to `30`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_order_book`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 + local_var_params['currency_pair'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_order_book`") # noqa: E501 + + if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 30: # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_order_book`, must be a value less than or equal to `30`") # 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_order_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if 'currency_pair' in local_var_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 'interval' in local_var_params: + if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 query_params.append(('interval', local_var_params['interval'])) # noqa: E501 - if 'limit' in local_var_params: + 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 header_params = {} @@ -1158,21 +1372,24 @@ def list_orders(self, currency_pair, status, **kwargs): # noqa: E501 >>> thread = api.list_orders(currency_pair, status, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :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 in one list + :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. :return: list[Order] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_orders_with_http_info(currency_pair, status, **kwargs) # noqa: E501 - else: - (data) = self.list_orders_with_http_info(currency_pair, status, **kwargs) # noqa: E501 - return data + return self.list_orders_with_http_info(currency_pair, status, **kwargs) # noqa: E501 def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: E501 """List orders # noqa: E501 @@ -1182,59 +1399,77 @@ def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: >>> thread = api.list_orders_with_http_info(currency_pair, status, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :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 in one list - :return: list[Order] + :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. + :return: tuple(list[Order], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['currency_pair', 'status', 'page', 'limit'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'currency_pair', + 'status', + 'page', + 'limit' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set - if ('currency_pair' not in local_var_params or - local_var_params['currency_pair'] is None): - raise ValueError("Missing the required parameter `currency_pair` when calling `list_orders`") # noqa: E501 + if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 + local_var_params['currency_pair'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_orders`") # noqa: E501 # verify the required parameter 'status' is set - if ('status' not in local_var_params or - local_var_params['status'] is None): - raise ValueError("Missing the required parameter `status` when calling `list_orders`") # noqa: E501 - - if 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `page` when calling `list_orders`, must be a value greater than or equal to `1`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_orders`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_orders`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 + local_var_params['status'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `status` when calling `list_orders`") # noqa: E501 + + if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 + raise ApiValueError("Invalid value for parameter `page` when calling `list_orders`, must be a value greater than or equal to `1`") # 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_orders`, 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_orders`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if 'currency_pair' in local_var_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 'status' in local_var_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 'page' in local_var_params: + if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 query_params.append(('page', local_var_params['page'])) # noqa: E501 - if 'limit' in local_var_params: + 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 header_params = {} @@ -1274,18 +1509,21 @@ def list_spot_accounts(self, **kwargs): # noqa: E501 >>> thread = api.list_spot_accounts(async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency: Retrieved specified currency related data + :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. :return: list[SpotAccount] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_spot_accounts_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_spot_accounts_with_http_info(**kwargs) # noqa: E501 - return data + return self.list_spot_accounts_with_http_info(**kwargs) # noqa: E501 def list_spot_accounts_with_http_info(self, **kwargs): # noqa: E501 """List spot accounts # noqa: E501 @@ -1295,24 +1533,39 @@ def list_spot_accounts_with_http_info(self, **kwargs): # noqa: E501 >>> thread = api.list_spot_accounts_with_http_info(async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency: Retrieved specified currency related data - :return: list[SpotAccount] + :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. + :return: tuple(list[SpotAccount], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['currency'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'currency' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_spot_accounts" % key ) @@ -1324,7 +1577,7 @@ def list_spot_accounts_with_http_info(self, **kwargs): # noqa: E501 path_params = {} query_params = [] - if 'currency' in local_var_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 header_params = {} @@ -1365,18 +1618,21 @@ def list_tickers(self, **kwargs): # noqa: E501 >>> thread = api.list_tickers(async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair + :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. :return: list[Ticker] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_tickers_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_tickers_with_http_info(**kwargs) # noqa: E501 - return data + return self.list_tickers_with_http_info(**kwargs) # noqa: E501 def list_tickers_with_http_info(self, **kwargs): # noqa: E501 """Retrieve ticker information # noqa: E501 @@ -1387,24 +1643,39 @@ def list_tickers_with_http_info(self, **kwargs): # noqa: E501 >>> thread = api.list_tickers_with_http_info(async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair - :return: list[Ticker] + :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. + :return: tuple(list[Ticker], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['currency_pair'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'currency_pair' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_tickers" % key ) @@ -1416,7 +1687,7 @@ def list_tickers_with_http_info(self, **kwargs): # noqa: E501 path_params = {} query_params = [] - if 'currency_pair' in local_var_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 header_params = {} @@ -1456,20 +1727,23 @@ def list_trades(self, currency_pair, **kwargs): # noqa: E501 >>> thread = api.list_trades(currency_pair, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param int limit: Maximum number of records returned in one list :param str last_id: Specify list staring point using the `id` of last record in previous list-query 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. :return: list[Trade] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_trades_with_http_info(currency_pair, **kwargs) # noqa: E501 - else: - (data) = self.list_trades_with_http_info(currency_pair, **kwargs) # noqa: E501 - return data + return self.list_trades_with_http_info(currency_pair, **kwargs) # noqa: E501 def list_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """Retrieve market trades # noqa: E501 @@ -1479,50 +1753,67 @@ def list_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 >>> thread = api.list_trades_with_http_info(currency_pair, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param int limit: Maximum number of records returned in one list :param str last_id: Specify list staring point using the `id` of last record in previous list-query results - :return: list[Trade] + :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. + :return: tuple(list[Trade], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['currency_pair', 'limit', 'last_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'currency_pair', + 'limit', + 'last_id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_trades" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set - if ('currency_pair' not in local_var_params or - local_var_params['currency_pair'] is None): - raise ValueError("Missing the required parameter `currency_pair` when calling `list_trades`") # noqa: E501 - - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_trades`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_trades`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 + local_var_params['currency_pair'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_trades`") # 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_trades`, 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_trades`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if 'currency_pair' in local_var_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 'limit' in local_var_params: + 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 'last_id' in local_var_params: + if 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 header_params = {} diff --git a/gate_api/api/wallet_api.py b/gate_api/api/wallet_api.py index 23a062a..c01e8da 100644 --- a/gate_api/api/wallet_api.py +++ b/gate_api/api/wallet_api.py @@ -18,6 +18,10 @@ import six from gate_api.api_client import ApiClient +from gate_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) class WalletApi(object): @@ -40,18 +44,21 @@ def get_deposit_address(self, currency, **kwargs): # noqa: E501 >>> thread = api.get_deposit_address(currency, async_req=True) >>> result = thread.get() - :param async_req bool + :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. :return: DepositAddress If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_deposit_address_with_http_info(currency, **kwargs) # noqa: E501 - else: - (data) = self.get_deposit_address_with_http_info(currency, **kwargs) # noqa: E501 - return data + return self.get_deposit_address_with_http_info(currency, **kwargs) # noqa: E501 def get_deposit_address_with_http_info(self, currency, **kwargs): # noqa: E501 """Generate currency deposit address # noqa: E501 @@ -61,40 +68,55 @@ def get_deposit_address_with_http_info(self, currency, **kwargs): # noqa: E501 >>> thread = api.get_deposit_address_with_http_info(currency, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency: Currency name (required) - :return: DepositAddress + :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. + :return: tuple(DepositAddress, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['currency'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'currency' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_deposit_address" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency' is set - if ('currency' not in local_var_params or - local_var_params['currency'] is None): - raise ValueError("Missing the required parameter `currency` when calling `get_deposit_address`") # noqa: E501 + if self.api_client.client_side_validation and ('currency' not in local_var_params or # noqa: E501 + local_var_params['currency'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency` when calling `get_deposit_address`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if 'currency' in local_var_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 header_params = {} @@ -135,22 +157,25 @@ def list_deposits(self, **kwargs): # noqa: E501 >>> thread = api.list_deposits(async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency: Filter by currency. Return all currency records if not specified :param int _from: Time range beginning, default to 7 days before current time :param int to: Time range ending, default to current time :param int limit: Maximum number of records returned in one list :param int offset: List offset, starting from 0 + :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. :return: list[LedgerRecord] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_deposits_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_deposits_with_http_info(**kwargs) # noqa: E501 - return data + return self.list_deposits_with_http_info(**kwargs) # noqa: E501 def list_deposits_with_http_info(self, **kwargs): # noqa: E501 """Retrieve deposit records # noqa: E501 @@ -161,54 +186,73 @@ def list_deposits_with_http_info(self, **kwargs): # noqa: E501 >>> thread = api.list_deposits_with_http_info(async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency: Filter by currency. Return all currency records if not specified :param int _from: Time range beginning, default to 7 days before current time :param int to: Time range ending, default to current time :param int limit: Maximum number of records returned in one list :param int offset: List offset, starting from 0 - :return: list[LedgerRecord] + :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. + :return: tuple(list[LedgerRecord], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['currency', '_from', 'to', 'limit', 'offset'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'currency', + '_from', + 'to', + 'limit', + 'offset' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_deposits" % key ) local_var_params[key] = val del local_var_params['kwargs'] - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_deposits`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_deposits`, must be a value greater than or equal to `1`") # noqa: E501 - if 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 - raise ValueError("Invalid value for parameter `offset` when calling `list_deposits`, must be a value greater than or equal to `0`") # 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_deposits`, 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_deposits`, 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_deposits`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if 'currency' in local_var_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 '_from' in local_var_params: + if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params: + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 - if 'limit' in local_var_params: + 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: + 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 header_params = {} @@ -249,22 +293,25 @@ def list_sub_account_transfers(self, **kwargs): # noqa: E501 >>> thread = api.list_sub_account_transfers(async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str sub_uid: Sub account user ID. Return records related to all sub accounts if not specified :param int _from: Time range beginning, default to 7 days before current time :param int to: Time range ending, default to current time :param int limit: Maximum number of records returned in one list :param int offset: List offset, starting from 0 + :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. :return: list[SubAccountTransfer] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_sub_account_transfers_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_sub_account_transfers_with_http_info(**kwargs) # noqa: E501 - return data + return self.list_sub_account_transfers_with_http_info(**kwargs) # noqa: E501 def list_sub_account_transfers_with_http_info(self, **kwargs): # noqa: E501 """Transfer records between main and sub accounts # noqa: E501 @@ -275,54 +322,73 @@ def list_sub_account_transfers_with_http_info(self, **kwargs): # noqa: E501 >>> thread = api.list_sub_account_transfers_with_http_info(async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str sub_uid: Sub account user ID. Return records related to all sub accounts if not specified :param int _from: Time range beginning, default to 7 days before current time :param int to: Time range ending, default to current time :param int limit: Maximum number of records returned in one list :param int offset: List offset, starting from 0 - :return: list[SubAccountTransfer] + :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. + :return: tuple(list[SubAccountTransfer], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['sub_uid', '_from', 'to', 'limit', 'offset'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'sub_uid', + '_from', + 'to', + 'limit', + 'offset' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_sub_account_transfers" % key ) local_var_params[key] = val del local_var_params['kwargs'] - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_sub_account_transfers`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_sub_account_transfers`, must be a value greater than or equal to `1`") # noqa: E501 - if 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 - raise ValueError("Invalid value for parameter `offset` when calling `list_sub_account_transfers`, must be a value greater than or equal to `0`") # 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_sub_account_transfers`, 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_sub_account_transfers`, 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_sub_account_transfers`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if 'sub_uid' in local_var_params: + if 'sub_uid' in local_var_params and local_var_params['sub_uid'] is not None: # noqa: E501 query_params.append(('sub_uid', local_var_params['sub_uid'])) # noqa: E501 - if '_from' in local_var_params: + if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params: + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 - if 'limit' in local_var_params: + 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: + 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 header_params = {} @@ -363,22 +429,25 @@ def list_withdrawals(self, **kwargs): # noqa: E501 >>> thread = api.list_withdrawals(async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency: Filter by currency. Return all currency records if not specified :param int _from: Time range beginning, default to 7 days before current time :param int to: Time range ending, default to current time :param int limit: Maximum number of records returned in one list :param int offset: List offset, starting from 0 + :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. :return: list[LedgerRecord] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_withdrawals_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_withdrawals_with_http_info(**kwargs) # noqa: E501 - return data + return self.list_withdrawals_with_http_info(**kwargs) # noqa: E501 def list_withdrawals_with_http_info(self, **kwargs): # noqa: E501 """Retrieve withdrawal records # noqa: E501 @@ -389,54 +458,73 @@ def list_withdrawals_with_http_info(self, **kwargs): # noqa: E501 >>> thread = api.list_withdrawals_with_http_info(async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param str currency: Filter by currency. Return all currency records if not specified :param int _from: Time range beginning, default to 7 days before current time :param int to: Time range ending, default to current time :param int limit: Maximum number of records returned in one list :param int offset: List offset, starting from 0 - :return: list[LedgerRecord] + :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. + :return: tuple(list[LedgerRecord], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['currency', '_from', 'to', 'limit', 'offset'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'currency', + '_from', + 'to', + 'limit', + 'offset' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_withdrawals" % key ) local_var_params[key] = val del local_var_params['kwargs'] - if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_withdrawals`, must be a value less than or equal to `1000`") # noqa: E501 - if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `limit` when calling `list_withdrawals`, must be a value greater than or equal to `1`") # noqa: E501 - if 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 - raise ValueError("Invalid value for parameter `offset` when calling `list_withdrawals`, must be a value greater than or equal to `0`") # 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_withdrawals`, 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_withdrawals`, 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_withdrawals`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if 'currency' in local_var_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 '_from' in local_var_params: + if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params: + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 - if 'limit' in local_var_params: + 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: + 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 header_params = {} @@ -477,18 +565,21 @@ def transfer(self, transfer, **kwargs): # noqa: E501 >>> thread = api.transfer(transfer, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param Transfer transfer: (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. :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.transfer_with_http_info(transfer, **kwargs) # noqa: E501 - else: - (data) = self.transfer_with_http_info(transfer, **kwargs) # noqa: E501 - return data + return self.transfer_with_http_info(transfer, **kwargs) # noqa: E501 def transfer_with_http_info(self, transfer, **kwargs): # noqa: E501 """Transfer between accounts # noqa: E501 @@ -499,8 +590,17 @@ def transfer_with_http_info(self, transfer, **kwargs): # noqa: E501 >>> thread = api.transfer_with_http_info(transfer, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param Transfer transfer: (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. :return: None If the method is called asynchronously, returns the request thread. @@ -508,24 +608,30 @@ def transfer_with_http_info(self, transfer, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ['transfer'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'transfer' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method transfer" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'transfer' is set - if ('transfer' not in local_var_params or - local_var_params['transfer'] is None): - raise ValueError("Missing the required parameter `transfer` when calling `transfer`") # noqa: E501 + if self.api_client.client_side_validation and ('transfer' not in local_var_params or # noqa: E501 + local_var_params['transfer'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `transfer` when calling `transfer`") # noqa: E501 collection_formats = {} @@ -572,18 +678,21 @@ def transfer_with_sub_account(self, sub_account_transfer, **kwargs): # noqa: E5 >>> thread = api.transfer_with_sub_account(sub_account_transfer, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param SubAccountTransfer sub_account_transfer: (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. :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.transfer_with_sub_account_with_http_info(sub_account_transfer, **kwargs) # noqa: E501 - else: - (data) = self.transfer_with_sub_account_with_http_info(sub_account_transfer, **kwargs) # noqa: E501 - return data + return self.transfer_with_sub_account_with_http_info(sub_account_transfer, **kwargs) # noqa: E501 def transfer_with_sub_account_with_http_info(self, sub_account_transfer, **kwargs): # noqa: E501 """Transfer between main and sub accounts # noqa: E501 @@ -593,8 +702,17 @@ def transfer_with_sub_account_with_http_info(self, sub_account_transfer, **kwarg >>> thread = api.transfer_with_sub_account_with_http_info(sub_account_transfer, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param SubAccountTransfer sub_account_transfer: (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. :return: None If the method is called asynchronously, returns the request thread. @@ -602,24 +720,30 @@ def transfer_with_sub_account_with_http_info(self, sub_account_transfer, **kwarg local_var_params = locals() - all_params = ['sub_account_transfer'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'sub_account_transfer' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method transfer_with_sub_account" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'sub_account_transfer' is set - if ('sub_account_transfer' not in local_var_params or - local_var_params['sub_account_transfer'] is None): - raise ValueError("Missing the required parameter `sub_account_transfer` when calling `transfer_with_sub_account`") # noqa: E501 + if self.api_client.client_side_validation and ('sub_account_transfer' not in local_var_params or # noqa: E501 + local_var_params['sub_account_transfer'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `sub_account_transfer` when calling `transfer_with_sub_account`") # noqa: E501 collection_formats = {} diff --git a/gate_api/api/withdrawal_api.py b/gate_api/api/withdrawal_api.py index 30d16ec..84b37ca 100644 --- a/gate_api/api/withdrawal_api.py +++ b/gate_api/api/withdrawal_api.py @@ -18,6 +18,10 @@ import six from gate_api.api_client import ApiClient +from gate_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) class WithdrawalApi(object): @@ -40,18 +44,21 @@ def withdraw(self, ledger_record, **kwargs): # noqa: E501 >>> thread = api.withdraw(ledger_record, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param LedgerRecord ledger_record: (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. :return: LedgerRecord If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.withdraw_with_http_info(ledger_record, **kwargs) # noqa: E501 - else: - (data) = self.withdraw_with_http_info(ledger_record, **kwargs) # noqa: E501 - return data + return self.withdraw_with_http_info(ledger_record, **kwargs) # noqa: E501 def withdraw_with_http_info(self, ledger_record, **kwargs): # noqa: E501 """Withdraw # noqa: E501 @@ -61,33 +68,48 @@ def withdraw_with_http_info(self, ledger_record, **kwargs): # noqa: E501 >>> thread = api.withdraw_with_http_info(ledger_record, async_req=True) >>> result = thread.get() - :param async_req bool + :param bool async_req: execute request asynchronously :param LedgerRecord ledger_record: (required) - :return: LedgerRecord + :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. + :return: tuple(LedgerRecord, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['ledger_record'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') + all_params = [ + 'ledger_record' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( + raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method withdraw" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'ledger_record' is set - if ('ledger_record' not in local_var_params or - local_var_params['ledger_record'] is None): - raise ValueError("Missing the required parameter `ledger_record` when calling `withdraw`") # noqa: E501 + if self.api_client.client_side_validation and ('ledger_record' not in local_var_params or # noqa: E501 + local_var_params['ledger_record'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `ledger_record` when calling `withdraw`") # noqa: E501 collection_formats = {} diff --git a/gate_api/api_client.py b/gate_api/api_client.py index 8645c22..a7aed1b 100644 --- a/gate_api/api_client.py +++ b/gate_api/api_client.py @@ -10,7 +10,14 @@ from __future__ import absolute_import +import atexit import datetime +import hashlib +import hmac +import time +from urllib.parse import unquote_plus, urlencode, urlparse + +from dateutil.parser import parse import json import mimetypes from multiprocessing.pool import ThreadPool @@ -25,6 +32,7 @@ from gate_api.configuration import Configuration import gate_api.models from gate_api import rest +from gate_api.exceptions import ApiValueError, ApiException class ApiClient(object): @@ -63,9 +71,9 @@ class ApiClient(object): _pool = None def __init__(self, configuration=None, header_name=None, header_value=None, - cookie=None, pool_threads=None): + cookie=None, pool_threads=1): if configuration is None: - configuration = Configuration() + configuration = Configuration.get_default_copy() self.configuration = configuration self.pool_threads = pool_threads @@ -75,13 +83,22 @@ def __init__(self, configuration=None, header_name=None, header_value=None, self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/4.14.0/python' + self.user_agent = 'OpenAPI-Generator/4.15.0/python' + self.client_side_validation = configuration.client_side_validation + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.close() - def __del__(self): + def close(self): if self._pool: self._pool.close() self._pool.join() self._pool = None + if hasattr(atexit, 'unregister'): + atexit.unregister(self.close) @property def pool(self): @@ -89,6 +106,7 @@ def pool(self): avoids instantiating unused threadpool for blocking clients. """ if self._pool is None: + atexit.register(self.close) self._pool = ThreadPool(self.pool_threads) return self._pool @@ -109,7 +127,7 @@ def __call_api( query_params=None, header_params=None, body=None, post_params=None, files=None, response_type=None, auth_settings=None, _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None): + _preload_content=True, _request_timeout=None, _host=None): config = self.configuration @@ -143,42 +161,61 @@ def __call_api( # post parameters if post_params or files: - post_params = self.prepare_post_parameters(post_params, files) + post_params = post_params if post_params else [] post_params = self.sanitize_for_serialization(post_params) post_params = self.parameters_to_tuples(post_params, collection_formats) - - # auth setting - # self.update_params_for_auth(header_params, query_params, auth_settings) - _auth_required = (auth_settings != []) + post_params.extend(self.files_parameters(files)) # body if body: body = self.sanitize_for_serialization(body) # request url - url = self.configuration.host + resource_path + if _host is None: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path - # perform request and return response - response_data = self.request( - method, url, query_params=query_params, headers=header_params, - post_params=post_params, body=body, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - _auth_required=_auth_required) + # auth setting + self.update_params_for_auth(method, url, header_params, query_params, body, auth_settings) + + try: + # perform request and return response + response_data = self.request( + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + except ApiException as e: + e.body = e.body.decode('utf-8') if six.PY3 else e.body + raise e + + content_type = response_data.getheader('content-type') self.last_response = response_data return_data = response_data - if _preload_content: - # deserialize response data - if response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None + + if not _preload_content: + return return_data + + if six.PY3 and response_type not in ["file", "bytes"]: + match = None + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_data.data = response_data.data.decode(encoding) + + # deserialize response data + if response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None if _return_http_data_only: - return (return_data) + return return_data else: return (return_data, response_data.status, response_data.getheaders()) @@ -282,7 +319,7 @@ def __deserialize(self, data, klass): elif klass == datetime.date: return self.__deserialize_date(data) elif klass == datetime.datetime: - return self.__deserialize_datatime(data) + return self.__deserialize_datetime(data) else: return self.__deserialize_model(data, klass) @@ -291,7 +328,7 @@ def call_api(self, resource_path, method, body=None, post_params=None, files=None, response_type=None, auth_settings=None, async_req=None, _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None): + _preload_content=True, _request_timeout=None, _host=None): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async_req request, set the async_req parameter. @@ -303,7 +340,7 @@ def call_api(self, resource_path, method, :param header_params: Header parameters to be placed in the request header. :param body: Request body. - :param dict post_params: Request post form parameters, + :param list post_params: Request post form parameters, for `application/x-www-form-urlencoded`, `multipart/form-data`. :param list auth_settings: Auth Settings names for the request. :param response_type: Response data type. @@ -321,6 +358,7 @@ def call_api(self, resource_path, method, number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _host: server/host defined in path or operation instead :return: If async_req parameter is True, the request will be called asynchronously. @@ -334,50 +372,47 @@ def call_api(self, resource_path, method, body, post_params, files, response_type, auth_settings, _return_http_data_only, collection_formats, - _preload_content, _request_timeout) - else: - thread = self.pool.apply_async(self.__call_api, (resource_path, - method, path_params, query_params, - header_params, body, - post_params, files, - response_type, auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, _request_timeout)) - return thread + _preload_content, _request_timeout, _host) + + return self.pool.apply_async(self.__call_api, (resource_path, + method, path_params, + query_params, + header_params, body, + post_params, files, + response_type, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host)) def request(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, - _request_timeout=None, _auth_required=True): + _request_timeout=None): """Makes the HTTP request using RESTClient.""" if method == "GET": return self.rest_client.GET(url, query_params=query_params, _preload_content=_preload_content, _request_timeout=_request_timeout, - headers=headers, - _auth_required=_auth_required) + headers=headers) elif method == "HEAD": return self.rest_client.HEAD(url, query_params=query_params, _preload_content=_preload_content, _request_timeout=_request_timeout, - headers=headers, - _auth_required=_auth_required) + headers=headers) elif method == "OPTIONS": return self.rest_client.OPTIONS(url, query_params=query_params, headers=headers, - _auth_required=_auth_required, - post_params=post_params, _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + _request_timeout=_request_timeout) elif method == "POST": return self.rest_client.POST(url, query_params=query_params, headers=headers, - _auth_required=_auth_required, post_params=post_params, _preload_content=_preload_content, _request_timeout=_request_timeout, @@ -386,7 +421,6 @@ def request(self, method, url, query_params=None, headers=None, return self.rest_client.PUT(url, query_params=query_params, headers=headers, - _auth_required=_auth_required, post_params=post_params, _preload_content=_preload_content, _request_timeout=_request_timeout, @@ -395,7 +429,6 @@ def request(self, method, url, query_params=None, headers=None, return self.rest_client.PATCH(url, query_params=query_params, headers=headers, - _auth_required=_auth_required, post_params=post_params, _preload_content=_preload_content, _request_timeout=_request_timeout, @@ -404,12 +437,11 @@ def request(self, method, url, query_params=None, headers=None, return self.rest_client.DELETE(url, query_params=query_params, headers=headers, - _auth_required=_auth_required, _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) else: - raise ValueError( + raise ApiValueError( "http method must be `GET`, `HEAD`, `OPTIONS`," " `POST`, `PATCH`, `PUT` or `DELETE`." ) @@ -444,18 +476,14 @@ def parameters_to_tuples(self, params, collection_formats): new_params.append((k, v)) return new_params - def prepare_post_parameters(self, post_params=None, files=None): + def files_parameters(self, files=None): """Builds form parameters. - :param post_params: Normal form parameters. :param files: File parameters. :return: Form parameters with files. """ params = [] - if post_params: - params = post_params - if files: for k, v in six.iteritems(files): if not v: @@ -504,11 +532,14 @@ def select_header_content_type(self, content_types): else: return content_types[0] - def update_params_for_auth(self, headers, querys, auth_settings): + def update_params_for_auth(self, method, url, headers, querys, body, auth_settings): """Updates header and query params based on authentication setting. + :param method: Request method + :param url: Request path, host included :param headers: Header parameters dict to be updated. :param querys: Query parameters tuple list to be updated. + :param body: Request body :param auth_settings: Authentication setting identifiers list. """ if not auth_settings: @@ -517,17 +548,42 @@ def update_params_for_auth(self, headers, querys, auth_settings): for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: - if not auth_setting['value']: + if auth_setting['type'] == 'apiv4': + auth_headers = self.gen_sign(method, urlparse(url).path, unquote_plus(urlencode(querys)), body) + headers.update(auth_headers) continue + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] elif auth_setting['in'] == 'header': headers[auth_setting['key']] = auth_setting['value'] elif auth_setting['in'] == 'query': querys.append((auth_setting['key'], auth_setting['value'])) else: - raise ValueError( + raise ApiValueError( 'Authentication token must be in `query` or `header`' ) + def gen_sign(self, method, url, query_string=None, body=None): + """generate authentication headers + + :param method: http request method + :param url: http resource path + :param query_string: query string + :param body: request body + :return: signature headers + """ + t = time.time() + m = hashlib.sha512() + if body is not None: + if not isinstance(body, six.string_types): + body = json.dumps(body) + m.update(body.encode('utf-8')) + hashed_payload = m.hexdigest() + s = '%s\n%s\n%s\n%s\n%s' % (method, url, query_string or "", hashed_payload, t) + sign = hmac.new(self.configuration.secret.encode('utf-8'), s.encode('utf-8'), + hashlib.sha512).hexdigest() + return {'KEY': self.configuration.key, 'Timestamp': str(t), 'SIGN': sign} + def __deserialize_file(self, response): """Deserializes body to file @@ -581,7 +637,6 @@ def __deserialize_date(self, string): :return: date. """ try: - from dateutil.parser import parse return parse(string).date() except ImportError: return string @@ -591,7 +646,7 @@ def __deserialize_date(self, string): reason="Failed to parse `{0}` as date object".format(string) ) - def __deserialize_datatime(self, string): + def __deserialize_datetime(self, string): """Deserializes string to datetime. The string should be in iso8601 datetime format. @@ -600,7 +655,6 @@ def __deserialize_datatime(self, string): :return: datetime. """ try: - from dateutil.parser import parse return parse(string) except ImportError: return string @@ -620,23 +674,26 @@ def __deserialize_model(self, data, klass): :param klass: class literal. :return: model object. """ + has_discriminator = False + if (hasattr(klass, 'get_real_child_model') + and klass.discriminator_value_class_map): + has_discriminator = True - if not klass.openapi_types and not hasattr(klass, - 'get_real_child_model'): + if not klass.openapi_types and has_discriminator is False: return data kwargs = {} - if klass.openapi_types is not None: + if (data is not None and + klass.openapi_types is not None and + isinstance(data, (list, dict))): for attr, attr_type in six.iteritems(klass.openapi_types): - if (data is not None and - klass.attribute_map[attr] in data and - isinstance(data, (list, dict))): + if klass.attribute_map[attr] in data: value = data[klass.attribute_map[attr]] kwargs[attr] = self.__deserialize(value, attr_type) instance = klass(**kwargs) - if hasattr(instance, 'get_real_child_model'): + if has_discriminator: klass_name = instance.get_real_child_model(data) if klass_name: instance = self.__deserialize(data, klass_name) diff --git a/gate_api/configuration.py b/gate_api/configuration.py index bfe1e0c..a867fb0 100644 --- a/gate_api/configuration.py +++ b/gate_api/configuration.py @@ -22,87 +22,177 @@ from six.moves import http_client as httplib -class TypeWithDefault(type): - def __init__(cls, name, bases, dct): - super(TypeWithDefault, cls).__init__(name, bases, dct) - cls._default = None - - def __call__(cls): - if cls._default is None: - cls._default = type.__call__(cls) - return copy.copy(cls._default) - - def set_default(cls, default): - cls._default = copy.copy(default) - - -class Configuration(six.with_metaclass(TypeWithDefault, object)): +class Configuration(object): """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. + + :param host: Base url + :param key: APIv4 key + :param secret: APIv4 secret + :param username: Username for HTTP basic authentication + :param password: Password for HTTP basic authentication + :param discard_unknown_keys: Boolean value indicating whether to discard + unknown properties. A server may send a response that includes additional + properties that are not known by the client in the following scenarios: + 1. The OpenAPI document is incomplete, i.e. it does not match the server + implementation. + 2. The client was generated using an older version of the OpenAPI document + and the server has been upgraded since then. + If a schema in the OpenAPI document defines the additionalProperties attribute, + then all undeclared properties received by the server are injected into the + additional properties map. In that case, there are undeclared properties, and + nothing to discard. + + :Example: + + You can set the APIv4 key and secret like: + +conf = gate_api.Configuration( + key='example_key' + secret='example_secret' +) + + The following headers will be added to the HTTP request: + KEY: example_key + SIGN: generated_signature_using_example_secret + Timestamp: request_timestamp """ - def __init__(self): - """Constructor""" - # Default Base url - self.host = "https://api.gateio.ws/api/v4" - # Temp file folder for downloading files - self.temp_folder_path = None + _default = None + def __init__(self, host="https://api.gateio.ws/api/v4", + key=None, secret=None, + username=None, password=None, + discard_unknown_keys=False, + ): + """Constructor + """ + self.host = host + """Default Base url + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ # Authentication Settings - # dict to store API key(s) - self.api_key = {} - # dict to store API prefix (e.g. Bearer) - self.api_key_prefix = {} - # Username for HTTP basic authentication - self.username = "" - # Password for HTTP basic authentication - self.password = "" - - # Logging Settings + # Init APIv4 authentication key and secret + self.key = key + """API key for APIv4 authentication + """ + self.secret = secret + """API secret for APIv4 authentication + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.discard_unknown_keys = discard_unknown_keys self.logger = {} + """Logging Settings + """ self.logger["package_logger"] = logging.getLogger("gate_api") self.logger["urllib3_logger"] = logging.getLogger("urllib3") - # Log format self.logger_format = '%(asctime)s %(levelname)s %(message)s' - # Log stream handler + """Log format + """ self.logger_stream_handler = None - # Log file handler + """Log stream handler + """ self.logger_file_handler = None - # Debug file location + """Log file handler + """ self.logger_file = None - # Debug switch + """Debug file location + """ self.debug = False + """Debug switch + """ - # SSL/TLS verification - # Set this to false to skip verifying SSL certificate when calling API - # from https server. self.verify_ssl = True - # Set this to customize the certificate file to verify the peer. + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ self.ssl_ca_cert = None - # client certificate file + """Set this to customize the certificate file to verify the peer. + """ self.cert_file = None - # client key file + """client certificate file + """ self.key_file = None - # Set this to True/False to enable/disable SSL hostname verification. + """client key file + """ self.assert_hostname = None + """Set this to True/False to enable/disable SSL hostname verification. + """ - # urllib3 connection pool's maximum number of connections saved - # per pool. urllib3 uses 1 connection as default value, but this is - # not the best value when you are making a lot of possibly parallel - # requests to the same host, which is often the case here. - # cpu_count * 5 is used as default value to increase performance. self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + """urllib3 connection pool's maximum number of connections saved + per pool. urllib3 uses 1 connection as default value, but this is + not the best value when you are making a lot of possibly parallel + requests to the same host, which is often the case here. + cpu_count * 5 is used as default value to increase performance. + """ - # Proxy URL self.proxy = None - # Safe chars for path_param + """Proxy URL + """ + self.proxy_headers = None + """Proxy headers + """ self.safe_chars_for_path_param = '' + """Safe chars for path_param + """ + self.retries = None + """Adding retries to override urllib3 default value 3 + """ + # Disable client side validation + self.client_side_validation = True + + def __deepcopy__(self, memo): + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setters to configure loggers + result.logger_file = self.logger_file + result.debug = self.debug + return result + + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + + @classmethod + def set_default(cls, default): + """Set default instance of configuration. - # API key and secret - self.key = "" - self.secret = "" + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = copy.deepcopy(default) + + @classmethod + def get_default_copy(cls): + """Return new instance of configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration passed by the set_default method. + + :return: The configuration object. + """ + if cls._default is not None: + return copy.deepcopy(cls._default) + return Configuration() @property def logger_file(self): @@ -111,8 +201,7 @@ def logger_file(self): If the logger_file is None, then add stream handler and remove file handler. Otherwise, add file handler and remove stream handler. - :param value: The logger_file path. - :type: str + :return: The logger_file path. """ return self.__logger_file @@ -139,8 +228,7 @@ def logger_file(self, value): def debug(self): """Debug status - :param value: The debug status, True or False. - :type: bool + :return: The debug status, True or False. """ return self.__debug @@ -172,8 +260,7 @@ def logger_format(self): The logger_formatter will be updated when sets logger_format. - :param value: The format string. - :type: str + :return: The format string. """ return self.__logger_format @@ -189,25 +276,19 @@ def logger_format(self, value): self.__logger_format = value self.logger_formatter = logging.Formatter(self.__logger_format) - def get_api_key_with_prefix(self, identifier): - """Gets API key (with prefix if set). - - :param identifier: The identifier of apiKey. - :return: The token for api key authentication. - """ - if (self.api_key.get(identifier) and - self.api_key_prefix.get(identifier)): - return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] # noqa: E501 - elif self.api_key.get(identifier): - return self.api_key[identifier] - def get_basic_auth_token(self): """Gets HTTP basic authentication header (string). :return: The token for basic HTTP authentication. """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password return urllib3.util.make_headers( - basic_auth=self.username + ':' + self.password + basic_auth=username + ':' + password ).get('authorization') def auth_settings(self): @@ -215,16 +296,14 @@ def auth_settings(self): :return: The Auth Settings information dict. """ - return { - 'apiv4': - { - 'type': 'api_key', - 'in': 'header', - 'key': 'SIGN', - 'value': self.get_api_key_with_prefix('SIGN') - }, - - } + auth = {} + if self.key is not None and self.secret is not None: + auth['apiv4'] = { + 'type': 'apiv4', + 'in': 'header', + 'key': 'SIGN', + } + return auth def to_debug_report(self): """Gets the essential information for debugging. @@ -234,6 +313,57 @@ def to_debug_report(self): return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: 4.14.0\n"\ - "SDK Package Version: 4.14.0".\ + "Version of the API: 4.15.0\n"\ + "SDK Package Version: 4.15.0".\ format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self): + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "https://api.gateio.ws/api/v4", + 'description': "Real Trading", + }, + { + 'url': "https://fx-api-testnet.gateio.ws/api/v4", + 'description': "TestNet Trading", + } + ] + + def get_host_from_settings(self, index, variables=None): + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :return: URL based on host settings + """ + variables = {} if variables is None else variables + servers = self.get_host_settings() + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server['variables'].items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url diff --git a/gate_api/exceptions.py b/gate_api/exceptions.py new file mode 100644 index 0000000..2754470 --- /dev/null +++ b/gate_api/exceptions.py @@ -0,0 +1,120 @@ +# coding: utf-8 + +""" + Gate API v4 + + APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # noqa: E501 + + Contact: support@mail.gate.io + Generated by: https://openapi-generator.tech +""" + + +import six + + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None): + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None): + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None): + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__(self, status=None, reason=None, http_resp=None): + if http_resp: + self.status = http_resp.status + self.reason = http_resp.reason + self.body = http_resp.data + self.headers = http_resp.getheaders() + else: + self.status = status + self.reason = reason + self.body = None + self.headers = None + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + return error_message + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, six.integer_types): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/gate_api/models/batch_order.py b/gate_api/models/batch_order.py index f98f532..6d4932d 100644 --- a/gate_api/models/batch_order.py +++ b/gate_api/models/batch_order.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class BatchOrder(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -88,8 +90,11 @@ class BatchOrder(object): 'rebated_fee_currency': 'rebated_fee_currency' } - def __init__(self, text=None, succeeded=None, label=None, message=None, id=None, create_time=None, update_time=None, status=None, currency_pair=None, type='limit', account='spot', side=None, amount=None, price=None, time_in_force='gtc', auto_borrow=None, left=None, fill_price=None, filled_total=None, fee=None, fee_currency=None, point_fee=None, gt_fee=None, gt_discount=None, rebated_fee=None, rebated_fee_currency=None): # noqa: E501 + def __init__(self, text=None, succeeded=None, label=None, message=None, id=None, create_time=None, update_time=None, status=None, currency_pair=None, type='limit', account='spot', side=None, amount=None, price=None, time_in_force='gtc', auto_borrow=None, left=None, fill_price=None, filled_total=None, fee=None, fee_currency=None, point_fee=None, gt_fee=None, gt_discount=None, rebated_fee=None, rebated_fee_currency=None, local_vars_configuration=None): # noqa: E501 """BatchOrder - 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._text = None self._succeeded = None @@ -176,7 +181,7 @@ def __init__(self, text=None, succeeded=None, label=None, message=None, id=None, def text(self): """Gets the text of this BatchOrder. # noqa: E501 - User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 16 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) # noqa: E501 + 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(.) # noqa: E501 :return: The text of this BatchOrder. # noqa: E501 :rtype: str @@ -187,7 +192,7 @@ def text(self): def text(self, text): """Sets the text of this BatchOrder. - User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 16 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) # noqa: E501 + 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(.) # noqa: E501 :param text: The text of this BatchOrder. # noqa: E501 :type: str @@ -354,7 +359,7 @@ def status(self, status): :type: str """ allowed_values = ["open", "closed", "cancelled"] # noqa: E501 - if status not in allowed_values: + 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}" # noqa: E501 .format(status, allowed_values) @@ -406,7 +411,7 @@ def type(self, type): :type: str """ allowed_values = ["limit"] # noqa: E501 - if type not in allowed_values: + if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 .format(type, allowed_values) @@ -435,7 +440,7 @@ def account(self, account): :type: str """ allowed_values = ["spot", "margin"] # noqa: E501 - if account not in allowed_values: + 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}" # noqa: E501 .format(account, allowed_values) @@ -464,7 +469,7 @@ def side(self, side): :type: str """ allowed_values = ["buy", "sell"] # noqa: E501 - if side not in allowed_values: + if self.local_vars_configuration.client_side_validation and side not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `side` ({0}), must be one of {1}" # noqa: E501 .format(side, allowed_values) @@ -539,7 +544,7 @@ def time_in_force(self, time_in_force): :type: str """ allowed_values = ["gtc", "ioc", "poc"] # noqa: E501 - if time_in_force not in allowed_values: + if self.local_vars_configuration.client_side_validation and time_in_force not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `time_in_force` ({0}), must be one of {1}" # noqa: E501 .format(time_in_force, allowed_values) @@ -837,8 +842,11 @@ def __eq__(self, other): if not isinstance(other, BatchOrder): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, BatchOrder): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/cancel_order.py b/gate_api/models/cancel_order.py index 4cad4c7..6fc0aad 100644 --- a/gate_api/models/cancel_order.py +++ b/gate_api/models/cancel_order.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class CancelOrder(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -40,8 +42,11 @@ class CancelOrder(object): 'id': 'id' } - def __init__(self, currency_pair=None, id=None): # noqa: E501 + def __init__(self, currency_pair=None, id=None, local_vars_configuration=None): # noqa: E501 """CancelOrder - 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_pair = None self._id = None @@ -70,7 +75,7 @@ def currency_pair(self, currency_pair): :param currency_pair: The currency_pair of this CancelOrder. # noqa: E501 :type: str """ - if currency_pair is None: + if self.local_vars_configuration.client_side_validation and currency_pair is None: # noqa: E501 raise ValueError("Invalid value for `currency_pair`, must not be `None`") # noqa: E501 self._currency_pair = currency_pair @@ -95,7 +100,7 @@ def id(self, id): :param id: The id of this CancelOrder. # noqa: E501 :type: str """ - if id is None: + if self.local_vars_configuration.client_side_validation and id is None: # noqa: E501 raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501 self._id = id @@ -137,8 +142,11 @@ def __eq__(self, other): if not isinstance(other, CancelOrder): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, CancelOrder): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/cancel_order_result.py b/gate_api/models/cancel_order_result.py index 4b5ab2f..f056805 100644 --- a/gate_api/models/cancel_order_result.py +++ b/gate_api/models/cancel_order_result.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class CancelOrderResult(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -46,8 +48,11 @@ class CancelOrderResult(object): 'message': 'message' } - def __init__(self, currency_pair=None, id=None, succeeded=None, label=None, message=None): # noqa: E501 + def __init__(self, currency_pair=None, id=None, succeeded=None, label=None, message=None, local_vars_configuration=None): # noqa: E501 """CancelOrderResult - 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_pair = None self._id = None @@ -219,8 +224,11 @@ def __eq__(self, other): if not isinstance(other, CancelOrderResult): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, CancelOrderResult): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/contract.py b/gate_api/models/contract.py index 5958a7a..e797d7c 100644 --- a/gate_api/models/contract.py +++ b/gate_api/models/contract.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class Contract(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -98,8 +100,11 @@ class Contract(object): 'in_delisting': 'in_delisting' } - def __init__(self, name=None, type=None, quanto_multiplier=None, leverage_min=None, leverage_max=None, maintenance_rate=None, mark_type=None, mark_price=None, index_price=None, last_price=None, maker_fee_rate=None, taker_fee_rate=None, order_price_round=None, mark_price_round=None, funding_rate=None, funding_interval=None, funding_next_apply=None, risk_limit_base=None, risk_limit_step=None, risk_limit_max=None, order_size_min=None, order_size_max=None, order_price_deviate=None, ref_discount_rate=None, ref_rebate_rate=None, orderbook_id=None, trade_id=None, trade_size=None, position_size=None, config_change_time=None, in_delisting=None): # noqa: E501 + def __init__(self, name=None, type=None, quanto_multiplier=None, leverage_min=None, leverage_max=None, maintenance_rate=None, mark_type=None, mark_price=None, index_price=None, last_price=None, maker_fee_rate=None, taker_fee_rate=None, order_price_round=None, mark_price_round=None, funding_rate=None, funding_interval=None, funding_next_apply=None, risk_limit_base=None, risk_limit_step=None, risk_limit_max=None, order_size_min=None, order_size_max=None, order_price_deviate=None, ref_discount_rate=None, ref_rebate_rate=None, orderbook_id=None, trade_id=None, trade_size=None, position_size=None, config_change_time=None, in_delisting=None, local_vars_configuration=None): # noqa: E501 """Contract - 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._type = None @@ -241,7 +246,7 @@ def type(self, type): :type: str """ allowed_values = ["inverse", "direct"] # noqa: E501 - if type not in allowed_values: + if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 .format(type, allowed_values) @@ -362,7 +367,7 @@ def mark_type(self, mark_type): :type: str """ allowed_values = ["internal", "index"] # noqa: E501 - if mark_type not in allowed_values: + if self.local_vars_configuration.client_side_validation and mark_type not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `mark_type` ({0}), must be one of {1}" # noqa: E501 .format(mark_type, allowed_values) @@ -959,8 +964,11 @@ def __eq__(self, other): if not isinstance(other, Contract): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, Contract): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/currency_pair.py b/gate_api/models/currency_pair.py index 6152585..bed0dd1 100644 --- a/gate_api/models/currency_pair.py +++ b/gate_api/models/currency_pair.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class CurrencyPair(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -54,8 +56,11 @@ class CurrencyPair(object): 'trade_status': 'trade_status' } - def __init__(self, id=None, base=None, quote=None, fee=None, min_base_amount=None, min_quote_amount=None, amount_precision=None, precision=None, trade_status=None): # noqa: E501 + def __init__(self, id=None, base=None, quote=None, fee=None, min_base_amount=None, min_quote_amount=None, amount_precision=None, precision=None, trade_status=None, local_vars_configuration=None): # noqa: E501 """CurrencyPair - 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._base = None @@ -292,7 +297,7 @@ def trade_status(self, trade_status): :type: str """ allowed_values = ["untradable", "buyable", "sellable", "tradable"] # noqa: E501 - if trade_status not in allowed_values: + if self.local_vars_configuration.client_side_validation and trade_status not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `trade_status` ({0}), must be one of {1}" # noqa: E501 .format(trade_status, allowed_values) @@ -337,8 +342,11 @@ def __eq__(self, other): if not isinstance(other, CurrencyPair): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, CurrencyPair): + 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 e5b9150..96c51fd 100644 --- a/gate_api/models/delivery_contract.py +++ b/gate_api/models/delivery_contract.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class DeliveryContract(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -110,8 +112,11 @@ class DeliveryContract(object): 'in_delisting': 'in_delisting' } - def __init__(self, name=None, underling=None, cycle=None, type=None, quanto_multiplier=None, leverage_min=None, leverage_max=None, maintenance_rate=None, mark_type=None, mark_price=None, index_price=None, last_price=None, maker_fee_rate=None, taker_fee_rate=None, order_price_round=None, mark_price_round=None, basis_rate=None, basis_value=None, basis_impact_value=None, settle_price=None, settle_price_interval=None, settle_price_duration=None, expire_time=None, risk_limit_base=None, risk_limit_step=None, risk_limit_max=None, order_size_min=None, order_size_max=None, order_price_deviate=None, ref_discount_rate=None, ref_rebate_rate=None, orderbook_id=None, trade_id=None, trade_size=None, position_size=None, config_change_time=None, in_delisting=None): # noqa: E501 + def __init__(self, name=None, underling=None, cycle=None, type=None, quanto_multiplier=None, leverage_min=None, leverage_max=None, maintenance_rate=None, mark_type=None, mark_price=None, index_price=None, last_price=None, maker_fee_rate=None, taker_fee_rate=None, order_price_round=None, mark_price_round=None, basis_rate=None, basis_value=None, basis_impact_value=None, settle_price=None, settle_price_interval=None, settle_price_duration=None, expire_time=None, risk_limit_base=None, risk_limit_step=None, risk_limit_max=None, order_size_min=None, order_size_max=None, order_price_deviate=None, ref_discount_rate=None, ref_rebate_rate=None, orderbook_id=None, trade_id=None, trade_size=None, position_size=None, config_change_time=None, in_delisting=None, local_vars_configuration=None): # noqa: E501 """DeliveryContract - 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._underling = None @@ -294,7 +299,7 @@ def cycle(self, cycle): :type: str """ allowed_values = ["WEEKLY", "BI-WEEKLY", "QUARTERLY", "BI-QUARTERLY"] # noqa: E501 - if cycle not in allowed_values: + if self.local_vars_configuration.client_side_validation and cycle not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `cycle` ({0}), must be one of {1}" # noqa: E501 .format(cycle, allowed_values) @@ -323,7 +328,7 @@ def type(self, type): :type: str """ allowed_values = ["inverse", "direct"] # noqa: E501 - if type not in allowed_values: + if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 .format(type, allowed_values) @@ -444,7 +449,7 @@ def mark_type(self, mark_type): :type: str """ allowed_values = ["internal", "index"] # noqa: E501 - if mark_type not in allowed_values: + if self.local_vars_configuration.client_side_validation and mark_type not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `mark_type` ({0}), must be one of {1}" # noqa: E501 .format(mark_type, allowed_values) @@ -1133,8 +1138,11 @@ def __eq__(self, other): if not isinstance(other, DeliveryContract): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, DeliveryContract): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/delivery_settlement.py b/gate_api/models/delivery_settlement.py index d8c0c93..9acbbc6 100644 --- a/gate_api/models/delivery_settlement.py +++ b/gate_api/models/delivery_settlement.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class DeliverySettlement(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -54,8 +56,11 @@ class DeliverySettlement(object): 'fee': 'fee' } - def __init__(self, time=None, contract=None, leverage=None, size=None, margin=None, entry_price=None, settle_price=None, profit=None, fee=None): # noqa: E501 + def __init__(self, time=None, contract=None, leverage=None, size=None, margin=None, entry_price=None, settle_price=None, profit=None, fee=None, local_vars_configuration=None): # noqa: E501 """DeliverySettlement - 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._time = None self._contract = None @@ -331,8 +336,11 @@ def __eq__(self, other): if not isinstance(other, DeliverySettlement): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, DeliverySettlement): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/deposit_address.py b/gate_api/models/deposit_address.py index 3b1fe25..284e559 100644 --- a/gate_api/models/deposit_address.py +++ b/gate_api/models/deposit_address.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class DepositAddress(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -40,8 +42,11 @@ class DepositAddress(object): 'address': 'address' } - def __init__(self, currency=None, address=None): # noqa: E501 + def __init__(self, currency=None, address=None, local_vars_configuration=None): # noqa: E501 """DepositAddress - 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._address = None @@ -70,7 +75,7 @@ def currency(self, currency): :param currency: The currency of this DepositAddress. # noqa: E501 :type: str """ - if currency is None: + 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 @@ -95,7 +100,7 @@ def address(self, address): :param address: The address of this DepositAddress. # noqa: E501 :type: str """ - if address is None: + if self.local_vars_configuration.client_side_validation and address is None: # noqa: E501 raise ValueError("Invalid value for `address`, must not be `None`") # noqa: E501 self._address = address @@ -137,8 +142,11 @@ def __eq__(self, other): if not isinstance(other, DepositAddress): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, DepositAddress): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/funding_account.py b/gate_api/models/funding_account.py index a3ac1eb..47acf07 100644 --- a/gate_api/models/funding_account.py +++ b/gate_api/models/funding_account.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class FundingAccount(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -46,8 +48,11 @@ class FundingAccount(object): 'total_lent': 'total_lent' } - def __init__(self, currency=None, available=None, locked=None, lent=None, total_lent=None): # noqa: E501 + def __init__(self, currency=None, available=None, locked=None, lent=None, total_lent=None, local_vars_configuration=None): # noqa: E501 """FundingAccount - 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._available = None @@ -219,8 +224,11 @@ def __eq__(self, other): if not isinstance(other, FundingAccount): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, FundingAccount): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/funding_book_item.py b/gate_api/models/funding_book_item.py index 7d5f1dc..58fd885 100644 --- a/gate_api/models/funding_book_item.py +++ b/gate_api/models/funding_book_item.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class FundingBookItem(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -42,8 +44,11 @@ class FundingBookItem(object): 'days': 'days' } - def __init__(self, rate=None, amount=None, days=None): # noqa: E501 + def __init__(self, rate=None, amount=None, days=None, local_vars_configuration=None): # noqa: E501 """FundingBookItem - 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._rate = None self._amount = None @@ -163,8 +168,11 @@ def __eq__(self, other): if not isinstance(other, FundingBookItem): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, FundingBookItem): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/funding_rate_record.py b/gate_api/models/funding_rate_record.py index 8010021..df1956d 100644 --- a/gate_api/models/funding_rate_record.py +++ b/gate_api/models/funding_rate_record.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class FundingRateRecord(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -40,8 +42,11 @@ class FundingRateRecord(object): 'r': 'r' } - def __init__(self, t=None, r=None): # noqa: E501 + def __init__(self, t=None, r=None, local_vars_configuration=None): # noqa: E501 """FundingRateRecord - 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._t = None self._r = None @@ -135,8 +140,11 @@ def __eq__(self, other): if not isinstance(other, FundingRateRecord): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, FundingRateRecord): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/futures_account.py b/gate_api/models/futures_account.py index 36c67cc..fc21a04 100644 --- a/gate_api/models/futures_account.py +++ b/gate_api/models/futures_account.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class FuturesAccount(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -50,8 +52,11 @@ class FuturesAccount(object): 'currency': 'currency' } - def __init__(self, total=None, unrealised_pnl=None, position_margin=None, order_margin=None, available=None, point=None, currency=None): # noqa: E501 + def __init__(self, total=None, unrealised_pnl=None, position_margin=None, order_margin=None, available=None, point=None, currency=None, local_vars_configuration=None): # noqa: E501 """FuturesAccount - 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._total = None self._unrealised_pnl = None @@ -275,8 +280,11 @@ def __eq__(self, other): if not isinstance(other, FuturesAccount): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, FuturesAccount): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/futures_account_book.py b/gate_api/models/futures_account_book.py index 58f9548..3ff3a15 100644 --- a/gate_api/models/futures_account_book.py +++ b/gate_api/models/futures_account_book.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class FuturesAccountBook(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -46,8 +48,11 @@ class FuturesAccountBook(object): 'text': 'text' } - def __init__(self, time=None, change=None, balance=None, type=None, text=None): # noqa: E501 + def __init__(self, time=None, change=None, balance=None, type=None, text=None, local_vars_configuration=None): # noqa: E501 """FuturesAccountBook - 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._time = None self._change = None @@ -157,7 +162,7 @@ def type(self, type): :type: str """ allowed_values = ["dnw", "pnl", "fee", "refr", "fund", "point_dnw", "point_fee", "point_refr"] # noqa: E501 - if type not in allowed_values: + if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 .format(type, allowed_values) @@ -225,8 +230,11 @@ def __eq__(self, other): if not isinstance(other, FuturesAccountBook): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, FuturesAccountBook): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/futures_candlestick.py b/gate_api/models/futures_candlestick.py index 2b3d972..424fe0c 100644 --- a/gate_api/models/futures_candlestick.py +++ b/gate_api/models/futures_candlestick.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class FuturesCandlestick(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -48,8 +50,11 @@ class FuturesCandlestick(object): 'o': 'o' } - def __init__(self, t=None, v=None, c=None, h=None, l=None, o=None): # noqa: E501 + def __init__(self, t=None, v=None, c=None, h=None, l=None, o=None, local_vars_configuration=None): # noqa: E501 """FuturesCandlestick - 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._t = None self._v = None @@ -247,8 +252,11 @@ def __eq__(self, other): if not isinstance(other, FuturesCandlestick): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, FuturesCandlestick): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/futures_initial_order.py b/gate_api/models/futures_initial_order.py index 075628e..a291caf 100644 --- a/gate_api/models/futures_initial_order.py +++ b/gate_api/models/futures_initial_order.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class FuturesInitialOrder(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -54,8 +56,11 @@ class FuturesInitialOrder(object): 'is_close': 'is_close' } - def __init__(self, contract=None, size=None, price=None, close=False, tif='gtc', text=None, reduce_only=False, is_reduce_only=None, is_close=None): # noqa: E501 + def __init__(self, contract=None, size=None, price=None, close=False, tif='gtc', text=None, reduce_only=False, is_reduce_only=None, is_close=None, local_vars_configuration=None): # noqa: E501 """FuturesInitialOrder - 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._contract = None self._size = None @@ -105,7 +110,7 @@ def contract(self, contract): :param contract: The contract of this FuturesInitialOrder. # noqa: E501 :type: str """ - if contract is None: + if self.local_vars_configuration.client_side_validation and contract is None: # noqa: E501 raise ValueError("Invalid value for `contract`, must not be `None`") # noqa: E501 self._contract = contract @@ -153,7 +158,7 @@ def price(self, price): :param price: The price of this FuturesInitialOrder. # noqa: E501 :type: str """ - if price is None: + if self.local_vars_configuration.client_side_validation and price is None: # noqa: E501 raise ValueError("Invalid value for `price`, must not be `None`") # noqa: E501 self._price = price @@ -202,7 +207,7 @@ def tif(self, tif): :type: str """ allowed_values = ["gtc", "ioc"] # noqa: E501 - if tif not in allowed_values: + if self.local_vars_configuration.client_side_validation and tif not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `tif` ({0}), must be one of {1}" # noqa: E501 .format(tif, allowed_values) @@ -339,8 +344,11 @@ def __eq__(self, other): if not isinstance(other, FuturesInitialOrder): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, FuturesInitialOrder): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/futures_liquidate.py b/gate_api/models/futures_liquidate.py index d309ead..c292851 100644 --- a/gate_api/models/futures_liquidate.py +++ b/gate_api/models/futures_liquidate.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class FuturesLiquidate(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -60,8 +62,11 @@ class FuturesLiquidate(object): 'left': 'left' } - def __init__(self, time=None, contract=None, leverage=None, size=None, margin=None, entry_price=None, liq_price=None, mark_price=None, order_id=None, order_price=None, fill_price=None, left=None): # noqa: E501 + def __init__(self, time=None, contract=None, leverage=None, size=None, margin=None, entry_price=None, liq_price=None, mark_price=None, order_id=None, order_price=None, fill_price=None, left=None, local_vars_configuration=None): # noqa: E501 """FuturesLiquidate - 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._time = None self._contract = None @@ -415,8 +420,11 @@ def __eq__(self, other): if not isinstance(other, FuturesLiquidate): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, FuturesLiquidate): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/futures_order.py b/gate_api/models/futures_order.py index 852d59c..8953d23 100644 --- a/gate_api/models/futures_order.py +++ b/gate_api/models/futures_order.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class FuturesOrder(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -80,8 +82,11 @@ class FuturesOrder(object): 'refu': 'refu' } - def __init__(self, id=None, user=None, create_time=None, finish_time=None, finish_as=None, status=None, contract=None, size=None, iceberg=None, price=None, close=False, is_close=None, reduce_only=False, is_reduce_only=None, is_liq=None, tif='gtc', left=None, fill_price=None, text=None, tkfr=None, mkfr=None, refu=None): # noqa: E501 + def __init__(self, id=None, user=None, create_time=None, finish_time=None, finish_as=None, status=None, contract=None, size=None, iceberg=None, price=None, close=False, is_close=None, reduce_only=False, is_reduce_only=None, is_liq=None, tif='gtc', left=None, fill_price=None, text=None, tkfr=None, mkfr=None, refu=None, local_vars_configuration=None): # noqa: E501 """FuturesOrder - 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._user = None @@ -264,7 +269,7 @@ def finish_as(self, finish_as): :type: str """ allowed_values = ["filled", "cancelled", "liquidated", "ioc", "auto_deleveraged", "reduce_only"] # noqa: E501 - if finish_as not in allowed_values: + 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}" # noqa: E501 .format(finish_as, allowed_values) @@ -293,7 +298,7 @@ def status(self, status): :type: str """ allowed_values = ["open", "finished"] # noqa: E501 - if status not in allowed_values: + 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}" # noqa: E501 .format(status, allowed_values) @@ -321,7 +326,7 @@ def contract(self, contract): :param contract: The contract of this FuturesOrder. # noqa: E501 :type: str """ - if contract is None: + if self.local_vars_configuration.client_side_validation and contract is None: # noqa: E501 raise ValueError("Invalid value for `contract`, must not be `None`") # noqa: E501 self._contract = contract @@ -531,7 +536,7 @@ def tif(self, tif): :type: str """ allowed_values = ["gtc", "ioc", "poc"] # noqa: E501 - if tif not in allowed_values: + if self.local_vars_configuration.client_side_validation and tif not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `tif` ({0}), must be one of {1}" # noqa: E501 .format(tif, allowed_values) @@ -589,7 +594,7 @@ def fill_price(self, fill_price): def text(self): """Gets the text of this FuturesOrder. # noqa: E501 - User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 16 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) Besides user defined information, reserved contents are listed below, denoting how the order is created: - web: from web - api: from API - app: from mobile phones - auto_deleveraging: from ADL - liquidation: from liquidation - insurance: from insurance # noqa: E501 + 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(.) Besides user defined information, reserved contents are listed below, denoting how the order is created: - web: from web - api: from API - app: from mobile phones - auto_deleveraging: from ADL - liquidation: from liquidation - insurance: from insurance # noqa: E501 :return: The text of this FuturesOrder. # noqa: E501 :rtype: str @@ -600,7 +605,7 @@ def text(self): def text(self, text): """Sets the text of this FuturesOrder. - User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 16 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) Besides user defined information, reserved contents are listed below, denoting how the order is created: - web: from web - api: from API - app: from mobile phones - auto_deleveraging: from ADL - liquidation: from liquidation - insurance: from insurance # noqa: E501 + 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(.) Besides user defined information, reserved contents are listed below, denoting how the order is created: - web: from web - api: from API - app: from mobile phones - auto_deleveraging: from ADL - liquidation: from liquidation - insurance: from insurance # noqa: E501 :param text: The text of this FuturesOrder. # noqa: E501 :type: str @@ -714,8 +719,11 @@ def __eq__(self, other): if not isinstance(other, FuturesOrder): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, FuturesOrder): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/futures_order_book.py b/gate_api/models/futures_order_book.py index b765415..e30fb43 100644 --- a/gate_api/models/futures_order_book.py +++ b/gate_api/models/futures_order_book.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class FuturesOrderBook(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -40,8 +42,11 @@ class FuturesOrderBook(object): 'bids': 'bids' } - def __init__(self, asks=None, bids=None): # noqa: E501 + def __init__(self, asks=None, bids=None, local_vars_configuration=None): # noqa: E501 """FuturesOrderBook - 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._asks = None self._bids = None @@ -70,7 +75,7 @@ def asks(self, asks): :param asks: The asks of this FuturesOrderBook. # noqa: E501 :type: list[FuturesOrderBookItem] """ - if asks is None: + if self.local_vars_configuration.client_side_validation and asks is None: # noqa: E501 raise ValueError("Invalid value for `asks`, must not be `None`") # noqa: E501 self._asks = asks @@ -95,7 +100,7 @@ def bids(self, bids): :param bids: The bids of this FuturesOrderBook. # noqa: E501 :type: list[FuturesOrderBookItem] """ - if bids is None: + if self.local_vars_configuration.client_side_validation and bids is None: # noqa: E501 raise ValueError("Invalid value for `bids`, must not be `None`") # noqa: E501 self._bids = bids @@ -137,8 +142,11 @@ def __eq__(self, other): if not isinstance(other, FuturesOrderBook): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, FuturesOrderBook): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/futures_order_book_item.py b/gate_api/models/futures_order_book_item.py index c04a1af..44c7674 100644 --- a/gate_api/models/futures_order_book_item.py +++ b/gate_api/models/futures_order_book_item.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class FuturesOrderBookItem(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -40,8 +42,11 @@ class FuturesOrderBookItem(object): 's': 's' } - def __init__(self, p=None, s=None): # noqa: E501 + def __init__(self, p=None, s=None, local_vars_configuration=None): # noqa: E501 """FuturesOrderBookItem - 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._p = None self._s = None @@ -135,8 +140,11 @@ def __eq__(self, other): if not isinstance(other, FuturesOrderBookItem): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, FuturesOrderBookItem): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/futures_price_trigger.py b/gate_api/models/futures_price_trigger.py index ea128f1..74b3ec7 100644 --- a/gate_api/models/futures_price_trigger.py +++ b/gate_api/models/futures_price_trigger.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class FuturesPriceTrigger(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -46,8 +48,11 @@ class FuturesPriceTrigger(object): 'expiration': 'expiration' } - def __init__(self, strategy_type=None, price_type=None, price=None, rule=None, expiration=None): # noqa: E501 + def __init__(self, strategy_type=None, price_type=None, price=None, rule=None, expiration=None, local_vars_configuration=None): # noqa: E501 """FuturesPriceTrigger - 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._strategy_type = None self._price_type = None @@ -88,7 +93,7 @@ def strategy_type(self, strategy_type): :type: int """ allowed_values = [0, 1] # noqa: E501 - if strategy_type not in allowed_values: + if self.local_vars_configuration.client_side_validation and strategy_type not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `strategy_type` ({0}), must be one of {1}" # noqa: E501 .format(strategy_type, allowed_values) @@ -117,7 +122,7 @@ def price_type(self, price_type): :type: int """ allowed_values = [0, 1, 2] # noqa: E501 - if price_type not in allowed_values: + if self.local_vars_configuration.client_side_validation and price_type not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `price_type` ({0}), must be one of {1}" # noqa: E501 .format(price_type, allowed_values) @@ -169,7 +174,7 @@ def rule(self, rule): :type: int """ allowed_values = [1, 2] # noqa: E501 - if rule not in allowed_values: + if self.local_vars_configuration.client_side_validation and rule not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `rule` ({0}), must be one of {1}" # noqa: E501 .format(rule, allowed_values) @@ -237,8 +242,11 @@ def __eq__(self, other): if not isinstance(other, FuturesPriceTrigger): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, FuturesPriceTrigger): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/futures_price_triggered_order.py b/gate_api/models/futures_price_triggered_order.py index 6066169..3e53970 100644 --- a/gate_api/models/futures_price_triggered_order.py +++ b/gate_api/models/futures_price_triggered_order.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class FuturesPriceTriggeredOrder(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -56,8 +58,11 @@ class FuturesPriceTriggeredOrder(object): 'reason': 'reason' } - def __init__(self, initial=None, trigger=None, id=None, user=None, create_time=None, finish_time=None, trade_id=None, status=None, finish_as=None, reason=None): # noqa: E501 + def __init__(self, initial=None, trigger=None, id=None, user=None, create_time=None, finish_time=None, trade_id=None, status=None, finish_as=None, reason=None, local_vars_configuration=None): # noqa: E501 """FuturesPriceTriggeredOrder - 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._initial = None self._trigger = None @@ -108,7 +113,7 @@ def initial(self, initial): :param initial: The initial of this FuturesPriceTriggeredOrder. # noqa: E501 :type: FuturesInitialOrder """ - if initial is None: + if self.local_vars_configuration.client_side_validation and initial is None: # noqa: E501 raise ValueError("Invalid value for `initial`, must not be `None`") # noqa: E501 self._initial = initial @@ -131,7 +136,7 @@ def trigger(self, trigger): :param trigger: The trigger of this FuturesPriceTriggeredOrder. # noqa: E501 :type: FuturesPriceTrigger """ - if trigger is None: + if self.local_vars_configuration.client_side_validation and trigger is None: # noqa: E501 raise ValueError("Invalid value for `trigger`, must not be `None`") # noqa: E501 self._trigger = trigger @@ -272,7 +277,7 @@ def status(self, status): :type: str """ allowed_values = ["open", "finished"] # noqa: E501 - if status not in allowed_values: + 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}" # noqa: E501 .format(status, allowed_values) @@ -301,7 +306,7 @@ def finish_as(self, finish_as): :type: str """ allowed_values = ["cancelled", "succeeded", "failed", "expired"] # noqa: E501 - if finish_as not in allowed_values: + 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}" # noqa: E501 .format(finish_as, allowed_values) @@ -369,8 +374,11 @@ def __eq__(self, other): if not isinstance(other, FuturesPriceTriggeredOrder): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, FuturesPriceTriggeredOrder): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/futures_ticker.py b/gate_api/models/futures_ticker.py index 9ec67fd..d81960d 100644 --- a/gate_api/models/futures_ticker.py +++ b/gate_api/models/futures_ticker.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class FuturesTicker(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -70,8 +72,11 @@ class FuturesTicker(object): 'quanto_base_rate': 'quanto_base_rate' } - def __init__(self, contract=None, last=None, change_percentage=None, total_size=None, low_24h=None, high_24h=None, volume_24h=None, volume_24h_btc=None, volume_24h_usd=None, volume_24h_base=None, volume_24h_quote=None, volume_24h_settle=None, mark_price=None, funding_rate=None, funding_rate_indicative=None, index_price=None, quanto_base_rate=None): # noqa: E501 + def __init__(self, contract=None, last=None, change_percentage=None, total_size=None, low_24h=None, high_24h=None, volume_24h=None, volume_24h_btc=None, volume_24h_usd=None, volume_24h_base=None, volume_24h_quote=None, volume_24h_settle=None, mark_price=None, funding_rate=None, funding_rate_indicative=None, index_price=None, quanto_base_rate=None, local_vars_configuration=None): # noqa: E501 """FuturesTicker - 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._contract = None self._last = None @@ -555,8 +560,11 @@ def __eq__(self, other): if not isinstance(other, FuturesTicker): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, FuturesTicker): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/futures_trade.py b/gate_api/models/futures_trade.py index 73684f6..ff9b175 100644 --- a/gate_api/models/futures_trade.py +++ b/gate_api/models/futures_trade.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class FuturesTrade(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -46,8 +48,11 @@ class FuturesTrade(object): 'price': 'price' } - def __init__(self, id=None, create_time=None, contract=None, size=None, price=None): # noqa: E501 + def __init__(self, id=None, create_time=None, contract=None, size=None, price=None, local_vars_configuration=None): # noqa: E501 """FuturesTrade - 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 @@ -219,8 +224,11 @@ def __eq__(self, other): if not isinstance(other, FuturesTrade): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, FuturesTrade): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/gate_error_response.py b/gate_api/models/gate_error_response.py index 23f7ba6..3c3dcde 100644 --- a/gate_api/models/gate_error_response.py +++ b/gate_api/models/gate_error_response.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class GateErrorResponse(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -40,8 +42,11 @@ class GateErrorResponse(object): 'message': 'message' } - def __init__(self, label=None, message=None): # noqa: E501 + def __init__(self, label=None, message=None, local_vars_configuration=None): # noqa: E501 """GateErrorResponse - 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._label = None self._message = None @@ -135,8 +140,11 @@ def __eq__(self, other): if not isinstance(other, GateErrorResponse): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, GateErrorResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/insurance_record.py b/gate_api/models/insurance_record.py index b382472..3c8119d 100644 --- a/gate_api/models/insurance_record.py +++ b/gate_api/models/insurance_record.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class InsuranceRecord(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -40,8 +42,11 @@ class InsuranceRecord(object): 'b': 'b' } - def __init__(self, t=None, b=None): # noqa: E501 + def __init__(self, t=None, b=None, local_vars_configuration=None): # noqa: E501 """InsuranceRecord - 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._t = None self._b = None @@ -135,8 +140,11 @@ def __eq__(self, other): if not isinstance(other, InsuranceRecord): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, InsuranceRecord): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/ledger_record.py b/gate_api/models/ledger_record.py index 76ba330..852a322 100644 --- a/gate_api/models/ledger_record.py +++ b/gate_api/models/ledger_record.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class LedgerRecord(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -52,8 +54,11 @@ class LedgerRecord(object): 'status': 'status' } - def __init__(self, id=None, txid=None, timestamp=None, amount=None, currency=None, address=None, memo=None, status=None): # noqa: E501 + def __init__(self, id=None, txid=None, timestamp=None, amount=None, currency=None, address=None, memo=None, status=None, local_vars_configuration=None): # noqa: E501 """LedgerRecord - 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._txid = None @@ -169,7 +174,7 @@ def amount(self, amount): :param amount: The amount of this LedgerRecord. # noqa: E501 :type: str """ - if amount is None: + 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 @@ -194,7 +199,7 @@ def currency(self, currency): :param currency: The currency of this LedgerRecord. # noqa: E501 :type: str """ - if currency is None: + 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 @@ -266,7 +271,7 @@ def status(self, status): :type: str """ allowed_values = ["DONE", "CANCEL", "REQUEST", "MANUAL", "BCODE"] # noqa: E501 - if status not in allowed_values: + 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}" # noqa: E501 .format(status, allowed_values) @@ -311,8 +316,11 @@ def __eq__(self, other): if not isinstance(other, LedgerRecord): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, LedgerRecord): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/loan.py b/gate_api/models/loan.py index ba77055..b7395c5 100644 --- a/gate_api/models/loan.py +++ b/gate_api/models/loan.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class Loan(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -70,8 +72,11 @@ class Loan(object): 'orig_id': 'orig_id' } - def __init__(self, id=None, create_time=None, expire_time=None, status=None, side=None, currency=None, rate=None, amount=None, days=None, auto_renew=False, currency_pair=None, left=None, repaid=None, paid_interest=None, unpaid_interest=None, fee_rate=None, orig_id=None): # noqa: E501 + def __init__(self, id=None, create_time=None, expire_time=None, status=None, side=None, currency=None, rate=None, amount=None, days=None, auto_renew=False, currency_pair=None, left=None, repaid=None, paid_interest=None, unpaid_interest=None, fee_rate=None, orig_id=None, local_vars_configuration=None): # noqa: E501 """Loan - 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 @@ -213,7 +218,7 @@ def status(self, status): :type: str """ allowed_values = ["open", "loaned", "finished", "auto_repaid"] # noqa: E501 - if status not in allowed_values: + 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}" # noqa: E501 .format(status, allowed_values) @@ -241,10 +246,10 @@ def side(self, side): :param side: The side of this Loan. # noqa: E501 :type: str """ - if side is None: + if self.local_vars_configuration.client_side_validation and side is None: # noqa: E501 raise ValueError("Invalid value for `side`, must not be `None`") # noqa: E501 allowed_values = ["lend", "borrow"] # noqa: E501 - if side not in allowed_values: + if self.local_vars_configuration.client_side_validation and side not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `side` ({0}), must be one of {1}" # noqa: E501 .format(side, allowed_values) @@ -272,7 +277,7 @@ def currency(self, currency): :param currency: The currency of this Loan. # noqa: E501 :type: str """ - if currency is None: + 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 @@ -320,7 +325,7 @@ def amount(self, amount): :param amount: The amount of this Loan. # noqa: E501 :type: str """ - if amount is None: + 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 @@ -345,7 +350,7 @@ def days(self, days): :param days: The days of this Loan. # noqa: E501 :type: int """ - if days is None: + if self.local_vars_configuration.client_side_validation and days is None: # noqa: E501 raise ValueError("Invalid value for `days`, must not be `None`") # noqa: E501 self._days = days @@ -571,8 +576,11 @@ def __eq__(self, other): if not isinstance(other, Loan): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, Loan): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/loan_patch.py b/gate_api/models/loan_patch.py index 97db9a9..d7408ba 100644 --- a/gate_api/models/loan_patch.py +++ b/gate_api/models/loan_patch.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class LoanPatch(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -46,8 +48,11 @@ class LoanPatch(object): 'loan_id': 'loan_id' } - def __init__(self, currency=None, side=None, auto_renew=None, currency_pair=None, loan_id=None): # noqa: E501 + def __init__(self, currency=None, side=None, auto_renew=None, currency_pair=None, loan_id=None, local_vars_configuration=None): # noqa: E501 """LoanPatch - 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._side = None @@ -84,7 +89,7 @@ def currency(self, currency): :param currency: The currency of this LoanPatch. # noqa: E501 :type: str """ - if currency is None: + 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 @@ -109,10 +114,10 @@ def side(self, side): :param side: The side of this LoanPatch. # noqa: E501 :type: str """ - if side is None: + if self.local_vars_configuration.client_side_validation and side is None: # noqa: E501 raise ValueError("Invalid value for `side`, must not be `None`") # noqa: E501 allowed_values = ["lend", "borrow"] # noqa: E501 - if side not in allowed_values: + if self.local_vars_configuration.client_side_validation and side not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `side` ({0}), must be one of {1}" # noqa: E501 .format(side, allowed_values) @@ -140,7 +145,7 @@ def auto_renew(self, auto_renew): :param auto_renew: The auto_renew of this LoanPatch. # noqa: E501 :type: bool """ - if auto_renew is None: + if self.local_vars_configuration.client_side_validation and auto_renew is None: # noqa: E501 raise ValueError("Invalid value for `auto_renew`, must not be `None`") # noqa: E501 self._auto_renew = auto_renew @@ -228,8 +233,11 @@ def __eq__(self, other): if not isinstance(other, LoanPatch): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, LoanPatch): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/loan_record.py b/gate_api/models/loan_record.py index 5bda380..b777608 100644 --- a/gate_api/models/loan_record.py +++ b/gate_api/models/loan_record.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class LoanRecord(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -64,8 +66,11 @@ class LoanRecord(object): 'unpaid_interest': 'unpaid_interest' } - def __init__(self, id=None, loan_id=None, create_time=None, expire_time=None, status=None, borrow_user_id=None, currency=None, rate=None, amount=None, days=None, auto_renew=False, repaid=None, paid_interest=None, unpaid_interest=None): # noqa: E501 + def __init__(self, id=None, loan_id=None, create_time=None, expire_time=None, status=None, borrow_user_id=None, currency=None, rate=None, amount=None, days=None, auto_renew=False, repaid=None, paid_interest=None, unpaid_interest=None, local_vars_configuration=None): # noqa: E501 """LoanRecord - 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._loan_id = None @@ -225,7 +230,7 @@ def status(self, status): :type: str """ allowed_values = ["loaned", "finished"] # noqa: E501 - if status not in allowed_values: + 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}" # noqa: E501 .format(status, allowed_values) @@ -477,8 +482,11 @@ def __eq__(self, other): if not isinstance(other, LoanRecord): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, LoanRecord): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/margin_account.py b/gate_api/models/margin_account.py index 9a797ff..c77df76 100644 --- a/gate_api/models/margin_account.py +++ b/gate_api/models/margin_account.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class MarginAccount(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -42,8 +44,11 @@ class MarginAccount(object): 'quote': 'quote' } - def __init__(self, currency_pair=None, base=None, quote=None): # noqa: E501 + def __init__(self, currency_pair=None, base=None, quote=None, local_vars_configuration=None): # noqa: E501 """MarginAccount - 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_pair = None self._base = None @@ -159,8 +164,11 @@ def __eq__(self, other): if not isinstance(other, MarginAccount): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, MarginAccount): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/margin_account_currency.py b/gate_api/models/margin_account_currency.py index fc19129..e5be027 100644 --- a/gate_api/models/margin_account_currency.py +++ b/gate_api/models/margin_account_currency.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class MarginAccountCurrency(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -44,8 +46,11 @@ class MarginAccountCurrency(object): 'borrowed': 'borrowed' } - def __init__(self, currency=None, available=None, locked=None, borrowed=None): # noqa: E501 + def __init__(self, currency=None, available=None, locked=None, borrowed=None, local_vars_configuration=None): # noqa: E501 """MarginAccountCurrency - 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._available = None @@ -191,8 +196,11 @@ def __eq__(self, other): if not isinstance(other, MarginAccountCurrency): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, MarginAccountCurrency): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/margin_currency_pair.py b/gate_api/models/margin_currency_pair.py index b310557..44670bd 100644 --- a/gate_api/models/margin_currency_pair.py +++ b/gate_api/models/margin_currency_pair.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class MarginCurrencyPair(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -50,8 +52,11 @@ class MarginCurrencyPair(object): 'max_quote_amount': 'max_quote_amount' } - def __init__(self, id=None, base=None, quote=None, leverage=None, min_base_amount=None, min_quote_amount=None, max_quote_amount=None): # noqa: E501 + def __init__(self, id=None, base=None, quote=None, leverage=None, min_base_amount=None, min_quote_amount=None, max_quote_amount=None, local_vars_configuration=None): # noqa: E501 """MarginCurrencyPair - 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._base = None @@ -275,8 +280,11 @@ def __eq__(self, other): if not isinstance(other, MarginCurrencyPair): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, MarginCurrencyPair): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/my_futures_trade.py b/gate_api/models/my_futures_trade.py index ee1279b..546c02e 100644 --- a/gate_api/models/my_futures_trade.py +++ b/gate_api/models/my_futures_trade.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class MyFuturesTrade(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -50,8 +52,11 @@ class MyFuturesTrade(object): 'role': 'role' } - def __init__(self, id=None, create_time=None, contract=None, order_id=None, size=None, price=None, role=None): # noqa: E501 + def __init__(self, id=None, create_time=None, contract=None, order_id=None, size=None, price=None, role=None, local_vars_configuration=None): # noqa: E501 """MyFuturesTrade - 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 @@ -236,7 +241,7 @@ def role(self, role): :type: str """ allowed_values = ["taker", "maker"] # noqa: E501 - if role not in allowed_values: + if self.local_vars_configuration.client_side_validation and role not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `role` ({0}), must be one of {1}" # noqa: E501 .format(role, allowed_values) @@ -281,8 +286,11 @@ def __eq__(self, other): if not isinstance(other, MyFuturesTrade): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, MyFuturesTrade): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/order.py b/gate_api/models/order.py index 4295c75..7d4d419 100644 --- a/gate_api/models/order.py +++ b/gate_api/models/order.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class Order(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -82,8 +84,11 @@ class Order(object): 'rebated_fee_currency': 'rebated_fee_currency' } - def __init__(self, id=None, text=None, create_time=None, update_time=None, status=None, currency_pair=None, type='limit', account='spot', side=None, amount=None, price=None, time_in_force='gtc', auto_borrow=None, left=None, fill_price=None, filled_total=None, fee=None, fee_currency=None, point_fee=None, gt_fee=None, gt_discount=None, rebated_fee=None, rebated_fee_currency=None): # noqa: E501 + def __init__(self, id=None, text=None, create_time=None, update_time=None, status=None, currency_pair=None, type='limit', account='spot', side=None, amount=None, price=None, time_in_force='gtc', auto_borrow=None, left=None, fill_price=None, filled_total=None, fee=None, fee_currency=None, point_fee=None, gt_fee=None, gt_discount=None, rebated_fee=None, rebated_fee_currency=None, local_vars_configuration=None): # noqa: E501 """Order - 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._text = None @@ -180,7 +185,7 @@ def id(self, id): def text(self): """Gets the text of this Order. # noqa: E501 - User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 16 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) # noqa: E501 + 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(.) # noqa: E501 :return: The text of this Order. # noqa: E501 :rtype: str @@ -191,7 +196,7 @@ def text(self): def text(self, text): """Sets the text of this Order. - User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 16 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) # noqa: E501 + 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(.) # noqa: E501 :param text: The text of this Order. # noqa: E501 :type: str @@ -266,7 +271,7 @@ def status(self, status): :type: str """ allowed_values = ["open", "closed", "cancelled"] # noqa: E501 - if status not in allowed_values: + 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}" # noqa: E501 .format(status, allowed_values) @@ -294,7 +299,7 @@ def currency_pair(self, currency_pair): :param currency_pair: The currency_pair of this Order. # noqa: E501 :type: str """ - if currency_pair is None: + if self.local_vars_configuration.client_side_validation and currency_pair is None: # noqa: E501 raise ValueError("Invalid value for `currency_pair`, must not be `None`") # noqa: E501 self._currency_pair = currency_pair @@ -320,7 +325,7 @@ def type(self, type): :type: str """ allowed_values = ["limit"] # noqa: E501 - if type not in allowed_values: + if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 .format(type, allowed_values) @@ -349,7 +354,7 @@ def account(self, account): :type: str """ allowed_values = ["spot", "margin"] # noqa: E501 - if account not in allowed_values: + 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}" # noqa: E501 .format(account, allowed_values) @@ -377,10 +382,10 @@ def side(self, side): :param side: The side of this Order. # noqa: E501 :type: str """ - if side is None: + if self.local_vars_configuration.client_side_validation and side is None: # noqa: E501 raise ValueError("Invalid value for `side`, must not be `None`") # noqa: E501 allowed_values = ["buy", "sell"] # noqa: E501 - if side not in allowed_values: + if self.local_vars_configuration.client_side_validation and side not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `side` ({0}), must be one of {1}" # noqa: E501 .format(side, allowed_values) @@ -408,7 +413,7 @@ def amount(self, amount): :param amount: The amount of this Order. # noqa: E501 :type: str """ - if amount is None: + 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 @@ -433,7 +438,7 @@ def price(self, price): :param price: The price of this Order. # noqa: E501 :type: str """ - if price is None: + if self.local_vars_configuration.client_side_validation and price is None: # noqa: E501 raise ValueError("Invalid value for `price`, must not be `None`") # noqa: E501 self._price = price @@ -459,7 +464,7 @@ def time_in_force(self, time_in_force): :type: str """ allowed_values = ["gtc", "ioc", "poc"] # noqa: E501 - if time_in_force not in allowed_values: + if self.local_vars_configuration.client_side_validation and time_in_force not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `time_in_force` ({0}), must be one of {1}" # noqa: E501 .format(time_in_force, allowed_values) @@ -757,8 +762,11 @@ def __eq__(self, other): if not isinstance(other, Order): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, Order): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/order_book.py b/gate_api/models/order_book.py index f7e11c7..88b8177 100644 --- a/gate_api/models/order_book.py +++ b/gate_api/models/order_book.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class OrderBook(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -40,8 +42,11 @@ class OrderBook(object): 'bids': 'bids' } - def __init__(self, asks=None, bids=None): # noqa: E501 + def __init__(self, asks=None, bids=None, local_vars_configuration=None): # noqa: E501 """OrderBook - 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._asks = None self._bids = None @@ -70,7 +75,7 @@ def asks(self, asks): :param asks: The asks of this OrderBook. # noqa: E501 :type: list[list[str]] """ - if asks is None: + if self.local_vars_configuration.client_side_validation and asks is None: # noqa: E501 raise ValueError("Invalid value for `asks`, must not be `None`") # noqa: E501 self._asks = asks @@ -95,7 +100,7 @@ def bids(self, bids): :param bids: The bids of this OrderBook. # noqa: E501 :type: list[list[str]] """ - if bids is None: + if self.local_vars_configuration.client_side_validation and bids is None: # noqa: E501 raise ValueError("Invalid value for `bids`, must not be `None`") # noqa: E501 self._bids = bids @@ -137,8 +142,11 @@ def __eq__(self, other): if not isinstance(other, OrderBook): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, OrderBook): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/position.py b/gate_api/models/position.py index fac3a46..74d78c1 100644 --- a/gate_api/models/position.py +++ b/gate_api/models/position.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class Position(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -78,8 +80,11 @@ class Position(object): 'close_order': 'close_order' } - def __init__(self, user=None, contract=None, size=None, leverage=None, risk_limit=None, leverage_max=None, maintenance_rate=None, value=None, margin=None, entry_price=None, liq_price=None, mark_price=None, unrealised_pnl=None, realised_pnl=None, history_pnl=None, last_close_pnl=None, realised_point=None, history_point=None, adl_ranking=None, pending_orders=None, close_order=None): # noqa: E501 + def __init__(self, user=None, contract=None, size=None, leverage=None, risk_limit=None, leverage_max=None, maintenance_rate=None, value=None, margin=None, entry_price=None, liq_price=None, mark_price=None, unrealised_pnl=None, realised_pnl=None, history_pnl=None, last_close_pnl=None, realised_point=None, history_point=None, adl_ranking=None, pending_orders=None, close_order=None, local_vars_configuration=None): # noqa: E501 """Position - 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 = None self._contract = None @@ -665,8 +670,11 @@ def __eq__(self, other): if not isinstance(other, Position): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, Position): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/position_close.py b/gate_api/models/position_close.py index 65e4100..101efd4 100644 --- a/gate_api/models/position_close.py +++ b/gate_api/models/position_close.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class PositionClose(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -46,8 +48,11 @@ class PositionClose(object): 'text': 'text' } - def __init__(self, time=None, contract=None, side=None, pnl=None, text=None): # noqa: E501 + def __init__(self, time=None, contract=None, side=None, pnl=None, text=None, local_vars_configuration=None): # noqa: E501 """PositionClose - 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._time = None self._contract = None @@ -134,7 +139,7 @@ def side(self, side): :type: str """ allowed_values = ["long", "short"] # noqa: E501 - if side not in allowed_values: + if self.local_vars_configuration.client_side_validation and side not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `side` ({0}), must be one of {1}" # noqa: E501 .format(side, allowed_values) @@ -225,8 +230,11 @@ def __eq__(self, other): if not isinstance(other, PositionClose): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, PositionClose): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/position_close_order.py b/gate_api/models/position_close_order.py index d9dbaed..fb94f1f 100644 --- a/gate_api/models/position_close_order.py +++ b/gate_api/models/position_close_order.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class PositionCloseOrder(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -42,8 +44,11 @@ class PositionCloseOrder(object): 'is_liq': 'is_liq' } - def __init__(self, id=None, price=None, is_liq=None): # noqa: E501 + def __init__(self, id=None, price=None, is_liq=None, local_vars_configuration=None): # noqa: E501 """PositionCloseOrder - 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._price = None @@ -163,8 +168,11 @@ def __eq__(self, other): if not isinstance(other, PositionCloseOrder): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, PositionCloseOrder): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/repay_request.py b/gate_api/models/repay_request.py index a3f0d9a..fd9f9b7 100644 --- a/gate_api/models/repay_request.py +++ b/gate_api/models/repay_request.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class RepayRequest(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -44,8 +46,11 @@ class RepayRequest(object): 'amount': 'amount' } - def __init__(self, currency_pair=None, currency=None, mode=None, amount=None): # noqa: E501 + def __init__(self, currency_pair=None, currency=None, mode=None, amount=None, local_vars_configuration=None): # noqa: E501 """RepayRequest - 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_pair = None self._currency = None @@ -79,7 +84,7 @@ def currency_pair(self, currency_pair): :param currency_pair: The currency_pair of this RepayRequest. # noqa: E501 :type: str """ - if currency_pair is None: + if self.local_vars_configuration.client_side_validation and currency_pair is None: # noqa: E501 raise ValueError("Invalid value for `currency_pair`, must not be `None`") # noqa: E501 self._currency_pair = currency_pair @@ -104,7 +109,7 @@ def currency(self, currency): :param currency: The currency of this RepayRequest. # noqa: E501 :type: str """ - if currency is None: + 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 @@ -129,10 +134,10 @@ def mode(self, mode): :param mode: The mode of this RepayRequest. # noqa: E501 :type: str """ - if mode is None: + if self.local_vars_configuration.client_side_validation and mode is None: # noqa: E501 raise ValueError("Invalid value for `mode`, must not be `None`") # noqa: E501 allowed_values = ["all", "partial"] # noqa: E501 - if mode not in allowed_values: + if self.local_vars_configuration.client_side_validation and mode not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `mode` ({0}), must be one of {1}" # noqa: E501 .format(mode, allowed_values) @@ -200,8 +205,11 @@ def __eq__(self, other): if not isinstance(other, RepayRequest): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, RepayRequest): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/repayment.py b/gate_api/models/repayment.py index 72769c7..99ff969 100644 --- a/gate_api/models/repayment.py +++ b/gate_api/models/repayment.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class Repayment(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -44,8 +46,11 @@ class Repayment(object): 'interest': 'interest' } - def __init__(self, id=None, create_time=None, principal=None, interest=None): # noqa: E501 + def __init__(self, id=None, create_time=None, principal=None, interest=None, local_vars_configuration=None): # noqa: E501 """Repayment - 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 @@ -191,8 +196,11 @@ def __eq__(self, other): if not isinstance(other, Repayment): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, Repayment): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/spot_account.py b/gate_api/models/spot_account.py index f60792e..f27ab03 100644 --- a/gate_api/models/spot_account.py +++ b/gate_api/models/spot_account.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class SpotAccount(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -42,8 +44,11 @@ class SpotAccount(object): 'locked': 'locked' } - def __init__(self, currency=None, available=None, locked=None): # noqa: E501 + def __init__(self, currency=None, available=None, locked=None, local_vars_configuration=None): # noqa: E501 """SpotAccount - 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._available = None @@ -163,8 +168,11 @@ def __eq__(self, other): if not isinstance(other, SpotAccount): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, SpotAccount): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/sub_account_transfer.py b/gate_api/models/sub_account_transfer.py index 88edaa4..a75493b 100644 --- a/gate_api/models/sub_account_transfer.py +++ b/gate_api/models/sub_account_transfer.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class SubAccountTransfer(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -50,8 +52,11 @@ class SubAccountTransfer(object): 'source': 'source' } - def __init__(self, currency=None, sub_account=None, direction=None, amount=None, uid=None, timest=None, source=None): # noqa: E501 + def __init__(self, currency=None, sub_account=None, direction=None, amount=None, uid=None, timest=None, source=None, local_vars_configuration=None): # noqa: E501 """SubAccountTransfer - 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._sub_account = None @@ -93,7 +98,7 @@ def currency(self, currency): :param currency: The currency of this SubAccountTransfer. # noqa: E501 :type: str """ - if currency is None: + 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 @@ -118,7 +123,7 @@ def sub_account(self, sub_account): :param sub_account: The sub_account of this SubAccountTransfer. # noqa: E501 :type: str """ - if sub_account is None: + if self.local_vars_configuration.client_side_validation and sub_account is None: # noqa: E501 raise ValueError("Invalid value for `sub_account`, must not be `None`") # noqa: E501 self._sub_account = sub_account @@ -143,10 +148,10 @@ def direction(self, direction): :param direction: The direction of this SubAccountTransfer. # noqa: E501 :type: str """ - if direction is None: + if self.local_vars_configuration.client_side_validation and direction is None: # noqa: E501 raise ValueError("Invalid value for `direction`, must not be `None`") # noqa: E501 allowed_values = ["to", "from"] # noqa: E501 - if direction not in allowed_values: + if self.local_vars_configuration.client_side_validation and direction not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 .format(direction, allowed_values) @@ -174,7 +179,7 @@ def amount(self, amount): :param amount: The amount of this SubAccountTransfer. # noqa: E501 :type: str """ - if amount is None: + 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 @@ -285,8 +290,11 @@ def __eq__(self, other): if not isinstance(other, SubAccountTransfer): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, SubAccountTransfer): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/ticker.py b/gate_api/models/ticker.py index e309979..2f4febc 100644 --- a/gate_api/models/ticker.py +++ b/gate_api/models/ticker.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class Ticker(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -54,8 +56,11 @@ class Ticker(object): 'low_24h': 'low_24h' } - def __init__(self, currency_pair=None, last=None, lowest_ask=None, highest_bid=None, change_percentage=None, base_volume=None, quote_volume=None, high_24h=None, low_24h=None): # noqa: E501 + def __init__(self, currency_pair=None, last=None, lowest_ask=None, highest_bid=None, change_percentage=None, base_volume=None, quote_volume=None, high_24h=None, low_24h=None, local_vars_configuration=None): # noqa: E501 """Ticker - 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_pair = None self._last = None @@ -331,8 +336,11 @@ def __eq__(self, other): if not isinstance(other, Ticker): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, Ticker): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/trade.py b/gate_api/models/trade.py index a113b3c..dfe4b83 100644 --- a/gate_api/models/trade.py +++ b/gate_api/models/trade.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class Trade(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -58,8 +60,11 @@ class Trade(object): 'gt_fee': 'gt_fee' } - def __init__(self, id=None, create_time=None, side=None, role=None, amount=None, price=None, order_id=None, fee=None, fee_currency=None, point_fee=None, gt_fee=None): # noqa: E501 + def __init__(self, id=None, create_time=None, side=None, role=None, amount=None, price=None, order_id=None, fee=None, fee_currency=None, point_fee=None, gt_fee=None, local_vars_configuration=None): # noqa: E501 """Trade - 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 @@ -164,7 +169,7 @@ def side(self, side): :type: str """ allowed_values = ["buy", "sell"] # noqa: E501 - if side not in allowed_values: + if self.local_vars_configuration.client_side_validation and side not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `side` ({0}), must be one of {1}" # noqa: E501 .format(side, allowed_values) @@ -193,7 +198,7 @@ def role(self, role): :type: str """ allowed_values = ["taker", "maker"] # noqa: E501 - if role not in allowed_values: + if self.local_vars_configuration.client_side_validation and role not in allowed_values: # noqa: E501 raise ValueError( "Invalid value for `role` ({0}), must be one of {1}" # noqa: E501 .format(role, allowed_values) @@ -399,8 +404,11 @@ def __eq__(self, other): if not isinstance(other, Trade): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, Trade): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/transfer.py b/gate_api/models/transfer.py index 2ad8213..418a75d 100644 --- a/gate_api/models/transfer.py +++ b/gate_api/models/transfer.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class Transfer(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -48,8 +50,11 @@ class Transfer(object): 'settle': 'settle' } - def __init__(self, currency=None, _from=None, to=None, amount=None, currency_pair=None, settle=None): # noqa: E501 + def __init__(self, currency=None, _from=None, to=None, amount=None, currency_pair=None, settle=None, local_vars_configuration=None): # noqa: E501 """Transfer - 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.__from = None @@ -88,7 +93,7 @@ def currency(self, currency): :param currency: The currency of this Transfer. # noqa: E501 :type: str """ - if currency is None: + 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 @@ -113,10 +118,10 @@ def _from(self, _from): :param _from: The _from of this Transfer. # noqa: E501 :type: str """ - if _from is None: + 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 - if _from not in allowed_values: + 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}" # noqa: E501 .format(_from, allowed_values) @@ -144,10 +149,10 @@ def to(self, to): :param to: The to of this Transfer. # noqa: E501 :type: str """ - if to is None: + 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 - if to not in allowed_values: + 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}" # noqa: E501 .format(to, allowed_values) @@ -175,7 +180,7 @@ def amount(self, amount): :param amount: The amount of this Transfer. # noqa: E501 :type: str """ - if amount is None: + 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 @@ -263,8 +268,11 @@ def __eq__(self, other): if not isinstance(other, Transfer): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, Transfer): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/trigger_order_response.py b/gate_api/models/trigger_order_response.py index e571612..0db6191 100644 --- a/gate_api/models/trigger_order_response.py +++ b/gate_api/models/trigger_order_response.py @@ -15,6 +15,8 @@ import six +from gate_api.configuration import Configuration + class TriggerOrderResponse(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -38,8 +40,11 @@ class TriggerOrderResponse(object): 'id': 'id' } - def __init__(self, id=None): # noqa: E501 + def __init__(self, id=None, local_vars_configuration=None): # noqa: E501 """TriggerOrderResponse - 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.discriminator = None @@ -107,8 +112,11 @@ def __eq__(self, other): if not isinstance(other, TriggerOrderResponse): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, TriggerOrderResponse): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/rest.py b/gate_api/rest.py index 4215826..70da07c 100644 --- a/gate_api/rest.py +++ b/gate_api/rest.py @@ -12,24 +12,19 @@ from __future__ import absolute_import -import hashlib -import hmac import io import json import logging import re import ssl -import time import certifi # python 2 and python 3 compatibility library import six -from six.moves.urllib.parse import unquote_plus, urlencode +from six.moves.urllib.parse import urlencode +import urllib3 -try: - import urllib3 -except ImportError: - raise ImportError('OpenAPI Python client requires urllib3.') +from gate_api.exceptions import ApiException, ApiValueError logger = logging.getLogger(__name__) @@ -62,7 +57,6 @@ def __init__(self, configuration, pools_size=4, maxsize=None): # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 # cert_reqs - self.configuration = configuration if configuration.verify_ssl: cert_reqs = ssl.CERT_REQUIRED else: @@ -79,6 +73,9 @@ def __init__(self, configuration, pools_size=4, maxsize=None): if configuration.assert_hostname is not None: addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + if configuration.retries is not None: + addition_pool_args['retries'] = configuration.retries + if maxsize is None: if configuration.connection_pool_maxsize is not None: maxsize = configuration.connection_pool_maxsize @@ -95,6 +92,7 @@ def __init__(self, configuration, pools_size=4, maxsize=None): cert_file=configuration.cert_file, key_file=configuration.key_file, proxy_url=configuration.proxy, + proxy_headers=configuration.proxy_headers, **addition_pool_args ) else: @@ -108,28 +106,9 @@ def __init__(self, configuration, pools_size=4, maxsize=None): **addition_pool_args ) - def gen_sign(self, method, url, query_string=None, payload_string=None): - """generate authentication headers - - :param method: http request method - :param url: http resource path - :param query_string: query string - :param payload_string: request payload in string format - :return: signature headers - """ - t = time.time() - m = hashlib.sha512() - if payload_string is not None: - m.update(payload_string.encode('utf-8')) - hashed_payload = m.hexdigest() - s = '%s\n%s\n%s\n%s\n%s' % (method, url, query_string or "", hashed_payload, t) - sign = hmac.new(self.configuration.secret.encode('utf-8'), s.encode('utf-8'), - hashlib.sha512).hexdigest() - return {'KEY': self.configuration.key, 'Timestamp': str(t), 'SIGN': sign} - def request(self, method, url, query_params=None, headers=None, body=None, post_params=None, _preload_content=True, - _request_timeout=None, _auth_required=True): + _request_timeout=None): """Perform requests. :param method: http request method @@ -147,14 +126,13 @@ def request(self, method, url, query_params=None, headers=None, number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :param _auth_required: whether authentication is required """ method = method.upper() assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS'] if post_params and body: - raise ValueError( + raise ApiValueError( "body parameter cannot be used with post_params parameter." ) @@ -173,21 +151,15 @@ def request(self, method, url, query_params=None, headers=None, if 'Content-Type' not in headers: headers['Content-Type'] = 'application/json' - request_body = None - if body is not None: - request_body = json.dumps(body) - if _auth_required: - resource_path = '/api/v4' + url[len(self.configuration.host):] - sign_headers = self.gen_sign(method, resource_path, unquote_plus(urlencode(query_params)), - request_body) - headers.update(sign_headers) - try: # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: if query_params: url += '?' + urlencode(query_params) if re.search('json', headers['Content-Type'], re.IGNORECASE): + request_body = None + if body is not None: + request_body = json.dumps(body) r = self.pool_manager.request( method, url, body=request_body, @@ -217,7 +189,7 @@ def request(self, method, url, query_params=None, headers=None, # Pass a `string` parameter directly in the body to support # other content types than Json when `body` argument is # provided in serialized form - elif isinstance(body, str): + elif isinstance(body, str) or isinstance(body, bytes): request_body = body r = self.pool_manager.request( method, url, @@ -245,11 +217,6 @@ def request(self, method, url, query_params=None, headers=None, if _preload_content: r = RESTResponse(r) - # In the python 3, the response.data is bytes. - # we need to decode it to string. - if six.PY3: - r.data = r.data.decode('utf8') - # log response body logger.debug("response body: %s", r.data) @@ -259,106 +226,66 @@ def request(self, method, url, query_params=None, headers=None, return r def GET(self, url, headers=None, query_params=None, _preload_content=True, - _request_timeout=None, _auth_required=True): + _request_timeout=None): return self.request("GET", url, headers=headers, _preload_content=_preload_content, _request_timeout=_request_timeout, - query_params=query_params, - _auth_required=_auth_required) + query_params=query_params) def HEAD(self, url, headers=None, query_params=None, _preload_content=True, - _request_timeout=None, _auth_required=True): + _request_timeout=None): return self.request("HEAD", url, headers=headers, _preload_content=_preload_content, _request_timeout=_request_timeout, - query_params=query_params, - _auth_required=_auth_required) + query_params=query_params) def OPTIONS(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None, - _auth_required=True): + body=None, _preload_content=True, _request_timeout=None): return self.request("OPTIONS", url, headers=headers, query_params=query_params, - _auth_required=_auth_required, post_params=post_params, _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) def DELETE(self, url, headers=None, query_params=None, body=None, - _preload_content=True, _request_timeout=None, - _auth_required=True): + _preload_content=True, _request_timeout=None): return self.request("DELETE", url, headers=headers, query_params=query_params, - _auth_required=_auth_required, _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) def POST(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None, - _auth_required=True): + body=None, _preload_content=True, _request_timeout=None): return self.request("POST", url, headers=headers, query_params=query_params, - _auth_required=_auth_required, post_params=post_params, _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) def PUT(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None, - _auth_required=True): + body=None, _preload_content=True, _request_timeout=None): return self.request("PUT", url, headers=headers, query_params=query_params, - _auth_required=_auth_required, post_params=post_params, _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) def PATCH(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None, - _auth_required=True): + body=None, _preload_content=True, _request_timeout=None): return self.request("PATCH", url, headers=headers, query_params=query_params, - _auth_required=_auth_required, post_params=post_params, _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) - - -class ApiException(Exception): - - def __init__(self, status=None, reason=None, http_resp=None): - if http_resp: - self.status = http_resp.status - self.reason = http_resp.reason - self.body = http_resp.data - self.headers = http_resp.getheaders() - else: - self.status = status - self.reason = reason - self.body = None - self.headers = None - - def __str__(self): - """Custom error messages for exception""" - error_message = "({0})\n"\ - "Reason: {1}\n".format(self.status, self.reason) - if self.headers: - error_message += "HTTP response headers: {0}\n".format( - self.headers) - - if self.body: - error_message += "HTTP response body: {0}\n".format(self.body) - - return error_message diff --git a/git_push.sh b/git_push.sh index 06af295..2bad2b3 100644 --- a/git_push.sh +++ b/git_push.sh @@ -1,11 +1,17 @@ #!/bin/sh # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ # -# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" git_user_id=$1 git_repo_id=$2 release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi if [ "$git_user_id" = "" ]; then git_user_id="gateio" @@ -28,7 +34,7 @@ git init # Adds the files in the local repository and stages them for commit. git add . -# Commits the tracked changes and prepares them to be pushed to a remote repository. +# Commits the tracked changes and prepares them to be pushed to a remote repository. git commit -m "$release_note" # Sets the new remote @@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git fi fi @@ -47,6 +53,6 @@ fi git pull origin master # Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" git push origin master 2>&1 | grep -v 'To https' diff --git a/requirements.txt b/requirements.txt index bafdc07..eb358ef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ certifi >= 14.05.14 +future; python_version<="2.7" six >= 1.10 python_dateutil >= 2.5.3 setuptools >= 21.0.0 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..11433ee --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/setup.py b/setup.py index cde72c6..f186b65 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "gate-api" -VERSION = "4.14.0" +VERSION = "4.15.0" # To install the library, run the following # # python setup.py install @@ -27,12 +27,14 @@ name=NAME, version=VERSION, description="Gate API v4", + author="Gate API support", author_email="support@mail.gate.io", url="", keywords=["OpenAPI", "OpenAPI-Generator", "Gate API v4"], install_requires=REQUIRES, - packages=find_packages(), + packages=find_packages(exclude=["test", "tests"]), include_package_data=True, + license="Apache License 2.0", long_description="""\ 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 """ diff --git a/test-requirements.txt b/test-requirements.txt index 2702246..4ed3991 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,5 +1,3 @@ -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 diff --git a/tox.ini b/tox.ini index 3d0be61..2be77d1 100644 --- a/tox.ini +++ b/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] + pytest --cov=gate_api From 2695d30e1280e683e268b77bf04d004f16cb7dea Mon Sep 17 00:00:00 2001 From: Revil Wang Date: Mon, 3 Aug 2020 17:12:31 +0800 Subject: [PATCH 2/3] add open orders and margin balance history API --- README.md | 156 ++- docs/DeliveryApi.md | 914 ++++++------- docs/FuturesApi.md | 874 ++++++------- docs/MarginAccountBook.md | 15 + docs/MarginApi.md | 456 ++++--- docs/OpenOrders.md | 12 + docs/SpotApi.md | 602 +++++---- docs/Transfer.md | 2 + docs/WalletApi.md | 106 +- gate_api/__init__.py | 5 +- gate_api/api/delivery_api.py | 1630 ++++++++++++------------ gate_api/api/futures_api.py | 1512 +++++++++++----------- gate_api/api/margin_api.py | 893 +++++++------ gate_api/api/spot_api.py | 915 +++++++------ gate_api/api/wallet_api.py | 212 +-- gate_api/api_client.py | 2 +- gate_api/configuration.py | 4 +- gate_api/models/__init__.py | 3 +- gate_api/models/margin_account_book.py | 262 ++++ gate_api/models/open_orders.py | 176 +++ gate_api/models/transfer.py | 58 +- setup.py | 2 +- 22 files changed, 4870 insertions(+), 3941 deletions(-) create mode 100644 docs/MarginAccountBook.md create mode 100644 docs/OpenOrders.md create mode 100644 gate_api/models/margin_account_book.py create mode 100644 gate_api/models/open_orders.py diff --git a/README.md b/README.md index 3353d99..4f29c8d 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,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.15.0 -- Package version: 4.15.0 +- API version: 4.15.1 +- Package version: 4.15.1 - Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit [https://www.gate.io/page/contacts](https://www.gate.io/page/contacts) @@ -53,16 +53,8 @@ from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) @@ -70,14 +62,13 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -order_id = '12345' # str | ID returned on order successfully being created try: - # Cancel a single order - api_response = api_instance.cancel_delivery_order(settle, order_id) + # List all futures contracts + api_response = api_instance.list_delivery_contracts(settle) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->cancel_delivery_order: %s\n" % e) + print("Exception when calling DeliveryApi->list_delivery_contracts: %s\n" % e) ``` @@ -87,97 +78,99 @@ All URIs are relative to *https://api.gateio.ws/api/v4* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*DeliveryApi* | [**cancel_delivery_order**](docs/DeliveryApi.md#cancel_delivery_order) | **DELETE** /delivery/{settle}/orders/{order_id} | Cancel a single order -*DeliveryApi* | [**cancel_delivery_orders**](docs/DeliveryApi.md#cancel_delivery_orders) | **DELETE** /delivery/{settle}/orders | Cancel all `open` orders matched -*DeliveryApi* | [**cancel_price_triggered_delivery_order**](docs/DeliveryApi.md#cancel_price_triggered_delivery_order) | **DELETE** /delivery/{settle}/price_orders/{order_id} | Cancel a single order -*DeliveryApi* | [**cancel_price_triggered_delivery_order_list**](docs/DeliveryApi.md#cancel_price_triggered_delivery_order_list) | **DELETE** /delivery/{settle}/price_orders | Cancel all open orders -*DeliveryApi* | [**create_delivery_order**](docs/DeliveryApi.md#create_delivery_order) | **POST** /delivery/{settle}/orders | Create a futures order -*DeliveryApi* | [**create_price_triggered_delivery_order**](docs/DeliveryApi.md#create_price_triggered_delivery_order) | **POST** /delivery/{settle}/price_orders | Create a price-triggered order +*DeliveryApi* | [**list_delivery_contracts**](docs/DeliveryApi.md#list_delivery_contracts) | **GET** /delivery/{settle}/contracts | List all futures contracts *DeliveryApi* | [**get_delivery_contract**](docs/DeliveryApi.md#get_delivery_contract) | **GET** /delivery/{settle}/contracts/{contract} | Get a single contract -*DeliveryApi* | [**get_delivery_order**](docs/DeliveryApi.md#get_delivery_order) | **GET** /delivery/{settle}/orders/{order_id} | Get a single order -*DeliveryApi* | [**get_delivery_position**](docs/DeliveryApi.md#get_delivery_position) | **GET** /delivery/{settle}/positions/{contract} | Get single position -*DeliveryApi* | [**get_my_delivery_trades**](docs/DeliveryApi.md#get_my_delivery_trades) | **GET** /delivery/{settle}/my_trades | List personal trading history -*DeliveryApi* | [**get_price_triggered_delivery_order**](docs/DeliveryApi.md#get_price_triggered_delivery_order) | **GET** /delivery/{settle}/price_orders/{order_id} | Get a single order -*DeliveryApi* | [**list_delivery_account_book**](docs/DeliveryApi.md#list_delivery_account_book) | **GET** /delivery/{settle}/account_book | Query account book -*DeliveryApi* | [**list_delivery_accounts**](docs/DeliveryApi.md#list_delivery_accounts) | **GET** /delivery/{settle}/accounts | Query futures account +*DeliveryApi* | [**list_delivery_order_book**](docs/DeliveryApi.md#list_delivery_order_book) | **GET** /delivery/{settle}/order_book | Futures order book +*DeliveryApi* | [**list_delivery_trades**](docs/DeliveryApi.md#list_delivery_trades) | **GET** /delivery/{settle}/trades | Futures trading history *DeliveryApi* | [**list_delivery_candlesticks**](docs/DeliveryApi.md#list_delivery_candlesticks) | **GET** /delivery/{settle}/candlesticks | Get futures candlesticks -*DeliveryApi* | [**list_delivery_contracts**](docs/DeliveryApi.md#list_delivery_contracts) | **GET** /delivery/{settle}/contracts | List all futures contracts +*DeliveryApi* | [**list_delivery_tickers**](docs/DeliveryApi.md#list_delivery_tickers) | **GET** /delivery/{settle}/tickers | List futures tickers *DeliveryApi* | [**list_delivery_insurance_ledger**](docs/DeliveryApi.md#list_delivery_insurance_ledger) | **GET** /delivery/{settle}/insurance | Futures insurance balance history -*DeliveryApi* | [**list_delivery_liquidates**](docs/DeliveryApi.md#list_delivery_liquidates) | **GET** /delivery/{settle}/liquidates | List liquidation history -*DeliveryApi* | [**list_delivery_order_book**](docs/DeliveryApi.md#list_delivery_order_book) | **GET** /delivery/{settle}/order_book | Futures order book +*DeliveryApi* | [**list_delivery_accounts**](docs/DeliveryApi.md#list_delivery_accounts) | **GET** /delivery/{settle}/accounts | Query futures account +*DeliveryApi* | [**list_delivery_account_book**](docs/DeliveryApi.md#list_delivery_account_book) | **GET** /delivery/{settle}/account_book | Query account book +*DeliveryApi* | [**list_delivery_positions**](docs/DeliveryApi.md#list_delivery_positions) | **GET** /delivery/{settle}/positions | List all positions of a user +*DeliveryApi* | [**get_delivery_position**](docs/DeliveryApi.md#get_delivery_position) | **GET** /delivery/{settle}/positions/{contract} | Get single position +*DeliveryApi* | [**update_delivery_position_margin**](docs/DeliveryApi.md#update_delivery_position_margin) | **POST** /delivery/{settle}/positions/{contract}/margin | Update position margin +*DeliveryApi* | [**update_delivery_position_leverage**](docs/DeliveryApi.md#update_delivery_position_leverage) | **POST** /delivery/{settle}/positions/{contract}/leverage | Update position leverage +*DeliveryApi* | [**update_delivery_position_risk_limit**](docs/DeliveryApi.md#update_delivery_position_risk_limit) | **POST** /delivery/{settle}/positions/{contract}/risk_limit | Update position risk limit *DeliveryApi* | [**list_delivery_orders**](docs/DeliveryApi.md#list_delivery_orders) | **GET** /delivery/{settle}/orders | List futures orders +*DeliveryApi* | [**create_delivery_order**](docs/DeliveryApi.md#create_delivery_order) | **POST** /delivery/{settle}/orders | Create a futures order +*DeliveryApi* | [**cancel_delivery_orders**](docs/DeliveryApi.md#cancel_delivery_orders) | **DELETE** /delivery/{settle}/orders | Cancel all `open` orders matched +*DeliveryApi* | [**get_delivery_order**](docs/DeliveryApi.md#get_delivery_order) | **GET** /delivery/{settle}/orders/{order_id} | Get a single order +*DeliveryApi* | [**cancel_delivery_order**](docs/DeliveryApi.md#cancel_delivery_order) | **DELETE** /delivery/{settle}/orders/{order_id} | Cancel a single order +*DeliveryApi* | [**get_my_delivery_trades**](docs/DeliveryApi.md#get_my_delivery_trades) | **GET** /delivery/{settle}/my_trades | List personal trading history *DeliveryApi* | [**list_delivery_position_close**](docs/DeliveryApi.md#list_delivery_position_close) | **GET** /delivery/{settle}/position_close | List position close history -*DeliveryApi* | [**list_delivery_positions**](docs/DeliveryApi.md#list_delivery_positions) | **GET** /delivery/{settle}/positions | List all positions of a user +*DeliveryApi* | [**list_delivery_liquidates**](docs/DeliveryApi.md#list_delivery_liquidates) | **GET** /delivery/{settle}/liquidates | List liquidation history *DeliveryApi* | [**list_delivery_settlements**](docs/DeliveryApi.md#list_delivery_settlements) | **GET** /delivery/{settle}/settlements | List settlement history -*DeliveryApi* | [**list_delivery_tickers**](docs/DeliveryApi.md#list_delivery_tickers) | **GET** /delivery/{settle}/tickers | List futures tickers -*DeliveryApi* | [**list_delivery_trades**](docs/DeliveryApi.md#list_delivery_trades) | **GET** /delivery/{settle}/trades | Futures trading history *DeliveryApi* | [**list_price_triggered_delivery_orders**](docs/DeliveryApi.md#list_price_triggered_delivery_orders) | **GET** /delivery/{settle}/price_orders | List all auto orders -*DeliveryApi* | [**update_delivery_position_leverage**](docs/DeliveryApi.md#update_delivery_position_leverage) | **POST** /delivery/{settle}/positions/{contract}/leverage | Update position leverage -*DeliveryApi* | [**update_delivery_position_margin**](docs/DeliveryApi.md#update_delivery_position_margin) | **POST** /delivery/{settle}/positions/{contract}/margin | Update position margin -*DeliveryApi* | [**update_delivery_position_risk_limit**](docs/DeliveryApi.md#update_delivery_position_risk_limit) | **POST** /delivery/{settle}/positions/{contract}/risk_limit | Update position risk limit -*FuturesApi* | [**cancel_futures_order**](docs/FuturesApi.md#cancel_futures_order) | **DELETE** /futures/{settle}/orders/{order_id} | Cancel a single order -*FuturesApi* | [**cancel_futures_orders**](docs/FuturesApi.md#cancel_futures_orders) | **DELETE** /futures/{settle}/orders | Cancel all `open` orders matched -*FuturesApi* | [**cancel_price_triggered_order**](docs/FuturesApi.md#cancel_price_triggered_order) | **DELETE** /futures/{settle}/price_orders/{order_id} | Cancel a single order -*FuturesApi* | [**cancel_price_triggered_order_list**](docs/FuturesApi.md#cancel_price_triggered_order_list) | **DELETE** /futures/{settle}/price_orders | Cancel all open orders -*FuturesApi* | [**create_futures_order**](docs/FuturesApi.md#create_futures_order) | **POST** /futures/{settle}/orders | Create a futures order -*FuturesApi* | [**create_price_triggered_order**](docs/FuturesApi.md#create_price_triggered_order) | **POST** /futures/{settle}/price_orders | Create a price-triggered order +*DeliveryApi* | [**create_price_triggered_delivery_order**](docs/DeliveryApi.md#create_price_triggered_delivery_order) | **POST** /delivery/{settle}/price_orders | Create a price-triggered order +*DeliveryApi* | [**cancel_price_triggered_delivery_order_list**](docs/DeliveryApi.md#cancel_price_triggered_delivery_order_list) | **DELETE** /delivery/{settle}/price_orders | Cancel all open orders +*DeliveryApi* | [**get_price_triggered_delivery_order**](docs/DeliveryApi.md#get_price_triggered_delivery_order) | **GET** /delivery/{settle}/price_orders/{order_id} | Get a single order +*DeliveryApi* | [**cancel_price_triggered_delivery_order**](docs/DeliveryApi.md#cancel_price_triggered_delivery_order) | **DELETE** /delivery/{settle}/price_orders/{order_id} | Cancel a single order +*FuturesApi* | [**list_futures_contracts**](docs/FuturesApi.md#list_futures_contracts) | **GET** /futures/{settle}/contracts | List all futures contracts *FuturesApi* | [**get_futures_contract**](docs/FuturesApi.md#get_futures_contract) | **GET** /futures/{settle}/contracts/{contract} | Get a single contract -*FuturesApi* | [**get_futures_order**](docs/FuturesApi.md#get_futures_order) | **GET** /futures/{settle}/orders/{order_id} | Get a single order -*FuturesApi* | [**get_my_trades**](docs/FuturesApi.md#get_my_trades) | **GET** /futures/{settle}/my_trades | List personal trading history -*FuturesApi* | [**get_position**](docs/FuturesApi.md#get_position) | **GET** /futures/{settle}/positions/{contract} | Get single position -*FuturesApi* | [**get_price_triggered_order**](docs/FuturesApi.md#get_price_triggered_order) | **GET** /futures/{settle}/price_orders/{order_id} | Get a single order -*FuturesApi* | [**list_futures_account_book**](docs/FuturesApi.md#list_futures_account_book) | **GET** /futures/{settle}/account_book | Query account book -*FuturesApi* | [**list_futures_accounts**](docs/FuturesApi.md#list_futures_accounts) | **GET** /futures/{settle}/accounts | Query futures account +*FuturesApi* | [**list_futures_order_book**](docs/FuturesApi.md#list_futures_order_book) | **GET** /futures/{settle}/order_book | Futures order book +*FuturesApi* | [**list_futures_trades**](docs/FuturesApi.md#list_futures_trades) | **GET** /futures/{settle}/trades | Futures trading history *FuturesApi* | [**list_futures_candlesticks**](docs/FuturesApi.md#list_futures_candlesticks) | **GET** /futures/{settle}/candlesticks | Get futures candlesticks -*FuturesApi* | [**list_futures_contracts**](docs/FuturesApi.md#list_futures_contracts) | **GET** /futures/{settle}/contracts | List all futures contracts +*FuturesApi* | [**list_futures_tickers**](docs/FuturesApi.md#list_futures_tickers) | **GET** /futures/{settle}/tickers | List futures tickers *FuturesApi* | [**list_futures_funding_rate_history**](docs/FuturesApi.md#list_futures_funding_rate_history) | **GET** /futures/{settle}/funding_rate | Funding rate history *FuturesApi* | [**list_futures_insurance_ledger**](docs/FuturesApi.md#list_futures_insurance_ledger) | **GET** /futures/{settle}/insurance | Futures insurance balance history -*FuturesApi* | [**list_futures_order_book**](docs/FuturesApi.md#list_futures_order_book) | **GET** /futures/{settle}/order_book | Futures order book -*FuturesApi* | [**list_futures_orders**](docs/FuturesApi.md#list_futures_orders) | **GET** /futures/{settle}/orders | List futures orders -*FuturesApi* | [**list_futures_tickers**](docs/FuturesApi.md#list_futures_tickers) | **GET** /futures/{settle}/tickers | List futures tickers -*FuturesApi* | [**list_futures_trades**](docs/FuturesApi.md#list_futures_trades) | **GET** /futures/{settle}/trades | Futures trading history -*FuturesApi* | [**list_liquidates**](docs/FuturesApi.md#list_liquidates) | **GET** /futures/{settle}/liquidates | List liquidation history -*FuturesApi* | [**list_position_close**](docs/FuturesApi.md#list_position_close) | **GET** /futures/{settle}/position_close | List position close history +*FuturesApi* | [**list_futures_accounts**](docs/FuturesApi.md#list_futures_accounts) | **GET** /futures/{settle}/accounts | Query futures account +*FuturesApi* | [**list_futures_account_book**](docs/FuturesApi.md#list_futures_account_book) | **GET** /futures/{settle}/account_book | Query account book *FuturesApi* | [**list_positions**](docs/FuturesApi.md#list_positions) | **GET** /futures/{settle}/positions | List all positions of a user -*FuturesApi* | [**list_price_triggered_orders**](docs/FuturesApi.md#list_price_triggered_orders) | **GET** /futures/{settle}/price_orders | List all auto orders -*FuturesApi* | [**update_position_leverage**](docs/FuturesApi.md#update_position_leverage) | **POST** /futures/{settle}/positions/{contract}/leverage | Update position leverage +*FuturesApi* | [**get_position**](docs/FuturesApi.md#get_position) | **GET** /futures/{settle}/positions/{contract} | Get single position *FuturesApi* | [**update_position_margin**](docs/FuturesApi.md#update_position_margin) | **POST** /futures/{settle}/positions/{contract}/margin | Update position margin +*FuturesApi* | [**update_position_leverage**](docs/FuturesApi.md#update_position_leverage) | **POST** /futures/{settle}/positions/{contract}/leverage | Update position leverage *FuturesApi* | [**update_position_risk_limit**](docs/FuturesApi.md#update_position_risk_limit) | **POST** /futures/{settle}/positions/{contract}/risk_limit | Update position risk limit -*MarginApi* | [**cancel_loan**](docs/MarginApi.md#cancel_loan) | **DELETE** /margin/loans/{loan_id} | Cancel lending loan -*MarginApi* | [**create_loan**](docs/MarginApi.md#create_loan) | **POST** /margin/loans | Lend or borrow -*MarginApi* | [**get_loan**](docs/MarginApi.md#get_loan) | **GET** /margin/loans/{loan_id} | Retrieve one single loan detail -*MarginApi* | [**get_loan_record**](docs/MarginApi.md#get_loan_record) | **GET** /margin/loan_records/{loan_record_id} | Get one single loan record -*MarginApi* | [**list_funding_accounts**](docs/MarginApi.md#list_funding_accounts) | **GET** /margin/funding_accounts | Funding account list +*FuturesApi* | [**list_futures_orders**](docs/FuturesApi.md#list_futures_orders) | **GET** /futures/{settle}/orders | List futures orders +*FuturesApi* | [**create_futures_order**](docs/FuturesApi.md#create_futures_order) | **POST** /futures/{settle}/orders | Create a futures order +*FuturesApi* | [**cancel_futures_orders**](docs/FuturesApi.md#cancel_futures_orders) | **DELETE** /futures/{settle}/orders | Cancel all `open` orders matched +*FuturesApi* | [**get_futures_order**](docs/FuturesApi.md#get_futures_order) | **GET** /futures/{settle}/orders/{order_id} | Get a single order +*FuturesApi* | [**cancel_futures_order**](docs/FuturesApi.md#cancel_futures_order) | **DELETE** /futures/{settle}/orders/{order_id} | Cancel a single order +*FuturesApi* | [**get_my_trades**](docs/FuturesApi.md#get_my_trades) | **GET** /futures/{settle}/my_trades | List personal trading history +*FuturesApi* | [**list_position_close**](docs/FuturesApi.md#list_position_close) | **GET** /futures/{settle}/position_close | List position close history +*FuturesApi* | [**list_liquidates**](docs/FuturesApi.md#list_liquidates) | **GET** /futures/{settle}/liquidates | List liquidation history +*FuturesApi* | [**list_price_triggered_orders**](docs/FuturesApi.md#list_price_triggered_orders) | **GET** /futures/{settle}/price_orders | List all auto orders +*FuturesApi* | [**create_price_triggered_order**](docs/FuturesApi.md#create_price_triggered_order) | **POST** /futures/{settle}/price_orders | Create a price-triggered order +*FuturesApi* | [**cancel_price_triggered_order_list**](docs/FuturesApi.md#cancel_price_triggered_order_list) | **DELETE** /futures/{settle}/price_orders | Cancel all open orders +*FuturesApi* | [**get_price_triggered_order**](docs/FuturesApi.md#get_price_triggered_order) | **GET** /futures/{settle}/price_orders/{order_id} | Get a single order +*FuturesApi* | [**cancel_price_triggered_order**](docs/FuturesApi.md#cancel_price_triggered_order) | **DELETE** /futures/{settle}/price_orders/{order_id} | Cancel a single order +*MarginApi* | [**list_margin_currency_pairs**](docs/MarginApi.md#list_margin_currency_pairs) | **GET** /margin/currency_pairs | List all supported currency pairs supported in margin trading *MarginApi* | [**list_funding_book**](docs/MarginApi.md#list_funding_book) | **GET** /margin/funding_book | Order book of lending loans -*MarginApi* | [**list_loan_records**](docs/MarginApi.md#list_loan_records) | **GET** /margin/loan_records | List repayment records of specified loan -*MarginApi* | [**list_loan_repayments**](docs/MarginApi.md#list_loan_repayments) | **GET** /margin/loans/{loan_id}/repayment | List loan repayment records -*MarginApi* | [**list_loans**](docs/MarginApi.md#list_loans) | **GET** /margin/loans | List all loans *MarginApi* | [**list_margin_accounts**](docs/MarginApi.md#list_margin_accounts) | **GET** /margin/accounts | Margin account list -*MarginApi* | [**list_margin_currency_pairs**](docs/MarginApi.md#list_margin_currency_pairs) | **GET** /margin/currency_pairs | List all supported currency pairs supported in margin trading +*MarginApi* | [**list_margin_account_book**](docs/MarginApi.md#list_margin_account_book) | **GET** /margin/account_book | List margin account balance change history +*MarginApi* | [**list_funding_accounts**](docs/MarginApi.md#list_funding_accounts) | **GET** /margin/funding_accounts | Funding account list +*MarginApi* | [**list_loans**](docs/MarginApi.md#list_loans) | **GET** /margin/loans | List all loans +*MarginApi* | [**create_loan**](docs/MarginApi.md#create_loan) | **POST** /margin/loans | Lend or borrow *MarginApi* | [**merge_loans**](docs/MarginApi.md#merge_loans) | **POST** /margin/merged_loans | Merge multiple lending loans -*MarginApi* | [**repay_loan**](docs/MarginApi.md#repay_loan) | **POST** /margin/loans/{loan_id}/repayment | Repay a loan +*MarginApi* | [**get_loan**](docs/MarginApi.md#get_loan) | **GET** /margin/loans/{loan_id} | Retrieve one single loan detail +*MarginApi* | [**cancel_loan**](docs/MarginApi.md#cancel_loan) | **DELETE** /margin/loans/{loan_id} | Cancel lending loan *MarginApi* | [**update_loan**](docs/MarginApi.md#update_loan) | **PATCH** /margin/loans/{loan_id} | Modify a loan +*MarginApi* | [**list_loan_repayments**](docs/MarginApi.md#list_loan_repayments) | **GET** /margin/loans/{loan_id}/repayment | List loan repayment records +*MarginApi* | [**repay_loan**](docs/MarginApi.md#repay_loan) | **POST** /margin/loans/{loan_id}/repayment | Repay a loan +*MarginApi* | [**list_loan_records**](docs/MarginApi.md#list_loan_records) | **GET** /margin/loan_records | List repayment records of specified loan +*MarginApi* | [**get_loan_record**](docs/MarginApi.md#get_loan_record) | **GET** /margin/loan_records/{loan_record_id} | Get one single loan record *MarginApi* | [**update_loan_record**](docs/MarginApi.md#update_loan_record) | **PATCH** /margin/loan_records/{loan_record_id} | Modify a loan record -*SpotApi* | [**cancel_batch_orders**](docs/SpotApi.md#cancel_batch_orders) | **POST** /spot/cancel_batch_orders | Cancel a batch of orders with an ID list -*SpotApi* | [**cancel_order**](docs/SpotApi.md#cancel_order) | **DELETE** /spot/orders/{order_id} | Cancel a single order -*SpotApi* | [**cancel_orders**](docs/SpotApi.md#cancel_orders) | **DELETE** /spot/orders | Cancel all `open` orders in specified currency pair +*SpotApi* | [**list_currency_pairs**](docs/SpotApi.md#list_currency_pairs) | **GET** /spot/currency_pairs | List all currency pairs supported +*SpotApi* | [**get_currency_pair**](docs/SpotApi.md#get_currency_pair) | **GET** /spot/currency_pairs/{currency_pair} | Get detail of one single order +*SpotApi* | [**list_tickers**](docs/SpotApi.md#list_tickers) | **GET** /spot/tickers | Retrieve ticker information +*SpotApi* | [**list_order_book**](docs/SpotApi.md#list_order_book) | **GET** /spot/order_book | Retrieve order book +*SpotApi* | [**list_trades**](docs/SpotApi.md#list_trades) | **GET** /spot/trades | Retrieve market trades +*SpotApi* | [**list_candlesticks**](docs/SpotApi.md#list_candlesticks) | **GET** /spot/candlesticks | Market candlesticks +*SpotApi* | [**list_spot_accounts**](docs/SpotApi.md#list_spot_accounts) | **GET** /spot/accounts | List spot accounts *SpotApi* | [**create_batch_orders**](docs/SpotApi.md#create_batch_orders) | **POST** /spot/batch_orders | Create a batch of orders +*SpotApi* | [**list_all_open_orders**](docs/SpotApi.md#list_all_open_orders) | **GET** /spot/open_orders | List all open orders +*SpotApi* | [**list_orders**](docs/SpotApi.md#list_orders) | **GET** /spot/orders | List orders *SpotApi* | [**create_order**](docs/SpotApi.md#create_order) | **POST** /spot/orders | Create an order -*SpotApi* | [**get_currency_pair**](docs/SpotApi.md#get_currency_pair) | **GET** /spot/currency_pairs/{currency_pair} | Get detail of one single order +*SpotApi* | [**cancel_orders**](docs/SpotApi.md#cancel_orders) | **DELETE** /spot/orders | Cancel all `open` orders in specified currency pair +*SpotApi* | [**cancel_batch_orders**](docs/SpotApi.md#cancel_batch_orders) | **POST** /spot/cancel_batch_orders | Cancel a batch of orders with an ID list *SpotApi* | [**get_order**](docs/SpotApi.md#get_order) | **GET** /spot/orders/{order_id} | Get a single order -*SpotApi* | [**list_candlesticks**](docs/SpotApi.md#list_candlesticks) | **GET** /spot/candlesticks | Market candlesticks -*SpotApi* | [**list_currency_pairs**](docs/SpotApi.md#list_currency_pairs) | **GET** /spot/currency_pairs | List all currency pairs supported +*SpotApi* | [**cancel_order**](docs/SpotApi.md#cancel_order) | **DELETE** /spot/orders/{order_id} | Cancel a single order *SpotApi* | [**list_my_trades**](docs/SpotApi.md#list_my_trades) | **GET** /spot/my_trades | List personal trading history -*SpotApi* | [**list_order_book**](docs/SpotApi.md#list_order_book) | **GET** /spot/order_book | Retrieve order book -*SpotApi* | [**list_orders**](docs/SpotApi.md#list_orders) | **GET** /spot/orders | List orders -*SpotApi* | [**list_spot_accounts**](docs/SpotApi.md#list_spot_accounts) | **GET** /spot/accounts | List spot accounts -*SpotApi* | [**list_tickers**](docs/SpotApi.md#list_tickers) | **GET** /spot/tickers | Retrieve ticker information -*SpotApi* | [**list_trades**](docs/SpotApi.md#list_trades) | **GET** /spot/trades | Retrieve market trades *WalletApi* | [**get_deposit_address**](docs/WalletApi.md#get_deposit_address) | **GET** /wallet/deposit_address | Generate currency deposit address +*WalletApi* | [**list_withdrawals**](docs/WalletApi.md#list_withdrawals) | **GET** /wallet/withdrawals | Retrieve withdrawal records *WalletApi* | [**list_deposits**](docs/WalletApi.md#list_deposits) | **GET** /wallet/deposits | Retrieve deposit records +*WalletApi* | [**transfer**](docs/WalletApi.md#transfer) | **POST** /wallet/transfers | Transfer between trading accounts *WalletApi* | [**list_sub_account_transfers**](docs/WalletApi.md#list_sub_account_transfers) | **GET** /wallet/sub_account_transfers | Transfer records between main and sub accounts -*WalletApi* | [**list_withdrawals**](docs/WalletApi.md#list_withdrawals) | **GET** /wallet/withdrawals | Retrieve withdrawal records -*WalletApi* | [**transfer**](docs/WalletApi.md#transfer) | **POST** /wallet/transfers | Transfer between accounts *WalletApi* | [**transfer_with_sub_account**](docs/WalletApi.md#transfer_with_sub_account) | **POST** /wallet/sub_account_transfers | Transfer between main and sub accounts *WithdrawalApi* | [**withdraw**](docs/WithdrawalApi.md#withdraw) | **POST** /withdrawals | Withdraw @@ -207,16 +200,17 @@ Class | Method | HTTP request | Description - [FuturesPriceTriggeredOrder](docs/FuturesPriceTriggeredOrder.md) - [FuturesTicker](docs/FuturesTicker.md) - [FuturesTrade](docs/FuturesTrade.md) - - [GateErrorResponse](docs/GateErrorResponse.md) - [InsuranceRecord](docs/InsuranceRecord.md) - [LedgerRecord](docs/LedgerRecord.md) - [Loan](docs/Loan.md) - [LoanPatch](docs/LoanPatch.md) - [LoanRecord](docs/LoanRecord.md) - [MarginAccount](docs/MarginAccount.md) + - [MarginAccountBook](docs/MarginAccountBook.md) - [MarginAccountCurrency](docs/MarginAccountCurrency.md) - [MarginCurrencyPair](docs/MarginCurrencyPair.md) - [MyFuturesTrade](docs/MyFuturesTrade.md) + - [OpenOrders](docs/OpenOrders.md) - [Order](docs/Order.md) - [OrderBook](docs/OrderBook.md) - [Position](docs/Position.md) diff --git a/docs/DeliveryApi.md b/docs/DeliveryApi.md index 23cecc6..c2a707a 100644 --- a/docs/DeliveryApi.md +++ b/docs/DeliveryApi.md @@ -4,74 +4,64 @@ All URIs are relative to *https://api.gateio.ws/api/v4* Method | HTTP request | Description ------------- | ------------- | ------------- -[**cancel_delivery_order**](DeliveryApi.md#cancel_delivery_order) | **DELETE** /delivery/{settle}/orders/{order_id} | Cancel a single order -[**cancel_delivery_orders**](DeliveryApi.md#cancel_delivery_orders) | **DELETE** /delivery/{settle}/orders | Cancel all `open` orders matched -[**cancel_price_triggered_delivery_order**](DeliveryApi.md#cancel_price_triggered_delivery_order) | **DELETE** /delivery/{settle}/price_orders/{order_id} | Cancel a single order -[**cancel_price_triggered_delivery_order_list**](DeliveryApi.md#cancel_price_triggered_delivery_order_list) | **DELETE** /delivery/{settle}/price_orders | Cancel all open orders -[**create_delivery_order**](DeliveryApi.md#create_delivery_order) | **POST** /delivery/{settle}/orders | Create a futures order -[**create_price_triggered_delivery_order**](DeliveryApi.md#create_price_triggered_delivery_order) | **POST** /delivery/{settle}/price_orders | Create a price-triggered order +[**list_delivery_contracts**](DeliveryApi.md#list_delivery_contracts) | **GET** /delivery/{settle}/contracts | List all futures contracts [**get_delivery_contract**](DeliveryApi.md#get_delivery_contract) | **GET** /delivery/{settle}/contracts/{contract} | Get a single contract -[**get_delivery_order**](DeliveryApi.md#get_delivery_order) | **GET** /delivery/{settle}/orders/{order_id} | Get a single order -[**get_delivery_position**](DeliveryApi.md#get_delivery_position) | **GET** /delivery/{settle}/positions/{contract} | Get single position -[**get_my_delivery_trades**](DeliveryApi.md#get_my_delivery_trades) | **GET** /delivery/{settle}/my_trades | List personal trading history -[**get_price_triggered_delivery_order**](DeliveryApi.md#get_price_triggered_delivery_order) | **GET** /delivery/{settle}/price_orders/{order_id} | Get a single order -[**list_delivery_account_book**](DeliveryApi.md#list_delivery_account_book) | **GET** /delivery/{settle}/account_book | Query account book -[**list_delivery_accounts**](DeliveryApi.md#list_delivery_accounts) | **GET** /delivery/{settle}/accounts | Query futures account +[**list_delivery_order_book**](DeliveryApi.md#list_delivery_order_book) | **GET** /delivery/{settle}/order_book | Futures order book +[**list_delivery_trades**](DeliveryApi.md#list_delivery_trades) | **GET** /delivery/{settle}/trades | Futures trading history [**list_delivery_candlesticks**](DeliveryApi.md#list_delivery_candlesticks) | **GET** /delivery/{settle}/candlesticks | Get futures candlesticks -[**list_delivery_contracts**](DeliveryApi.md#list_delivery_contracts) | **GET** /delivery/{settle}/contracts | List all futures contracts +[**list_delivery_tickers**](DeliveryApi.md#list_delivery_tickers) | **GET** /delivery/{settle}/tickers | List futures tickers [**list_delivery_insurance_ledger**](DeliveryApi.md#list_delivery_insurance_ledger) | **GET** /delivery/{settle}/insurance | Futures insurance balance history -[**list_delivery_liquidates**](DeliveryApi.md#list_delivery_liquidates) | **GET** /delivery/{settle}/liquidates | List liquidation history -[**list_delivery_order_book**](DeliveryApi.md#list_delivery_order_book) | **GET** /delivery/{settle}/order_book | Futures order book +[**list_delivery_accounts**](DeliveryApi.md#list_delivery_accounts) | **GET** /delivery/{settle}/accounts | Query futures account +[**list_delivery_account_book**](DeliveryApi.md#list_delivery_account_book) | **GET** /delivery/{settle}/account_book | Query account book +[**list_delivery_positions**](DeliveryApi.md#list_delivery_positions) | **GET** /delivery/{settle}/positions | List all positions of a user +[**get_delivery_position**](DeliveryApi.md#get_delivery_position) | **GET** /delivery/{settle}/positions/{contract} | Get single position +[**update_delivery_position_margin**](DeliveryApi.md#update_delivery_position_margin) | **POST** /delivery/{settle}/positions/{contract}/margin | Update position margin +[**update_delivery_position_leverage**](DeliveryApi.md#update_delivery_position_leverage) | **POST** /delivery/{settle}/positions/{contract}/leverage | Update position leverage +[**update_delivery_position_risk_limit**](DeliveryApi.md#update_delivery_position_risk_limit) | **POST** /delivery/{settle}/positions/{contract}/risk_limit | Update position risk limit [**list_delivery_orders**](DeliveryApi.md#list_delivery_orders) | **GET** /delivery/{settle}/orders | List futures orders +[**create_delivery_order**](DeliveryApi.md#create_delivery_order) | **POST** /delivery/{settle}/orders | Create a futures order +[**cancel_delivery_orders**](DeliveryApi.md#cancel_delivery_orders) | **DELETE** /delivery/{settle}/orders | Cancel all `open` orders matched +[**get_delivery_order**](DeliveryApi.md#get_delivery_order) | **GET** /delivery/{settle}/orders/{order_id} | Get a single order +[**cancel_delivery_order**](DeliveryApi.md#cancel_delivery_order) | **DELETE** /delivery/{settle}/orders/{order_id} | Cancel a single order +[**get_my_delivery_trades**](DeliveryApi.md#get_my_delivery_trades) | **GET** /delivery/{settle}/my_trades | List personal trading history [**list_delivery_position_close**](DeliveryApi.md#list_delivery_position_close) | **GET** /delivery/{settle}/position_close | List position close history -[**list_delivery_positions**](DeliveryApi.md#list_delivery_positions) | **GET** /delivery/{settle}/positions | List all positions of a user +[**list_delivery_liquidates**](DeliveryApi.md#list_delivery_liquidates) | **GET** /delivery/{settle}/liquidates | List liquidation history [**list_delivery_settlements**](DeliveryApi.md#list_delivery_settlements) | **GET** /delivery/{settle}/settlements | List settlement history -[**list_delivery_tickers**](DeliveryApi.md#list_delivery_tickers) | **GET** /delivery/{settle}/tickers | List futures tickers -[**list_delivery_trades**](DeliveryApi.md#list_delivery_trades) | **GET** /delivery/{settle}/trades | Futures trading history [**list_price_triggered_delivery_orders**](DeliveryApi.md#list_price_triggered_delivery_orders) | **GET** /delivery/{settle}/price_orders | List all auto orders -[**update_delivery_position_leverage**](DeliveryApi.md#update_delivery_position_leverage) | **POST** /delivery/{settle}/positions/{contract}/leverage | Update position leverage -[**update_delivery_position_margin**](DeliveryApi.md#update_delivery_position_margin) | **POST** /delivery/{settle}/positions/{contract}/margin | Update position margin -[**update_delivery_position_risk_limit**](DeliveryApi.md#update_delivery_position_risk_limit) | **POST** /delivery/{settle}/positions/{contract}/risk_limit | Update position risk limit +[**create_price_triggered_delivery_order**](DeliveryApi.md#create_price_triggered_delivery_order) | **POST** /delivery/{settle}/price_orders | Create a price-triggered order +[**cancel_price_triggered_delivery_order_list**](DeliveryApi.md#cancel_price_triggered_delivery_order_list) | **DELETE** /delivery/{settle}/price_orders | Cancel all open orders +[**get_price_triggered_delivery_order**](DeliveryApi.md#get_price_triggered_delivery_order) | **GET** /delivery/{settle}/price_orders/{order_id} | Get a single order +[**cancel_price_triggered_delivery_order**](DeliveryApi.md#cancel_price_triggered_delivery_order) | **DELETE** /delivery/{settle}/price_orders/{order_id} | Cancel a single order -# **cancel_delivery_order** -> FuturesOrder cancel_delivery_order(settle, order_id) +# **list_delivery_contracts** +> list[DeliveryContract] list_delivery_contracts(settle) -Cancel a single order +List all futures contracts ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -order_id = '12345' # str | ID returned on order successfully being created try: - # Cancel a single order - api_response = api_instance.cancel_delivery_order(settle, order_id) + # List all futures contracts + api_response = api_instance.list_delivery_contracts(settle) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->cancel_delivery_order: %s\n" % e) + print("Exception when calling DeliveryApi->list_delivery_contracts: %s\n" % e) ``` ### Parameters @@ -79,15 +69,14 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **order_id** | **str**| ID returned on order successfully being created | ### Return type -[**FuturesOrder**](FuturesOrder.md) +[**list[DeliveryContract]**](DeliveryContract.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers @@ -97,36 +86,25 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Order details | - | +**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) -# **cancel_delivery_orders** -> list[FuturesOrder] cancel_delivery_orders(settle, contract, side=side) - -Cancel all `open` orders matched +# **get_delivery_contract** +> DeliveryContract get_delivery_contract(settle, contract) -Zero-fill order cannot be retrieved 60 seconds after cancellation +Get a single contract ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) @@ -134,14 +112,13 @@ api_client = gate_api.ApiClient(configuration) api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract -side = 'ask' # str | All bids or asks. Both included in not specified (optional) try: - # Cancel all `open` orders matched - api_response = api_instance.cancel_delivery_orders(settle, contract, side=side) + # Get a single contract + api_response = api_instance.get_delivery_contract(settle, contract) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->cancel_delivery_orders: %s\n" % e) + print("Exception when calling DeliveryApi->get_delivery_contract: %s\n" % e) ``` ### Parameters @@ -150,15 +127,14 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | - **side** | **str**| All bids or asks. Both included in not specified | [optional] ### Return type -[**list[FuturesOrder]**](FuturesOrder.md) +[**DeliveryContract**](DeliveryContract.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers @@ -168,48 +144,43 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | All orders matched cancelled | - | +**200** | Contract information | - | [[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_price_triggered_delivery_order** -> FuturesPriceTriggeredOrder cancel_price_triggered_delivery_order(settle, order_id) +# **list_delivery_order_book** +> FuturesOrderBook list_delivery_order_book(settle, contract, interval=interval, limit=limit) -Cancel a single order +Futures order book + +Bids will be sorted by price from high to low, while asks sorted reversely ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -order_id = 'order_id_example' # str | ID returned on order successfully being created +contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +interval = '0' # str | Order depth. 0 means no aggregation is applied. default to 0 (optional) (default to '0') +limit = 10 # int | Maximum number of order depth data in asks or bids (optional) (default to 10) try: - # Cancel a single order - api_response = api_instance.cancel_price_triggered_delivery_order(settle, order_id) + # Futures order book + api_response = api_instance.list_delivery_order_book(settle, contract, interval=interval, limit=limit) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order: %s\n" % e) + print("Exception when calling DeliveryApi->list_delivery_order_book: %s\n" % e) ``` ### Parameters @@ -217,15 +188,17 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **order_id** | **str**| ID returned on order successfully being created | + **contract** | **str**| Futures contract | + **interval** | **str**| Order depth. 0 means no aggregation is applied. default to 0 | [optional] [default to '0'] + **limit** | **int**| Maximum number of order depth data in asks or bids | [optional] [default to 10] ### Return type -[**FuturesPriceTriggeredOrder**](FuturesPriceTriggeredOrder.md) +[**FuturesOrderBook**](FuturesOrderBook.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers @@ -235,48 +208,43 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Auto order detail | - | +**200** | Order book 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) -# **cancel_price_triggered_delivery_order_list** -> list[FuturesPriceTriggeredOrder] cancel_price_triggered_delivery_order_list(settle, contract) +# **list_delivery_trades** +> list[FuturesTrade] list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to) -Cancel all open orders +Futures trading history ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USD' # str | Futures contract +contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) +last_id = '12345' # str | Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) +_from = 1546905600 # float | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional) +to = 1546935600 # float | Specify end time in Unix seconds, default to current time (optional) try: - # Cancel all open orders - api_response = api_instance.cancel_price_triggered_delivery_order_list(settle, contract) + # Futures trading history + api_response = api_instance.list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order_list: %s\n" % e) + print("Exception when calling DeliveryApi->list_delivery_trades: %s\n" % e) ``` ### Parameters @@ -285,14 +253,18 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | + **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **last_id** | **str**| Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range | [optional] + **_from** | **float**| Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. | [optional] + **to** | **float**| Specify end time in Unix seconds, default to current time | [optional] ### Return type -[**list[FuturesPriceTriggeredOrder]**](FuturesPriceTriggeredOrder.md) +[**list[FuturesTrade]**](FuturesTrade.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers @@ -302,50 +274,45 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Batch cancellation request accepted. Query order status by listing orders | - | +**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) -# **create_delivery_order** -> FuturesOrder create_delivery_order(settle, futures_order) +# **list_delivery_candlesticks** +> list[FuturesCandlestick] list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval) -Create a futures order +Get futures candlesticks -Zero-fill order cannot be retrieved 60 seconds after cancellation +Return specified contract candlesticks. If prefix `contract` with `mark_`, the contract's mark price candlesticks are returned; if prefix with `index_`, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -futures_order = {"id":15675394,"user":100000,"contract":"BTC_USD","create_time":1546569968,"size":6024,"iceberg":0,"left":6024,"price":"3765","fill_price":"0","mkfr":"-0.00025","tkfr":"0.00075","tif":"gtc","refu":0,"is_reduce_only":false,"is_close":false,"is_liq":false,"text":"t-my-custom-id","status":"finished","finish_time":1514764900,"finish_as":"cancelled"} # FuturesOrder | +contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +_from = 1546905600 # float | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) +to = 1546935600 # float | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) +limit = 100 # int | Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional) (default to 100) +interval = '5m' # str | Interval time between data points (optional) (default to '5m') try: - # Create a futures order - api_response = api_instance.create_delivery_order(settle, futures_order) + # Get futures candlesticks + api_response = api_instance.list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->create_delivery_order: %s\n" % e) + print("Exception when calling DeliveryApi->list_delivery_candlesticks: %s\n" % e) ``` ### Parameters @@ -353,66 +320,61 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **futures_order** | [**FuturesOrder**](FuturesOrder.md)| | + **contract** | **str**| Futures contract | + **_from** | **float**| Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified | [optional] + **to** | **float**| End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time | [optional] + **limit** | **int**| Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [optional] [default to 100] + **interval** | **str**| Interval time between data points | [optional] [default to '5m'] ### Return type -[**FuturesOrder**](FuturesOrder.md) +[**list[FuturesCandlestick]**](FuturesCandlestick.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**201** | Order details | - | +**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_price_triggered_delivery_order** -> TriggerOrderResponse create_price_triggered_delivery_order(settle, futures_price_triggered_order) +# **list_delivery_tickers** +> list[FuturesTicker] list_delivery_tickers(settle, contract=contract) -Create a price-triggered order +List futures tickers ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -futures_price_triggered_order = {"initial":{"contract":"BTC_USD","size":100,"price":"5.03","close":false,"tif":"gtc","text":"web"},"trigger":{"strategy_type":0,"price_type":0,"price":"3000","rule":1,"expiration":86400},"id":1283293,"user":1234,"create_time":1514764800,"finish_time":1514764900,"trade_id":13566,"status":"finished","finish_as":"cancelled","reason":""} # FuturesPriceTriggeredOrder | +contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) try: - # Create a price-triggered order - api_response = api_instance.create_price_triggered_delivery_order(settle, futures_price_triggered_order) + # List futures tickers + api_response = api_instance.list_delivery_tickers(settle, contract=contract) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->create_price_triggered_delivery_order: %s\n" % e) + print("Exception when calling DeliveryApi->list_delivery_tickers: %s\n" % e) ``` ### Parameters @@ -420,32 +382,32 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **futures_price_triggered_order** | [**FuturesPriceTriggeredOrder**](FuturesPriceTriggeredOrder.md)| | + **contract** | **str**| Futures contract | [optional] ### Return type -[**TriggerOrderResponse**](TriggerOrderResponse.md) +[**list[FuturesTicker]**](FuturesTicker.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**201** | Order created | - | +**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_delivery_contract** -> DeliveryContract get_delivery_contract(settle, contract) +# **list_delivery_insurance_ledger** +> list[InsuranceRecord] list_delivery_insurance_ledger(settle, limit=limit) -Get a single contract +Futures insurance balance history ### Example @@ -463,14 +425,14 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) try: - # Get a single contract - api_response = api_instance.get_delivery_contract(settle, contract) + # Futures insurance balance history + api_response = api_instance.list_delivery_insurance_ledger(settle, limit=limit) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->get_delivery_contract: %s\n" % e) + print("Exception when calling DeliveryApi->list_delivery_insurance_ledger: %s\n" % e) ``` ### Parameters @@ -478,11 +440,11 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **contract** | **str**| Futures contract | + **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] ### Return type -[**DeliveryContract**](DeliveryContract.md) +[**list[InsuranceRecord]**](InsuranceRecord.md) ### Authorization @@ -496,16 +458,14 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Contract information | - | +**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_delivery_order** -> FuturesOrder get_delivery_order(settle, order_id) - -Get a single order +# **list_delivery_accounts** +> FuturesAccount list_delivery_accounts(settle) -Zero-fill order cannot be retrieved 60 seconds after cancellation +Query futures account ### Example @@ -532,14 +492,13 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -order_id = '12345' # str | ID returned on order successfully being created try: - # Get a single order - api_response = api_instance.get_delivery_order(settle, order_id) + # Query futures account + api_response = api_instance.list_delivery_accounts(settle) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->get_delivery_order: %s\n" % e) + print("Exception when calling DeliveryApi->list_delivery_accounts: %s\n" % e) ``` ### Parameters @@ -547,11 +506,10 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **order_id** | **str**| ID returned on order successfully being created | ### Return type -[**FuturesOrder**](FuturesOrder.md) +[**FuturesAccount**](FuturesAccount.md) ### Authorization @@ -565,14 +523,14 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Order details | - | +**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_delivery_position** -> Position get_delivery_position(settle, contract) +# **list_delivery_account_book** +> list[FuturesAccountBook] list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type) -Get single position +Query account book ### Example @@ -599,14 +557,17 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) +_from = 1547706332 # int | Start timestamp (optional) +to = 1547706332 # int | End timestamp (optional) +type = 'dnw' # str | Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) try: - # Get single position - api_response = api_instance.get_delivery_position(settle, contract) + # Query account book + api_response = api_instance.list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->get_delivery_position: %s\n" % e) + print("Exception when calling DeliveryApi->list_delivery_account_book: %s\n" % e) ``` ### Parameters @@ -614,11 +575,14 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **contract** | **str**| Futures contract | + **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **_from** | **int**| Start timestamp | [optional] + **to** | **int**| End timestamp | [optional] + **type** | **str**| Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate | [optional] ### Return type -[**Position**](Position.md) +[**list[FuturesAccountBook]**](FuturesAccountBook.md) ### Authorization @@ -632,14 +596,14 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Position information | - | +**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_my_delivery_trades** -> list[MyFuturesTrade] get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total) +# **list_delivery_positions** +> list[Position] list_delivery_positions(settle) -List personal trading history +List all positions of a user ### Example @@ -666,19 +630,79 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) -order = 12345 # int | Futures order ID, return related data only if specified (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) -last_id = '12345' # str | Specify list staring point using the `id` of last record in previous list-query results (optional) -count_total = 0 # int | Whether to return total number matched. Default to 0(no return) (optional) (default to 0) try: - # List personal trading history - api_response = api_instance.get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total) + # List all positions of a user + api_response = api_instance.list_delivery_positions(settle) + print(api_response) +except ApiException as e: + print("Exception when calling DeliveryApi->list_delivery_positions: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **settle** | **str**| Settle currency | + +### Return type + +[**list[Position]**](Position.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) + +# **get_delivery_position** +> Position get_delivery_position(settle, contract) + +Get single position + +### Example + +* Api Key Authentication (apiv4): +```python +from __future__ import print_function +import gate_api +from gate_api.exceptions import ApiException +# 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.DeliveryApi(api_client) +settle = 'usdt' # str | Settle currency +contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract + +try: + # Get single position + api_response = api_instance.get_delivery_position(settle, contract) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->get_my_delivery_trades: %s\n" % e) + print("Exception when calling DeliveryApi->get_delivery_position: %s\n" % e) ``` ### Parameters @@ -686,16 +710,11 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **contract** | **str**| Futures contract | [optional] - **order** | **int**| Futures order ID, return related data only if specified | [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] - **last_id** | **str**| Specify list staring point using the `id` of last record in previous list-query results | [optional] - **count_total** | **int**| Whether to return total number matched. Default to 0(no return) | [optional] [default to 0] + **contract** | **str**| Futures contract | ### Return type -[**list[MyFuturesTrade]**](MyFuturesTrade.md) +[**Position**](Position.md) ### Authorization @@ -709,14 +728,14 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | * X-Pagination-Limit - Request limit specified
* X-Pagination-Offset - Request offset specified
* X-Pagination-Total - Total number matched. Only returned on `count_total` set to 1
| +**200** | Position information | - | [[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_price_triggered_delivery_order** -> FuturesPriceTriggeredOrder get_price_triggered_delivery_order(settle, order_id) +# **update_delivery_position_margin** +> Position update_delivery_position_margin(settle, contract, change) -Get a single order +Update position margin ### Example @@ -743,14 +762,15 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -order_id = 'order_id_example' # str | ID returned on order successfully being created +contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +change = '0.01' # str | Margin change. Use positive number to increase margin, negative number otherwise. try: - # Get a single order - api_response = api_instance.get_price_triggered_delivery_order(settle, order_id) + # Update position margin + api_response = api_instance.update_delivery_position_margin(settle, contract, change) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->get_price_triggered_delivery_order: %s\n" % e) + print("Exception when calling DeliveryApi->update_delivery_position_margin: %s\n" % e) ``` ### Parameters @@ -758,11 +778,12 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **order_id** | **str**| ID returned on order successfully being created | + **contract** | **str**| Futures contract | + **change** | **str**| Margin change. Use positive number to increase margin, negative number otherwise. | ### Return type -[**FuturesPriceTriggeredOrder**](FuturesPriceTriggeredOrder.md) +[**Position**](Position.md) ### Authorization @@ -776,14 +797,14 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Auto order detail | - | +**200** | Position information | - | [[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_delivery_account_book** -> list[FuturesAccountBook] list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type) +# **update_delivery_position_leverage** +> Position update_delivery_position_leverage(settle, contract, leverage) -Query account book +Update position leverage ### Example @@ -810,17 +831,15 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) -_from = 1547706332 # int | Start timestamp (optional) -to = 1547706332 # int | End timestamp (optional) -type = 'dnw' # str | Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) +contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +leverage = '10' # str | New position leverage try: - # Query account book - api_response = api_instance.list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type) + # Update position leverage + api_response = api_instance.update_delivery_position_leverage(settle, contract, leverage) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->list_delivery_account_book: %s\n" % e) + print("Exception when calling DeliveryApi->update_delivery_position_leverage: %s\n" % e) ``` ### Parameters @@ -828,14 +847,12 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] - **_from** | **int**| Start timestamp | [optional] - **to** | **int**| End timestamp | [optional] - **type** | **str**| Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate | [optional] + **contract** | **str**| Futures contract | + **leverage** | **str**| New position leverage | ### Return type -[**list[FuturesAccountBook]**](FuturesAccountBook.md) +[**Position**](Position.md) ### Authorization @@ -849,14 +866,14 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**200** | Position information | - | [[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_delivery_accounts** -> FuturesAccount list_delivery_accounts(settle) +# **update_delivery_position_risk_limit** +> Position update_delivery_position_risk_limit(settle, contract, risk_limit) -Query futures account +Update position risk limit ### Example @@ -883,13 +900,15 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency +contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +risk_limit = '10' # str | New position risk limit try: - # Query futures account - api_response = api_instance.list_delivery_accounts(settle) + # Update position risk limit + api_response = api_instance.update_delivery_position_risk_limit(settle, contract, risk_limit) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->list_delivery_accounts: %s\n" % e) + print("Exception when calling DeliveryApi->update_delivery_position_risk_limit: %s\n" % e) ``` ### Parameters @@ -897,10 +916,12 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | + **contract** | **str**| Futures contract | + **risk_limit** | **str**| New position risk limit | ### Return type -[**FuturesAccount**](FuturesAccount.md) +[**Position**](Position.md) ### Authorization @@ -914,45 +935,55 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**200** | Position information | - | [[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_delivery_candlesticks** -> list[FuturesCandlestick] list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval) +# **list_delivery_orders** +> list[FuturesOrder] list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total) -Get futures candlesticks +List futures orders -Return specified contract candlesticks. If prefix `contract` with `mark_`, the contract's mark price candlesticks are returned; if prefix with `index_`, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` +Zero-fill order cannot be retrieved 60 seconds after cancellation ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract -_from = 1546905600 # float | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) -to = 1546935600 # float | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) -limit = 100 # int | Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional) (default to 100) -interval = '5m' # str | Interval time between data points (optional) (default to '5m') +status = 'open' # str | List orders based on status +contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (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) +last_id = '12345' # str | Specify list staring point using the `id` of last record in previous list-query results (optional) +count_total = 0 # int | Whether to return total number matched. Default to 0(no return) (optional) (default to 0) try: - # Get futures candlesticks - api_response = api_instance.list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval) + # List futures orders + api_response = api_instance.list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->list_delivery_candlesticks: %s\n" % e) + print("Exception when calling DeliveryApi->list_delivery_orders: %s\n" % e) ``` ### Parameters @@ -960,19 +991,20 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **contract** | **str**| Futures contract | - **_from** | **float**| Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified | [optional] - **to** | **float**| End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time | [optional] - **limit** | **int**| Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [optional] [default to 100] - **interval** | **str**| Interval time between data points | [optional] [default to '5m'] + **status** | **str**| List orders based on status | + **contract** | **str**| Futures contract | [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] + **last_id** | **str**| Specify list staring point using the `id` of last record in previous list-query results | [optional] + **count_total** | **int**| Whether to return total number matched. Default to 0(no return) | [optional] [default to 0] ### Return type -[**list[FuturesCandlestick]**](FuturesCandlestick.md) +[**list[FuturesOrder]**](FuturesOrder.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers @@ -982,38 +1014,50 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Successfully retrieved | - | +**200** | List retrieved | * X-Pagination-Limit - Request limit specified
* X-Pagination-Offset - Request offset specified
* X-Pagination-Total - Total number matched. Only returned on `count_total` set to 1
| [[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_delivery_contracts** -> list[DeliveryContract] list_delivery_contracts(settle) +# **create_delivery_order** +> FuturesOrder create_delivery_order(settle, futures_order) -List all futures contracts +Create a futures order + +Zero-fill order cannot be retrieved 60 seconds after cancellation ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency +futures_order = {"id":15675394,"user":100000,"contract":"BTC_USD","create_time":1546569968,"size":6024,"iceberg":0,"left":6024,"price":"3765","fill_price":"0","mkfr":"-0.00025","tkfr":"0.00075","tif":"gtc","refu":0,"is_reduce_only":false,"is_close":false,"is_liq":false,"text":"t-my-custom-id","status":"finished","finish_time":1514764900,"finish_as":"cancelled"} # FuturesOrder | try: - # List all futures contracts - api_response = api_instance.list_delivery_contracts(settle) + # Create a futures order + api_response = api_instance.create_delivery_order(settle, futures_order) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->list_delivery_contracts: %s\n" % e) + print("Exception when calling DeliveryApi->create_delivery_order: %s\n" % e) ``` ### Parameters @@ -1021,56 +1065,69 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | + **futures_order** | [**FuturesOrder**](FuturesOrder.md)| | ### Return type -[**list[DeliveryContract]**](DeliveryContract.md) +[**FuturesOrder**](FuturesOrder.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**201** | Order details | - | [[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_delivery_insurance_ledger** -> list[InsuranceRecord] list_delivery_insurance_ledger(settle, limit=limit) +# **cancel_delivery_orders** +> list[FuturesOrder] cancel_delivery_orders(settle, contract, side=side) -Futures insurance balance history +Cancel all `open` orders matched + +Zero-fill order cannot be retrieved 60 seconds after cancellation ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) +contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +side = 'ask' # str | All bids or asks. Both included in not specified (optional) try: - # Futures insurance balance history - api_response = api_instance.list_delivery_insurance_ledger(settle, limit=limit) + # Cancel all `open` orders matched + api_response = api_instance.cancel_delivery_orders(settle, contract, side=side) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->list_delivery_insurance_ledger: %s\n" % e) + print("Exception when calling DeliveryApi->cancel_delivery_orders: %s\n" % e) ``` ### Parameters @@ -1078,15 +1135,16 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **contract** | **str**| Futures contract | + **side** | **str**| All bids or asks. Both included in not specified | [optional] ### Return type -[**list[InsuranceRecord]**](InsuranceRecord.md) +[**list[FuturesOrder]**](FuturesOrder.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers @@ -1096,14 +1154,16 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Successfully retrieved | - | +**200** | All orders matched cancelled | - | [[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_delivery_liquidates** -> list[FuturesLiquidate] list_delivery_liquidates(settle, contract=contract, limit=limit, at=at) +# **get_delivery_order** +> FuturesOrder get_delivery_order(settle, order_id) -List liquidation history +Get a single order + +Zero-fill order cannot be retrieved 60 seconds after cancellation ### Example @@ -1130,16 +1190,14 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) -limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) -at = 0 # int | Specify a liquidation timestamp (optional) (default to 0) +order_id = '12345' # str | ID returned on order successfully being created try: - # List liquidation history - api_response = api_instance.list_delivery_liquidates(settle, contract=contract, limit=limit, at=at) + # Get a single order + api_response = api_instance.get_delivery_order(settle, order_id) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->list_delivery_liquidates: %s\n" % e) + print("Exception when calling DeliveryApi->get_delivery_order: %s\n" % e) ``` ### Parameters @@ -1147,13 +1205,11 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **contract** | **str**| Futures contract | [optional] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] - **at** | **int**| Specify a liquidation timestamp | [optional] [default to 0] + **order_id** | **str**| ID returned on order successfully being created | ### Return type -[**list[FuturesLiquidate]**](FuturesLiquidate.md) +[**FuturesOrder**](FuturesOrder.md) ### Authorization @@ -1167,43 +1223,48 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**200** | Order details | - | [[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_delivery_order_book** -> FuturesOrderBook list_delivery_order_book(settle, contract, interval=interval, limit=limit) - -Futures order book +# **cancel_delivery_order** +> FuturesOrder cancel_delivery_order(settle, order_id) -Bids will be sorted by price from high to low, while asks sorted reversely +Cancel a single order ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract -interval = '0' # str | Order depth. 0 means no aggregation is applied. default to 0 (optional) (default to '0') -limit = 10 # int | Maximum number of order depth data in asks or bids (optional) (default to 10) +order_id = '12345' # str | ID returned on order successfully being created try: - # Futures order book - api_response = api_instance.list_delivery_order_book(settle, contract, interval=interval, limit=limit) + # Cancel a single order + api_response = api_instance.cancel_delivery_order(settle, order_id) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->list_delivery_order_book: %s\n" % e) + print("Exception when calling DeliveryApi->cancel_delivery_order: %s\n" % e) ``` ### Parameters @@ -1211,17 +1272,15 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **contract** | **str**| Futures contract | - **interval** | **str**| Order depth. 0 means no aggregation is applied. default to 0 | [optional] [default to '0'] - **limit** | **int**| Maximum number of order depth data in asks or bids | [optional] [default to 10] + **order_id** | **str**| ID returned on order successfully being created | ### Return type -[**FuturesOrderBook**](FuturesOrderBook.md) +[**FuturesOrder**](FuturesOrder.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers @@ -1231,16 +1290,14 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Order book retrieved | - | +**200** | Order details | - | [[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_delivery_orders** -> list[FuturesOrder] list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total) - -List futures orders +# **get_my_delivery_trades** +> list[MyFuturesTrade] get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total) -Zero-fill order cannot be retrieved 60 seconds after cancellation +List personal trading history ### Example @@ -1267,19 +1324,19 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -status = 'open' # str | List orders based on status contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) +order = 12345 # int | Futures order ID, return related data only if specified (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) last_id = '12345' # str | Specify list staring point using the `id` of last record in previous list-query results (optional) count_total = 0 # int | Whether to return total number matched. Default to 0(no return) (optional) (default to 0) try: - # List futures orders - api_response = api_instance.list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total) + # List personal trading history + api_response = api_instance.get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->list_delivery_orders: %s\n" % e) + print("Exception when calling DeliveryApi->get_my_delivery_trades: %s\n" % e) ``` ### Parameters @@ -1287,8 +1344,8 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **status** | **str**| List orders based on status | **contract** | **str**| Futures contract | [optional] + **order** | **int**| Futures order ID, return related data only if specified | [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] **last_id** | **str**| Specify list staring point using the `id` of last record in previous list-query results | [optional] @@ -1296,7 +1353,7 @@ Name | Type | Description | Notes ### Return type -[**list[FuturesOrder]**](FuturesOrder.md) +[**list[MyFuturesTrade]**](MyFuturesTrade.md) ### Authorization @@ -1383,10 +1440,10 @@ 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_delivery_positions** -> list[Position] list_delivery_positions(settle) +# **list_delivery_liquidates** +> list[FuturesLiquidate] list_delivery_liquidates(settle, contract=contract, limit=limit, at=at) -List all positions of a user +List liquidation history ### Example @@ -1413,13 +1470,16 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency +contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) +limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) +at = 0 # int | Specify a liquidation timestamp (optional) (default to 0) try: - # List all positions of a user - api_response = api_instance.list_delivery_positions(settle) + # List liquidation history + api_response = api_instance.list_delivery_liquidates(settle, contract=contract, limit=limit, at=at) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->list_delivery_positions: %s\n" % e) + print("Exception when calling DeliveryApi->list_delivery_liquidates: %s\n" % e) ``` ### Parameters @@ -1427,10 +1487,13 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | + **contract** | **str**| Futures contract | [optional] + **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **at** | **int**| Specify a liquidation timestamp | [optional] [default to 0] ### Return type -[**list[Position]**](Position.md) +[**list[FuturesLiquidate]**](FuturesLiquidate.md) ### Authorization @@ -1519,97 +1582,47 @@ 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_delivery_tickers** -> list[FuturesTicker] list_delivery_tickers(settle, contract=contract) +# **list_price_triggered_delivery_orders** +> list[FuturesPriceTriggeredOrder] list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset) -List futures tickers +List all auto orders ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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.DeliveryApi(api_client) -settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) - -try: - # List futures tickers - api_response = api_instance.list_delivery_tickers(settle, contract=contract) - print(api_response) -except ApiException as e: - print("Exception when calling DeliveryApi->list_delivery_tickers: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **settle** | **str**| Settle currency | - **contract** | **str**| Futures contract | [optional] - -### Return type - -[**list[FuturesTicker]**](FuturesTicker.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) - -# **list_delivery_trades** -> list[FuturesTrade] list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to) - -Futures trading history - -### Example +# 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. -```python -from __future__ import print_function -import gate_api -from gate_api.exceptions import ApiException -# 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. +# Configure APIv4 key authorization configuration = gate_api.Configuration( - host = "https://api.gateio.ws/api/v4" + 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.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +status = 'status_example' # str | List orders based on status +contract = 'BTC_USD' # str | Futures contract, return related data only if specified (optional) limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) -last_id = '12345' # str | Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) -_from = 1546905600 # float | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional) -to = 1546935600 # float | Specify end time in Unix seconds, default to current time (optional) +offset = 0 # int | List offset, starting from 0 (optional) (default to 0) try: - # Futures trading history - api_response = api_instance.list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to) + # List all auto orders + api_response = api_instance.list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->list_delivery_trades: %s\n" % e) + print("Exception when calling DeliveryApi->list_price_triggered_delivery_orders: %s\n" % e) ``` ### Parameters @@ -1617,19 +1630,18 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **contract** | **str**| Futures contract | + **status** | **str**| List orders based on status | + **contract** | **str**| Futures contract, return related data only if specified | [optional] **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] - **last_id** | **str**| Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range | [optional] - **_from** | **float**| Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. | [optional] - **to** | **float**| Specify end time in Unix seconds, default to current time | [optional] + **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] ### Return type -[**list[FuturesTrade]**](FuturesTrade.md) +[**list[FuturesPriceTriggeredOrder]**](FuturesPriceTriggeredOrder.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers @@ -1643,10 +1655,10 @@ No authorization required [[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_price_triggered_delivery_orders** -> list[FuturesPriceTriggeredOrder] list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset) +# **create_price_triggered_delivery_order** +> TriggerOrderResponse create_price_triggered_delivery_order(settle, futures_price_triggered_order) -List all auto orders +Create a price-triggered order ### Example @@ -1673,17 +1685,14 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -status = 'status_example' # str | List orders based on status -contract = 'BTC_USD' # str | Futures contract, return related data only if specified (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) +futures_price_triggered_order = {"initial":{"contract":"BTC_USD","size":100,"price":"5.03","close":false,"tif":"gtc","text":"web"},"trigger":{"strategy_type":0,"price_type":0,"price":"3000","rule":1,"expiration":86400},"id":1283293,"user":1234,"create_time":1514764800,"finish_time":1514764900,"trade_id":13566,"status":"finished","finish_as":"cancelled","reason":""} # FuturesPriceTriggeredOrder | try: - # List all auto orders - api_response = api_instance.list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset) + # Create a price-triggered order + api_response = api_instance.create_price_triggered_delivery_order(settle, futures_price_triggered_order) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->list_price_triggered_delivery_orders: %s\n" % e) + print("Exception when calling DeliveryApi->create_price_triggered_delivery_order: %s\n" % e) ``` ### Parameters @@ -1691,14 +1700,11 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **status** | **str**| List orders based on status | - **contract** | **str**| Futures contract, return related data only if specified | [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] + **futures_price_triggered_order** | [**FuturesPriceTriggeredOrder**](FuturesPriceTriggeredOrder.md)| | ### Return type -[**list[FuturesPriceTriggeredOrder]**](FuturesPriceTriggeredOrder.md) +[**TriggerOrderResponse**](TriggerOrderResponse.md) ### Authorization @@ -1706,20 +1712,20 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**201** | Order created | - | [[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_delivery_position_leverage** -> Position update_delivery_position_leverage(settle, contract, leverage) +# **cancel_price_triggered_delivery_order_list** +> list[FuturesPriceTriggeredOrder] cancel_price_triggered_delivery_order_list(settle, contract) -Update position leverage +Cancel all open orders ### Example @@ -1746,15 +1752,14 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract -leverage = '10' # str | New position leverage +contract = 'BTC_USD' # str | Futures contract try: - # Update position leverage - api_response = api_instance.update_delivery_position_leverage(settle, contract, leverage) + # Cancel all open orders + api_response = api_instance.cancel_price_triggered_delivery_order_list(settle, contract) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->update_delivery_position_leverage: %s\n" % e) + print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order_list: %s\n" % e) ``` ### Parameters @@ -1763,11 +1768,10 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | - **leverage** | **str**| New position leverage | ### Return type -[**Position**](Position.md) +[**list[FuturesPriceTriggeredOrder]**](FuturesPriceTriggeredOrder.md) ### Authorization @@ -1781,14 +1785,14 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Position information | - | +**200** | Batch cancellation request accepted. Query order status by listing orders | - | [[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_delivery_position_margin** -> Position update_delivery_position_margin(settle, contract, change) +# **get_price_triggered_delivery_order** +> FuturesPriceTriggeredOrder get_price_triggered_delivery_order(settle, order_id) -Update position margin +Get a single order ### Example @@ -1815,15 +1819,14 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract -change = '0.01' # str | Margin change. Use positive number to increase margin, negative number otherwise. +order_id = 'order_id_example' # str | ID returned on order successfully being created try: - # Update position margin - api_response = api_instance.update_delivery_position_margin(settle, contract, change) + # Get a single order + api_response = api_instance.get_price_triggered_delivery_order(settle, order_id) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->update_delivery_position_margin: %s\n" % e) + print("Exception when calling DeliveryApi->get_price_triggered_delivery_order: %s\n" % e) ``` ### Parameters @@ -1831,12 +1834,11 @@ except ApiException as e: 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. | + **order_id** | **str**| ID returned on order successfully being created | ### Return type -[**Position**](Position.md) +[**FuturesPriceTriggeredOrder**](FuturesPriceTriggeredOrder.md) ### Authorization @@ -1850,14 +1852,14 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Position information | - | +**200** | Auto order detail | - | [[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_delivery_position_risk_limit** -> Position update_delivery_position_risk_limit(settle, contract, risk_limit) +# **cancel_price_triggered_delivery_order** +> FuturesPriceTriggeredOrder cancel_price_triggered_delivery_order(settle, order_id) -Update position risk limit +Cancel a single order ### Example @@ -1884,15 +1886,14 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract -risk_limit = '10' # str | New position risk limit +order_id = 'order_id_example' # str | ID returned on order successfully being created try: - # Update position risk limit - api_response = api_instance.update_delivery_position_risk_limit(settle, contract, risk_limit) + # Cancel a single order + api_response = api_instance.cancel_price_triggered_delivery_order(settle, order_id) print(api_response) except ApiException as e: - print("Exception when calling DeliveryApi->update_delivery_position_risk_limit: %s\n" % e) + print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order: %s\n" % e) ``` ### Parameters @@ -1900,12 +1901,11 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | - **contract** | **str**| Futures contract | - **risk_limit** | **str**| New position risk limit | + **order_id** | **str**| ID returned on order successfully being created | ### Return type -[**Position**](Position.md) +[**FuturesPriceTriggeredOrder**](FuturesPriceTriggeredOrder.md) ### Authorization @@ -1919,7 +1919,7 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Position information | - | +**200** | Auto order detail | - | [[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/FuturesApi.md b/docs/FuturesApi.md index c8e0592..5729d60 100644 --- a/docs/FuturesApi.md +++ b/docs/FuturesApi.md @@ -4,74 +4,64 @@ All URIs are relative to *https://api.gateio.ws/api/v4* Method | HTTP request | Description ------------- | ------------- | ------------- -[**cancel_futures_order**](FuturesApi.md#cancel_futures_order) | **DELETE** /futures/{settle}/orders/{order_id} | Cancel a single order -[**cancel_futures_orders**](FuturesApi.md#cancel_futures_orders) | **DELETE** /futures/{settle}/orders | Cancel all `open` orders matched -[**cancel_price_triggered_order**](FuturesApi.md#cancel_price_triggered_order) | **DELETE** /futures/{settle}/price_orders/{order_id} | Cancel a single order -[**cancel_price_triggered_order_list**](FuturesApi.md#cancel_price_triggered_order_list) | **DELETE** /futures/{settle}/price_orders | Cancel all open orders -[**create_futures_order**](FuturesApi.md#create_futures_order) | **POST** /futures/{settle}/orders | Create a futures order -[**create_price_triggered_order**](FuturesApi.md#create_price_triggered_order) | **POST** /futures/{settle}/price_orders | Create a price-triggered order +[**list_futures_contracts**](FuturesApi.md#list_futures_contracts) | **GET** /futures/{settle}/contracts | List all futures contracts [**get_futures_contract**](FuturesApi.md#get_futures_contract) | **GET** /futures/{settle}/contracts/{contract} | Get a single contract -[**get_futures_order**](FuturesApi.md#get_futures_order) | **GET** /futures/{settle}/orders/{order_id} | Get a single order -[**get_my_trades**](FuturesApi.md#get_my_trades) | **GET** /futures/{settle}/my_trades | List personal trading history -[**get_position**](FuturesApi.md#get_position) | **GET** /futures/{settle}/positions/{contract} | Get single position -[**get_price_triggered_order**](FuturesApi.md#get_price_triggered_order) | **GET** /futures/{settle}/price_orders/{order_id} | Get a single order -[**list_futures_account_book**](FuturesApi.md#list_futures_account_book) | **GET** /futures/{settle}/account_book | Query account book -[**list_futures_accounts**](FuturesApi.md#list_futures_accounts) | **GET** /futures/{settle}/accounts | Query futures account +[**list_futures_order_book**](FuturesApi.md#list_futures_order_book) | **GET** /futures/{settle}/order_book | Futures order book +[**list_futures_trades**](FuturesApi.md#list_futures_trades) | **GET** /futures/{settle}/trades | Futures trading history [**list_futures_candlesticks**](FuturesApi.md#list_futures_candlesticks) | **GET** /futures/{settle}/candlesticks | Get futures candlesticks -[**list_futures_contracts**](FuturesApi.md#list_futures_contracts) | **GET** /futures/{settle}/contracts | List all futures contracts +[**list_futures_tickers**](FuturesApi.md#list_futures_tickers) | **GET** /futures/{settle}/tickers | List futures tickers [**list_futures_funding_rate_history**](FuturesApi.md#list_futures_funding_rate_history) | **GET** /futures/{settle}/funding_rate | Funding rate history [**list_futures_insurance_ledger**](FuturesApi.md#list_futures_insurance_ledger) | **GET** /futures/{settle}/insurance | Futures insurance balance history -[**list_futures_order_book**](FuturesApi.md#list_futures_order_book) | **GET** /futures/{settle}/order_book | Futures order book -[**list_futures_orders**](FuturesApi.md#list_futures_orders) | **GET** /futures/{settle}/orders | List futures orders -[**list_futures_tickers**](FuturesApi.md#list_futures_tickers) | **GET** /futures/{settle}/tickers | List futures tickers -[**list_futures_trades**](FuturesApi.md#list_futures_trades) | **GET** /futures/{settle}/trades | Futures trading history -[**list_liquidates**](FuturesApi.md#list_liquidates) | **GET** /futures/{settle}/liquidates | List liquidation history -[**list_position_close**](FuturesApi.md#list_position_close) | **GET** /futures/{settle}/position_close | List position close history +[**list_futures_accounts**](FuturesApi.md#list_futures_accounts) | **GET** /futures/{settle}/accounts | Query futures account +[**list_futures_account_book**](FuturesApi.md#list_futures_account_book) | **GET** /futures/{settle}/account_book | Query account book [**list_positions**](FuturesApi.md#list_positions) | **GET** /futures/{settle}/positions | List all positions of a user -[**list_price_triggered_orders**](FuturesApi.md#list_price_triggered_orders) | **GET** /futures/{settle}/price_orders | List all auto orders -[**update_position_leverage**](FuturesApi.md#update_position_leverage) | **POST** /futures/{settle}/positions/{contract}/leverage | Update position leverage +[**get_position**](FuturesApi.md#get_position) | **GET** /futures/{settle}/positions/{contract} | Get single position [**update_position_margin**](FuturesApi.md#update_position_margin) | **POST** /futures/{settle}/positions/{contract}/margin | Update position margin +[**update_position_leverage**](FuturesApi.md#update_position_leverage) | **POST** /futures/{settle}/positions/{contract}/leverage | Update position leverage [**update_position_risk_limit**](FuturesApi.md#update_position_risk_limit) | **POST** /futures/{settle}/positions/{contract}/risk_limit | Update position risk limit +[**list_futures_orders**](FuturesApi.md#list_futures_orders) | **GET** /futures/{settle}/orders | List futures orders +[**create_futures_order**](FuturesApi.md#create_futures_order) | **POST** /futures/{settle}/orders | Create a futures order +[**cancel_futures_orders**](FuturesApi.md#cancel_futures_orders) | **DELETE** /futures/{settle}/orders | Cancel all `open` orders matched +[**get_futures_order**](FuturesApi.md#get_futures_order) | **GET** /futures/{settle}/orders/{order_id} | Get a single order +[**cancel_futures_order**](FuturesApi.md#cancel_futures_order) | **DELETE** /futures/{settle}/orders/{order_id} | Cancel a single order +[**get_my_trades**](FuturesApi.md#get_my_trades) | **GET** /futures/{settle}/my_trades | List personal trading history +[**list_position_close**](FuturesApi.md#list_position_close) | **GET** /futures/{settle}/position_close | List position close history +[**list_liquidates**](FuturesApi.md#list_liquidates) | **GET** /futures/{settle}/liquidates | List liquidation history +[**list_price_triggered_orders**](FuturesApi.md#list_price_triggered_orders) | **GET** /futures/{settle}/price_orders | List all auto orders +[**create_price_triggered_order**](FuturesApi.md#create_price_triggered_order) | **POST** /futures/{settle}/price_orders | Create a price-triggered order +[**cancel_price_triggered_order_list**](FuturesApi.md#cancel_price_triggered_order_list) | **DELETE** /futures/{settle}/price_orders | Cancel all open orders +[**get_price_triggered_order**](FuturesApi.md#get_price_triggered_order) | **GET** /futures/{settle}/price_orders/{order_id} | Get a single order +[**cancel_price_triggered_order**](FuturesApi.md#cancel_price_triggered_order) | **DELETE** /futures/{settle}/price_orders/{order_id} | Cancel a single order -# **cancel_futures_order** -> FuturesOrder cancel_futures_order(settle, order_id) +# **list_futures_contracts** +> list[Contract] list_futures_contracts(settle) -Cancel a single order +List all futures contracts ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -order_id = '12345' # str | ID returned on order successfully being created try: - # Cancel a single order - api_response = api_instance.cancel_futures_order(settle, order_id) + # List all futures contracts + api_response = api_instance.list_futures_contracts(settle) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->cancel_futures_order: %s\n" % e) + print("Exception when calling FuturesApi->list_futures_contracts: %s\n" % e) ``` ### Parameters @@ -79,15 +69,14 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] - **order_id** | **str**| ID returned on order successfully being created | ### Return type -[**FuturesOrder**](FuturesOrder.md) +[**list[Contract]**](Contract.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers @@ -97,36 +86,25 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Order details | - | +**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) -# **cancel_futures_orders** -> list[FuturesOrder] cancel_futures_orders(settle, contract, side=side) - -Cancel all `open` orders matched +# **get_futures_contract** +> Contract get_futures_contract(settle, contract) -Zero-fill order cannot be retrieved 60 seconds after cancellation +Get a single contract ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) @@ -134,14 +112,13 @@ api_client = gate_api.ApiClient(configuration) api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract -side = 'ask' # str | All bids or asks. Both included in not specified (optional) try: - # Cancel all `open` orders matched - api_response = api_instance.cancel_futures_orders(settle, contract, side=side) + # Get a single contract + api_response = api_instance.get_futures_contract(settle, contract) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->cancel_futures_orders: %s\n" % e) + print("Exception when calling FuturesApi->get_futures_contract: %s\n" % e) ``` ### Parameters @@ -150,15 +127,14 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] **contract** | **str**| Futures contract | - **side** | **str**| All bids or asks. Both included in not specified | [optional] ### Return type -[**list[FuturesOrder]**](FuturesOrder.md) +[**Contract**](Contract.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers @@ -168,48 +144,43 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | All orders matched cancelled | - | +**200** | Contract information | - | [[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_price_triggered_order** -> FuturesPriceTriggeredOrder cancel_price_triggered_order(settle, order_id) +# **list_futures_order_book** +> FuturesOrderBook list_futures_order_book(settle, contract, interval=interval, limit=limit) -Cancel a single order +Futures order book + +Bids will be sorted by price from high to low, while asks sorted reversely ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -order_id = 'order_id_example' # str | ID returned on order successfully being created +contract = 'BTC_USD' # str | Futures contract +interval = '0' # str | Order depth. 0 means no aggregation is applied. default to 0 (optional) (default to '0') +limit = 10 # int | Maximum number of order depth data in asks or bids (optional) (default to 10) try: - # Cancel a single order - api_response = api_instance.cancel_price_triggered_order(settle, order_id) + # Futures order book + api_response = api_instance.list_futures_order_book(settle, contract, interval=interval, limit=limit) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->cancel_price_triggered_order: %s\n" % e) + print("Exception when calling FuturesApi->list_futures_order_book: %s\n" % e) ``` ### Parameters @@ -217,15 +188,17 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] - **order_id** | **str**| ID returned on order successfully being created | + **contract** | **str**| Futures contract | + **interval** | **str**| Order depth. 0 means no aggregation is applied. default to 0 | [optional] [default to '0'] + **limit** | **int**| Maximum number of order depth data in asks or bids | [optional] [default to 10] ### Return type -[**FuturesPriceTriggeredOrder**](FuturesPriceTriggeredOrder.md) +[**FuturesOrderBook**](FuturesOrderBook.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers @@ -235,34 +208,25 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Auto order detail | - | +**200** | Order book 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) -# **cancel_price_triggered_order_list** -> list[FuturesPriceTriggeredOrder] cancel_price_triggered_order_list(settle, contract) +# **list_futures_trades** +> list[FuturesTrade] list_futures_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to) -Cancel all open orders +Futures trading history ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) @@ -270,13 +234,17 @@ api_client = gate_api.ApiClient(configuration) api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract +limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) +last_id = '12345' # str | Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) +_from = 1546905600 # int | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional) +to = 1546935600 # int | Specify end time in Unix seconds, default to current time (optional) try: - # Cancel all open orders - api_response = api_instance.cancel_price_triggered_order_list(settle, contract) + # Futures trading history + api_response = api_instance.list_futures_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->cancel_price_triggered_order_list: %s\n" % e) + print("Exception when calling FuturesApi->list_futures_trades: %s\n" % e) ``` ### Parameters @@ -285,14 +253,18 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] **contract** | **str**| Futures contract | + **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **last_id** | **str**| Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range | [optional] + **_from** | **int**| Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. | [optional] + **to** | **int**| Specify end time in Unix seconds, default to current time | [optional] ### Return type -[**list[FuturesPriceTriggeredOrder]**](FuturesPriceTriggeredOrder.md) +[**list[FuturesTrade]**](FuturesTrade.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers @@ -302,50 +274,45 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Batch cancellation request accepted. Query order status by listing orders | - | +**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) -# **create_futures_order** -> FuturesOrder create_futures_order(settle, futures_order) +# **list_futures_candlesticks** +> list[FuturesCandlestick] list_futures_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval) -Create a futures order +Get futures candlesticks -Zero-fill order cannot be retrieved 60 seconds after cancellation +Return specified contract candlesticks. If prefix `contract` with `mark_`, the contract's mark price candlesticks are returned; if prefix with `index_`, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -futures_order = {"id":15675394,"user":100000,"contract":"BTC_USD","create_time":1546569968,"size":6024,"iceberg":0,"left":6024,"price":"3765","fill_price":"0","mkfr":"-0.00025","tkfr":"0.00075","tif":"gtc","refu":0,"is_reduce_only":false,"is_close":false,"is_liq":false,"text":"t-my-custom-id","status":"finished","finish_time":1514764900,"finish_as":"cancelled"} # FuturesOrder | +contract = 'BTC_USD' # str | Futures contract +_from = 1546905600 # int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) +to = 1546935600 # int | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) +limit = 100 # int | Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional) (default to 100) +interval = '5m' # str | Interval time between data points (optional) (default to '5m') try: - # Create a futures order - api_response = api_instance.create_futures_order(settle, futures_order) + # Get futures candlesticks + api_response = api_instance.list_futures_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->create_futures_order: %s\n" % e) + print("Exception when calling FuturesApi->list_futures_candlesticks: %s\n" % e) ``` ### Parameters @@ -353,66 +320,61 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] - **futures_order** | [**FuturesOrder**](FuturesOrder.md)| | + **contract** | **str**| Futures contract | + **_from** | **int**| Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified | [optional] + **to** | **int**| End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time | [optional] + **limit** | **int**| Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [optional] [default to 100] + **interval** | **str**| Interval time between data points | [optional] [default to '5m'] ### Return type -[**FuturesOrder**](FuturesOrder.md) +[**list[FuturesCandlestick]**](FuturesCandlestick.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**201** | Order details | - | +**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_price_triggered_order** -> TriggerOrderResponse create_price_triggered_order(settle, futures_price_triggered_order) +# **list_futures_tickers** +> list[FuturesTicker] list_futures_tickers(settle, contract=contract) -Create a price-triggered order +List futures tickers ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -futures_price_triggered_order = {"initial":{"contract":"BTC_USD","size":100,"price":"5.03","close":false,"tif":"gtc","text":"web"},"trigger":{"strategy_type":0,"price_type":0,"price":"3000","rule":1,"expiration":86400},"id":1283293,"user":1234,"create_time":1514764800,"finish_time":1514764900,"trade_id":13566,"status":"finished","finish_as":"cancelled","reason":""} # FuturesPriceTriggeredOrder | +contract = 'BTC_USD' # str | Futures contract, return related data only if specified (optional) try: - # Create a price-triggered order - api_response = api_instance.create_price_triggered_order(settle, futures_price_triggered_order) + # List futures tickers + api_response = api_instance.list_futures_tickers(settle, contract=contract) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->create_price_triggered_order: %s\n" % e) + print("Exception when calling FuturesApi->list_futures_tickers: %s\n" % e) ``` ### Parameters @@ -420,32 +382,32 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] - **futures_price_triggered_order** | [**FuturesPriceTriggeredOrder**](FuturesPriceTriggeredOrder.md)| | + **contract** | **str**| Futures contract, return related data only if specified | [optional] ### Return type -[**TriggerOrderResponse**](TriggerOrderResponse.md) +[**list[FuturesTicker]**](FuturesTicker.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**201** | Order created | - | +**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_futures_contract** -> Contract get_futures_contract(settle, contract) +# **list_futures_funding_rate_history** +> list[FundingRateRecord] list_futures_funding_rate_history(settle, contract, limit=limit) -Get a single contract +Funding rate history ### Example @@ -464,13 +426,14 @@ api_client = gate_api.ApiClient(configuration) api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract +limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) try: - # Get a single contract - api_response = api_instance.get_futures_contract(settle, contract) + # Funding rate history + api_response = api_instance.list_futures_funding_rate_history(settle, contract, limit=limit) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->get_futures_contract: %s\n" % e) + print("Exception when calling FuturesApi->list_futures_funding_rate_history: %s\n" % e) ``` ### Parameters @@ -479,10 +442,11 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] **contract** | **str**| Futures contract | + **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] ### Return type -[**Contract**](Contract.md) +[**list[FundingRateRecord]**](FundingRateRecord.md) ### Authorization @@ -496,50 +460,39 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Contract information | - | +**200** | History 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_futures_order** -> FuturesOrder get_futures_order(settle, order_id) - -Get a single order +# **list_futures_insurance_ledger** +> list[InsuranceRecord] list_futures_insurance_ledger(settle, limit=limit) -Zero-fill order cannot be retrieved 60 seconds after cancellation +Futures insurance balance history ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -order_id = '12345' # str | ID returned on order successfully being created +limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) try: - # Get a single order - api_response = api_instance.get_futures_order(settle, order_id) + # Futures insurance balance history + api_response = api_instance.list_futures_insurance_ledger(settle, limit=limit) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->get_futures_order: %s\n" % e) + print("Exception when calling FuturesApi->list_futures_insurance_ledger: %s\n" % e) ``` ### Parameters @@ -547,15 +500,15 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] - **order_id** | **str**| ID returned on order successfully being created | + **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] ### Return type -[**FuturesOrder**](FuturesOrder.md) +[**list[InsuranceRecord]**](InsuranceRecord.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers @@ -565,14 +518,14 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Order details | - | +**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_my_trades** -> list[MyFuturesTrade] get_my_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total) +# **list_futures_accounts** +> FuturesAccount list_futures_accounts(settle) -List personal trading history +Query futures account ### Example @@ -599,19 +552,13 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -contract = 'BTC_USD' # str | Futures contract, return related data only if specified (optional) -order = 12345 # int | Futures order ID, return related data only if specified (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) -last_id = '12345' # str | Specify list staring point using the `id` of last record in previous list-query results (optional) -count_total = 0 # int | Whether to return total number matched. Default to 0(no return) (optional) (default to 0) try: - # List personal trading history - api_response = api_instance.get_my_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total) + # Query futures account + api_response = api_instance.list_futures_accounts(settle) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->get_my_trades: %s\n" % e) + print("Exception when calling FuturesApi->list_futures_accounts: %s\n" % e) ``` ### Parameters @@ -619,16 +566,10 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] - **contract** | **str**| Futures contract, return related data only if specified | [optional] - **order** | **int**| Futures order ID, return related data only if specified | [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] - **last_id** | **str**| Specify list staring point using the `id` of last record in previous list-query results | [optional] - **count_total** | **int**| Whether to return total number matched. Default to 0(no return) | [optional] [default to 0] ### Return type -[**list[MyFuturesTrade]**](MyFuturesTrade.md) +[**FuturesAccount**](FuturesAccount.md) ### Authorization @@ -642,14 +583,14 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | * X-Pagination-Limit - Request limit specified
* X-Pagination-Offset - Request offset specified
* X-Pagination-Total - Total number matched. Only returned on `count_total` set to 1
| +**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_position** -> Position get_position(settle, contract) +# **list_futures_account_book** +> list[FuturesAccountBook] list_futures_account_book(settle, limit=limit, _from=_from, to=to, type=type) -Get single position +Query account book ### Example @@ -676,14 +617,17 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -contract = 'BTC_USD' # str | Futures contract +limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) +_from = 1547706332 # int | Start timestamp (optional) +to = 1547706332 # int | End timestamp (optional) +type = 'dnw' # str | Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) try: - # Get single position - api_response = api_instance.get_position(settle, contract) + # Query account book + api_response = api_instance.list_futures_account_book(settle, limit=limit, _from=_from, to=to, type=type) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->get_position: %s\n" % e) + print("Exception when calling FuturesApi->list_futures_account_book: %s\n" % e) ``` ### Parameters @@ -691,11 +635,14 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] - **contract** | **str**| Futures contract | + **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **_from** | **int**| Start timestamp | [optional] + **to** | **int**| End timestamp | [optional] + **type** | **str**| Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate | [optional] ### Return type -[**Position**](Position.md) +[**list[FuturesAccountBook]**](FuturesAccountBook.md) ### Authorization @@ -709,14 +656,14 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Position information | - | +**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_price_triggered_order** -> FuturesPriceTriggeredOrder get_price_triggered_order(settle, order_id) +# **list_positions** +> list[Position] list_positions(settle) -Get a single order +List all positions of a user ### Example @@ -743,14 +690,13 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -order_id = 'order_id_example' # str | ID returned on order successfully being created try: - # Get a single order - api_response = api_instance.get_price_triggered_order(settle, order_id) + # List all positions of a user + api_response = api_instance.list_positions(settle) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->get_price_triggered_order: %s\n" % e) + print("Exception when calling FuturesApi->list_positions: %s\n" % e) ``` ### Parameters @@ -758,11 +704,10 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] - **order_id** | **str**| ID returned on order successfully being created | ### Return type -[**FuturesPriceTriggeredOrder**](FuturesPriceTriggeredOrder.md) +[**list[Position]**](Position.md) ### Authorization @@ -776,14 +721,14 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Auto order detail | - | +**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) -# **list_futures_account_book** -> list[FuturesAccountBook] list_futures_account_book(settle, limit=limit, _from=_from, to=to, type=type) +# **get_position** +> Position get_position(settle, contract) -Query account book +Get single position ### Example @@ -810,17 +755,14 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) -_from = 1547706332 # int | Start timestamp (optional) -to = 1547706332 # int | End timestamp (optional) -type = 'dnw' # str | Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) +contract = 'BTC_USD' # str | Futures contract try: - # Query account book - api_response = api_instance.list_futures_account_book(settle, limit=limit, _from=_from, to=to, type=type) + # Get single position + api_response = api_instance.get_position(settle, contract) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->list_futures_account_book: %s\n" % e) + print("Exception when calling FuturesApi->get_position: %s\n" % e) ``` ### Parameters @@ -828,14 +770,11 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] - **_from** | **int**| Start timestamp | [optional] - **to** | **int**| End timestamp | [optional] - **type** | **str**| Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate | [optional] + **contract** | **str**| Futures contract | ### Return type -[**list[FuturesAccountBook]**](FuturesAccountBook.md) +[**Position**](Position.md) ### Authorization @@ -849,14 +788,14 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**200** | Position information | - | [[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_futures_accounts** -> FuturesAccount list_futures_accounts(settle) +# **update_position_margin** +> Position update_position_margin(settle, contract, change) -Query futures account +Update position margin ### Example @@ -883,13 +822,15 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') +contract = 'BTC_USD' # str | Futures contract +change = '0.01' # str | Margin change. Use positive number to increase margin, negative number otherwise. try: - # Query futures account - api_response = api_instance.list_futures_accounts(settle) + # Update position margin + api_response = api_instance.update_position_margin(settle, contract, change) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->list_futures_accounts: %s\n" % e) + print("Exception when calling FuturesApi->update_position_margin: %s\n" % e) ``` ### Parameters @@ -897,10 +838,12 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] + **contract** | **str**| Futures contract | + **change** | **str**| Margin change. Use positive number to increase margin, negative number otherwise. | ### Return type -[**FuturesAccount**](FuturesAccount.md) +[**Position**](Position.md) ### Authorization @@ -914,27 +857,34 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**200** | Position information | - | [[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_futures_candlesticks** -> list[FuturesCandlestick] list_futures_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval) - -Get futures candlesticks +# **update_position_leverage** +> Position update_position_leverage(settle, contract, leverage) -Return specified contract candlesticks. If prefix `contract` with `mark_`, the contract's mark price candlesticks are returned; if prefix with `index_`, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` +Update position leverage ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4", + key = "YOU_API_KEY", + secret = "YOUR_API_SECRET" ) api_client = gate_api.ApiClient(configuration) @@ -942,17 +892,14 @@ api_client = gate_api.ApiClient(configuration) api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract -_from = 1546905600 # float | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) -to = 1546935600 # float | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) -limit = 100 # int | Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional) (default to 100) -interval = '5m' # str | Interval time between data points (optional) (default to '5m') +leverage = '10' # str | New position leverage try: - # Get futures candlesticks - api_response = api_instance.list_futures_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval) + # Update position leverage + api_response = api_instance.update_position_leverage(settle, contract, leverage) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->list_futures_candlesticks: %s\n" % e) + print("Exception when calling FuturesApi->update_position_leverage: %s\n" % e) ``` ### Parameters @@ -961,18 +908,15 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] **contract** | **str**| Futures contract | - **_from** | **float**| Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified | [optional] - **to** | **float**| End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time | [optional] - **limit** | **int**| Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [optional] [default to 100] - **interval** | **str**| Interval time between data points | [optional] [default to '5m'] + **leverage** | **str**| New position leverage | ### Return type -[**list[FuturesCandlestick]**](FuturesCandlestick.md) +[**Position**](Position.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers @@ -982,38 +926,49 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Successfully retrieved | - | +**200** | Position information | - | [[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_futures_contracts** -> list[Contract] list_futures_contracts(settle) +# **update_position_risk_limit** +> Position update_position_risk_limit(settle, contract, risk_limit) -List all futures contracts +Update position risk limit ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') +contract = 'BTC_USD' # str | Futures contract +risk_limit = '10' # str | New position risk limit try: - # List all futures contracts - api_response = api_instance.list_futures_contracts(settle) + # Update position risk limit + api_response = api_instance.update_position_risk_limit(settle, contract, risk_limit) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->list_futures_contracts: %s\n" % e) + print("Exception when calling FuturesApi->update_position_risk_limit: %s\n" % e) ``` ### Parameters @@ -1021,14 +976,16 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] + **contract** | **str**| Futures contract | + **risk_limit** | **str**| New position risk limit | ### Return type -[**list[Contract]**](Contract.md) +[**Position**](Position.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers @@ -1038,25 +995,36 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**200** | Position information | - | [[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_futures_funding_rate_history** -> list[FundingRateRecord] list_futures_funding_rate_history(settle, contract, limit=limit) +# **list_futures_orders** +> list[FuturesOrder] list_futures_orders(settle, contract, status, limit=limit, offset=offset, last_id=last_id, count_total=count_total) -Funding rate history +List futures orders + +Zero-fill order cannot be retrieved 60 seconds after cancellation ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4", + key = "YOU_API_KEY", + secret = "YOUR_API_SECRET" ) api_client = gate_api.ApiClient(configuration) @@ -1064,14 +1032,18 @@ api_client = gate_api.ApiClient(configuration) api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract +status = 'open' # str | List orders based on status 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) +last_id = '12345' # str | Specify list staring point using the `id` of last record in previous list-query results (optional) +count_total = 0 # int | Whether to return total number matched. Default to 0(no return) (optional) (default to 0) try: - # Funding rate history - api_response = api_instance.list_futures_funding_rate_history(settle, contract, limit=limit) + # List futures orders + api_response = api_instance.list_futures_orders(settle, contract, status, limit=limit, offset=offset, last_id=last_id, count_total=count_total) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->list_futures_funding_rate_history: %s\n" % e) + print("Exception when calling FuturesApi->list_futures_orders: %s\n" % e) ``` ### Parameters @@ -1080,15 +1052,19 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] **contract** | **str**| Futures contract | + **status** | **str**| List orders based on status | **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] + **last_id** | **str**| Specify list staring point using the `id` of last record in previous list-query results | [optional] + **count_total** | **int**| Whether to return total number matched. Default to 0(no return) | [optional] [default to 0] ### Return type -[**list[FundingRateRecord]**](FundingRateRecord.md) +[**list[FuturesOrder]**](FuturesOrder.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers @@ -1098,39 +1074,50 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | History retrieved | - | +**200** | List retrieved | * X-Pagination-Limit - Request limit specified
* X-Pagination-Offset - Request offset specified
* X-Pagination-Total - Total number matched. Only returned on `count_total` set to 1
| [[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_futures_insurance_ledger** -> list[InsuranceRecord] list_futures_insurance_ledger(settle, limit=limit) +# **create_futures_order** +> FuturesOrder create_futures_order(settle, futures_order) -Futures insurance balance history +Create a futures order + +Zero-fill order cannot be retrieved 60 seconds after cancellation ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) +futures_order = {"id":15675394,"user":100000,"contract":"BTC_USD","create_time":1546569968,"size":6024,"iceberg":0,"left":6024,"price":"3765","fill_price":"0","mkfr":"-0.00025","tkfr":"0.00075","tif":"gtc","refu":0,"is_reduce_only":false,"is_close":false,"is_liq":false,"text":"t-my-custom-id","status":"finished","finish_time":1514764900,"finish_as":"cancelled"} # FuturesOrder | try: - # Futures insurance balance history - api_response = api_instance.list_futures_insurance_ledger(settle, limit=limit) + # Create a futures order + api_response = api_instance.create_futures_order(settle, futures_order) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->list_futures_insurance_ledger: %s\n" % e) + print("Exception when calling FuturesApi->create_futures_order: %s\n" % e) ``` ### Parameters @@ -1138,45 +1125,54 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **futures_order** | [**FuturesOrder**](FuturesOrder.md)| | ### Return type -[**list[InsuranceRecord]**](InsuranceRecord.md) +[**FuturesOrder**](FuturesOrder.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Successfully retrieved | - | +**201** | Order details | - | [[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_futures_order_book** -> FuturesOrderBook list_futures_order_book(settle, contract, interval=interval, limit=limit) +# **cancel_futures_orders** +> list[FuturesOrder] cancel_futures_orders(settle, contract, side=side) -Futures order book +Cancel all `open` orders matched -Bids will be sorted by price from high to low, while asks sorted reversely +Zero-fill order cannot be retrieved 60 seconds after cancellation ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4", + key = "YOU_API_KEY", + secret = "YOUR_API_SECRET" ) api_client = gate_api.ApiClient(configuration) @@ -1184,15 +1180,14 @@ api_client = gate_api.ApiClient(configuration) api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract -interval = '0' # str | Order depth. 0 means no aggregation is applied. default to 0 (optional) (default to '0') -limit = 10 # int | Maximum number of order depth data in asks or bids (optional) (default to 10) +side = 'ask' # str | All bids or asks. Both included in not specified (optional) try: - # Futures order book - api_response = api_instance.list_futures_order_book(settle, contract, interval=interval, limit=limit) + # Cancel all `open` orders matched + api_response = api_instance.cancel_futures_orders(settle, contract, side=side) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->list_futures_order_book: %s\n" % e) + print("Exception when calling FuturesApi->cancel_futures_orders: %s\n" % e) ``` ### Parameters @@ -1201,16 +1196,15 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] **contract** | **str**| Futures contract | - **interval** | **str**| Order depth. 0 means no aggregation is applied. default to 0 | [optional] [default to '0'] - **limit** | **int**| Maximum number of order depth data in asks or bids | [optional] [default to 10] + **side** | **str**| All bids or asks. Both included in not specified | [optional] ### Return type -[**FuturesOrderBook**](FuturesOrderBook.md) +[**list[FuturesOrder]**](FuturesOrder.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers @@ -1220,14 +1214,14 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Order book retrieved | - | +**200** | All orders matched cancelled | - | [[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_futures_orders** -> list[FuturesOrder] list_futures_orders(settle, contract, status, limit=limit, offset=offset, last_id=last_id, count_total=count_total) +# **get_futures_order** +> FuturesOrder get_futures_order(settle, order_id) -List futures orders +Get a single order Zero-fill order cannot be retrieved 60 seconds after cancellation @@ -1256,19 +1250,14 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -contract = 'BTC_USD' # str | Futures contract -status = 'open' # str | List orders based on status -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) -last_id = '12345' # str | Specify list staring point using the `id` of last record in previous list-query results (optional) -count_total = 0 # int | Whether to return total number matched. Default to 0(no return) (optional) (default to 0) +order_id = '12345' # str | ID returned on order successfully being created try: - # List futures orders - api_response = api_instance.list_futures_orders(settle, contract, status, limit=limit, offset=offset, last_id=last_id, count_total=count_total) + # Get a single order + api_response = api_instance.get_futures_order(settle, order_id) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->list_futures_orders: %s\n" % e) + print("Exception when calling FuturesApi->get_futures_order: %s\n" % e) ``` ### Parameters @@ -1276,16 +1265,11 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] - **contract** | **str**| Futures contract | - **status** | **str**| List orders based on status | - **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] - **last_id** | **str**| Specify list staring point using the `id` of last record in previous list-query results | [optional] - **count_total** | **int**| Whether to return total number matched. Default to 0(no return) | [optional] [default to 0] + **order_id** | **str**| ID returned on order successfully being created | ### Return type -[**list[FuturesOrder]**](FuturesOrder.md) +[**FuturesOrder**](FuturesOrder.md) ### Authorization @@ -1299,39 +1283,48 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | * X-Pagination-Limit - Request limit specified
* X-Pagination-Offset - Request offset specified
* X-Pagination-Total - Total number matched. Only returned on `count_total` set to 1
| +**200** | Order details | - | [[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_futures_tickers** -> list[FuturesTicker] list_futures_tickers(settle, contract=contract) +# **cancel_futures_order** +> FuturesOrder cancel_futures_order(settle, order_id) -List futures tickers +Cancel a single order ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -contract = 'BTC_USD' # str | Futures contract, return related data only if specified (optional) +order_id = '12345' # str | ID returned on order successfully being created try: - # List futures tickers - api_response = api_instance.list_futures_tickers(settle, contract=contract) + # Cancel a single order + api_response = api_instance.cancel_futures_order(settle, order_id) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->list_futures_tickers: %s\n" % e) + print("Exception when calling FuturesApi->cancel_futures_order: %s\n" % e) ``` ### Parameters @@ -1339,15 +1332,15 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] - **contract** | **str**| Futures contract, return related data only if specified | [optional] + **order_id** | **str**| ID returned on order successfully being created | ### Return type -[**list[FuturesTicker]**](FuturesTicker.md) +[**FuturesOrder**](FuturesOrder.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers @@ -1357,43 +1350,53 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Successfully retrieved | - | +**200** | Order details | - | [[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_futures_trades** -> list[FuturesTrade] list_futures_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to) +# **get_my_trades** +> list[MyFuturesTrade] get_my_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total) -Futures trading history +List personal trading history ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + 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.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -contract = 'BTC_USD' # str | Futures contract +contract = 'BTC_USD' # str | Futures contract, return related data only if specified (optional) +order = 12345 # int | Futures order ID, return related data only if specified (optional) limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) -last_id = '12345' # str | Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) -_from = 1546905600 # float | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional) -to = 1546935600 # float | Specify end time in Unix seconds, default to current time (optional) +offset = 0 # int | List offset, starting from 0 (optional) (default to 0) +last_id = '12345' # str | Specify list staring point using the `id` of last record in previous list-query results (optional) +count_total = 0 # int | Whether to return total number matched. Default to 0(no return) (optional) (default to 0) try: - # Futures trading history - api_response = api_instance.list_futures_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to) + # List personal trading history + api_response = api_instance.get_my_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->list_futures_trades: %s\n" % e) + print("Exception when calling FuturesApi->get_my_trades: %s\n" % e) ``` ### Parameters @@ -1401,19 +1404,20 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] - **contract** | **str**| Futures contract | + **contract** | **str**| Futures contract, return related data only if specified | [optional] + **order** | **int**| Futures order ID, return related data only if specified | [optional] **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] - **last_id** | **str**| Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range | [optional] - **_from** | **float**| Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. | [optional] - **to** | **float**| Specify end time in Unix seconds, default to current time | [optional] + **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] + **last_id** | **str**| Specify list staring point using the `id` of last record in previous list-query results | [optional] + **count_total** | **int**| Whether to return total number matched. Default to 0(no return) | [optional] [default to 0] ### Return type -[**list[FuturesTrade]**](FuturesTrade.md) +[**list[MyFuturesTrade]**](MyFuturesTrade.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers @@ -1423,14 +1427,14 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**200** | List retrieved | * X-Pagination-Limit - Request limit specified
* X-Pagination-Offset - Request offset specified
* X-Pagination-Total - Total number matched. Only returned on `count_total` set to 1
| [[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_liquidates** -> list[FuturesLiquidate] list_liquidates(settle, contract=contract, limit=limit, at=at) +# **list_position_close** +> list[PositionClose] list_position_close(settle, contract=contract, limit=limit) -List liquidation history +List position close history ### Example @@ -1459,14 +1463,13 @@ api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract, return related data only if specified (optional) limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) -at = 0 # int | Specify a liquidation timestamp (optional) (default to 0) try: - # List liquidation history - api_response = api_instance.list_liquidates(settle, contract=contract, limit=limit, at=at) + # List position close history + api_response = api_instance.list_position_close(settle, contract=contract, limit=limit) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->list_liquidates: %s\n" % e) + print("Exception when calling FuturesApi->list_position_close: %s\n" % e) ``` ### Parameters @@ -1476,11 +1479,10 @@ Name | Type | Description | Notes **settle** | **str**| Settle currency | [default to 'btc'] **contract** | **str**| Futures contract, return related data only if specified | [optional] **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] - **at** | **int**| Specify a liquidation timestamp | [optional] [default to 0] ### Return type -[**list[FuturesLiquidate]**](FuturesLiquidate.md) +[**list[PositionClose]**](PositionClose.md) ### Authorization @@ -1498,10 +1500,10 @@ 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_position_close** -> list[PositionClose] list_position_close(settle, contract=contract, limit=limit) +# **list_liquidates** +> list[FuturesLiquidate] list_liquidates(settle, contract=contract, limit=limit, at=at) -List position close history +List liquidation history ### Example @@ -1530,13 +1532,14 @@ api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract, return related data only if specified (optional) limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) +at = 0 # int | Specify a liquidation timestamp (optional) (default to 0) try: - # List position close history - api_response = api_instance.list_position_close(settle, contract=contract, limit=limit) + # List liquidation history + api_response = api_instance.list_liquidates(settle, contract=contract, limit=limit, at=at) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->list_position_close: %s\n" % e) + print("Exception when calling FuturesApi->list_liquidates: %s\n" % e) ``` ### Parameters @@ -1546,10 +1549,11 @@ Name | Type | Description | Notes **settle** | **str**| Settle currency | [default to 'btc'] **contract** | **str**| Futures contract, return related data only if specified | [optional] **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **at** | **int**| Specify a liquidation timestamp | [optional] [default to 0] ### Return type -[**list[PositionClose]**](PositionClose.md) +[**list[FuturesLiquidate]**](FuturesLiquidate.md) ### Authorization @@ -1567,10 +1571,10 @@ 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_positions** -> list[Position] list_positions(settle) +# **list_price_triggered_orders** +> list[FuturesPriceTriggeredOrder] list_price_triggered_orders(settle, status, contract=contract, limit=limit, offset=offset) -List all positions of a user +List all auto orders ### Example @@ -1597,13 +1601,17 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') +status = 'status_example' # str | List orders based on status +contract = 'BTC_USD' # str | Futures contract, return related data only if specified (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) try: - # List all positions of a user - api_response = api_instance.list_positions(settle) + # List all auto orders + api_response = api_instance.list_price_triggered_orders(settle, status, contract=contract, limit=limit, offset=offset) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->list_positions: %s\n" % e) + print("Exception when calling FuturesApi->list_price_triggered_orders: %s\n" % e) ``` ### Parameters @@ -1611,10 +1619,14 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] + **status** | **str**| List orders based on status | + **contract** | **str**| Futures contract, return related data only if specified | [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] ### Return type -[**list[Position]**](Position.md) +[**list[FuturesPriceTriggeredOrder]**](FuturesPriceTriggeredOrder.md) ### Authorization @@ -1632,10 +1644,10 @@ 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_price_triggered_orders** -> list[FuturesPriceTriggeredOrder] list_price_triggered_orders(settle, status, contract=contract, limit=limit, offset=offset) +# **create_price_triggered_order** +> TriggerOrderResponse create_price_triggered_order(settle, futures_price_triggered_order) -List all auto orders +Create a price-triggered order ### Example @@ -1662,17 +1674,14 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -status = 'status_example' # str | List orders based on status -contract = 'BTC_USD' # str | Futures contract, return related data only if specified (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) +futures_price_triggered_order = {"initial":{"contract":"BTC_USD","size":100,"price":"5.03","close":false,"tif":"gtc","text":"web"},"trigger":{"strategy_type":0,"price_type":0,"price":"3000","rule":1,"expiration":86400},"id":1283293,"user":1234,"create_time":1514764800,"finish_time":1514764900,"trade_id":13566,"status":"finished","finish_as":"cancelled","reason":""} # FuturesPriceTriggeredOrder | try: - # List all auto orders - api_response = api_instance.list_price_triggered_orders(settle, status, contract=contract, limit=limit, offset=offset) + # Create a price-triggered order + api_response = api_instance.create_price_triggered_order(settle, futures_price_triggered_order) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->list_price_triggered_orders: %s\n" % e) + print("Exception when calling FuturesApi->create_price_triggered_order: %s\n" % e) ``` ### Parameters @@ -1680,14 +1689,11 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] - **status** | **str**| List orders based on status | - **contract** | **str**| Futures contract, return related data only if specified | [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] + **futures_price_triggered_order** | [**FuturesPriceTriggeredOrder**](FuturesPriceTriggeredOrder.md)| | ### Return type -[**list[FuturesPriceTriggeredOrder]**](FuturesPriceTriggeredOrder.md) +[**TriggerOrderResponse**](TriggerOrderResponse.md) ### Authorization @@ -1695,20 +1701,20 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**201** | Order created | - | [[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) +# **cancel_price_triggered_order_list** +> list[FuturesPriceTriggeredOrder] cancel_price_triggered_order_list(settle, contract) -Update position leverage +Cancel all open orders ### Example @@ -1736,14 +1742,13 @@ api_client = gate_api.ApiClient(configuration) api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') contract = 'BTC_USD' # str | Futures contract -leverage = '10' # str | New position leverage try: - # Update position leverage - api_response = api_instance.update_position_leverage(settle, contract, leverage) + # Cancel all open orders + api_response = api_instance.cancel_price_triggered_order_list(settle, contract) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->update_position_leverage: %s\n" % e) + print("Exception when calling FuturesApi->cancel_price_triggered_order_list: %s\n" % e) ``` ### Parameters @@ -1752,11 +1757,10 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] **contract** | **str**| Futures contract | - **leverage** | **str**| New position leverage | ### Return type -[**Position**](Position.md) +[**list[FuturesPriceTriggeredOrder]**](FuturesPriceTriggeredOrder.md) ### Authorization @@ -1770,14 +1774,14 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Position information | - | +**200** | Batch cancellation request accepted. Query order status by listing orders | - | [[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_margin** -> Position update_position_margin(settle, contract, change) +# **get_price_triggered_order** +> FuturesPriceTriggeredOrder get_price_triggered_order(settle, order_id) -Update position margin +Get a single order ### Example @@ -1804,15 +1808,14 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -contract = 'BTC_USD' # str | Futures contract -change = '0.01' # str | Margin change. Use positive number to increase margin, negative number otherwise. +order_id = 'order_id_example' # str | ID returned on order successfully being created try: - # Update position margin - api_response = api_instance.update_position_margin(settle, contract, change) + # Get a single order + api_response = api_instance.get_price_triggered_order(settle, order_id) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->update_position_margin: %s\n" % e) + print("Exception when calling FuturesApi->get_price_triggered_order: %s\n" % e) ``` ### Parameters @@ -1820,12 +1823,11 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] - **contract** | **str**| Futures contract | - **change** | **str**| Margin change. Use positive number to increase margin, negative number otherwise. | + **order_id** | **str**| ID returned on order successfully being created | ### Return type -[**Position**](Position.md) +[**FuturesPriceTriggeredOrder**](FuturesPriceTriggeredOrder.md) ### Authorization @@ -1839,14 +1841,14 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Position information | - | +**200** | Auto order detail | - | [[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_risk_limit** -> Position update_position_risk_limit(settle, contract, risk_limit) +# **cancel_price_triggered_order** +> FuturesPriceTriggeredOrder cancel_price_triggered_order(settle, order_id) -Update position risk limit +Cancel a single order ### Example @@ -1873,15 +1875,14 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -contract = 'BTC_USD' # str | Futures contract -risk_limit = '10' # str | New position risk limit +order_id = 'order_id_example' # str | ID returned on order successfully being created try: - # Update position risk limit - api_response = api_instance.update_position_risk_limit(settle, contract, risk_limit) + # Cancel a single order + api_response = api_instance.cancel_price_triggered_order(settle, order_id) print(api_response) except ApiException as e: - print("Exception when calling FuturesApi->update_position_risk_limit: %s\n" % e) + print("Exception when calling FuturesApi->cancel_price_triggered_order: %s\n" % e) ``` ### Parameters @@ -1889,12 +1890,11 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | [default to 'btc'] - **contract** | **str**| Futures contract | - **risk_limit** | **str**| New position risk limit | + **order_id** | **str**| ID returned on order successfully being created | ### Return type -[**Position**](Position.md) +[**FuturesPriceTriggeredOrder**](FuturesPriceTriggeredOrder.md) ### Authorization @@ -1908,7 +1908,7 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Position information | - | +**200** | Auto order detail | - | [[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/MarginAccountBook.md b/docs/MarginAccountBook.md new file mode 100644 index 0000000..e745b7b --- /dev/null +++ b/docs/MarginAccountBook.md @@ -0,0 +1,15 @@ +# MarginAccountBook + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Balance change record ID | [optional] +**time** | **str** | Balance changed timestamp | [optional] +**currency** | **str** | Currency changed | [optional] +**currency_pair** | **str** | Account currency pair | [optional] +**change** | **str** | Amount changed. Positive value means transferring in, while negative out | [optional] +**balance** | **str** | Balance after change | [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 acd2fa7..4f303ed 100644 --- a/docs/MarginApi.md +++ b/docs/MarginApi.md @@ -4,79 +4,63 @@ All URIs are relative to *https://api.gateio.ws/api/v4* Method | HTTP request | Description ------------- | ------------- | ------------- -[**cancel_loan**](MarginApi.md#cancel_loan) | **DELETE** /margin/loans/{loan_id} | Cancel lending loan -[**create_loan**](MarginApi.md#create_loan) | **POST** /margin/loans | Lend or borrow -[**get_loan**](MarginApi.md#get_loan) | **GET** /margin/loans/{loan_id} | Retrieve one single loan detail -[**get_loan_record**](MarginApi.md#get_loan_record) | **GET** /margin/loan_records/{loan_record_id} | Get one single loan record -[**list_funding_accounts**](MarginApi.md#list_funding_accounts) | **GET** /margin/funding_accounts | Funding account list +[**list_margin_currency_pairs**](MarginApi.md#list_margin_currency_pairs) | **GET** /margin/currency_pairs | List all supported currency pairs supported in margin trading [**list_funding_book**](MarginApi.md#list_funding_book) | **GET** /margin/funding_book | Order book of lending loans -[**list_loan_records**](MarginApi.md#list_loan_records) | **GET** /margin/loan_records | List repayment records of specified loan -[**list_loan_repayments**](MarginApi.md#list_loan_repayments) | **GET** /margin/loans/{loan_id}/repayment | List loan repayment records -[**list_loans**](MarginApi.md#list_loans) | **GET** /margin/loans | List all loans [**list_margin_accounts**](MarginApi.md#list_margin_accounts) | **GET** /margin/accounts | Margin account list -[**list_margin_currency_pairs**](MarginApi.md#list_margin_currency_pairs) | **GET** /margin/currency_pairs | List all supported currency pairs supported in margin trading +[**list_margin_account_book**](MarginApi.md#list_margin_account_book) | **GET** /margin/account_book | List margin account balance change history +[**list_funding_accounts**](MarginApi.md#list_funding_accounts) | **GET** /margin/funding_accounts | Funding account list +[**list_loans**](MarginApi.md#list_loans) | **GET** /margin/loans | List all loans +[**create_loan**](MarginApi.md#create_loan) | **POST** /margin/loans | Lend or borrow [**merge_loans**](MarginApi.md#merge_loans) | **POST** /margin/merged_loans | Merge multiple lending loans -[**repay_loan**](MarginApi.md#repay_loan) | **POST** /margin/loans/{loan_id}/repayment | Repay a loan +[**get_loan**](MarginApi.md#get_loan) | **GET** /margin/loans/{loan_id} | Retrieve one single loan detail +[**cancel_loan**](MarginApi.md#cancel_loan) | **DELETE** /margin/loans/{loan_id} | Cancel lending loan [**update_loan**](MarginApi.md#update_loan) | **PATCH** /margin/loans/{loan_id} | Modify a loan +[**list_loan_repayments**](MarginApi.md#list_loan_repayments) | **GET** /margin/loans/{loan_id}/repayment | List loan repayment records +[**repay_loan**](MarginApi.md#repay_loan) | **POST** /margin/loans/{loan_id}/repayment | Repay a loan +[**list_loan_records**](MarginApi.md#list_loan_records) | **GET** /margin/loan_records | List repayment records of specified loan +[**get_loan_record**](MarginApi.md#get_loan_record) | **GET** /margin/loan_records/{loan_record_id} | Get one single loan record [**update_loan_record**](MarginApi.md#update_loan_record) | **PATCH** /margin/loan_records/{loan_record_id} | Modify a loan record -# **cancel_loan** -> Loan cancel_loan(loan_id, currency) - -Cancel lending loan +# **list_margin_currency_pairs** +> list[MarginCurrencyPair] list_margin_currency_pairs() -Only lending loans can be cancelled +List all supported currency pairs supported in margin trading ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + 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) -loan_id = '12345' # str | Loan ID -currency = 'BTC' # str | Retrieved specified currency related data try: - # Cancel lending loan - api_response = api_instance.cancel_loan(loan_id, currency) + # List all supported currency pairs supported in margin trading + api_response = api_instance.list_margin_currency_pairs() print(api_response) except ApiException as e: - print("Exception when calling MarginApi->cancel_loan: %s\n" % e) + print("Exception when calling MarginApi->list_margin_currency_pairs: %s\n" % e) ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **loan_id** | **str**| Loan ID | - **currency** | **str**| Retrieved specified currency related data | +This endpoint does not need any parameter. ### Return type -[**Loan**](Loan.md) +[**list[MarginCurrencyPair]**](MarginCurrencyPair.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers @@ -86,79 +70,70 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Order cancelled | - | +**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) -# **create_loan** -> Loan create_loan(loan) +# **list_funding_book** +> list[FundingBookItem] list_funding_book(currency) -Lend or borrow +Order book of lending loans ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + 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) -loan = {"id":"123435","create_time":"1548000000","expire_time":"1548100000","side":"borrow","status":"loaned","currency":"BTC","rate":"0.002","amount":"1.5","days":10,"auto_renew":true,"currency_pair":"ETH_BTC","left":"0","repaid":"0","paid_interest":"0","unpaid_interest":"0","fee_rate":"0.18","orig_id":"123424"} # Loan | +currency = 'BTC' # str | Retrieved specified currency related data try: - # Lend or borrow - api_response = api_instance.create_loan(loan) + # Order book of lending loans + api_response = api_instance.list_funding_book(currency) print(api_response) except ApiException as e: - print("Exception when calling MarginApi->create_loan: %s\n" % e) + print("Exception when calling MarginApi->list_funding_book: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **loan** | [**Loan**](Loan.md)| | + **currency** | **str**| Retrieved specified currency related data | ### Return type -[**Loan**](Loan.md) +[**list[FundingBookItem]**](FundingBookItem.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**201** | Loan created | - | +**200** | Order book 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_loan** -> Loan get_loan(loan_id, side) +# **list_margin_accounts** +> list[MarginAccount] list_margin_accounts(currency_pair=currency_pair) -Retrieve one single loan detail +Margin account list ### Example @@ -184,27 +159,25 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.MarginApi(api_client) -loan_id = '12345' # str | Loan ID -side = 'lend' # str | Lend or borrow +currency_pair = 'BTC_USDT' # str | Currency pair (optional) try: - # Retrieve one single loan detail - api_response = api_instance.get_loan(loan_id, side) + # Margin account list + api_response = api_instance.list_margin_accounts(currency_pair=currency_pair) print(api_response) except ApiException as e: - print("Exception when calling MarginApi->get_loan: %s\n" % e) + print("Exception when calling MarginApi->list_margin_accounts: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **loan_id** | **str**| Loan ID | - **side** | **str**| Lend or borrow | + **currency_pair** | **str**| Currency pair | [optional] ### Return type -[**Loan**](Loan.md) +[**list[MarginAccount]**](MarginAccount.md) ### Authorization @@ -222,10 +195,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_loan_record** -> LoanRecord get_loan_record(loan_record_id, loan_id) +# **list_margin_account_book** +> list[MarginAccountBook] list_margin_account_book(currency=currency, currency_pair=currency_pair, _from=_from, to=to, page=page, limit=limit) -Get one single loan record +List margin account balance change history + +Only transferring from or to margin account are provided for now. Time range allows 30 days at most ### Example @@ -251,27 +226,35 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.MarginApi(api_client) -loan_record_id = '12345' # str | Loan record ID -loan_id = '12345' # str | Loan ID +currency = 'currency_example' # str | List records related to specified currency only. If specified, `currency_pair` is also required. (optional) +currency_pair = 'currency_pair_example' # str | List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided (optional) +_from = 56 # int | Time range beginning, default to 7 days before current time (optional) +to = 56 # int | Time range ending, default to current time (optional) +page = 1 # int | Page number (optional) (default to 1) +limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) try: - # Get one single loan record - api_response = api_instance.get_loan_record(loan_record_id, loan_id) + # List margin account balance change history + api_response = api_instance.list_margin_account_book(currency=currency, currency_pair=currency_pair, _from=_from, to=to, page=page, limit=limit) print(api_response) except ApiException as e: - print("Exception when calling MarginApi->get_loan_record: %s\n" % e) + print("Exception when calling MarginApi->list_margin_account_book: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **loan_record_id** | **str**| Loan record ID | - **loan_id** | **str**| Loan ID | + **currency** | **str**| List records related to specified currency only. If specified, `currency_pair` is also required. | [optional] + **currency_pair** | **str**| List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided | [optional] + **_from** | **int**| Time range beginning, default to 7 days before current time | [optional] + **to** | **int**| Time range ending, default to current time | [optional] + **page** | **int**| Page number | [optional] [default to 1] + **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] ### Return type -[**LoanRecord**](LoanRecord.md) +[**list[MarginAccountBook]**](MarginAccountBook.md) ### Authorization @@ -285,7 +268,7 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Detail retrieved | - | +**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) @@ -354,49 +337,72 @@ 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_funding_book** -> list[FundingBookItem] list_funding_book(currency) +# **list_loans** +> list[Loan] list_loans(status, side, currency=currency, currency_pair=currency_pair, sort_by=sort_by, reverse_sort=reverse_sort, page=page, limit=limit) -Order book of lending loans +List all loans ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + 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 | Retrieved specified currency related data +status = 'open' # str | Loan status +side = 'lend' # str | Lend or borrow +currency = 'BTC' # str | Retrieved specified currency related data (optional) +currency_pair = 'BTC_USDT' # str | Currency pair (optional) +sort_by = 'rate' # str | Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` (optional) +reverse_sort = false # bool | Whether to sort in descending order. Default to `true` (optional) +page = 1 # int | Page number (optional) (default to 1) +limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) try: - # Order book of lending loans - api_response = api_instance.list_funding_book(currency) + # List all loans + api_response = api_instance.list_loans(status, side, currency=currency, currency_pair=currency_pair, sort_by=sort_by, reverse_sort=reverse_sort, page=page, limit=limit) print(api_response) except ApiException as e: - print("Exception when calling MarginApi->list_funding_book: %s\n" % e) + print("Exception when calling MarginApi->list_loans: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **currency** | **str**| Retrieved specified currency related data | + **status** | **str**| Loan status | + **side** | **str**| Lend or borrow | + **currency** | **str**| Retrieved specified currency related data | [optional] + **currency_pair** | **str**| Currency pair | [optional] + **sort_by** | **str**| Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` | [optional] + **reverse_sort** | **bool**| Whether to sort in descending order. Default to `true` | [optional] + **page** | **int**| Page number | [optional] [default to 1] + **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] ### Return type -[**list[FundingBookItem]**](FundingBookItem.md) +[**list[Loan]**](Loan.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers @@ -406,14 +412,14 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Order book retrieved | - | +**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) -# **list_loan_records** -> list[LoanRecord] list_loan_records(loan_id, status=status, page=page, limit=limit) +# **create_loan** +> Loan create_loan(loan) -List repayment records of specified loan +Lend or borrow ### Example @@ -439,31 +445,25 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.MarginApi(api_client) -loan_id = '12345' # str | Loan ID -status = 'loaned' # str | Loan record status (optional) -page = 1 # int | Page number (optional) (default to 1) -limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) +loan = {"id":"123435","create_time":"1548000000","expire_time":"1548100000","side":"borrow","status":"loaned","currency":"BTC","rate":"0.002","amount":"1.5","days":10,"auto_renew":true,"currency_pair":"ETH_BTC","left":"0","repaid":"0","paid_interest":"0","unpaid_interest":"0","fee_rate":"0.18","orig_id":"123424"} # Loan | try: - # List repayment records of specified loan - api_response = api_instance.list_loan_records(loan_id, status=status, page=page, limit=limit) + # Lend or borrow + api_response = api_instance.create_loan(loan) print(api_response) except ApiException as e: - print("Exception when calling MarginApi->list_loan_records: %s\n" % e) + print("Exception when calling MarginApi->create_loan: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **loan_id** | **str**| Loan ID | - **status** | **str**| Loan record status | [optional] - **page** | **int**| Page number | [optional] [default to 1] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **loan** | [**Loan**](Loan.md)| | ### Return type -[**list[LoanRecord]**](LoanRecord.md) +[**Loan**](Loan.md) ### Authorization @@ -471,20 +471,20 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**201** | Loan created | - | [[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_loan_repayments** -> list[Repayment] list_loan_repayments(loan_id) +# **merge_loans** +> Loan merge_loans(currency, ids) -List loan repayment records +Merge multiple lending loans ### Example @@ -510,25 +510,27 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.MarginApi(api_client) -loan_id = '12345' # str | Loan ID +currency = 'BTC' # str | Retrieved specified currency related data +ids = '123,234,345' # str | Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request try: - # List loan repayment records - api_response = api_instance.list_loan_repayments(loan_id) + # Merge multiple lending loans + api_response = api_instance.merge_loans(currency, ids) print(api_response) except ApiException as e: - print("Exception when calling MarginApi->list_loan_repayments: %s\n" % e) + print("Exception when calling MarginApi->merge_loans: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **loan_id** | **str**| Loan ID | + **currency** | **str**| Retrieved specified currency related data | + **ids** | **str**| Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request | ### Return type -[**list[Repayment]**](Repayment.md) +[**Loan**](Loan.md) ### Authorization @@ -542,14 +544,14 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**201** | Loans merged | - | [[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_loans** -> list[Loan] list_loans(status, side, currency=currency, currency_pair=currency_pair, sort_by=sort_by, reverse_sort=reverse_sort, page=page, limit=limit) +# **get_loan** +> Loan get_loan(loan_id, side) -List all loans +Retrieve one single loan detail ### Example @@ -575,39 +577,27 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.MarginApi(api_client) -status = 'open' # str | Loan status +loan_id = '12345' # str | Loan ID side = 'lend' # str | Lend or borrow -currency = 'BTC' # str | Retrieved specified currency related data (optional) -currency_pair = 'BTC_USDT' # str | Currency pair (optional) -sort_by = 'rate' # str | Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` (optional) -reverse_sort = false # bool | Whether to sort in descending order. Default to `true` (optional) -page = 1 # int | Page number (optional) (default to 1) -limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) try: - # List all loans - api_response = api_instance.list_loans(status, side, currency=currency, currency_pair=currency_pair, sort_by=sort_by, reverse_sort=reverse_sort, page=page, limit=limit) + # Retrieve one single loan detail + api_response = api_instance.get_loan(loan_id, side) print(api_response) except ApiException as e: - print("Exception when calling MarginApi->list_loans: %s\n" % e) + print("Exception when calling MarginApi->get_loan: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | **str**| Loan status | + **loan_id** | **str**| Loan ID | **side** | **str**| Lend or borrow | - **currency** | **str**| Retrieved specified currency related data | [optional] - **currency_pair** | **str**| Currency pair | [optional] - **sort_by** | **str**| Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` | [optional] - **reverse_sort** | **bool**| Whether to sort in descending order. Default to `true` | [optional] - **page** | **int**| Page number | [optional] [default to 1] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] ### Return type -[**list[Loan]**](Loan.md) +[**Loan**](Loan.md) ### Authorization @@ -625,10 +615,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_margin_accounts** -> list[MarginAccount] list_margin_accounts(currency_pair=currency_pair) +# **cancel_loan** +> Loan cancel_loan(loan_id, currency) -Margin account list +Cancel lending loan + +Only lending loans can be cancelled ### Example @@ -654,25 +646,27 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.MarginApi(api_client) -currency_pair = 'BTC_USDT' # str | Currency pair (optional) +loan_id = '12345' # str | Loan ID +currency = 'BTC' # str | Retrieved specified currency related data try: - # Margin account list - api_response = api_instance.list_margin_accounts(currency_pair=currency_pair) + # Cancel lending loan + api_response = api_instance.cancel_loan(loan_id, currency) print(api_response) except ApiException as e: - print("Exception when calling MarginApi->list_margin_accounts: %s\n" % e) + print("Exception when calling MarginApi->cancel_loan: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **currency_pair** | **str**| Currency pair | [optional] + **loan_id** | **str**| Loan ID | + **currency** | **str**| Retrieved specified currency related data | ### Return type -[**list[MarginAccount]**](MarginAccount.md) +[**Loan**](Loan.md) ### Authorization @@ -686,66 +680,83 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**200** | Order cancelled | - | [[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_margin_currency_pairs** -> list[MarginCurrencyPair] list_margin_currency_pairs() +# **update_loan** +> Loan update_loan(loan_id, loan_patch) -List all supported currency pairs supported in margin trading +Modify a loan + +Only `auto_renew` modification is supported currently ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + 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 | Loan ID +loan_patch = {"currency":"BTC","side":"borrow","currency_pair":"BTC_USDT","auto_renew":false} # LoanPatch | try: - # List all supported currency pairs supported in margin trading - api_response = api_instance.list_margin_currency_pairs() + # Modify a loan + api_response = api_instance.update_loan(loan_id, loan_patch) print(api_response) except ApiException as e: - print("Exception when calling MarginApi->list_margin_currency_pairs: %s\n" % e) + print("Exception when calling MarginApi->update_loan: %s\n" % e) ``` ### Parameters -This endpoint does not need any parameter. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **loan_id** | **str**| Loan ID | + **loan_patch** | [**LoanPatch**](LoanPatch.md)| | ### Return type -[**list[MarginCurrencyPair]**](MarginCurrencyPair.md) +[**Loan**](Loan.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**200** | Updated | - | [[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) -# **merge_loans** -> Loan merge_loans(currency, ids) +# **list_loan_repayments** +> list[Repayment] list_loan_repayments(loan_id) -Merge multiple lending loans +List loan repayment records ### Example @@ -771,27 +782,25 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.MarginApi(api_client) -currency = 'BTC' # str | Retrieved specified currency related data -ids = '123,234,345' # str | Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request +loan_id = '12345' # str | Loan ID try: - # Merge multiple lending loans - api_response = api_instance.merge_loans(currency, ids) + # List loan repayment records + api_response = api_instance.list_loan_repayments(loan_id) print(api_response) except ApiException as e: - print("Exception when calling MarginApi->merge_loans: %s\n" % e) + print("Exception when calling MarginApi->list_loan_repayments: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **currency** | **str**| Retrieved specified currency related data | - **ids** | **str**| Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request | + **loan_id** | **str**| Loan ID | ### Return type -[**Loan**](Loan.md) +[**list[Repayment]**](Repayment.md) ### Authorization @@ -805,7 +814,7 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**201** | Loans merged | - | +**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) @@ -876,12 +885,81 @@ 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_loan** -> Loan update_loan(loan_id, loan_patch) +# **list_loan_records** +> list[LoanRecord] list_loan_records(loan_id, status=status, page=page, limit=limit) -Modify a loan +List repayment records of specified loan -Only `auto_renew` modification is supported currently +### Example + +* Api Key Authentication (apiv4): +```python +from __future__ import print_function +import gate_api +from gate_api.exceptions import ApiException +# 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 | Loan ID +status = 'loaned' # str | Loan record status (optional) +page = 1 # int | Page number (optional) (default to 1) +limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) + +try: + # List repayment records of specified loan + api_response = api_instance.list_loan_records(loan_id, status=status, page=page, limit=limit) + print(api_response) +except ApiException as e: + print("Exception when calling MarginApi->list_loan_records: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **loan_id** | **str**| Loan ID | + **status** | **str**| Loan record status | [optional] + **page** | **int**| Page number | [optional] [default to 1] + **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + +### Return type + +[**list[LoanRecord]**](LoanRecord.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) + +# **get_loan_record** +> LoanRecord get_loan_record(loan_record_id, loan_id) + +Get one single loan record ### Example @@ -907,27 +985,27 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.MarginApi(api_client) +loan_record_id = '12345' # str | Loan record ID loan_id = '12345' # str | Loan ID -loan_patch = {"currency":"BTC","side":"borrow","currency_pair":"BTC_USDT","auto_renew":false} # LoanPatch | try: - # Modify a loan - api_response = api_instance.update_loan(loan_id, loan_patch) + # Get one single loan record + api_response = api_instance.get_loan_record(loan_record_id, loan_id) print(api_response) except ApiException as e: - print("Exception when calling MarginApi->update_loan: %s\n" % e) + print("Exception when calling MarginApi->get_loan_record: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **loan_record_id** | **str**| Loan record ID | **loan_id** | **str**| Loan ID | - **loan_patch** | [**LoanPatch**](LoanPatch.md)| | ### Return type -[**Loan**](Loan.md) +[**LoanRecord**](LoanRecord.md) ### Authorization @@ -935,13 +1013,13 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Updated | - | +**200** | Detail 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) diff --git a/docs/OpenOrders.md b/docs/OpenOrders.md new file mode 100644 index 0000000..e57cbf6 --- /dev/null +++ b/docs/OpenOrders.md @@ -0,0 +1,12 @@ +# OpenOrders + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**currency_pair** | **str** | Currency pair | [optional] +**total** | **int** | Total open orders in this currency pair | [optional] +**orders** | [**list[Order]**](Order.md) | | [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 869fc00..0d1c12e 100644 --- a/docs/SpotApi.md +++ b/docs/SpotApi.md @@ -4,144 +4,119 @@ All URIs are relative to *https://api.gateio.ws/api/v4* Method | HTTP request | Description ------------- | ------------- | ------------- -[**cancel_batch_orders**](SpotApi.md#cancel_batch_orders) | **POST** /spot/cancel_batch_orders | Cancel a batch of orders with an ID list -[**cancel_order**](SpotApi.md#cancel_order) | **DELETE** /spot/orders/{order_id} | Cancel a single order -[**cancel_orders**](SpotApi.md#cancel_orders) | **DELETE** /spot/orders | Cancel all `open` orders in specified currency pair +[**list_currency_pairs**](SpotApi.md#list_currency_pairs) | **GET** /spot/currency_pairs | List all currency pairs supported +[**get_currency_pair**](SpotApi.md#get_currency_pair) | **GET** /spot/currency_pairs/{currency_pair} | Get detail of one single order +[**list_tickers**](SpotApi.md#list_tickers) | **GET** /spot/tickers | Retrieve ticker information +[**list_order_book**](SpotApi.md#list_order_book) | **GET** /spot/order_book | Retrieve order book +[**list_trades**](SpotApi.md#list_trades) | **GET** /spot/trades | Retrieve market trades +[**list_candlesticks**](SpotApi.md#list_candlesticks) | **GET** /spot/candlesticks | Market candlesticks +[**list_spot_accounts**](SpotApi.md#list_spot_accounts) | **GET** /spot/accounts | List spot accounts [**create_batch_orders**](SpotApi.md#create_batch_orders) | **POST** /spot/batch_orders | Create a batch of orders +[**list_all_open_orders**](SpotApi.md#list_all_open_orders) | **GET** /spot/open_orders | List all open orders +[**list_orders**](SpotApi.md#list_orders) | **GET** /spot/orders | List orders [**create_order**](SpotApi.md#create_order) | **POST** /spot/orders | Create an order -[**get_currency_pair**](SpotApi.md#get_currency_pair) | **GET** /spot/currency_pairs/{currency_pair} | Get detail of one single order +[**cancel_orders**](SpotApi.md#cancel_orders) | **DELETE** /spot/orders | Cancel all `open` orders in specified currency pair +[**cancel_batch_orders**](SpotApi.md#cancel_batch_orders) | **POST** /spot/cancel_batch_orders | Cancel a batch of orders with an ID list [**get_order**](SpotApi.md#get_order) | **GET** /spot/orders/{order_id} | Get a single order -[**list_candlesticks**](SpotApi.md#list_candlesticks) | **GET** /spot/candlesticks | Market candlesticks -[**list_currency_pairs**](SpotApi.md#list_currency_pairs) | **GET** /spot/currency_pairs | List all currency pairs supported +[**cancel_order**](SpotApi.md#cancel_order) | **DELETE** /spot/orders/{order_id} | Cancel a single order [**list_my_trades**](SpotApi.md#list_my_trades) | **GET** /spot/my_trades | List personal trading history -[**list_order_book**](SpotApi.md#list_order_book) | **GET** /spot/order_book | Retrieve order book -[**list_orders**](SpotApi.md#list_orders) | **GET** /spot/orders | List orders -[**list_spot_accounts**](SpotApi.md#list_spot_accounts) | **GET** /spot/accounts | List spot accounts -[**list_tickers**](SpotApi.md#list_tickers) | **GET** /spot/tickers | Retrieve ticker information -[**list_trades**](SpotApi.md#list_trades) | **GET** /spot/trades | Retrieve market trades -# **cancel_batch_orders** -> list[CancelOrderResult] cancel_batch_orders(cancel_order) - -Cancel a batch of orders with an ID list +# **list_currency_pairs** +> list[CurrencyPair] list_currency_pairs() -Multiple currency pairs can be specified, but maximum 20 orders are allowed per request +List all currency pairs supported ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.SpotApi(api_client) -cancel_order = [{"currency_pair":"BTC_USDT","id":"123456"}] # list[CancelOrder] | try: - # Cancel a batch of orders with an ID list - api_response = api_instance.cancel_batch_orders(cancel_order) + # List all currency pairs supported + api_response = api_instance.list_currency_pairs() print(api_response) except ApiException as e: - print("Exception when calling SpotApi->cancel_batch_orders: %s\n" % e) + print("Exception when calling SpotApi->list_currency_pairs: %s\n" % e) ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **cancel_order** | [**list[CancelOrder]**](CancelOrder.md)| | +This endpoint does not need any parameter. ### Return type -[**list[CancelOrderResult]**](CancelOrderResult.md) +[**list[CurrencyPair]**](CurrencyPair.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Batch cancellation completed | - | +**200** | All currency pairs 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) -# **cancel_order** -> Order cancel_order(order_id, currency_pair) +# **get_currency_pair** +> CurrencyPair get_currency_pair(currency_pair) -Cancel a single order +Get detail of one single order ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.SpotApi(api_client) -order_id = '12345' # str | ID returned on order successfully being created -currency_pair = 'BTC_USDT' # str | Currency pair +currency_pair = 'ETH_BTC' # str | Currency pair try: - # Cancel a single order - api_response = api_instance.cancel_order(order_id, currency_pair) + # Get detail of one single order + api_response = api_instance.get_currency_pair(currency_pair) print(api_response) except ApiException as e: - print("Exception when calling SpotApi->cancel_order: %s\n" % e) + print("Exception when calling SpotApi->get_currency_pair: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | **str**| ID returned on order successfully being created | **currency_pair** | **str**| Currency pair | ### Return type -[**Order**](Order.md) +[**CurrencyPair**](CurrencyPair.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers @@ -151,66 +126,55 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Order cancelled | - | +**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) -# **cancel_orders** -> list[Order] cancel_orders(currency_pair, side=side, account=account) +# **list_tickers** +> list[Ticker] list_tickers(currency_pair=currency_pair) -Cancel all `open` orders in specified currency pair +Retrieve ticker information + +Return only related data if `currency_pair` is specified; otherwise return all of them ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.SpotApi(api_client) -currency_pair = 'BTC_USDT' # str | Currency pair -side = 'sell' # str | All bids or asks. Both included in not specified (optional) -account = 'spot' # str | Specify account type. Default to all account types being included (optional) +currency_pair = 'BTC_USDT' # str | Currency pair (optional) try: - # Cancel all `open` orders in specified currency pair - api_response = api_instance.cancel_orders(currency_pair, side=side, account=account) + # Retrieve ticker information + api_response = api_instance.list_tickers(currency_pair=currency_pair) print(api_response) except ApiException as e: - print("Exception when calling SpotApi->cancel_orders: %s\n" % e) + print("Exception when calling SpotApi->list_tickers: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **currency_pair** | **str**| Currency pair | - **side** | **str**| All bids or asks. Both included in not specified | [optional] - **account** | **str**| Specify account type. Default to all account types being included | [optional] + **currency_pair** | **str**| Currency pair | [optional] ### Return type -[**list[Order]**](Order.md) +[**list[Ticker]**](Ticker.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers @@ -220,146 +184,138 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Batch cancellation request accepted. Query order status by listing orders | - | +**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_batch_orders** -> list[BatchOrder] create_batch_orders(order) +# **list_order_book** +> OrderBook list_order_book(currency_pair, interval=interval, limit=limit) -Create a batch of orders +Retrieve order book -Batch orders requirements: 1. custom order field `text` is required 2. At most 4 currency pairs, maximum 5 orders each, are allowed in one request 3. No mixture of spot orders and margin orders, i.e. `account` must be identical for all orders +Order book will be sorted by price from high to low on bids; reversed on asks ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.SpotApi(api_client) -order = [{"id":"12332324","text":"t-123456","create_time":"1548000000","update_time":"1548000100","currency_pair":"ETH_BTC","status":"cancelled","type":"limit","account":"spot","side":"buy","amount":"1","price":"5.00032","time_in_force":"gtc","auto_borrow":false,"left":"0.5","filled_total":"2.50016","fee":"0.005","fee_currency":"ETH","point_fee":"0","gt_fee":"0","gt_discount":false,"rebated_fee":"0","rebated_fee_currency":"BTC"}] # list[Order] | +currency_pair = 'BTC_USDT' # str | Currency pair +interval = '0' # str | Order depth. 0 means no aggregation is applied. default to 0 (optional) (default to '0') +limit = 10 # int | Maximum number of order depth data in asks or bids (optional) (default to 10) try: - # Create a batch of orders - api_response = api_instance.create_batch_orders(order) + # Retrieve order book + api_response = api_instance.list_order_book(currency_pair, interval=interval, limit=limit) print(api_response) except ApiException as e: - print("Exception when calling SpotApi->create_batch_orders: %s\n" % e) + print("Exception when calling SpotApi->list_order_book: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order** | [**list[Order]**](Order.md)| | + **currency_pair** | **str**| Currency pair | + **interval** | **str**| Order depth. 0 means no aggregation is applied. default to 0 | [optional] [default to '0'] + **limit** | **int**| Maximum number of order depth data in asks or bids | [optional] [default to 10] ### Return type -[**list[BatchOrder]**](BatchOrder.md) +[**OrderBook**](OrderBook.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Request is completed | - | +**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_order** -> Order create_order(order) +# **list_trades** +> list[Trade] list_trades(currency_pair, limit=limit, last_id=last_id) -Create an order +Retrieve market trades ### Example -* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4" ) api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.SpotApi(api_client) -order = {"id":"12332324","text":"t-123456","create_time":"1548000000","update_time":"1548000100","currency_pair":"ETH_BTC","status":"cancelled","type":"limit","account":"spot","side":"buy","amount":"1","price":"5.00032","time_in_force":"gtc","auto_borrow":false,"left":"0.5","filled_total":"2.50016","fee":"0.005","fee_currency":"ETH","point_fee":"0","gt_fee":"0","gt_discount":false,"rebated_fee":"0","rebated_fee_currency":"BTC"} # Order | +currency_pair = 'BTC_USDT' # str | Currency pair +limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) +last_id = '12345' # str | Specify list staring point using the `id` of last record in previous list-query results (optional) try: - # Create an order - api_response = api_instance.create_order(order) + # Retrieve market trades + api_response = api_instance.list_trades(currency_pair, limit=limit, last_id=last_id) print(api_response) except ApiException as e: - print("Exception when calling SpotApi->create_order: %s\n" % e) + print("Exception when calling SpotApi->list_trades: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order** | [**Order**](Order.md)| | + **currency_pair** | **str**| Currency pair | + **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **last_id** | **str**| Specify list staring point using the `id` of last record in previous list-query results | [optional] ### Return type -[**Order**](Order.md) +[**list[Trade]**](Trade.md) ### Authorization -[apiv4](../README.md#apiv4) +No authorization required ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**201** | Order created. | - | +**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_currency_pair** -> CurrencyPair get_currency_pair(currency_pair) +# **list_candlesticks** +> list[list[str]] list_candlesticks(currency_pair, limit=limit, _from=_from, to=to, interval=interval) -Get detail of one single order +Market candlesticks + +Maximum of 1000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` ### Example @@ -376,14 +332,18 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.SpotApi(api_client) -currency_pair = 'ETH_BTC' # str | Currency pair +currency_pair = 'BTC_USDT' # str | Currency pair +limit = 100 # int | Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional) (default to 100) +_from = 1546905600 # int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) +to = 1546935600 # int | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) +interval = '30m' # str | Interval time between data points (optional) (default to '30m') try: - # Get detail of one single order - api_response = api_instance.get_currency_pair(currency_pair) + # Market candlesticks + api_response = api_instance.list_candlesticks(currency_pair, limit=limit, _from=_from, to=to, interval=interval) print(api_response) except ApiException as e: - print("Exception when calling SpotApi->get_currency_pair: %s\n" % e) + print("Exception when calling SpotApi->list_candlesticks: %s\n" % e) ``` ### Parameters @@ -391,10 +351,14 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **currency_pair** | **str**| Currency pair | + **limit** | **int**| Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [optional] [default to 100] + **_from** | **int**| Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified | [optional] + **to** | **int**| End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time | [optional] + **interval** | **str**| Interval time between data points | [optional] [default to '30m'] ### Return type -[**CurrencyPair**](CurrencyPair.md) +**list[list[str]]** ### Authorization @@ -412,10 +376,10 @@ No authorization required [[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) +# **list_spot_accounts** +> list[SpotAccount] list_spot_accounts(currency=currency) -Get a single order +List spot accounts ### Example @@ -441,27 +405,25 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.SpotApi(api_client) -order_id = '12345' # str | ID returned on order successfully being created -currency_pair = 'BTC_USDT' # str | Currency pair +currency = 'BTC' # str | Retrieved specified currency related data (optional) try: - # Get a single order - api_response = api_instance.get_order(order_id, currency_pair) + # List spot accounts + api_response = api_instance.list_spot_accounts(currency=currency) print(api_response) except ApiException as e: - print("Exception when calling SpotApi->get_order: %s\n" % e) + print("Exception when calling SpotApi->list_spot_accounts: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | **str**| ID returned on order successfully being created | - **currency_pair** | **str**| Currency pair | + **currency** | **str**| Retrieved specified currency related data | [optional] ### Return type -[**Order**](Order.md) +[**list[SpotAccount]**](SpotAccount.md) ### Authorization @@ -475,63 +437,133 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Detail retrieved | - | +**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) -# **list_candlesticks** -> list[list[str]] list_candlesticks(currency_pair, limit=limit, _from=_from, to=to, interval=interval) +# **create_batch_orders** +> list[BatchOrder] create_batch_orders(order) -Market candlesticks +Create a batch of orders -Maximum of 1000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` +Batch orders requirements: 1. custom order field `text` is required 2. At most 4 currency pairs, maximum 5 orders each, are allowed in one request 3. No mixture of spot orders and margin orders, i.e. `account` must be identical for all orders + +### Example + +* Api Key Authentication (apiv4): +```python +from __future__ import print_function +import gate_api +from gate_api.exceptions import ApiException +# 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.SpotApi(api_client) +order = [{"id":"12332324","text":"t-123456","create_time":"1548000000","update_time":"1548000100","currency_pair":"ETH_BTC","status":"cancelled","type":"limit","account":"spot","side":"buy","amount":"1","price":"5.00032","time_in_force":"gtc","auto_borrow":false,"left":"0.5","filled_total":"2.50016","fee":"0.005","fee_currency":"ETH","point_fee":"0","gt_fee":"0","gt_discount":false,"rebated_fee":"0","rebated_fee_currency":"BTC"}] # list[Order] | + +try: + # Create a batch of orders + api_response = api_instance.create_batch_orders(order) + print(api_response) +except ApiException as e: + print("Exception when calling SpotApi->create_batch_orders: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**list[Order]**](Order.md)| | + +### Return type + +[**list[BatchOrder]**](BatchOrder.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** | Request is completed | - | + +[[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 all open orders + +List all open orders in all currency pairs. Each currency pair has its own pagination ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + 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.SpotApi(api_client) -currency_pair = 'BTC_USDT' # str | Currency pair -limit = 100 # int | Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional) (default to 100) -_from = 1546905600 # int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) -to = 1546935600 # int | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) -interval = '30m' # str | Interval time between data points (optional) (default to '30m') +page = 1 # int | Page number (optional) (default to 1) +limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) try: - # Market candlesticks - api_response = api_instance.list_candlesticks(currency_pair, limit=limit, _from=_from, to=to, interval=interval) + # List all open orders + api_response = api_instance.list_all_open_orders(page=page, limit=limit) print(api_response) except ApiException as e: - print("Exception when calling SpotApi->list_candlesticks: %s\n" % e) + print("Exception when calling SpotApi->list_all_open_orders: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **currency_pair** | **str**| Currency pair | - **limit** | **int**| Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [optional] [default to 100] - **_from** | **int**| Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified | [optional] - **to** | **int**| End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time | [optional] - **interval** | **str**| Interval time between data points | [optional] [default to '30m'] + **page** | **int**| Page number | [optional] [default to 1] + **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] ### Return type -**list[list[str]]** +[**list[OpenOrders]**](OpenOrders.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers @@ -541,49 +573,68 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Successfully retrieved | - | +**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) -# **list_currency_pairs** -> list[CurrencyPair] list_currency_pairs() +# **list_orders** +> list[Order] list_orders(currency_pair, status, page=page, limit=limit) -List all currency pairs supported +List orders ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + 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.SpotApi(api_client) +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 in one list (optional) (default to 100) try: - # List all currency pairs supported - api_response = api_instance.list_currency_pairs() + # List orders + api_response = api_instance.list_orders(currency_pair, status, page=page, limit=limit) print(api_response) except ApiException as e: - print("Exception when calling SpotApi->list_currency_pairs: %s\n" % e) + print("Exception when calling SpotApi->list_orders: %s\n" % e) ``` ### Parameters -This endpoint does not need any parameter. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **currency_pair** | **str**| Currency pair | + **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 in one list | [optional] [default to 100] ### Return type -[**list[CurrencyPair]**](CurrencyPair.md) +[**list[Order]**](Order.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers @@ -593,14 +644,14 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | All currency pairs retrieved | - | +**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) -# **list_my_trades** -> list[Trade] list_my_trades(currency_pair, limit=limit, page=page, order_id=order_id) +# **create_order** +> Order create_order(order) -List personal trading history +Create an order ### Example @@ -626,31 +677,25 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.SpotApi(api_client) -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) +order = {"id":"12332324","text":"t-123456","create_time":"1548000000","update_time":"1548000100","currency_pair":"ETH_BTC","status":"cancelled","type":"limit","account":"spot","side":"buy","amount":"1","price":"5.00032","time_in_force":"gtc","auto_borrow":false,"left":"0.5","filled_total":"2.50016","fee":"0.005","fee_currency":"ETH","point_fee":"0","gt_fee":"0","gt_discount":false,"rebated_fee":"0","rebated_fee_currency":"BTC"} # Order | try: - # List personal trading history - api_response = api_instance.list_my_trades(currency_pair, limit=limit, page=page, order_id=order_id) + # Create an order + api_response = api_instance.create_order(order) print(api_response) except ApiException as e: - print("Exception when calling SpotApi->list_my_trades: %s\n" % e) + print("Exception when calling SpotApi->create_order: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **currency_pair** | **str**| Currency pair | - **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] + **order** | [**Order**](Order.md)| | ### Return type -[**list[Trade]**](Trade.md) +[**Order**](Order.md) ### Authorization @@ -658,48 +703,55 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**201** | Order created. | - | [[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_order_book** -> OrderBook list_order_book(currency_pair, interval=interval, limit=limit) - -Retrieve order book +# **cancel_orders** +> list[Order] cancel_orders(currency_pair, side=side, account=account) -Order book will be sorted by price from high to low on bids; reversed on asks +Cancel all `open` orders in specified currency pair ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + 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.SpotApi(api_client) currency_pair = 'BTC_USDT' # str | Currency pair -interval = '0' # str | Order depth. 0 means no aggregation is applied. default to 0 (optional) (default to '0') -limit = 10 # int | Maximum number of order depth data in asks or bids (optional) (default to 10) +side = 'sell' # str | All bids or asks. Both included in not specified (optional) +account = 'spot' # str | Specify account type. Default to all account types being included (optional) try: - # Retrieve order book - api_response = api_instance.list_order_book(currency_pair, interval=interval, limit=limit) + # Cancel all `open` orders in specified currency pair + api_response = api_instance.cancel_orders(currency_pair, side=side, account=account) print(api_response) except ApiException as e: - print("Exception when calling SpotApi->list_order_book: %s\n" % e) + print("Exception when calling SpotApi->cancel_orders: %s\n" % e) ``` ### Parameters @@ -707,16 +759,16 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **currency_pair** | **str**| Currency pair | - **interval** | **str**| Order depth. 0 means no aggregation is applied. default to 0 | [optional] [default to '0'] - **limit** | **int**| Maximum number of order depth data in asks or bids | [optional] [default to 10] + **side** | **str**| All bids or asks. Both included in not specified | [optional] + **account** | **str**| Specify account type. Default to all account types being included | [optional] ### Return type -[**OrderBook**](OrderBook.md) +[**list[Order]**](Order.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers @@ -726,14 +778,16 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Successfully retrieved | - | +**200** | Batch cancellation request accepted. Query order status by listing orders | - | [[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) +# **cancel_batch_orders** +> list[CancelOrderResult] cancel_batch_orders(cancel_order) -List orders +Cancel a batch of orders with an ID list + +Multiple currency pairs can be specified, but maximum 20 orders are allowed per request ### Example @@ -759,31 +813,25 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.SpotApi(api_client) -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 in one list (optional) (default to 100) +cancel_order = [{"currency_pair":"BTC_USDT","id":"123456"}] # list[CancelOrder] | try: - # List orders - api_response = api_instance.list_orders(currency_pair, status, page=page, limit=limit) + # Cancel a batch of orders with an ID list + api_response = api_instance.cancel_batch_orders(cancel_order) print(api_response) except ApiException as e: - print("Exception when calling SpotApi->list_orders: %s\n" % e) + print("Exception when calling SpotApi->cancel_batch_orders: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **currency_pair** | **str**| Currency pair | - **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 in one list | [optional] [default to 100] + **cancel_order** | [**list[CancelOrder]**](CancelOrder.md)| | ### Return type -[**list[Order]**](Order.md) +[**list[CancelOrderResult]**](CancelOrderResult.md) ### Authorization @@ -791,20 +839,20 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**200** | Batch cancellation completed | - | [[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_spot_accounts** -> list[SpotAccount] list_spot_accounts(currency=currency) +# **get_order** +> Order get_order(order_id, currency_pair) -List spot accounts +Get a single order ### Example @@ -830,25 +878,27 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.SpotApi(api_client) -currency = 'BTC' # str | Retrieved specified currency related data (optional) +order_id = '12345' # str | ID returned on order successfully being created +currency_pair = 'BTC_USDT' # str | Currency pair try: - # List spot accounts - api_response = api_instance.list_spot_accounts(currency=currency) + # Get a single order + api_response = api_instance.get_order(order_id, currency_pair) print(api_response) except ApiException as e: - print("Exception when calling SpotApi->list_spot_accounts: %s\n" % e) + print("Exception when calling SpotApi->get_order: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **currency** | **str**| Retrieved specified currency related data | [optional] + **order_id** | **str**| ID returned on order successfully being created | + **currency_pair** | **str**| Currency pair | ### Return type -[**list[SpotAccount]**](SpotAccount.md) +[**Order**](Order.md) ### Authorization @@ -862,55 +912,64 @@ Name | Type | Description | Notes ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**200** | Detail 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_tickers** -> list[Ticker] list_tickers(currency_pair=currency_pair) - -Retrieve ticker information +# **cancel_order** +> Order cancel_order(order_id, currency_pair) -Return only related data if `currency_pair` is specified; otherwise return all of them +Cancel a single order ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + 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.SpotApi(api_client) -currency_pair = 'BTC_USDT' # str | Currency pair (optional) +order_id = '12345' # str | ID returned on order successfully being created +currency_pair = 'BTC_USDT' # str | Currency pair try: - # Retrieve ticker information - api_response = api_instance.list_tickers(currency_pair=currency_pair) + # Cancel a single order + api_response = api_instance.cancel_order(order_id, currency_pair) print(api_response) except ApiException as e: - print("Exception when calling SpotApi->list_tickers: %s\n" % e) + print("Exception when calling SpotApi->cancel_order: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **currency_pair** | **str**| Currency pair | [optional] + **order_id** | **str**| ID returned on order successfully being created | + **currency_pair** | **str**| Currency pair | ### Return type -[**list[Ticker]**](Ticker.md) +[**Order**](Order.md) ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers @@ -920,25 +979,34 @@ No authorization required ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Successfully retrieved | - | +**200** | Order cancelled | - | [[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_trades** -> list[Trade] list_trades(currency_pair, limit=limit, last_id=last_id) +# **list_my_trades** +> list[Trade] list_my_trades(currency_pair, limit=limit, page=page, order_id=order_id) -Retrieve market trades +List personal trading history ### Example +* Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException # 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" + host = "https://api.gateio.ws/api/v4", + key = "YOU_API_KEY", + secret = "YOUR_API_SECRET" ) api_client = gate_api.ApiClient(configuration) @@ -946,14 +1014,15 @@ api_client = gate_api.ApiClient(configuration) api_instance = gate_api.SpotApi(api_client) currency_pair = 'BTC_USDT' # str | Currency pair limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) -last_id = '12345' # str | Specify list staring point using the `id` of last record in previous list-query results (optional) +page = 1 # int | Page number (optional) (default to 1) +order_id = '12345' # str | List all trades of specified order (optional) try: - # Retrieve market trades - api_response = api_instance.list_trades(currency_pair, limit=limit, last_id=last_id) + # List personal trading history + api_response = api_instance.list_my_trades(currency_pair, limit=limit, page=page, order_id=order_id) print(api_response) except ApiException as e: - print("Exception when calling SpotApi->list_trades: %s\n" % e) + print("Exception when calling SpotApi->list_my_trades: %s\n" % e) ``` ### Parameters @@ -962,7 +1031,8 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **currency_pair** | **str**| Currency pair | **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] - **last_id** | **str**| Specify list staring point using the `id` of last record in previous list-query results | [optional] + **page** | **int**| Page number | [optional] [default to 1] + **order_id** | **str**| List all trades of specified order | [optional] ### Return type @@ -970,7 +1040,7 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[apiv4](../README.md#apiv4) ### HTTP request headers diff --git a/docs/Transfer.md b/docs/Transfer.md index 2c7e018..9106bf6 100644 --- a/docs/Transfer.md +++ b/docs/Transfer.md @@ -4,6 +4,8 @@ Accounts available to transfer: - `spot`: spot account - `margin`: margin accou ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**id** | **str** | Transfer ID | [optional] [readonly] +**created_at** | **str** | Timestamp when the transfer occurred | [optional] [readonly] **currency** | **str** | Transfer currency. For futures account, `currency` can be set to `POINT` or settle currency | **_from** | **str** | Account transferred from | **to** | **str** | Account transferred to | diff --git a/docs/WalletApi.md b/docs/WalletApi.md index d2114f3..2a31068 100644 --- a/docs/WalletApi.md +++ b/docs/WalletApi.md @@ -5,10 +5,10 @@ All URIs are relative to *https://api.gateio.ws/api/v4* Method | HTTP request | Description ------------- | ------------- | ------------- [**get_deposit_address**](WalletApi.md#get_deposit_address) | **GET** /wallet/deposit_address | Generate currency deposit address +[**list_withdrawals**](WalletApi.md#list_withdrawals) | **GET** /wallet/withdrawals | Retrieve withdrawal records [**list_deposits**](WalletApi.md#list_deposits) | **GET** /wallet/deposits | Retrieve deposit records +[**transfer**](WalletApi.md#transfer) | **POST** /wallet/transfers | Transfer between trading accounts [**list_sub_account_transfers**](WalletApi.md#list_sub_account_transfers) | **GET** /wallet/sub_account_transfers | Transfer records between main and sub accounts -[**list_withdrawals**](WalletApi.md#list_withdrawals) | **GET** /wallet/withdrawals | Retrieve withdrawal records -[**transfer**](WalletApi.md#transfer) | **POST** /wallet/transfers | Transfer between accounts [**transfer_with_sub_account**](WalletApi.md#transfer_with_sub_account) | **POST** /wallet/sub_account_transfers | Transfer between main and sub accounts @@ -77,10 +77,10 @@ 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_deposits** -> list[LedgerRecord] list_deposits(currency=currency, _from=_from, to=to, limit=limit, offset=offset) +# **list_withdrawals** +> list[LedgerRecord] list_withdrawals(currency=currency, _from=_from, to=to, limit=limit, offset=offset) -Retrieve deposit records +Retrieve withdrawal records Record time range cannot exceed 30 days @@ -115,11 +115,11 @@ limit = 100 # int | Maximum number of records returned in one list (optional) (d offset = 0 # int | List offset, starting from 0 (optional) (default to 0) try: - # Retrieve deposit records - api_response = api_instance.list_deposits(currency=currency, _from=_from, to=to, limit=limit, offset=offset) + # Retrieve withdrawal records + api_response = api_instance.list_withdrawals(currency=currency, _from=_from, to=to, limit=limit, offset=offset) print(api_response) except ApiException as e: - print("Exception when calling WalletApi->list_deposits: %s\n" % e) + print("Exception when calling WalletApi->list_withdrawals: %s\n" % e) ``` ### Parameters @@ -152,12 +152,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_sub_account_transfers** -> list[SubAccountTransfer] list_sub_account_transfers(sub_uid=sub_uid, _from=_from, to=to, limit=limit, offset=offset) +# **list_deposits** +> list[LedgerRecord] list_deposits(currency=currency, _from=_from, to=to, limit=limit, offset=offset) -Transfer records between main and sub accounts +Retrieve deposit records -Record time range cannot exceed 30 days > Note: only records after 2020-04-10 can be retrieved +Record time range cannot exceed 30 days ### Example @@ -183,25 +183,25 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.WalletApi(api_client) -sub_uid = '10003' # str | Sub account user ID. Return records related to all sub accounts if not specified (optional) +currency = 'BTC' # str | Filter by currency. Return all currency records if not specified (optional) _from = 56 # int | Time range beginning, default to 7 days before current time (optional) to = 56 # int | Time range ending, default to current time (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) try: - # Transfer records between main and sub accounts - api_response = api_instance.list_sub_account_transfers(sub_uid=sub_uid, _from=_from, to=to, limit=limit, offset=offset) + # Retrieve deposit records + api_response = api_instance.list_deposits(currency=currency, _from=_from, to=to, limit=limit, offset=offset) print(api_response) except ApiException as e: - print("Exception when calling WalletApi->list_sub_account_transfers: %s\n" % e) + print("Exception when calling WalletApi->list_deposits: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **sub_uid** | **str**| Sub account user ID. Return records related to all sub accounts if not specified | [optional] + **currency** | **str**| Filter by currency. Return all currency records if not specified | [optional] **_from** | **int**| Time range beginning, default to 7 days before current time | [optional] **to** | **int**| Time range ending, default to current time | [optional] **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] @@ -209,7 +209,7 @@ Name | Type | Description | Notes ### Return type -[**list[SubAccountTransfer]**](SubAccountTransfer.md) +[**list[LedgerRecord]**](LedgerRecord.md) ### Authorization @@ -227,12 +227,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_withdrawals** -> list[LedgerRecord] list_withdrawals(currency=currency, _from=_from, to=to, limit=limit, offset=offset) +# **transfer** +> transfer(transfer) -Retrieve withdrawal records +Transfer between trading accounts -Record time range cannot exceed 30 days +Transfer between different accounts. Currently support transfers between the following: 1. spot - margin 2. spot - futures(perpetual) 3. spot - delivery ### Example @@ -258,33 +258,24 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.WalletApi(api_client) -currency = 'BTC' # str | Filter by currency. Return all currency records if not specified (optional) -_from = 56 # int | Time range beginning, default to 7 days before current time (optional) -to = 56 # int | Time range ending, default to current time (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) +transfer = {"id":"129012","created_at":"1596100000","currency":"BTC","from":"spot","to":"margin","amount":"1","currency_pair":"BTC_USDT"} # Transfer | try: - # Retrieve withdrawal records - api_response = api_instance.list_withdrawals(currency=currency, _from=_from, to=to, limit=limit, offset=offset) - print(api_response) + # Transfer between trading accounts + api_instance.transfer(transfer) except ApiException as e: - print("Exception when calling WalletApi->list_withdrawals: %s\n" % e) + print("Exception when calling WalletApi->transfer: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **currency** | **str**| Filter by currency. Return all currency records if not specified | [optional] - **_from** | **int**| Time range beginning, default to 7 days before current time | [optional] - **to** | **int**| Time range ending, default to current time | [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] + **transfer** | [**Transfer**](Transfer.md)| | ### Return type -[**list[LedgerRecord]**](LedgerRecord.md) +void (empty response body) ### Authorization @@ -292,22 +283,22 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json + - **Content-Type**: application/json + - **Accept**: Not defined ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | List retrieved | - | +**204** | Balance transferred | - | [[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) -# **transfer** -> transfer(transfer) +# **list_sub_account_transfers** +> list[SubAccountTransfer] list_sub_account_transfers(sub_uid=sub_uid, _from=_from, to=to, limit=limit, offset=offset) -Transfer between accounts +Transfer records between main and sub accounts -Transfer between different accounts. Currently support transfers between the following: 1. spot - margin 2. spot - futures(perpetual) 2. spot - delivery +Record time range cannot exceed 30 days > Note: only records after 2020-04-10 can be retrieved ### Example @@ -333,24 +324,33 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.WalletApi(api_client) -transfer = {"currency":"BTC","from":"spot","to":"margin","amount":"1","currency_pair":"BTC_USDT"} # Transfer | +sub_uid = '10003' # str | Sub account user ID. Return records related to all sub accounts if not specified (optional) +_from = 56 # int | Time range beginning, default to 7 days before current time (optional) +to = 56 # int | Time range ending, default to current time (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) try: - # Transfer between accounts - api_instance.transfer(transfer) + # Transfer records between main and sub accounts + api_response = api_instance.list_sub_account_transfers(sub_uid=sub_uid, _from=_from, to=to, limit=limit, offset=offset) + print(api_response) except ApiException as e: - print("Exception when calling WalletApi->transfer: %s\n" % e) + print("Exception when calling WalletApi->list_sub_account_transfers: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **transfer** | [**Transfer**](Transfer.md)| | + **sub_uid** | **str**| Sub account user ID. Return records related to all sub accounts if not specified | [optional] + **_from** | **int**| Time range beginning, default to 7 days before current time | [optional] + **to** | **int**| Time range ending, default to current time | [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] ### Return type -void (empty response body) +[**list[SubAccountTransfer]**](SubAccountTransfer.md) ### Authorization @@ -358,13 +358,13 @@ void (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: Not defined + - **Content-Type**: Not defined + - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**204** | Balance transferred | - | +**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) diff --git a/gate_api/__init__.py b/gate_api/__init__.py index 33d593e..831a590 100644 --- a/gate_api/__init__.py +++ b/gate_api/__init__.py @@ -14,7 +14,7 @@ from __future__ import absolute_import -__version__ = "4.15.0" +__version__ = "4.15.1" # import apis into sdk package from gate_api.api.delivery_api import DeliveryApi @@ -56,16 +56,17 @@ from gate_api.models.futures_price_triggered_order import FuturesPriceTriggeredOrder from gate_api.models.futures_ticker import FuturesTicker from gate_api.models.futures_trade import FuturesTrade -from gate_api.models.gate_error_response import GateErrorResponse from gate_api.models.insurance_record import InsuranceRecord from gate_api.models.ledger_record import LedgerRecord from gate_api.models.loan import Loan from gate_api.models.loan_patch import LoanPatch from gate_api.models.loan_record import LoanRecord from gate_api.models.margin_account import MarginAccount +from gate_api.models.margin_account_book import MarginAccountBook from gate_api.models.margin_account_currency import MarginAccountCurrency from gate_api.models.margin_currency_pair import MarginCurrencyPair from gate_api.models.my_futures_trade import MyFuturesTrade +from gate_api.models.open_orders import OpenOrders from gate_api.models.order import Order from gate_api.models.order_book import OrderBook from gate_api.models.position import Position diff --git a/gate_api/api/delivery_api.py b/gate_api/api/delivery_api.py index 2335185..486a2fb 100644 --- a/gate_api/api/delivery_api.py +++ b/gate_api/api/delivery_api.py @@ -36,17 +36,16 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def cancel_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 - """Cancel a single order # noqa: E501 + def list_delivery_contracts(self, settle, **kwargs): # noqa: E501 + """List all futures contracts # 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_delivery_order(settle, order_id, async_req=True) + >>> thread = api.list_delivery_contracts(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str order_id: ID returned on order successfully being created (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -54,24 +53,23 @@ def cancel_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesOrder + :return: list[DeliveryContract] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.cancel_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 + return self.list_delivery_contracts_with_http_info(settle, **kwargs) # noqa: E501 - def cancel_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 - """Cancel a single order # noqa: E501 + def list_delivery_contracts_with_http_info(self, settle, **kwargs): # noqa: E501 + """List all futures contracts # 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_delivery_order_with_http_info(settle, order_id, async_req=True) + >>> thread = api.list_delivery_contracts_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str order_id: ID returned on order successfully being created (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -81,7 +79,7 @@ def cancel_delivery_order_with_http_info(self, settle, order_id, **kwargs): # n number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[DeliveryContract], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -89,8 +87,7 @@ def cancel_delivery_order_with_http_info(self, settle, order_id, **kwargs): # n local_var_params = locals() all_params = [ - 'settle', - 'order_id' + 'settle' ] all_params.extend( [ @@ -105,26 +102,20 @@ def cancel_delivery_order_with_http_info(self, settle, order_id, **kwargs): # n if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method cancel_delivery_order" % key + " to method list_delivery_contracts" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `cancel_delivery_order`") # noqa: E501 - # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_delivery_order`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_contracts`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'order_id' in local_var_params: - path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] @@ -139,17 +130,17 @@ def cancel_delivery_order_with_http_info(self, settle, order_id, **kwargs): # n ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ['apiv4'] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/orders/{order_id}', 'DELETE', + '/delivery/{settle}/contracts', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='FuturesOrder', # noqa: E501 + response_type='list[DeliveryContract]', # 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 @@ -157,19 +148,17 @@ def cancel_delivery_order_with_http_info(self, settle, order_id, **kwargs): # n _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def cancel_delivery_orders(self, settle, contract, **kwargs): # noqa: E501 - """Cancel all `open` orders matched # noqa: E501 + def get_delivery_contract(self, settle, contract, **kwargs): # noqa: E501 + """Get a single contract # noqa: E501 - Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_delivery_orders(settle, contract, async_req=True) + >>> thread = api.get_delivery_contract(settle, contract, 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 side: All bids or asks. Both included in not specified :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -177,26 +166,24 @@ def cancel_delivery_orders(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesOrder] + :return: DeliveryContract If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.cancel_delivery_orders_with_http_info(settle, contract, **kwargs) # noqa: E501 + return self.get_delivery_contract_with_http_info(settle, contract, **kwargs) # noqa: E501 - def cancel_delivery_orders_with_http_info(self, settle, contract, **kwargs): # noqa: E501 - """Cancel all `open` orders matched # noqa: E501 + def get_delivery_contract_with_http_info(self, settle, contract, **kwargs): # noqa: E501 + """Get a single contract # noqa: E501 - Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_delivery_orders_with_http_info(settle, contract, async_req=True) + >>> thread = api.get_delivery_contract_with_http_info(settle, contract, 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 side: All bids or asks. Both included in not specified :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -206,7 +193,7 @@ def cancel_delivery_orders_with_http_info(self, settle, contract, **kwargs): # number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesOrder], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(DeliveryContract, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -215,8 +202,7 @@ def cancel_delivery_orders_with_http_info(self, settle, contract, **kwargs): # all_params = [ 'settle', - 'contract', - 'side' + 'contract' ] all_params.extend( [ @@ -231,30 +217,28 @@ def cancel_delivery_orders_with_http_info(self, settle, contract, **kwargs): # if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method cancel_delivery_orders" % key + " to method get_delivery_contract" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `cancel_delivery_orders`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_delivery_contract`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `cancel_delivery_orders`") # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `get_delivery_contract`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 + if 'contract' in local_var_params: + path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] - if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 - query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 - query_params.append(('side', local_var_params['side'])) # noqa: E501 header_params = {} @@ -267,17 +251,17 @@ def cancel_delivery_orders_with_http_info(self, settle, contract, **kwargs): # ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ['apiv4'] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/orders', 'DELETE', + '/delivery/{settle}/contracts/{contract}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FuturesOrder]', # noqa: E501 + response_type='DeliveryContract', # 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 @@ -285,17 +269,20 @@ def cancel_delivery_orders_with_http_info(self, settle, contract, **kwargs): # _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def cancel_price_triggered_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 - """Cancel a single order # noqa: E501 + def list_delivery_order_book(self, settle, contract, **kwargs): # noqa: E501 + """Futures order book # noqa: E501 + Bids will be sorted by price from high to low, while asks sorted reversely # 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_price_triggered_delivery_order(settle, order_id, async_req=True) + >>> thread = api.list_delivery_order_book(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str order_id: ID returned on order successfully being created (required) + :param str contract: Futures contract (required) + :param str interval: Order depth. 0 means no aggregation is applied. default to 0 + :param int limit: Maximum number of order depth data in asks or bids :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -303,24 +290,27 @@ def cancel_price_triggered_delivery_order(self, settle, order_id, **kwargs): # number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesPriceTriggeredOrder + :return: FuturesOrderBook If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.cancel_price_triggered_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 + return self.list_delivery_order_book_with_http_info(settle, contract, **kwargs) # noqa: E501 - def cancel_price_triggered_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 - """Cancel a single order # noqa: E501 + def list_delivery_order_book_with_http_info(self, settle, contract, **kwargs): # noqa: E501 + """Futures order book # noqa: E501 + Bids will be sorted by price from high to low, while asks sorted reversely # 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_price_triggered_delivery_order_with_http_info(settle, order_id, async_req=True) + >>> thread = api.list_delivery_order_book_with_http_info(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str order_id: ID returned on order successfully being created (required) + :param str contract: Futures contract (required) + :param str interval: Order depth. 0 means no aggregation is applied. default to 0 + :param int limit: Maximum number of order depth data in asks or bids :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -330,7 +320,7 @@ def cancel_price_triggered_delivery_order_with_http_info(self, settle, order_id, number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(FuturesOrderBook, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -339,7 +329,9 @@ def cancel_price_triggered_delivery_order_with_http_info(self, settle, order_id, all_params = [ 'settle', - 'order_id' + 'contract', + 'interval', + 'limit' ] all_params.extend( [ @@ -354,28 +346,36 @@ def cancel_price_triggered_delivery_order_with_http_info(self, settle, order_id, if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method cancel_price_triggered_delivery_order" % key + " to method list_delivery_order_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_delivery_order`") # noqa: E501 - # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_price_triggered_delivery_order`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_order_book`") # noqa: E501 + # verify the required parameter 'contract' is set + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `list_delivery_order_book`") # noqa: E501 + if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 20: # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_delivery_order_book`, must be a value less than or equal to `20`") # 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_delivery_order_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'order_id' in local_var_params: - path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 + query_params.append(('contract', local_var_params['contract'])) # noqa: E501 + if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 + query_params.append(('interval', local_var_params['interval'])) # 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 header_params = {} @@ -388,17 +388,17 @@ def cancel_price_triggered_delivery_order_with_http_info(self, settle, order_id, ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ['apiv4'] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/price_orders/{order_id}', 'DELETE', + '/delivery/{settle}/order_book', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='FuturesPriceTriggeredOrder', # noqa: E501 + response_type='FuturesOrderBook', # 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 @@ -406,17 +406,21 @@ def cancel_price_triggered_delivery_order_with_http_info(self, settle, order_id, _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def cancel_price_triggered_delivery_order_list(self, settle, contract, **kwargs): # noqa: E501 - """Cancel all open orders # noqa: E501 + def list_delivery_trades(self, settle, contract, **kwargs): # noqa: E501 + """Futures trading history # 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_price_triggered_delivery_order_list(settle, contract, async_req=True) + >>> thread = api.list_delivery_trades(settle, contract, 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 int limit: Maximum number of records returned in one list + :param str last_id: Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range + :param float _from: Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. + :param float to: Specify end time in Unix seconds, default to current time :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -424,24 +428,28 @@ def cancel_price_triggered_delivery_order_list(self, settle, contract, **kwargs) number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesPriceTriggeredOrder] + :return: list[FuturesTrade] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.cancel_price_triggered_delivery_order_list_with_http_info(settle, contract, **kwargs) # noqa: E501 + return self.list_delivery_trades_with_http_info(settle, contract, **kwargs) # noqa: E501 - def cancel_price_triggered_delivery_order_list_with_http_info(self, settle, contract, **kwargs): # noqa: E501 - """Cancel all open orders # noqa: E501 + def list_delivery_trades_with_http_info(self, settle, contract, **kwargs): # noqa: E501 + """Futures trading history # 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_price_triggered_delivery_order_list_with_http_info(settle, contract, async_req=True) + >>> thread = api.list_delivery_trades_with_http_info(settle, contract, 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 int limit: Maximum number of records returned in one list + :param str last_id: Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range + :param float _from: Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. + :param float to: Specify end time in Unix seconds, default to current time :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -451,7 +459,7 @@ def cancel_price_triggered_delivery_order_list_with_http_info(self, settle, cont number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesTrade], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -460,7 +468,11 @@ def cancel_price_triggered_delivery_order_list_with_http_info(self, settle, cont all_params = [ 'settle', - 'contract' + 'contract', + 'limit', + 'last_id', + '_from', + 'to' ] all_params.extend( [ @@ -475,19 +487,23 @@ def cancel_price_triggered_delivery_order_list_with_http_info(self, settle, cont if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method cancel_price_triggered_delivery_order_list" % key + " to method list_delivery_trades" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_delivery_order_list`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_trades`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `cancel_price_triggered_delivery_order_list`") # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `list_delivery_trades`") # 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_delivery_trades`, 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_delivery_trades`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -497,6 +513,14 @@ def cancel_price_triggered_delivery_order_list_with_http_info(self, settle, cont query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # 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 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 + query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 + if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 + query_params.append(('from', local_var_params['_from'])) # noqa: E501 + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 + query_params.append(('to', local_var_params['to'])) # noqa: E501 header_params = {} @@ -509,17 +533,17 @@ def cancel_price_triggered_delivery_order_list_with_http_info(self, settle, cont ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ['apiv4'] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/price_orders', 'DELETE', + '/delivery/{settle}/trades', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FuturesPriceTriggeredOrder]', # noqa: E501 + response_type='list[FuturesTrade]', # 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 @@ -527,18 +551,22 @@ def cancel_price_triggered_delivery_order_list_with_http_info(self, settle, cont _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def create_delivery_order(self, settle, futures_order, **kwargs): # noqa: E501 - """Create a futures order # noqa: E501 + def list_delivery_candlesticks(self, settle, contract, **kwargs): # noqa: E501 + """Get futures candlesticks # noqa: E501 - Zero-fill order cannot be retrieved 60 seconds after cancellation # noqa: E501 + Return specified contract candlesticks. If prefix `contract` with `mark_`, the contract's mark price candlesticks are returned; if prefix with `index_`, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` # 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_delivery_order(settle, futures_order, async_req=True) + >>> thread = api.list_delivery_candlesticks(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param FuturesOrder futures_order: (required) + :param str contract: Futures contract (required) + :param float _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified + :param float to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time + :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. + :param str interval: Interval time between data points :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -546,25 +574,29 @@ def create_delivery_order(self, settle, futures_order, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesOrder + :return: list[FuturesCandlestick] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.create_delivery_order_with_http_info(settle, futures_order, **kwargs) # noqa: E501 + return self.list_delivery_candlesticks_with_http_info(settle, contract, **kwargs) # noqa: E501 - def create_delivery_order_with_http_info(self, settle, futures_order, **kwargs): # noqa: E501 - """Create a futures order # noqa: E501 + def list_delivery_candlesticks_with_http_info(self, settle, contract, **kwargs): # noqa: E501 + """Get futures candlesticks # noqa: E501 - Zero-fill order cannot be retrieved 60 seconds after cancellation # noqa: E501 + Return specified contract candlesticks. If prefix `contract` with `mark_`, the contract's mark price candlesticks are returned; if prefix with `index_`, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` # 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_delivery_order_with_http_info(settle, futures_order, async_req=True) + >>> thread = api.list_delivery_candlesticks_with_http_info(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param FuturesOrder futures_order: (required) + :param str contract: Futures contract (required) + :param float _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified + :param float to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time + :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. + :param str interval: Interval time between data points :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -574,7 +606,7 @@ def create_delivery_order_with_http_info(self, settle, futures_order, **kwargs): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesCandlestick], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -583,7 +615,11 @@ def create_delivery_order_with_http_info(self, settle, futures_order, **kwargs): all_params = [ 'settle', - 'futures_order' + 'contract', + '_from', + 'to', + 'limit', + 'interval' ] all_params.extend( [ @@ -598,19 +634,21 @@ def create_delivery_order_with_http_info(self, settle, futures_order, **kwargs): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method create_delivery_order" % key + " to method list_delivery_candlesticks" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `create_delivery_order`") # noqa: E501 - # verify the required parameter 'futures_order' is set - if self.api_client.client_side_validation and ('futures_order' not in local_var_params or # noqa: E501 - local_var_params['futures_order'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `futures_order` when calling `create_delivery_order`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_candlesticks`") # noqa: E501 + # verify the required parameter 'contract' is set + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `list_delivery_candlesticks`") # noqa: E501 + if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 2000: # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_delivery_candlesticks`, must be a value less than or equal to `2000`") # noqa: E501 collection_formats = {} path_params = {} @@ -618,35 +656,39 @@ def create_delivery_order_with_http_info(self, settle, futures_order, **kwargs): path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - - header_params = {} + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 + query_params.append(('contract', local_var_params['contract'])) # noqa: E501 + if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 + query_params.append(('from', local_var_params['_from'])) # noqa: E501 + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 + query_params.append(('to', local_var_params['to'])) # 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 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 + query_params.append(('interval', local_var_params['interval'])) # noqa: E501 + + header_params = {} form_params = [] local_var_files = {} body_params = None - if 'futures_order' in local_var_params: - body_params = local_var_params['futures_order'] # 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 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/orders', 'POST', + '/delivery/{settle}/candlesticks', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='FuturesOrder', # noqa: E501 + response_type='list[FuturesCandlestick]', # 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 @@ -654,17 +696,17 @@ def create_delivery_order_with_http_info(self, settle, futures_order, **kwargs): _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def create_price_triggered_delivery_order(self, settle, futures_price_triggered_order, **kwargs): # noqa: E501 - """Create a price-triggered order # noqa: E501 + def list_delivery_tickers(self, settle, **kwargs): # noqa: E501 + """List futures tickers # 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_price_triggered_delivery_order(settle, futures_price_triggered_order, async_req=True) + >>> thread = api.list_delivery_tickers(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param FuturesPriceTriggeredOrder futures_price_triggered_order: (required) + :param str contract: Futures contract :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -672,24 +714,24 @@ def create_price_triggered_delivery_order(self, settle, futures_price_triggered_ number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: TriggerOrderResponse + :return: list[FuturesTicker] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.create_price_triggered_delivery_order_with_http_info(settle, futures_price_triggered_order, **kwargs) # noqa: E501 + return self.list_delivery_tickers_with_http_info(settle, **kwargs) # noqa: E501 - def create_price_triggered_delivery_order_with_http_info(self, settle, futures_price_triggered_order, **kwargs): # noqa: E501 - """Create a price-triggered order # noqa: E501 + def list_delivery_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 + """List futures tickers # 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_price_triggered_delivery_order_with_http_info(settle, futures_price_triggered_order, async_req=True) + >>> thread = api.list_delivery_tickers_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param FuturesPriceTriggeredOrder futures_price_triggered_order: (required) + :param str contract: Futures contract :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -699,7 +741,7 @@ def create_price_triggered_delivery_order_with_http_info(self, settle, futures_p number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(TriggerOrderResponse, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesTicker], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -708,7 +750,7 @@ def create_price_triggered_delivery_order_with_http_info(self, settle, futures_p all_params = [ 'settle', - 'futures_price_triggered_order' + 'contract' ] all_params.extend( [ @@ -723,18 +765,14 @@ def create_price_triggered_delivery_order_with_http_info(self, settle, futures_p if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method create_price_triggered_delivery_order" % key + " to method list_delivery_tickers" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `create_price_triggered_delivery_order`") # noqa: E501 - # verify the required parameter 'futures_price_triggered_order' is set - if self.api_client.client_side_validation and ('futures_price_triggered_order' not in local_var_params or # noqa: E501 - local_var_params['futures_price_triggered_order'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `futures_price_triggered_order` when calling `create_price_triggered_delivery_order`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_tickers`") # noqa: E501 collection_formats = {} @@ -743,6 +781,8 @@ def create_price_triggered_delivery_order_with_http_info(self, settle, futures_p path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 + query_params.append(('contract', local_var_params['contract'])) # noqa: E501 header_params = {} @@ -750,28 +790,22 @@ def create_price_triggered_delivery_order_with_http_info(self, settle, futures_p local_var_files = {} body_params = None - if 'futures_price_triggered_order' in local_var_params: - body_params = local_var_params['futures_price_triggered_order'] # 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 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/price_orders', 'POST', + '/delivery/{settle}/tickers', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='TriggerOrderResponse', # noqa: E501 + response_type='list[FuturesTicker]', # 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 @@ -779,17 +813,17 @@ def create_price_triggered_delivery_order_with_http_info(self, settle, futures_p _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def get_delivery_contract(self, settle, contract, **kwargs): # noqa: E501 - """Get a single contract # noqa: E501 + def list_delivery_insurance_ledger(self, settle, **kwargs): # noqa: E501 + """Futures insurance balance history # 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_delivery_contract(settle, contract, async_req=True) + >>> thread = api.list_delivery_insurance_ledger(settle, 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 int limit: Maximum number of records returned in one list :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -797,24 +831,24 @@ def get_delivery_contract(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: DeliveryContract + :return: list[InsuranceRecord] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_delivery_contract_with_http_info(settle, contract, **kwargs) # noqa: E501 + return self.list_delivery_insurance_ledger_with_http_info(settle, **kwargs) # noqa: E501 - def get_delivery_contract_with_http_info(self, settle, contract, **kwargs): # noqa: E501 - """Get a single contract # noqa: E501 + def list_delivery_insurance_ledger_with_http_info(self, settle, **kwargs): # noqa: E501 + """Futures insurance balance history # 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_delivery_contract_with_http_info(settle, contract, async_req=True) + >>> thread = api.list_delivery_insurance_ledger_with_http_info(settle, 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 int limit: Maximum number of records returned in one list :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -824,7 +858,7 @@ def get_delivery_contract_with_http_info(self, settle, contract, **kwargs): # n number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(DeliveryContract, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[InsuranceRecord], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -833,7 +867,7 @@ def get_delivery_contract_with_http_info(self, settle, contract, **kwargs): # n all_params = [ 'settle', - 'contract' + 'limit' ] all_params.extend( [ @@ -848,28 +882,28 @@ def get_delivery_contract_with_http_info(self, settle, contract, **kwargs): # n if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_delivery_contract" % key + " to method list_delivery_insurance_ledger" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_delivery_contract`") # noqa: E501 - # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `get_delivery_contract`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_insurance_ledger`") # 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_delivery_insurance_ledger`, 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_delivery_insurance_ledger`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'contract' in local_var_params: - path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] + 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 header_params = {} @@ -885,14 +919,14 @@ def get_delivery_contract_with_http_info(self, settle, contract, **kwargs): # n auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/contracts/{contract}', 'GET', + '/delivery/{settle}/insurance', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='DeliveryContract', # noqa: E501 + response_type='list[InsuranceRecord]', # 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 @@ -900,18 +934,16 @@ def get_delivery_contract_with_http_info(self, settle, contract, **kwargs): # n _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def get_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 - """Get a single order # noqa: E501 + def list_delivery_accounts(self, settle, **kwargs): # noqa: E501 + """Query futures account # noqa: E501 - Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_delivery_order(settle, order_id, async_req=True) + >>> thread = api.list_delivery_accounts(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str order_id: ID returned on order successfully being created (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -919,25 +951,23 @@ def get_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesOrder + :return: FuturesAccount If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 + return self.list_delivery_accounts_with_http_info(settle, **kwargs) # noqa: E501 - def get_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 - """Get a single order # noqa: E501 + def list_delivery_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 + """Query futures account # noqa: E501 - Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_delivery_order_with_http_info(settle, order_id, async_req=True) + >>> thread = api.list_delivery_accounts_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str order_id: ID returned on order successfully being created (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -947,7 +977,7 @@ def get_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(FuturesAccount, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -955,8 +985,7 @@ def get_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa local_var_params = locals() all_params = [ - 'settle', - 'order_id' + 'settle' ] all_params.extend( [ @@ -971,26 +1000,20 @@ def get_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_delivery_order" % key + " to method list_delivery_accounts" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_delivery_order`") # noqa: E501 - # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `get_delivery_order`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_accounts`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'order_id' in local_var_params: - path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] @@ -1008,14 +1031,14 @@ def get_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/orders/{order_id}', 'GET', + '/delivery/{settle}/accounts', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='FuturesOrder', # noqa: E501 + response_type='FuturesAccount', # 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 @@ -1023,17 +1046,20 @@ def get_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def get_delivery_position(self, settle, contract, **kwargs): # noqa: E501 - """Get single position # noqa: E501 + def list_delivery_account_book(self, settle, **kwargs): # noqa: E501 + """Query account book # 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_delivery_position(settle, contract, async_req=True) + >>> thread = api.list_delivery_account_book(settle, 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 int limit: Maximum number of records returned in one list + :param int _from: Start timestamp + :param int to: End timestamp + :param str type: Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1041,24 +1067,27 @@ def get_delivery_position(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Position + :return: list[FuturesAccountBook] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_delivery_position_with_http_info(settle, contract, **kwargs) # noqa: E501 + return self.list_delivery_account_book_with_http_info(settle, **kwargs) # noqa: E501 - def get_delivery_position_with_http_info(self, settle, contract, **kwargs): # noqa: E501 - """Get single position # noqa: E501 + def list_delivery_account_book_with_http_info(self, settle, **kwargs): # noqa: E501 + """Query account book # 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_delivery_position_with_http_info(settle, contract, async_req=True) + >>> thread = api.list_delivery_account_book_with_http_info(settle, 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 int limit: Maximum number of records returned in one list + :param int _from: Start timestamp + :param int to: End timestamp + :param str type: Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1068,7 +1097,7 @@ def get_delivery_position_with_http_info(self, settle, contract, **kwargs): # n number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesAccountBook], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1077,7 +1106,10 @@ def get_delivery_position_with_http_info(self, settle, contract, **kwargs): # n all_params = [ 'settle', - 'contract' + 'limit', + '_from', + 'to', + 'type' ] all_params.extend( [ @@ -1092,28 +1124,34 @@ def get_delivery_position_with_http_info(self, settle, contract, **kwargs): # n if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_delivery_position" % key + " to method list_delivery_account_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_delivery_position`") # noqa: E501 - # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `get_delivery_position`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_account_book`") # 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_delivery_account_book`, 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_delivery_account_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'contract' in local_var_params: - path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] + 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 '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 + query_params.append(('from', local_var_params['_from'])) # noqa: E501 + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 + query_params.append(('to', local_var_params['to'])) # noqa: E501 + if 'type' in local_var_params and local_var_params['type'] is not None: # noqa: E501 + query_params.append(('type', local_var_params['type'])) # noqa: E501 header_params = {} @@ -1129,14 +1167,14 @@ def get_delivery_position_with_http_info(self, settle, contract, **kwargs): # n auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/positions/{contract}', 'GET', + '/delivery/{settle}/account_book', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Position', # noqa: E501 + response_type='list[FuturesAccountBook]', # 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 @@ -1144,22 +1182,16 @@ def get_delivery_position_with_http_info(self, settle, contract, **kwargs): # n _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def get_my_delivery_trades(self, settle, **kwargs): # noqa: E501 - """List personal trading history # noqa: E501 + def list_delivery_positions(self, settle, **kwargs): # noqa: E501 + """List all positions of a user # 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_my_delivery_trades(settle, async_req=True) + >>> thread = api.list_delivery_positions(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str contract: Futures contract - :param int order: Futures order ID, return related data only if specified - :param int limit: Maximum number of records returned in one list - :param int offset: List offset, starting from 0 - :param str last_id: Specify list staring point using the `id` of last record in previous list-query results - :param int count_total: Whether to return total number matched. Default to 0(no return) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1167,29 +1199,23 @@ def get_my_delivery_trades(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[MyFuturesTrade] + :return: list[Position] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_my_delivery_trades_with_http_info(settle, **kwargs) # noqa: E501 + return self.list_delivery_positions_with_http_info(settle, **kwargs) # noqa: E501 - def get_my_delivery_trades_with_http_info(self, settle, **kwargs): # noqa: E501 - """List personal trading history # noqa: E501 + def list_delivery_positions_with_http_info(self, settle, **kwargs): # noqa: E501 + """List all positions of a user # 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_my_delivery_trades_with_http_info(settle, async_req=True) + >>> thread = api.list_delivery_positions_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str contract: Futures contract - :param int order: Futures order ID, return related data only if specified - :param int limit: Maximum number of records returned in one list - :param int offset: List offset, starting from 0 - :param str last_id: Specify list staring point using the `id` of last record in previous list-query results - :param int count_total: Whether to return total number matched. Default to 0(no return) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1199,7 +1225,7 @@ def get_my_delivery_trades_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[MyFuturesTrade], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[Position], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1207,13 +1233,7 @@ def get_my_delivery_trades_with_http_info(self, settle, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'settle', - 'contract', - 'order', - 'limit', - 'offset', - 'last_id', - 'count_total' + 'settle' ] all_params.extend( [ @@ -1228,21 +1248,15 @@ def get_my_delivery_trades_with_http_info(self, settle, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_my_delivery_trades" % key + " to method list_delivery_positions" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_my_delivery_trades`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_positions`") # 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 `get_my_delivery_trades`, 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 `get_my_delivery_trades`, 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 `get_my_delivery_trades`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} @@ -1250,18 +1264,6 @@ def get_my_delivery_trades_with_http_info(self, settle, **kwargs): # noqa: E501 path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 - query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'order' in local_var_params and local_var_params['order'] is not None: # noqa: E501 - query_params.append(('order', local_var_params['order'])) # 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 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 - query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 - if 'count_total' in local_var_params and local_var_params['count_total'] is not None: # noqa: E501 - query_params.append(('count_total', local_var_params['count_total'])) # noqa: E501 header_params = {} @@ -1277,14 +1279,14 @@ def get_my_delivery_trades_with_http_info(self, settle, **kwargs): # noqa: E501 auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/my_trades', 'GET', + '/delivery/{settle}/positions', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[MyFuturesTrade]', # noqa: E501 + response_type='list[Position]', # 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 @@ -1292,17 +1294,17 @@ def get_my_delivery_trades_with_http_info(self, settle, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def get_price_triggered_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 - """Get a single order # noqa: E501 + def get_delivery_position(self, settle, contract, **kwargs): # noqa: E501 + """Get single position # 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_price_triggered_delivery_order(settle, order_id, async_req=True) + >>> thread = api.get_delivery_position(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str order_id: ID returned on order successfully being created (required) + :param str contract: Futures contract (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1310,24 +1312,24 @@ def get_price_triggered_delivery_order(self, settle, order_id, **kwargs): # noq number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesPriceTriggeredOrder + :return: Position If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_price_triggered_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 + return self.get_delivery_position_with_http_info(settle, contract, **kwargs) # noqa: E501 - def get_price_triggered_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 - """Get a single order # noqa: E501 + def get_delivery_position_with_http_info(self, settle, contract, **kwargs): # noqa: E501 + """Get single position # 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_price_triggered_delivery_order_with_http_info(settle, order_id, async_req=True) + >>> thread = api.get_delivery_position_with_http_info(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str order_id: ID returned on order successfully being created (required) + :param str contract: Futures contract (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1337,7 +1339,7 @@ def get_price_triggered_delivery_order_with_http_info(self, settle, order_id, ** number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1346,7 +1348,7 @@ def get_price_triggered_delivery_order_with_http_info(self, settle, order_id, ** all_params = [ 'settle', - 'order_id' + 'contract' ] all_params.extend( [ @@ -1361,26 +1363,26 @@ def get_price_triggered_delivery_order_with_http_info(self, settle, order_id, ** if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_price_triggered_delivery_order" % key + " to method get_delivery_position" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_price_triggered_delivery_order`") # noqa: E501 - # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `get_price_triggered_delivery_order`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_delivery_position`") # noqa: E501 + # verify the required parameter 'contract' is set + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `get_delivery_position`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'order_id' in local_var_params: - path_params['order_id'] = local_var_params['order_id'] # noqa: E501 + if 'contract' in local_var_params: + path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] @@ -1398,14 +1400,14 @@ def get_price_triggered_delivery_order_with_http_info(self, settle, order_id, ** auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/price_orders/{order_id}', 'GET', + '/delivery/{settle}/positions/{contract}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='FuturesPriceTriggeredOrder', # noqa: E501 + response_type='Position', # 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 @@ -1413,20 +1415,18 @@ def get_price_triggered_delivery_order_with_http_info(self, settle, order_id, ** _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_delivery_account_book(self, settle, **kwargs): # noqa: E501 - """Query account book # noqa: E501 + def update_delivery_position_margin(self, settle, contract, change, **kwargs): # noqa: E501 + """Update position 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_delivery_account_book(settle, async_req=True) + >>> thread = api.update_delivery_position_margin(settle, contract, change, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param int limit: Maximum number of records returned in one list - :param int _from: Start timestamp - :param int to: End timestamp - :param str type: Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate + :param str contract: Futures contract (required) + :param str change: Margin change. Use positive number to increase margin, negative number otherwise. (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1434,27 +1434,25 @@ def list_delivery_account_book(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesAccountBook] + :return: Position If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_delivery_account_book_with_http_info(settle, **kwargs) # noqa: E501 + return self.update_delivery_position_margin_with_http_info(settle, contract, change, **kwargs) # noqa: E501 - def list_delivery_account_book_with_http_info(self, settle, **kwargs): # noqa: E501 - """Query account book # noqa: E501 + def update_delivery_position_margin_with_http_info(self, settle, contract, change, **kwargs): # noqa: E501 + """Update position 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_delivery_account_book_with_http_info(settle, async_req=True) + >>> thread = api.update_delivery_position_margin_with_http_info(settle, contract, change, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param int limit: Maximum number of records returned in one list - :param int _from: Start timestamp - :param int to: End timestamp - :param str type: Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate + :param str contract: Futures contract (required) + :param str change: Margin change. Use positive number to increase margin, negative number otherwise. (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1464,7 +1462,7 @@ def list_delivery_account_book_with_http_info(self, settle, **kwargs): # noqa: number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesAccountBook], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1473,10 +1471,8 @@ def list_delivery_account_book_with_http_info(self, settle, **kwargs): # noqa: all_params = [ 'settle', - 'limit', - '_from', - 'to', - 'type' + 'contract', + 'change' ] all_params.extend( [ @@ -1491,34 +1487,34 @@ def list_delivery_account_book_with_http_info(self, settle, **kwargs): # noqa: if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_delivery_account_book" % key + " to method update_delivery_position_margin" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_account_book`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `update_delivery_position_margin`") # noqa: E501 + # verify the required parameter 'contract' is set + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `update_delivery_position_margin`") # noqa: E501 + # verify the required parameter 'change' is set + if self.api_client.client_side_validation and ('change' not in local_var_params or # noqa: E501 + local_var_params['change'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `change` when calling `update_delivery_position_margin`") # 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_delivery_account_book`, 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_delivery_account_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 + if 'contract' in local_var_params: + path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] - 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 '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 - query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 - query_params.append(('to', local_var_params['to'])) # noqa: E501 - if 'type' in local_var_params and local_var_params['type'] is not None: # noqa: E501 - query_params.append(('type', local_var_params['type'])) # noqa: E501 + 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 header_params = {} @@ -1534,14 +1530,14 @@ def list_delivery_account_book_with_http_info(self, settle, **kwargs): # noqa: auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/account_book', 'GET', + '/delivery/{settle}/positions/{contract}/margin', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FuturesAccountBook]', # noqa: E501 + response_type='Position', # 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 @@ -1549,16 +1545,18 @@ def list_delivery_account_book_with_http_info(self, settle, **kwargs): # noqa: _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_delivery_accounts(self, settle, **kwargs): # noqa: E501 - """Query futures account # noqa: E501 + def update_delivery_position_leverage(self, settle, contract, leverage, **kwargs): # noqa: E501 + """Update position leverage # 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_delivery_accounts(settle, async_req=True) + >>> thread = api.update_delivery_position_leverage(settle, contract, leverage, 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 leverage: New position leverage (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1566,23 +1564,25 @@ def list_delivery_accounts(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesAccount + :return: Position If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_delivery_accounts_with_http_info(settle, **kwargs) # noqa: E501 + return self.update_delivery_position_leverage_with_http_info(settle, contract, leverage, **kwargs) # noqa: E501 - def list_delivery_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 - """Query futures account # noqa: E501 + def update_delivery_position_leverage_with_http_info(self, settle, contract, leverage, **kwargs): # noqa: E501 + """Update position leverage # 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_delivery_accounts_with_http_info(settle, async_req=True) + >>> thread = api.update_delivery_position_leverage_with_http_info(settle, contract, leverage, 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 leverage: New position leverage (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1592,7 +1592,7 @@ def list_delivery_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesAccount, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1600,7 +1600,9 @@ def list_delivery_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'settle' + 'settle', + 'contract', + 'leverage' ] all_params.extend( [ @@ -1615,22 +1617,34 @@ def list_delivery_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_delivery_accounts" % key + " to method update_delivery_position_leverage" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_accounts`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `update_delivery_position_leverage`") # noqa: E501 + # verify the required parameter 'contract' is set + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `update_delivery_position_leverage`") # noqa: E501 + # verify the required parameter 'leverage' is set + if self.api_client.client_side_validation and ('leverage' not in local_var_params or # noqa: E501 + local_var_params['leverage'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `leverage` when calling `update_delivery_position_leverage`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 + if 'contract' in local_var_params: + path_params['contract'] = local_var_params['contract'] # noqa: E501 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 header_params = {} @@ -1646,14 +1660,14 @@ def list_delivery_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/accounts', 'GET', + '/delivery/{settle}/positions/{contract}/leverage', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='FuturesAccount', # noqa: E501 + response_type='Position', # 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 @@ -1661,22 +1675,18 @@ def list_delivery_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_delivery_candlesticks(self, settle, contract, **kwargs): # noqa: E501 - """Get futures candlesticks # noqa: E501 + def update_delivery_position_risk_limit(self, settle, contract, risk_limit, **kwargs): # noqa: E501 + """Update position risk limit # noqa: E501 - Return specified contract candlesticks. If prefix `contract` with `mark_`, the contract's mark price candlesticks are returned; if prefix with `index_`, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` # 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_delivery_candlesticks(settle, contract, async_req=True) + >>> thread = api.update_delivery_position_risk_limit(settle, contract, risk_limit, 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 float _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified - :param float to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time - :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. - :param str interval: Interval time between data points + :param str risk_limit: New position risk limit (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1684,29 +1694,25 @@ def list_delivery_candlesticks(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesCandlestick] + :return: Position If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_delivery_candlesticks_with_http_info(settle, contract, **kwargs) # noqa: E501 + return self.update_delivery_position_risk_limit_with_http_info(settle, contract, risk_limit, **kwargs) # noqa: E501 - def list_delivery_candlesticks_with_http_info(self, settle, contract, **kwargs): # noqa: E501 - """Get futures candlesticks # noqa: E501 + def update_delivery_position_risk_limit_with_http_info(self, settle, contract, risk_limit, **kwargs): # noqa: E501 + """Update position risk limit # noqa: E501 - Return specified contract candlesticks. If prefix `contract` with `mark_`, the contract's mark price candlesticks are returned; if prefix with `index_`, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` # 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_delivery_candlesticks_with_http_info(settle, contract, async_req=True) + >>> thread = api.update_delivery_position_risk_limit_with_http_info(settle, contract, risk_limit, 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 float _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified - :param float to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time - :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. - :param str interval: Interval time between data points + :param str risk_limit: New position risk limit (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1716,7 +1722,7 @@ def list_delivery_candlesticks_with_http_info(self, settle, contract, **kwargs): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesCandlestick], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1726,10 +1732,7 @@ def list_delivery_candlesticks_with_http_info(self, settle, contract, **kwargs): all_params = [ 'settle', 'contract', - '_from', - 'to', - 'limit', - 'interval' + 'risk_limit' ] all_params.extend( [ @@ -1744,38 +1747,34 @@ def list_delivery_candlesticks_with_http_info(self, settle, contract, **kwargs): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_delivery_candlesticks" % key + " to method update_delivery_position_risk_limit" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_candlesticks`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `update_delivery_position_risk_limit`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `list_delivery_candlesticks`") # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `update_delivery_position_risk_limit`") # noqa: E501 + # verify the required parameter 'risk_limit' is set + if self.api_client.client_side_validation and ('risk_limit' not in local_var_params or # noqa: E501 + local_var_params['risk_limit'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `risk_limit` when calling `update_delivery_position_risk_limit`") # noqa: E501 - if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 2000: # noqa: E501 - raise ApiValueError("Invalid value for parameter `limit` when calling `list_delivery_candlesticks`, must be a value less than or equal to `2000`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 + if 'contract' in local_var_params: + path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] - if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 - query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 - query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 - query_params.append(('to', local_var_params['to'])) # 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 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 - query_params.append(('interval', local_var_params['interval'])) # noqa: E501 + if 'risk_limit' in local_var_params and local_var_params['risk_limit'] is not None: # noqa: E501 + query_params.append(('risk_limit', local_var_params['risk_limit'])) # noqa: E501 header_params = {} @@ -1788,17 +1787,17 @@ def list_delivery_candlesticks_with_http_info(self, settle, contract, **kwargs): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/candlesticks', 'GET', + '/delivery/{settle}/positions/{contract}/risk_limit', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FuturesCandlestick]', # noqa: E501 + response_type='Position', # 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 @@ -1806,40 +1805,54 @@ def list_delivery_candlesticks_with_http_info(self, settle, contract, **kwargs): _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_delivery_contracts(self, settle, **kwargs): # noqa: E501 - """List all futures contracts # noqa: E501 + def list_delivery_orders(self, settle, status, **kwargs): # noqa: E501 + """List futures orders # noqa: E501 + Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_delivery_contracts(settle, async_req=True) + >>> thread = api.list_delivery_orders(settle, status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (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 + :param str status: List orders based on status (required) + :param str contract: Futures contract + :param int limit: Maximum number of records returned in one list + :param int offset: List offset, starting from 0 + :param str last_id: Specify list staring point using the `id` of last record in previous list-query results + :param int count_total: Whether to return total number matched. Default to 0(no return) + :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. - :return: list[DeliveryContract] + :return: list[FuturesOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_delivery_contracts_with_http_info(settle, **kwargs) # noqa: E501 + return self.list_delivery_orders_with_http_info(settle, status, **kwargs) # noqa: E501 - def list_delivery_contracts_with_http_info(self, settle, **kwargs): # noqa: E501 - """List all futures contracts # noqa: E501 + def list_delivery_orders_with_http_info(self, settle, status, **kwargs): # noqa: E501 + """List futures orders # noqa: E501 + Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_delivery_contracts_with_http_info(settle, async_req=True) + >>> thread = api.list_delivery_orders_with_http_info(settle, status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) + :param str status: List orders based on status (required) + :param str contract: Futures contract + :param int limit: Maximum number of records returned in one list + :param int offset: List offset, starting from 0 + :param str last_id: Specify list staring point using the `id` of last record in previous list-query results + :param int count_total: Whether to return total number matched. Default to 0(no return) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1849,7 +1862,7 @@ def list_delivery_contracts_with_http_info(self, settle, **kwargs): # noqa: E50 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[DeliveryContract], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1857,7 +1870,13 @@ def list_delivery_contracts_with_http_info(self, settle, **kwargs): # noqa: E50 local_var_params = locals() all_params = [ - 'settle' + 'settle', + 'status', + 'contract', + 'limit', + 'offset', + 'last_id', + 'count_total' ] all_params.extend( [ @@ -1872,15 +1891,25 @@ def list_delivery_contracts_with_http_info(self, settle, **kwargs): # noqa: E50 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_delivery_contracts" % key + " to method list_delivery_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_contracts`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_orders`") # noqa: E501 + # verify the required parameter 'status' is set + if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 + local_var_params['status'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `status` when calling `list_delivery_orders`") # 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_delivery_orders`, 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_delivery_orders`, 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_delivery_orders`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} @@ -1888,6 +1917,18 @@ def list_delivery_contracts_with_http_info(self, settle, **kwargs): # noqa: E50 path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 + query_params.append(('contract', local_var_params['contract'])) # noqa: E501 + 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 '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 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 + query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 + if 'count_total' in local_var_params and local_var_params['count_total'] is not None: # noqa: E501 + query_params.append(('count_total', local_var_params['count_total'])) # noqa: E501 header_params = {} @@ -1900,17 +1941,17 @@ def list_delivery_contracts_with_http_info(self, settle, **kwargs): # noqa: E50 ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/contracts', 'GET', + '/delivery/{settle}/orders', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[DeliveryContract]', # noqa: E501 + response_type='list[FuturesOrder]', # 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 @@ -1918,17 +1959,18 @@ def list_delivery_contracts_with_http_info(self, settle, **kwargs): # noqa: E50 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_delivery_insurance_ledger(self, settle, **kwargs): # noqa: E501 - """Futures insurance balance history # noqa: E501 + def create_delivery_order(self, settle, futures_order, **kwargs): # noqa: E501 + """Create a futures order # noqa: E501 + Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_delivery_insurance_ledger(settle, async_req=True) + >>> thread = api.create_delivery_order(settle, futures_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param int limit: Maximum number of records returned in one list + :param FuturesOrder futures_order: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1936,24 +1978,25 @@ def list_delivery_insurance_ledger(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[InsuranceRecord] + :return: FuturesOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_delivery_insurance_ledger_with_http_info(settle, **kwargs) # noqa: E501 + return self.create_delivery_order_with_http_info(settle, futures_order, **kwargs) # noqa: E501 - def list_delivery_insurance_ledger_with_http_info(self, settle, **kwargs): # noqa: E501 - """Futures insurance balance history # noqa: E501 + def create_delivery_order_with_http_info(self, settle, futures_order, **kwargs): # noqa: E501 + """Create a futures order # noqa: E501 + Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_delivery_insurance_ledger_with_http_info(settle, async_req=True) + >>> thread = api.create_delivery_order_with_http_info(settle, futures_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param int limit: Maximum number of records returned in one list + :param FuturesOrder futures_order: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1963,7 +2006,7 @@ def list_delivery_insurance_ledger_with_http_info(self, settle, **kwargs): # no number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[InsuranceRecord], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1972,7 +2015,7 @@ def list_delivery_insurance_ledger_with_http_info(self, settle, **kwargs): # no all_params = [ 'settle', - 'limit' + 'futures_order' ] all_params.extend( [ @@ -1987,19 +2030,19 @@ def list_delivery_insurance_ledger_with_http_info(self, settle, **kwargs): # no if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_delivery_insurance_ledger" % key + " to method create_delivery_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_insurance_ledger`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `create_delivery_order`") # noqa: E501 + # verify the required parameter 'futures_order' is set + if self.api_client.client_side_validation and ('futures_order' not in local_var_params or # noqa: E501 + local_var_params['futures_order'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `futures_order` when calling `create_delivery_order`") # 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_delivery_insurance_ledger`, 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_delivery_insurance_ledger`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -2007,8 +2050,6 @@ def list_delivery_insurance_ledger_with_http_info(self, settle, **kwargs): # no path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - 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 header_params = {} @@ -2016,22 +2057,28 @@ def list_delivery_insurance_ledger_with_http_info(self, settle, **kwargs): # no local_var_files = {} body_params = None + if 'futures_order' in local_var_params: + body_params = local_var_params['futures_order'] # 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 = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/insurance', 'GET', + '/delivery/{settle}/orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[InsuranceRecord]', # noqa: E501 + response_type='FuturesOrder', # 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 @@ -2039,19 +2086,19 @@ def list_delivery_insurance_ledger_with_http_info(self, settle, **kwargs): # no _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_delivery_liquidates(self, settle, **kwargs): # noqa: E501 - """List liquidation history # noqa: E501 + def cancel_delivery_orders(self, settle, contract, **kwargs): # noqa: E501 + """Cancel all `open` orders matched # noqa: E501 + Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_delivery_liquidates(settle, async_req=True) + >>> thread = api.cancel_delivery_orders(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str contract: Futures contract - :param int limit: Maximum number of records returned in one list - :param int at: Specify a liquidation timestamp + :param str contract: Futures contract (required) + :param str side: All bids or asks. Both included in not specified :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -2059,26 +2106,26 @@ def list_delivery_liquidates(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesLiquidate] + :return: list[FuturesOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_delivery_liquidates_with_http_info(settle, **kwargs) # noqa: E501 + return self.cancel_delivery_orders_with_http_info(settle, contract, **kwargs) # noqa: E501 - def list_delivery_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 - """List liquidation history # noqa: E501 + def cancel_delivery_orders_with_http_info(self, settle, contract, **kwargs): # noqa: E501 + """Cancel all `open` orders matched # noqa: E501 + Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_delivery_liquidates_with_http_info(settle, async_req=True) + >>> thread = api.cancel_delivery_orders_with_http_info(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str contract: Futures contract - :param int limit: Maximum number of records returned in one list - :param int at: Specify a liquidation timestamp + :param str contract: Futures contract (required) + :param str side: All bids or asks. Both included in not specified :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -2088,7 +2135,7 @@ def list_delivery_liquidates_with_http_info(self, settle, **kwargs): # noqa: E5 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesLiquidate], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -2098,8 +2145,7 @@ def list_delivery_liquidates_with_http_info(self, settle, **kwargs): # noqa: E5 all_params = [ 'settle', 'contract', - 'limit', - 'at' + 'side' ] all_params.extend( [ @@ -2114,19 +2160,19 @@ def list_delivery_liquidates_with_http_info(self, settle, **kwargs): # noqa: E5 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_delivery_liquidates" % key + " to method cancel_delivery_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_liquidates`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `cancel_delivery_orders`") # noqa: E501 + # verify the required parameter 'contract' is set + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `cancel_delivery_orders`") # 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_delivery_liquidates`, 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_delivery_liquidates`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -2136,10 +2182,8 @@ def list_delivery_liquidates_with_http_info(self, settle, **kwargs): # noqa: E5 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # 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 'at' in local_var_params and local_var_params['at'] is not None: # noqa: E501 - query_params.append(('at', local_var_params['at'])) # noqa: E501 + if 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 + query_params.append(('side', local_var_params['side'])) # noqa: E501 header_params = {} @@ -2155,14 +2199,14 @@ def list_delivery_liquidates_with_http_info(self, settle, **kwargs): # noqa: E5 auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/liquidates', 'GET', + '/delivery/{settle}/orders', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FuturesLiquidate]', # noqa: E501 + response_type='list[FuturesOrder]', # 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 @@ -2170,20 +2214,18 @@ def list_delivery_liquidates_with_http_info(self, settle, **kwargs): # noqa: E5 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_delivery_order_book(self, settle, contract, **kwargs): # noqa: E501 - """Futures order book # noqa: E501 + def get_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 + """Get a single order # noqa: E501 - Bids will be sorted by price from high to low, while asks sorted reversely # noqa: E501 + Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_delivery_order_book(settle, contract, async_req=True) + >>> thread = api.get_delivery_order(settle, order_id, 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 interval: Order depth. 0 means no aggregation is applied. default to 0 - :param int limit: Maximum number of order depth data in asks or bids + :param str order_id: ID returned on order successfully being created (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -2191,27 +2233,25 @@ def list_delivery_order_book(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesOrderBook + :return: FuturesOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_delivery_order_book_with_http_info(settle, contract, **kwargs) # noqa: E501 + return self.get_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - def list_delivery_order_book_with_http_info(self, settle, contract, **kwargs): # noqa: E501 - """Futures order book # noqa: E501 + def get_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 + """Get a single order # noqa: E501 - Bids will be sorted by price from high to low, while asks sorted reversely # noqa: E501 + Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_delivery_order_book_with_http_info(settle, contract, async_req=True) + >>> thread = api.get_delivery_order_with_http_info(settle, order_id, 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 interval: Order depth. 0 means no aggregation is applied. default to 0 - :param int limit: Maximum number of order depth data in asks or bids + :param str order_id: ID returned on order successfully being created (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -2221,7 +2261,7 @@ def list_delivery_order_book_with_http_info(self, settle, contract, **kwargs): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesOrderBook, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -2230,9 +2270,7 @@ def list_delivery_order_book_with_http_info(self, settle, contract, **kwargs): all_params = [ 'settle', - 'contract', - 'interval', - 'limit' + 'order_id' ] all_params.extend( [ @@ -2247,36 +2285,149 @@ def list_delivery_order_book_with_http_info(self, settle, contract, **kwargs): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_delivery_order_book" % key + " to method get_delivery_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_order_book`") # noqa: E501 - # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `list_delivery_order_book`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_delivery_order`") # noqa: E501 + # verify the required parameter 'order_id' is set + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `get_delivery_order`") # noqa: E501 - if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 20: # noqa: E501 - raise ApiValueError("Invalid value for parameter `limit` when calling `list_delivery_order_book`, must be a value less than or equal to `20`") # 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_delivery_order_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 + if 'order_id' in local_var_params: + path_params['order_id'] = local_var_params['order_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( + '/delivery/{settle}/orders/{order_id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='FuturesOrder', # 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 cancel_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 + """Cancel a single order # 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_delivery_order(settle, order_id, async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param str settle: Settle currency (required) + :param str order_id: ID returned on order successfully being created (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. + :return: FuturesOrder + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.cancel_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 + + def cancel_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 + """Cancel a single order # 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_delivery_order_with_http_info(settle, order_id, async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param str settle: Settle currency (required) + :param str order_id: ID returned on order successfully being created (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. + :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'settle', + 'order_id' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method cancel_delivery_order" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'settle' is set + if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 + local_var_params['settle'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `cancel_delivery_order`") # noqa: E501 + # verify the required parameter 'order_id' is set + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_delivery_order`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'settle' in local_var_params: + path_params['settle'] = local_var_params['settle'] # noqa: E501 + if 'order_id' in local_var_params: + path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] - if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 - query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 - query_params.append(('interval', local_var_params['interval'])) # 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 header_params = {} @@ -2289,17 +2440,17 @@ def list_delivery_order_book_with_http_info(self, settle, contract, **kwargs): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/order_book', 'GET', + '/delivery/{settle}/orders/{order_id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='FuturesOrderBook', # noqa: E501 + response_type='FuturesOrder', # 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 @@ -2307,19 +2458,18 @@ def list_delivery_order_book_with_http_info(self, settle, contract, **kwargs): _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_delivery_orders(self, settle, status, **kwargs): # noqa: E501 - """List futures orders # noqa: E501 + def get_my_delivery_trades(self, settle, **kwargs): # noqa: E501 + """List personal trading history # noqa: E501 - Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_delivery_orders(settle, status, async_req=True) + >>> thread = api.get_my_delivery_trades(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str status: List orders based on status (required) :param str contract: Futures contract + :param int order: Futures order ID, return related data only if specified :param int limit: Maximum number of records returned in one list :param int offset: List offset, starting from 0 :param str last_id: Specify list staring point using the `id` of last record in previous list-query results @@ -2331,26 +2481,25 @@ def list_delivery_orders(self, settle, status, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesOrder] + :return: list[MyFuturesTrade] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_delivery_orders_with_http_info(settle, status, **kwargs) # noqa: E501 + return self.get_my_delivery_trades_with_http_info(settle, **kwargs) # noqa: E501 - def list_delivery_orders_with_http_info(self, settle, status, **kwargs): # noqa: E501 - """List futures orders # noqa: E501 + def get_my_delivery_trades_with_http_info(self, settle, **kwargs): # noqa: E501 + """List personal trading history # noqa: E501 - Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_delivery_orders_with_http_info(settle, status, async_req=True) + >>> thread = api.get_my_delivery_trades_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str status: List orders based on status (required) :param str contract: Futures contract + :param int order: Futures order ID, return related data only if specified :param int limit: Maximum number of records returned in one list :param int offset: List offset, starting from 0 :param str last_id: Specify list staring point using the `id` of last record in previous list-query results @@ -2364,7 +2513,7 @@ def list_delivery_orders_with_http_info(self, settle, status, **kwargs): # noqa number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesOrder], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[MyFuturesTrade], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -2373,8 +2522,8 @@ def list_delivery_orders_with_http_info(self, settle, status, **kwargs): # noqa all_params = [ 'settle', - 'status', 'contract', + 'order', 'limit', 'offset', 'last_id', @@ -2393,25 +2542,21 @@ def list_delivery_orders_with_http_info(self, settle, status, **kwargs): # noqa if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_delivery_orders" % key + " to method get_my_delivery_trades" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_orders`") # noqa: E501 - # verify the required parameter 'status' is set - if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 - local_var_params['status'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `status` when calling `list_delivery_orders`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_my_delivery_trades`") # 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_delivery_orders`, must be a value less than or equal to `1000`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `get_my_delivery_trades`, 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_delivery_orders`, must be a value greater than or equal to `1`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `get_my_delivery_trades`, 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_delivery_orders`, must be a value greater than or equal to `0`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `offset` when calling `get_my_delivery_trades`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} @@ -2421,8 +2566,8 @@ def list_delivery_orders_with_http_info(self, settle, status, **kwargs): # noqa query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - 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 'order' in local_var_params and local_var_params['order'] is not None: # noqa: E501 + query_params.append(('order', local_var_params['order'])) # 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 @@ -2446,14 +2591,14 @@ def list_delivery_orders_with_http_info(self, settle, status, **kwargs): # noqa auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/orders', 'GET', + '/delivery/{settle}/my_trades', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FuturesOrder]', # noqa: E501 + response_type='list[MyFuturesTrade]', # 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 @@ -2587,16 +2732,19 @@ def list_delivery_position_close_with_http_info(self, settle, **kwargs): # noqa _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_delivery_positions(self, settle, **kwargs): # noqa: E501 - """List all positions of a user # noqa: E501 + def list_delivery_liquidates(self, settle, **kwargs): # noqa: E501 + """List liquidation history # 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_delivery_positions(settle, async_req=True) + >>> thread = api.list_delivery_liquidates(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) + :param str contract: Futures contract + :param int limit: Maximum number of records returned in one list + :param int at: Specify a liquidation timestamp :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -2604,23 +2752,26 @@ def list_delivery_positions(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Position] + :return: list[FuturesLiquidate] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_delivery_positions_with_http_info(settle, **kwargs) # noqa: E501 + return self.list_delivery_liquidates_with_http_info(settle, **kwargs) # noqa: E501 - def list_delivery_positions_with_http_info(self, settle, **kwargs): # noqa: E501 - """List all positions of a user # noqa: E501 + def list_delivery_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 + """List liquidation history # 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_delivery_positions_with_http_info(settle, async_req=True) + >>> thread = api.list_delivery_liquidates_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) + :param str contract: Futures contract + :param int limit: Maximum number of records returned in one list + :param int at: Specify a liquidation timestamp :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -2630,7 +2781,7 @@ def list_delivery_positions_with_http_info(self, settle, **kwargs): # noqa: E50 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Position], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesLiquidate], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -2638,7 +2789,10 @@ def list_delivery_positions_with_http_info(self, settle, **kwargs): # noqa: E50 local_var_params = locals() all_params = [ - 'settle' + 'settle', + 'contract', + 'limit', + 'at' ] all_params.extend( [ @@ -2653,15 +2807,19 @@ def list_delivery_positions_with_http_info(self, settle, **kwargs): # noqa: E50 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_delivery_positions" % key + " to method list_delivery_liquidates" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_positions`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_liquidates`") # 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_delivery_liquidates`, 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_delivery_liquidates`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -2669,6 +2827,12 @@ def list_delivery_positions_with_http_info(self, settle, **kwargs): # noqa: E50 path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 + query_params.append(('contract', local_var_params['contract'])) # 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 'at' in local_var_params and local_var_params['at'] is not None: # noqa: E501 + query_params.append(('at', local_var_params['at'])) # noqa: E501 header_params = {} @@ -2684,14 +2848,14 @@ def list_delivery_positions_with_http_info(self, settle, **kwargs): # noqa: E50 auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/positions', 'GET', + '/delivery/{settle}/liquidates', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Position]', # noqa: E501 + response_type='list[FuturesLiquidate]', # 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 @@ -2830,138 +2994,20 @@ def list_delivery_settlements_with_http_info(self, settle, **kwargs): # noqa: E _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_delivery_tickers(self, settle, **kwargs): # noqa: E501 - """List futures tickers # 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_delivery_tickers(settle, async_req=True) - >>> result = thread.get() - - :param bool async_req: execute request asynchronously - :param str settle: Settle currency (required) - :param str contract: Futures contract - :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. - :return: list[FuturesTicker] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - return self.list_delivery_tickers_with_http_info(settle, **kwargs) # noqa: E501 - - def list_delivery_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 - """List futures tickers # 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_delivery_tickers_with_http_info(settle, async_req=True) - >>> result = thread.get() - - :param bool async_req: execute request asynchronously - :param str settle: Settle currency (required) - :param str contract: Futures contract - :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. - :return: tuple(list[FuturesTicker], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. - """ - - local_var_params = locals() - - all_params = [ - 'settle', - 'contract' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_delivery_tickers" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_tickers`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'settle' in local_var_params: - path_params['settle'] = local_var_params['settle'] # noqa: E501 - - query_params = [] - if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 - query_params.append(('contract', local_var_params['contract'])) # 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 = [] # noqa: E501 - - return self.api_client.call_api( - '/delivery/{settle}/tickers', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[FuturesTicker]', # 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_delivery_trades(self, settle, contract, **kwargs): # noqa: E501 - """Futures trading history # noqa: E501 + def list_price_triggered_delivery_orders(self, settle, status, **kwargs): # noqa: E501 + """List all auto orders # 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_delivery_trades(settle, contract, async_req=True) + >>> thread = api.list_price_triggered_delivery_orders(settle, status, 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 status: List orders based on status (required) + :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in one list - :param str last_id: Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range - :param float _from: Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. - :param float to: Specify end time in Unix seconds, default to current time + :param int offset: List offset, starting from 0 :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -2969,28 +3015,27 @@ def list_delivery_trades(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesTrade] + :return: list[FuturesPriceTriggeredOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_delivery_trades_with_http_info(settle, contract, **kwargs) # noqa: E501 + return self.list_price_triggered_delivery_orders_with_http_info(settle, status, **kwargs) # noqa: E501 - def list_delivery_trades_with_http_info(self, settle, contract, **kwargs): # noqa: E501 - """Futures trading history # noqa: E501 + def list_price_triggered_delivery_orders_with_http_info(self, settle, status, **kwargs): # noqa: E501 + """List all auto orders # 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_delivery_trades_with_http_info(settle, contract, async_req=True) + >>> thread = api.list_price_triggered_delivery_orders_with_http_info(settle, status, 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 status: List orders based on status (required) + :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in one list - :param str last_id: Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range - :param float _from: Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. - :param float to: Specify end time in Unix seconds, default to current time + :param int offset: List offset, starting from 0 :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -3000,7 +3045,7 @@ def list_delivery_trades_with_http_info(self, settle, contract, **kwargs): # no number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesTrade], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -3009,11 +3054,10 @@ def list_delivery_trades_with_http_info(self, settle, contract, **kwargs): # no all_params = [ 'settle', + 'status', 'contract', 'limit', - 'last_id', - '_from', - 'to' + 'offset' ] all_params.extend( [ @@ -3028,23 +3072,25 @@ def list_delivery_trades_with_http_info(self, settle, contract, **kwargs): # no if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_delivery_trades" % key + " to method list_price_triggered_delivery_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_trades`") # noqa: E501 - # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `list_delivery_trades`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_price_triggered_delivery_orders`") # noqa: E501 + # verify the required parameter 'status' is set + if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 + local_var_params['status'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `status` when calling `list_price_triggered_delivery_orders`") # 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_delivery_trades`, must be a value less than or equal to `1000`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_price_triggered_delivery_orders`, 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_delivery_trades`, must be a value greater than or equal to `1`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_price_triggered_delivery_orders`, 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_price_triggered_delivery_orders`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} @@ -3052,16 +3098,14 @@ def list_delivery_trades_with_http_info(self, settle, contract, **kwargs): # no path_params['settle'] = local_var_params['settle'] # noqa: E501 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 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # 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 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 - query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 - if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 - query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 - query_params.append(('to', local_var_params['to'])) # 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 header_params = {} @@ -3074,17 +3118,17 @@ def list_delivery_trades_with_http_info(self, settle, contract, **kwargs): # no ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/trades', 'GET', + '/delivery/{settle}/price_orders', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FuturesTrade]', # noqa: E501 + response_type='list[FuturesPriceTriggeredOrder]', # 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 @@ -3092,20 +3136,17 @@ def list_delivery_trades_with_http_info(self, settle, contract, **kwargs): # no _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_price_triggered_delivery_orders(self, settle, status, **kwargs): # noqa: E501 - """List all auto orders # noqa: E501 + def create_price_triggered_delivery_order(self, settle, futures_price_triggered_order, **kwargs): # noqa: E501 + """Create a price-triggered order # 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_price_triggered_delivery_orders(settle, status, async_req=True) + >>> thread = api.create_price_triggered_delivery_order(settle, futures_price_triggered_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str status: List orders based on status (required) - :param str contract: Futures contract, return related data only if specified - :param int limit: Maximum number of records returned in one list - :param int offset: List offset, starting from 0 + :param FuturesPriceTriggeredOrder futures_price_triggered_order: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -3113,27 +3154,24 @@ def list_price_triggered_delivery_orders(self, settle, status, **kwargs): # noq number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesPriceTriggeredOrder] + :return: TriggerOrderResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_price_triggered_delivery_orders_with_http_info(settle, status, **kwargs) # noqa: E501 + return self.create_price_triggered_delivery_order_with_http_info(settle, futures_price_triggered_order, **kwargs) # noqa: E501 - def list_price_triggered_delivery_orders_with_http_info(self, settle, status, **kwargs): # noqa: E501 - """List all auto orders # noqa: E501 + def create_price_triggered_delivery_order_with_http_info(self, settle, futures_price_triggered_order, **kwargs): # noqa: E501 + """Create a price-triggered order # 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_price_triggered_delivery_orders_with_http_info(settle, status, async_req=True) + >>> thread = api.create_price_triggered_delivery_order_with_http_info(settle, futures_price_triggered_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str status: List orders based on status (required) - :param str contract: Futures contract, return related data only if specified - :param int limit: Maximum number of records returned in one list - :param int offset: List offset, starting from 0 + :param FuturesPriceTriggeredOrder futures_price_triggered_order: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -3143,7 +3181,7 @@ def list_price_triggered_delivery_orders_with_http_info(self, settle, status, ** number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(TriggerOrderResponse, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -3152,10 +3190,7 @@ def list_price_triggered_delivery_orders_with_http_info(self, settle, status, ** all_params = [ 'settle', - 'status', - 'contract', - 'limit', - 'offset' + 'futures_price_triggered_order' ] all_params.extend( [ @@ -3170,25 +3205,19 @@ def list_price_triggered_delivery_orders_with_http_info(self, settle, status, ** if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_price_triggered_delivery_orders" % key + " to method create_price_triggered_delivery_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_price_triggered_delivery_orders`") # noqa: E501 - # verify the required parameter 'status' is set - if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 - local_var_params['status'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `status` when calling `list_price_triggered_delivery_orders`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `create_price_triggered_delivery_order`") # noqa: E501 + # verify the required parameter 'futures_price_triggered_order' is set + if self.api_client.client_side_validation and ('futures_price_triggered_order' not in local_var_params or # noqa: E501 + local_var_params['futures_price_triggered_order'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `futures_price_triggered_order` when calling `create_price_triggered_delivery_order`") # 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_price_triggered_delivery_orders`, 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_price_triggered_delivery_orders`, 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_price_triggered_delivery_orders`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} @@ -3196,14 +3225,6 @@ def list_price_triggered_delivery_orders_with_http_info(self, settle, status, ** path_params['settle'] = local_var_params['settle'] # noqa: E501 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 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 - query_params.append(('contract', local_var_params['contract'])) # 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 header_params = {} @@ -3211,22 +3232,28 @@ def list_price_triggered_delivery_orders_with_http_info(self, settle, status, ** local_var_files = {} body_params = None + if 'futures_price_triggered_order' in local_var_params: + body_params = local_var_params['futures_price_triggered_order'] # 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( - '/delivery/{settle}/price_orders', 'GET', + '/delivery/{settle}/price_orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FuturesPriceTriggeredOrder]', # noqa: E501 + response_type='TriggerOrderResponse', # 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 @@ -3234,18 +3261,17 @@ def list_price_triggered_delivery_orders_with_http_info(self, settle, status, ** _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def update_delivery_position_leverage(self, settle, contract, leverage, **kwargs): # noqa: E501 - """Update position leverage # noqa: E501 + def cancel_price_triggered_delivery_order_list(self, settle, contract, **kwargs): # noqa: E501 + """Cancel all open orders # 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_delivery_position_leverage(settle, contract, leverage, async_req=True) + >>> thread = api.cancel_price_triggered_delivery_order_list(settle, contract, 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 leverage: New position leverage (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -3253,25 +3279,24 @@ def update_delivery_position_leverage(self, settle, contract, leverage, **kwargs number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Position + :return: list[FuturesPriceTriggeredOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.update_delivery_position_leverage_with_http_info(settle, contract, leverage, **kwargs) # noqa: E501 + return self.cancel_price_triggered_delivery_order_list_with_http_info(settle, contract, **kwargs) # noqa: E501 - def update_delivery_position_leverage_with_http_info(self, settle, contract, leverage, **kwargs): # noqa: E501 - """Update position leverage # noqa: E501 + def cancel_price_triggered_delivery_order_list_with_http_info(self, settle, contract, **kwargs): # noqa: E501 + """Cancel all open orders # 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_delivery_position_leverage_with_http_info(settle, contract, leverage, async_req=True) + >>> thread = api.cancel_price_triggered_delivery_order_list_with_http_info(settle, contract, 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 leverage: New position leverage (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -3281,7 +3306,7 @@ def update_delivery_position_leverage_with_http_info(self, settle, contract, lev number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -3290,8 +3315,7 @@ def update_delivery_position_leverage_with_http_info(self, settle, contract, lev all_params = [ 'settle', - 'contract', - 'leverage' + 'contract' ] all_params.extend( [ @@ -3306,34 +3330,28 @@ def update_delivery_position_leverage_with_http_info(self, settle, contract, lev if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method update_delivery_position_leverage" % key + " to method cancel_price_triggered_delivery_order_list" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `update_delivery_position_leverage`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_delivery_order_list`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `update_delivery_position_leverage`") # noqa: E501 - # verify the required parameter 'leverage' is set - if self.api_client.client_side_validation and ('leverage' not in local_var_params or # noqa: E501 - local_var_params['leverage'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `leverage` when calling `update_delivery_position_leverage`") # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `cancel_price_triggered_delivery_order_list`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'contract' in local_var_params: - path_params['contract'] = local_var_params['contract'] # noqa: E501 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 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 + query_params.append(('contract', local_var_params['contract'])) # noqa: E501 header_params = {} @@ -3349,14 +3367,14 @@ def update_delivery_position_leverage_with_http_info(self, settle, contract, lev auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/positions/{contract}/leverage', 'POST', + '/delivery/{settle}/price_orders', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Position', # noqa: E501 + response_type='list[FuturesPriceTriggeredOrder]', # 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 @@ -3364,18 +3382,17 @@ def update_delivery_position_leverage_with_http_info(self, settle, contract, lev _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def update_delivery_position_margin(self, settle, contract, change, **kwargs): # noqa: E501 - """Update position margin # noqa: E501 + def get_price_triggered_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 + """Get a single order # 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_delivery_position_margin(settle, contract, change, async_req=True) + >>> thread = api.get_price_triggered_delivery_order(settle, order_id, 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 order_id: ID returned on order successfully being created (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -3383,25 +3400,24 @@ def update_delivery_position_margin(self, settle, contract, change, **kwargs): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Position + :return: FuturesPriceTriggeredOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.update_delivery_position_margin_with_http_info(settle, contract, change, **kwargs) # noqa: E501 + return self.get_price_triggered_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - def update_delivery_position_margin_with_http_info(self, settle, contract, change, **kwargs): # noqa: E501 - """Update position margin # noqa: E501 + def get_price_triggered_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 + """Get a single order # 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_delivery_position_margin_with_http_info(settle, contract, change, async_req=True) + >>> thread = api.get_price_triggered_delivery_order_with_http_info(settle, order_id, 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 order_id: ID returned on order successfully being created (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -3411,7 +3427,7 @@ def update_delivery_position_margin_with_http_info(self, settle, contract, chang number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -3420,8 +3436,7 @@ def update_delivery_position_margin_with_http_info(self, settle, contract, chang all_params = [ 'settle', - 'contract', - 'change' + 'order_id' ] all_params.extend( [ @@ -3436,34 +3451,28 @@ def update_delivery_position_margin_with_http_info(self, settle, contract, chang if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method update_delivery_position_margin" % key + " to method get_price_triggered_delivery_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `update_delivery_position_margin`") # noqa: E501 - # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `update_delivery_position_margin`") # noqa: E501 - # verify the required parameter 'change' is set - if self.api_client.client_side_validation and ('change' not in local_var_params or # noqa: E501 - local_var_params['change'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `change` when calling `update_delivery_position_margin`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_price_triggered_delivery_order`") # noqa: E501 + # verify the required parameter 'order_id' is set + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `get_price_triggered_delivery_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'contract' in local_var_params: - path_params['contract'] = local_var_params['contract'] # noqa: E501 + if 'order_id' in local_var_params: + path_params['order_id'] = local_var_params['order_id'] # noqa: E501 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 header_params = {} @@ -3479,14 +3488,14 @@ def update_delivery_position_margin_with_http_info(self, settle, contract, chang auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/positions/{contract}/margin', 'POST', + '/delivery/{settle}/price_orders/{order_id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Position', # noqa: E501 + response_type='FuturesPriceTriggeredOrder', # 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 @@ -3494,18 +3503,17 @@ def update_delivery_position_margin_with_http_info(self, settle, contract, chang _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def update_delivery_position_risk_limit(self, settle, contract, risk_limit, **kwargs): # noqa: E501 - """Update position risk limit # noqa: E501 + def cancel_price_triggered_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 + """Cancel a single order # 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_delivery_position_risk_limit(settle, contract, risk_limit, async_req=True) + >>> thread = api.cancel_price_triggered_delivery_order(settle, order_id, 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 risk_limit: New position risk limit (required) + :param str order_id: ID returned on order successfully being created (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -3513,25 +3521,24 @@ def update_delivery_position_risk_limit(self, settle, contract, risk_limit, **kw number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Position + :return: FuturesPriceTriggeredOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.update_delivery_position_risk_limit_with_http_info(settle, contract, risk_limit, **kwargs) # noqa: E501 + return self.cancel_price_triggered_delivery_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - def update_delivery_position_risk_limit_with_http_info(self, settle, contract, risk_limit, **kwargs): # noqa: E501 - """Update position risk limit # noqa: E501 + def cancel_price_triggered_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 + """Cancel a single order # 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_delivery_position_risk_limit_with_http_info(settle, contract, risk_limit, async_req=True) + >>> thread = api.cancel_price_triggered_delivery_order_with_http_info(settle, order_id, 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 risk_limit: New position risk limit (required) + :param str order_id: ID returned on order successfully being created (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -3541,7 +3548,7 @@ def update_delivery_position_risk_limit_with_http_info(self, settle, contract, r number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -3550,8 +3557,7 @@ def update_delivery_position_risk_limit_with_http_info(self, settle, contract, r all_params = [ 'settle', - 'contract', - 'risk_limit' + 'order_id' ] all_params.extend( [ @@ -3566,34 +3572,28 @@ def update_delivery_position_risk_limit_with_http_info(self, settle, contract, r if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method update_delivery_position_risk_limit" % key + " to method cancel_price_triggered_delivery_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `update_delivery_position_risk_limit`") # noqa: E501 - # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `update_delivery_position_risk_limit`") # noqa: E501 - # verify the required parameter 'risk_limit' is set - if self.api_client.client_side_validation and ('risk_limit' not in local_var_params or # noqa: E501 - local_var_params['risk_limit'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `risk_limit` when calling `update_delivery_position_risk_limit`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_delivery_order`") # noqa: E501 + # verify the required parameter 'order_id' is set + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_price_triggered_delivery_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'contract' in local_var_params: - path_params['contract'] = local_var_params['contract'] # noqa: E501 + if 'order_id' in local_var_params: + path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] - if 'risk_limit' in local_var_params and local_var_params['risk_limit'] is not None: # noqa: E501 - query_params.append(('risk_limit', local_var_params['risk_limit'])) # noqa: E501 header_params = {} @@ -3609,14 +3609,14 @@ def update_delivery_position_risk_limit_with_http_info(self, settle, contract, r auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/positions/{contract}/risk_limit', 'POST', + '/delivery/{settle}/price_orders/{order_id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Position', # noqa: E501 + response_type='FuturesPriceTriggeredOrder', # 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 diff --git a/gate_api/api/futures_api.py b/gate_api/api/futures_api.py index e6d7a16..8bf4b20 100644 --- a/gate_api/api/futures_api.py +++ b/gate_api/api/futures_api.py @@ -36,17 +36,16 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def cancel_futures_order(self, settle, order_id, **kwargs): # noqa: E501 - """Cancel a single order # noqa: E501 + def list_futures_contracts(self, settle, **kwargs): # noqa: E501 + """List all futures contracts # 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_futures_order(settle, order_id, async_req=True) + >>> thread = api.list_futures_contracts(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str order_id: ID returned on order successfully being created (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -54,24 +53,23 @@ def cancel_futures_order(self, settle, order_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesOrder + :return: list[Contract] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.cancel_futures_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 + return self.list_futures_contracts_with_http_info(settle, **kwargs) # noqa: E501 - def cancel_futures_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 - """Cancel a single order # noqa: E501 + def list_futures_contracts_with_http_info(self, settle, **kwargs): # noqa: E501 + """List all futures contracts # 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_futures_order_with_http_info(settle, order_id, async_req=True) + >>> thread = api.list_futures_contracts_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str order_id: ID returned on order successfully being created (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -81,7 +79,7 @@ def cancel_futures_order_with_http_info(self, settle, order_id, **kwargs): # no number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[Contract], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -89,8 +87,7 @@ def cancel_futures_order_with_http_info(self, settle, order_id, **kwargs): # no local_var_params = locals() all_params = [ - 'settle', - 'order_id' + 'settle' ] all_params.extend( [ @@ -105,26 +102,20 @@ def cancel_futures_order_with_http_info(self, settle, order_id, **kwargs): # no if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method cancel_futures_order" % key + " to method list_futures_contracts" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `cancel_futures_order`") # noqa: E501 - # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_futures_order`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_contracts`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'order_id' in local_var_params: - path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] @@ -139,17 +130,17 @@ def cancel_futures_order_with_http_info(self, settle, order_id, **kwargs): # no ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ['apiv4'] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/orders/{order_id}', 'DELETE', + '/futures/{settle}/contracts', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='FuturesOrder', # noqa: E501 + response_type='list[Contract]', # 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 @@ -157,19 +148,17 @@ def cancel_futures_order_with_http_info(self, settle, order_id, **kwargs): # no _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def cancel_futures_orders(self, settle, contract, **kwargs): # noqa: E501 - """Cancel all `open` orders matched # noqa: E501 + def get_futures_contract(self, settle, contract, **kwargs): # noqa: E501 + """Get a single contract # noqa: E501 - Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_futures_orders(settle, contract, async_req=True) + >>> thread = api.get_futures_contract(settle, contract, 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 side: All bids or asks. Both included in not specified :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -177,26 +166,24 @@ def cancel_futures_orders(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesOrder] + :return: Contract If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.cancel_futures_orders_with_http_info(settle, contract, **kwargs) # noqa: E501 + return self.get_futures_contract_with_http_info(settle, contract, **kwargs) # noqa: E501 - def cancel_futures_orders_with_http_info(self, settle, contract, **kwargs): # noqa: E501 - """Cancel all `open` orders matched # noqa: E501 + def get_futures_contract_with_http_info(self, settle, contract, **kwargs): # noqa: E501 + """Get a single contract # noqa: E501 - Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_futures_orders_with_http_info(settle, contract, async_req=True) + >>> thread = api.get_futures_contract_with_http_info(settle, contract, 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 side: All bids or asks. Both included in not specified :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -206,7 +193,7 @@ def cancel_futures_orders_with_http_info(self, settle, contract, **kwargs): # n number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesOrder], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(Contract, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -215,8 +202,7 @@ def cancel_futures_orders_with_http_info(self, settle, contract, **kwargs): # n all_params = [ 'settle', - 'contract', - 'side' + 'contract' ] all_params.extend( [ @@ -231,30 +217,28 @@ def cancel_futures_orders_with_http_info(self, settle, contract, **kwargs): # n if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method cancel_futures_orders" % key + " to method get_futures_contract" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `cancel_futures_orders`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_futures_contract`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `cancel_futures_orders`") # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `get_futures_contract`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 + if 'contract' in local_var_params: + path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] - if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 - query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 - query_params.append(('side', local_var_params['side'])) # noqa: E501 header_params = {} @@ -267,17 +251,17 @@ def cancel_futures_orders_with_http_info(self, settle, contract, **kwargs): # n ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ['apiv4'] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/orders', 'DELETE', + '/futures/{settle}/contracts/{contract}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FuturesOrder]', # noqa: E501 + response_type='Contract', # 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 @@ -285,17 +269,20 @@ def cancel_futures_orders_with_http_info(self, settle, contract, **kwargs): # n _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def cancel_price_triggered_order(self, settle, order_id, **kwargs): # noqa: E501 - """Cancel a single order # noqa: E501 + def list_futures_order_book(self, settle, contract, **kwargs): # noqa: E501 + """Futures order book # noqa: E501 + Bids will be sorted by price from high to low, while asks sorted reversely # 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_price_triggered_order(settle, order_id, async_req=True) + >>> thread = api.list_futures_order_book(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str order_id: ID returned on order successfully being created (required) + :param str contract: Futures contract (required) + :param str interval: Order depth. 0 means no aggregation is applied. default to 0 + :param int limit: Maximum number of order depth data in asks or bids :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -303,24 +290,27 @@ def cancel_price_triggered_order(self, settle, order_id, **kwargs): # noqa: E50 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesPriceTriggeredOrder + :return: FuturesOrderBook If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.cancel_price_triggered_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 + return self.list_futures_order_book_with_http_info(settle, contract, **kwargs) # noqa: E501 - def cancel_price_triggered_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 - """Cancel a single order # noqa: E501 + def list_futures_order_book_with_http_info(self, settle, contract, **kwargs): # noqa: E501 + """Futures order book # noqa: E501 + Bids will be sorted by price from high to low, while asks sorted reversely # 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_price_triggered_order_with_http_info(settle, order_id, async_req=True) + >>> thread = api.list_futures_order_book_with_http_info(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str order_id: ID returned on order successfully being created (required) + :param str contract: Futures contract (required) + :param str interval: Order depth. 0 means no aggregation is applied. default to 0 + :param int limit: Maximum number of order depth data in asks or bids :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -330,7 +320,7 @@ def cancel_price_triggered_order_with_http_info(self, settle, order_id, **kwargs number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(FuturesOrderBook, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -339,7 +329,9 @@ def cancel_price_triggered_order_with_http_info(self, settle, order_id, **kwargs all_params = [ 'settle', - 'order_id' + 'contract', + 'interval', + 'limit' ] all_params.extend( [ @@ -354,28 +346,36 @@ def cancel_price_triggered_order_with_http_info(self, settle, order_id, **kwargs if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method cancel_price_triggered_order" % key + " to method list_futures_order_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_order`") # noqa: E501 - # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_price_triggered_order`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_order_book`") # noqa: E501 + # verify the required parameter 'contract' is set + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_order_book`") # noqa: E501 + if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 20: # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_order_book`, must be a value less than or equal to `20`") # 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_futures_order_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'order_id' in local_var_params: - path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 + query_params.append(('contract', local_var_params['contract'])) # noqa: E501 + if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 + query_params.append(('interval', local_var_params['interval'])) # 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 header_params = {} @@ -388,17 +388,17 @@ def cancel_price_triggered_order_with_http_info(self, settle, order_id, **kwargs ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ['apiv4'] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/price_orders/{order_id}', 'DELETE', + '/futures/{settle}/order_book', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='FuturesPriceTriggeredOrder', # noqa: E501 + response_type='FuturesOrderBook', # 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 @@ -406,17 +406,21 @@ def cancel_price_triggered_order_with_http_info(self, settle, order_id, **kwargs _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def cancel_price_triggered_order_list(self, settle, contract, **kwargs): # noqa: E501 - """Cancel all open orders # noqa: E501 + def list_futures_trades(self, settle, contract, **kwargs): # noqa: E501 + """Futures trading history # 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_price_triggered_order_list(settle, contract, async_req=True) + >>> thread = api.list_futures_trades(settle, contract, 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 int limit: Maximum number of records returned in one list + :param str last_id: Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range + :param int _from: Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. + :param int to: Specify end time in Unix seconds, default to current time :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -424,24 +428,28 @@ def cancel_price_triggered_order_list(self, settle, contract, **kwargs): # noqa number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesPriceTriggeredOrder] + :return: list[FuturesTrade] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.cancel_price_triggered_order_list_with_http_info(settle, contract, **kwargs) # noqa: E501 + return self.list_futures_trades_with_http_info(settle, contract, **kwargs) # noqa: E501 - def cancel_price_triggered_order_list_with_http_info(self, settle, contract, **kwargs): # noqa: E501 - """Cancel all open orders # noqa: E501 + def list_futures_trades_with_http_info(self, settle, contract, **kwargs): # noqa: E501 + """Futures trading history # 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_price_triggered_order_list_with_http_info(settle, contract, async_req=True) + >>> thread = api.list_futures_trades_with_http_info(settle, contract, 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 int limit: Maximum number of records returned in one list + :param str last_id: Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range + :param int _from: Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. + :param int to: Specify end time in Unix seconds, default to current time :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -451,7 +459,7 @@ def cancel_price_triggered_order_list_with_http_info(self, settle, contract, **k number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesTrade], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -460,7 +468,11 @@ def cancel_price_triggered_order_list_with_http_info(self, settle, contract, **k all_params = [ 'settle', - 'contract' + 'contract', + 'limit', + 'last_id', + '_from', + 'to' ] all_params.extend( [ @@ -475,19 +487,23 @@ def cancel_price_triggered_order_list_with_http_info(self, settle, contract, **k if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method cancel_price_triggered_order_list" % key + " to method list_futures_trades" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_order_list`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_trades`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `cancel_price_triggered_order_list`") # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_trades`") # 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_futures_trades`, 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_futures_trades`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -497,6 +513,14 @@ def cancel_price_triggered_order_list_with_http_info(self, settle, contract, **k query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # 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 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 + query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 + if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 + query_params.append(('from', local_var_params['_from'])) # noqa: E501 + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 + query_params.append(('to', local_var_params['to'])) # noqa: E501 header_params = {} @@ -509,17 +533,17 @@ def cancel_price_triggered_order_list_with_http_info(self, settle, contract, **k ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ['apiv4'] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/price_orders', 'DELETE', + '/futures/{settle}/trades', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FuturesPriceTriggeredOrder]', # noqa: E501 + response_type='list[FuturesTrade]', # 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 @@ -527,18 +551,22 @@ def cancel_price_triggered_order_list_with_http_info(self, settle, contract, **k _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def create_futures_order(self, settle, futures_order, **kwargs): # noqa: E501 - """Create a futures order # noqa: E501 + def list_futures_candlesticks(self, settle, contract, **kwargs): # noqa: E501 + """Get futures candlesticks # noqa: E501 - Zero-fill order cannot be retrieved 60 seconds after cancellation # noqa: E501 + Return specified contract candlesticks. If prefix `contract` with `mark_`, the contract's mark price candlesticks are returned; if prefix with `index_`, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` # 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_futures_order(settle, futures_order, async_req=True) + >>> thread = api.list_futures_candlesticks(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param FuturesOrder futures_order: (required) + :param str contract: Futures contract (required) + :param int _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified + :param int to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time + :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. + :param str interval: Interval time between data points :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -546,25 +574,29 @@ def create_futures_order(self, settle, futures_order, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesOrder + :return: list[FuturesCandlestick] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.create_futures_order_with_http_info(settle, futures_order, **kwargs) # noqa: E501 + return self.list_futures_candlesticks_with_http_info(settle, contract, **kwargs) # noqa: E501 - def create_futures_order_with_http_info(self, settle, futures_order, **kwargs): # noqa: E501 - """Create a futures order # noqa: E501 + def list_futures_candlesticks_with_http_info(self, settle, contract, **kwargs): # noqa: E501 + """Get futures candlesticks # noqa: E501 - Zero-fill order cannot be retrieved 60 seconds after cancellation # noqa: E501 + Return specified contract candlesticks. If prefix `contract` with `mark_`, the contract's mark price candlesticks are returned; if prefix with `index_`, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` # 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_futures_order_with_http_info(settle, futures_order, async_req=True) + >>> thread = api.list_futures_candlesticks_with_http_info(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param FuturesOrder futures_order: (required) + :param str contract: Futures contract (required) + :param int _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified + :param int to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time + :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. + :param str interval: Interval time between data points :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -574,7 +606,7 @@ def create_futures_order_with_http_info(self, settle, futures_order, **kwargs): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesCandlestick], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -583,7 +615,11 @@ def create_futures_order_with_http_info(self, settle, futures_order, **kwargs): all_params = [ 'settle', - 'futures_order' + 'contract', + '_from', + 'to', + 'limit', + 'interval' ] all_params.extend( [ @@ -598,19 +634,21 @@ def create_futures_order_with_http_info(self, settle, futures_order, **kwargs): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method create_futures_order" % key + " to method list_futures_candlesticks" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `create_futures_order`") # noqa: E501 - # verify the required parameter 'futures_order' is set - if self.api_client.client_side_validation and ('futures_order' not in local_var_params or # noqa: E501 - local_var_params['futures_order'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `futures_order` when calling `create_futures_order`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_candlesticks`") # noqa: E501 + # verify the required parameter 'contract' is set + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_candlesticks`") # noqa: E501 + if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 2000: # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_candlesticks`, must be a value less than or equal to `2000`") # noqa: E501 collection_formats = {} path_params = {} @@ -618,6 +656,16 @@ def create_futures_order_with_http_info(self, settle, futures_order, **kwargs): path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 + query_params.append(('contract', local_var_params['contract'])) # noqa: E501 + if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 + query_params.append(('from', local_var_params['_from'])) # noqa: E501 + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 + query_params.append(('to', local_var_params['to'])) # 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 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 + query_params.append(('interval', local_var_params['interval'])) # noqa: E501 header_params = {} @@ -625,28 +673,22 @@ def create_futures_order_with_http_info(self, settle, futures_order, **kwargs): local_var_files = {} body_params = None - if 'futures_order' in local_var_params: - body_params = local_var_params['futures_order'] # 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 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/orders', 'POST', + '/futures/{settle}/candlesticks', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='FuturesOrder', # noqa: E501 + response_type='list[FuturesCandlestick]', # 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 @@ -654,17 +696,17 @@ def create_futures_order_with_http_info(self, settle, futures_order, **kwargs): _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def create_price_triggered_order(self, settle, futures_price_triggered_order, **kwargs): # noqa: E501 - """Create a price-triggered order # noqa: E501 + def list_futures_tickers(self, settle, **kwargs): # noqa: E501 + """List futures tickers # 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_price_triggered_order(settle, futures_price_triggered_order, async_req=True) + >>> thread = api.list_futures_tickers(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param FuturesPriceTriggeredOrder futures_price_triggered_order: (required) + :param str contract: Futures contract, return related data only if specified :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -672,24 +714,24 @@ def create_price_triggered_order(self, settle, futures_price_triggered_order, ** number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: TriggerOrderResponse + :return: list[FuturesTicker] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.create_price_triggered_order_with_http_info(settle, futures_price_triggered_order, **kwargs) # noqa: E501 + return self.list_futures_tickers_with_http_info(settle, **kwargs) # noqa: E501 - def create_price_triggered_order_with_http_info(self, settle, futures_price_triggered_order, **kwargs): # noqa: E501 - """Create a price-triggered order # noqa: E501 + def list_futures_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 + """List futures tickers # 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_price_triggered_order_with_http_info(settle, futures_price_triggered_order, async_req=True) + >>> thread = api.list_futures_tickers_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param FuturesPriceTriggeredOrder futures_price_triggered_order: (required) + :param str contract: Futures contract, return related data only if specified :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -699,7 +741,7 @@ def create_price_triggered_order_with_http_info(self, settle, futures_price_trig number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(TriggerOrderResponse, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesTicker], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -708,7 +750,7 @@ def create_price_triggered_order_with_http_info(self, settle, futures_price_trig all_params = [ 'settle', - 'futures_price_triggered_order' + 'contract' ] all_params.extend( [ @@ -723,18 +765,14 @@ def create_price_triggered_order_with_http_info(self, settle, futures_price_trig if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method create_price_triggered_order" % key + " to method list_futures_tickers" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `create_price_triggered_order`") # noqa: E501 - # verify the required parameter 'futures_price_triggered_order' is set - if self.api_client.client_side_validation and ('futures_price_triggered_order' not in local_var_params or # noqa: E501 - local_var_params['futures_price_triggered_order'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `futures_price_triggered_order` when calling `create_price_triggered_order`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_tickers`") # noqa: E501 collection_formats = {} @@ -743,6 +781,8 @@ def create_price_triggered_order_with_http_info(self, settle, futures_price_trig path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 + query_params.append(('contract', local_var_params['contract'])) # noqa: E501 header_params = {} @@ -750,28 +790,22 @@ def create_price_triggered_order_with_http_info(self, settle, futures_price_trig local_var_files = {} body_params = None - if 'futures_price_triggered_order' in local_var_params: - body_params = local_var_params['futures_price_triggered_order'] # 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 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/price_orders', 'POST', + '/futures/{settle}/tickers', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='TriggerOrderResponse', # noqa: E501 + response_type='list[FuturesTicker]', # 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 @@ -779,17 +813,18 @@ def create_price_triggered_order_with_http_info(self, settle, futures_price_trig _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def get_futures_contract(self, settle, contract, **kwargs): # noqa: E501 - """Get a single contract # noqa: E501 + def list_futures_funding_rate_history(self, settle, contract, **kwargs): # noqa: E501 + """Funding rate history # 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_futures_contract(settle, contract, async_req=True) + >>> thread = api.list_futures_funding_rate_history(settle, contract, 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 int limit: Maximum number of records returned in one list :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -797,24 +832,25 @@ def get_futures_contract(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Contract + :return: list[FundingRateRecord] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_futures_contract_with_http_info(settle, contract, **kwargs) # noqa: E501 + return self.list_futures_funding_rate_history_with_http_info(settle, contract, **kwargs) # noqa: E501 - def get_futures_contract_with_http_info(self, settle, contract, **kwargs): # noqa: E501 - """Get a single contract # noqa: E501 + def list_futures_funding_rate_history_with_http_info(self, settle, contract, **kwargs): # noqa: E501 + """Funding rate history # 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_futures_contract_with_http_info(settle, contract, async_req=True) + >>> thread = api.list_futures_funding_rate_history_with_http_info(settle, contract, 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 int limit: Maximum number of records returned in one list :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -824,7 +860,7 @@ def get_futures_contract_with_http_info(self, settle, contract, **kwargs): # no number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Contract, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FundingRateRecord], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -833,7 +869,8 @@ def get_futures_contract_with_http_info(self, settle, contract, **kwargs): # no all_params = [ 'settle', - 'contract' + 'contract', + 'limit' ] all_params.extend( [ @@ -848,28 +885,34 @@ def get_futures_contract_with_http_info(self, settle, contract, **kwargs): # no if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_futures_contract" % key + " to method list_futures_funding_rate_history" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_futures_contract`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_funding_rate_history`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `get_futures_contract`") # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_funding_rate_history`") # 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_futures_funding_rate_history`, 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_futures_funding_rate_history`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'contract' in local_var_params: - path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] + if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 + query_params.append(('contract', local_var_params['contract'])) # 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 header_params = {} @@ -885,14 +928,14 @@ def get_futures_contract_with_http_info(self, settle, contract, **kwargs): # no auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/contracts/{contract}', 'GET', + '/futures/{settle}/funding_rate', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Contract', # noqa: E501 + response_type='list[FundingRateRecord]', # 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 @@ -900,18 +943,17 @@ def get_futures_contract_with_http_info(self, settle, contract, **kwargs): # no _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def get_futures_order(self, settle, order_id, **kwargs): # noqa: E501 - """Get a single order # noqa: E501 + def list_futures_insurance_ledger(self, settle, **kwargs): # noqa: E501 + """Futures insurance balance history # noqa: E501 - Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_futures_order(settle, order_id, async_req=True) + >>> thread = api.list_futures_insurance_ledger(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str order_id: ID returned on order successfully being created (required) + :param int limit: Maximum number of records returned in one list :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -919,25 +961,24 @@ def get_futures_order(self, settle, order_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesOrder + :return: list[InsuranceRecord] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_futures_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 + return self.list_futures_insurance_ledger_with_http_info(settle, **kwargs) # noqa: E501 - def get_futures_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 - """Get a single order # noqa: E501 + def list_futures_insurance_ledger_with_http_info(self, settle, **kwargs): # noqa: E501 + """Futures insurance balance history # noqa: E501 - Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_futures_order_with_http_info(settle, order_id, async_req=True) + >>> thread = api.list_futures_insurance_ledger_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str order_id: ID returned on order successfully being created (required) + :param int limit: Maximum number of records returned in one list :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -947,7 +988,7 @@ def get_futures_order_with_http_info(self, settle, order_id, **kwargs): # noqa: number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[InsuranceRecord], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -956,7 +997,7 @@ def get_futures_order_with_http_info(self, settle, order_id, **kwargs): # noqa: all_params = [ 'settle', - 'order_id' + 'limit' ] all_params.extend( [ @@ -971,28 +1012,28 @@ def get_futures_order_with_http_info(self, settle, order_id, **kwargs): # noqa: if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_futures_order" % key + " to method list_futures_insurance_ledger" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_futures_order`") # noqa: E501 - # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `get_futures_order`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_insurance_ledger`") # 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_futures_insurance_ledger`, 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_futures_insurance_ledger`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'order_id' in local_var_params: - path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] + 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 header_params = {} @@ -1005,17 +1046,17 @@ def get_futures_order_with_http_info(self, settle, order_id, **kwargs): # noqa: ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ['apiv4'] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/orders/{order_id}', 'GET', + '/futures/{settle}/insurance', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='FuturesOrder', # noqa: E501 + response_type='list[InsuranceRecord]', # 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 @@ -1023,22 +1064,16 @@ def get_futures_order_with_http_info(self, settle, order_id, **kwargs): # noqa: _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def get_my_trades(self, settle, **kwargs): # noqa: E501 - """List personal trading history # noqa: E501 + def list_futures_accounts(self, settle, **kwargs): # noqa: E501 + """Query futures 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_my_trades(settle, async_req=True) + >>> thread = api.list_futures_accounts(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str contract: Futures contract, return related data only if specified - :param int order: Futures order ID, return related data only if specified - :param int limit: Maximum number of records returned in one list - :param int offset: List offset, starting from 0 - :param str last_id: Specify list staring point using the `id` of last record in previous list-query results - :param int count_total: Whether to return total number matched. Default to 0(no return) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1046,29 +1081,23 @@ def get_my_trades(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[MyFuturesTrade] + :return: FuturesAccount If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_my_trades_with_http_info(settle, **kwargs) # noqa: E501 + return self.list_futures_accounts_with_http_info(settle, **kwargs) # noqa: E501 - def get_my_trades_with_http_info(self, settle, **kwargs): # noqa: E501 - """List personal trading history # noqa: E501 + def list_futures_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 + """Query futures 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_my_trades_with_http_info(settle, async_req=True) + >>> thread = api.list_futures_accounts_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str contract: Futures contract, return related data only if specified - :param int order: Futures order ID, return related data only if specified - :param int limit: Maximum number of records returned in one list - :param int offset: List offset, starting from 0 - :param str last_id: Specify list staring point using the `id` of last record in previous list-query results - :param int count_total: Whether to return total number matched. Default to 0(no return) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1078,7 +1107,7 @@ def get_my_trades_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[MyFuturesTrade], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(FuturesAccount, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1086,13 +1115,7 @@ def get_my_trades_with_http_info(self, settle, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'settle', - 'contract', - 'order', - 'limit', - 'offset', - 'last_id', - 'count_total' + 'settle' ] all_params.extend( [ @@ -1107,21 +1130,15 @@ def get_my_trades_with_http_info(self, settle, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_my_trades" % key + " to method list_futures_accounts" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_my_trades`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_accounts`") # 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 `get_my_trades`, 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 `get_my_trades`, 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 `get_my_trades`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} @@ -1129,18 +1146,6 @@ def get_my_trades_with_http_info(self, settle, **kwargs): # noqa: E501 path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 - query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'order' in local_var_params and local_var_params['order'] is not None: # noqa: E501 - query_params.append(('order', local_var_params['order'])) # 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 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 - query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 - if 'count_total' in local_var_params and local_var_params['count_total'] is not None: # noqa: E501 - query_params.append(('count_total', local_var_params['count_total'])) # noqa: E501 header_params = {} @@ -1156,14 +1161,14 @@ def get_my_trades_with_http_info(self, settle, **kwargs): # noqa: E501 auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/my_trades', 'GET', + '/futures/{settle}/accounts', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[MyFuturesTrade]', # noqa: E501 + response_type='FuturesAccount', # 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 @@ -1171,17 +1176,20 @@ def get_my_trades_with_http_info(self, settle, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def get_position(self, settle, contract, **kwargs): # noqa: E501 - """Get single position # noqa: E501 + def list_futures_account_book(self, settle, **kwargs): # noqa: E501 + """Query account book # 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_position(settle, contract, async_req=True) + >>> thread = api.list_futures_account_book(settle, 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 int limit: Maximum number of records returned in one list + :param int _from: Start timestamp + :param int to: End timestamp + :param str type: Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1189,24 +1197,27 @@ def get_position(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Position + :return: list[FuturesAccountBook] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_position_with_http_info(settle, contract, **kwargs) # noqa: E501 + return self.list_futures_account_book_with_http_info(settle, **kwargs) # noqa: E501 - def get_position_with_http_info(self, settle, contract, **kwargs): # noqa: E501 - """Get single position # noqa: E501 + def list_futures_account_book_with_http_info(self, settle, **kwargs): # noqa: E501 + """Query account book # 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_position_with_http_info(settle, contract, async_req=True) + >>> thread = api.list_futures_account_book_with_http_info(settle, 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 int limit: Maximum number of records returned in one list + :param int _from: Start timestamp + :param int to: End timestamp + :param str type: Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1216,7 +1227,7 @@ def get_position_with_http_info(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesAccountBook], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1225,7 +1236,10 @@ def get_position_with_http_info(self, settle, contract, **kwargs): # noqa: E501 all_params = [ 'settle', - 'contract' + 'limit', + '_from', + 'to', + 'type' ] all_params.extend( [ @@ -1240,28 +1254,34 @@ def get_position_with_http_info(self, settle, contract, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_position" % key + " to method list_futures_account_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_position`") # noqa: E501 - # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `get_position`") # noqa: E501 - - collection_formats = {} + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_account_book`") # 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_futures_account_book`, 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_futures_account_book`, must be a value greater than or equal to `1`") # noqa: E501 + collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'contract' in local_var_params: - path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] + 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 '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 + query_params.append(('from', local_var_params['_from'])) # noqa: E501 + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 + query_params.append(('to', local_var_params['to'])) # noqa: E501 + if 'type' in local_var_params and local_var_params['type'] is not None: # noqa: E501 + query_params.append(('type', local_var_params['type'])) # noqa: E501 header_params = {} @@ -1277,14 +1297,14 @@ def get_position_with_http_info(self, settle, contract, **kwargs): # noqa: E501 auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/positions/{contract}', 'GET', + '/futures/{settle}/account_book', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Position', # noqa: E501 + response_type='list[FuturesAccountBook]', # 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 @@ -1292,17 +1312,16 @@ def get_position_with_http_info(self, settle, contract, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def get_price_triggered_order(self, settle, order_id, **kwargs): # noqa: E501 - """Get a single order # noqa: E501 + def list_positions(self, settle, **kwargs): # noqa: E501 + """List all positions of a user # 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_price_triggered_order(settle, order_id, async_req=True) + >>> thread = api.list_positions(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str order_id: ID returned on order successfully being created (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1310,24 +1329,23 @@ def get_price_triggered_order(self, settle, order_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesPriceTriggeredOrder + :return: list[Position] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_price_triggered_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 + return self.list_positions_with_http_info(settle, **kwargs) # noqa: E501 - def get_price_triggered_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 - """Get a single order # noqa: E501 + def list_positions_with_http_info(self, settle, **kwargs): # noqa: E501 + """List all positions of a user # 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_price_triggered_order_with_http_info(settle, order_id, async_req=True) + >>> thread = api.list_positions_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str order_id: ID returned on order successfully being created (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1337,7 +1355,7 @@ def get_price_triggered_order_with_http_info(self, settle, order_id, **kwargs): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[Position], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1345,8 +1363,7 @@ def get_price_triggered_order_with_http_info(self, settle, order_id, **kwargs): local_var_params = locals() all_params = [ - 'settle', - 'order_id' + 'settle' ] all_params.extend( [ @@ -1361,26 +1378,20 @@ def get_price_triggered_order_with_http_info(self, settle, order_id, **kwargs): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_price_triggered_order" % key + " to method list_positions" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_price_triggered_order`") # noqa: E501 - # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `get_price_triggered_order`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_positions`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'order_id' in local_var_params: - path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] @@ -1398,14 +1409,14 @@ def get_price_triggered_order_with_http_info(self, settle, order_id, **kwargs): auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/price_orders/{order_id}', 'GET', + '/futures/{settle}/positions', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='FuturesPriceTriggeredOrder', # noqa: E501 + response_type='list[Position]', # 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 @@ -1413,20 +1424,17 @@ def get_price_triggered_order_with_http_info(self, settle, order_id, **kwargs): _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_futures_account_book(self, settle, **kwargs): # noqa: E501 - """Query account book # noqa: E501 + def get_position(self, settle, contract, **kwargs): # noqa: E501 + """Get single position # 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_futures_account_book(settle, async_req=True) + >>> thread = api.get_position(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param int limit: Maximum number of records returned in one list - :param int _from: Start timestamp - :param int to: End timestamp - :param str type: Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate + :param str contract: Futures contract (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1434,27 +1442,24 @@ def list_futures_account_book(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesAccountBook] + :return: Position If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_futures_account_book_with_http_info(settle, **kwargs) # noqa: E501 + return self.get_position_with_http_info(settle, contract, **kwargs) # noqa: E501 - def list_futures_account_book_with_http_info(self, settle, **kwargs): # noqa: E501 - """Query account book # noqa: E501 + def get_position_with_http_info(self, settle, contract, **kwargs): # noqa: E501 + """Get single position # 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_futures_account_book_with_http_info(settle, async_req=True) + >>> thread = api.get_position_with_http_info(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param int limit: Maximum number of records returned in one list - :param int _from: Start timestamp - :param int to: End timestamp - :param str type: Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate + :param str contract: Futures contract (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1464,7 +1469,7 @@ def list_futures_account_book_with_http_info(self, settle, **kwargs): # noqa: E number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesAccountBook], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1473,10 +1478,7 @@ def list_futures_account_book_with_http_info(self, settle, **kwargs): # noqa: E all_params = [ 'settle', - 'limit', - '_from', - 'to', - 'type' + 'contract' ] all_params.extend( [ @@ -1491,34 +1493,28 @@ def list_futures_account_book_with_http_info(self, settle, **kwargs): # noqa: E if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_futures_account_book" % key + " to method get_position" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_account_book`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_position`") # noqa: E501 + # verify the required parameter 'contract' is set + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `get_position`") # 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_futures_account_book`, 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_futures_account_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 + if 'contract' in local_var_params: + path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] - 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 '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 - query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 - query_params.append(('to', local_var_params['to'])) # noqa: E501 - if 'type' in local_var_params and local_var_params['type'] is not None: # noqa: E501 - query_params.append(('type', local_var_params['type'])) # noqa: E501 header_params = {} @@ -1534,14 +1530,14 @@ def list_futures_account_book_with_http_info(self, settle, **kwargs): # noqa: E auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/account_book', 'GET', + '/futures/{settle}/positions/{contract}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FuturesAccountBook]', # noqa: E501 + response_type='Position', # 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 @@ -1549,16 +1545,18 @@ def list_futures_account_book_with_http_info(self, settle, **kwargs): # noqa: E _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_futures_accounts(self, settle, **kwargs): # noqa: E501 - """Query futures account # noqa: E501 + def update_position_margin(self, settle, contract, change, **kwargs): # noqa: E501 + """Update position 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_futures_accounts(settle, async_req=True) + >>> thread = api.update_position_margin(settle, contract, change, 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 _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1566,23 +1564,25 @@ def list_futures_accounts(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesAccount + :return: Position If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_futures_accounts_with_http_info(settle, **kwargs) # noqa: E501 + return self.update_position_margin_with_http_info(settle, contract, change, **kwargs) # noqa: E501 - def list_futures_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 - """Query futures account # noqa: E501 + def update_position_margin_with_http_info(self, settle, contract, change, **kwargs): # noqa: E501 + """Update position 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_futures_accounts_with_http_info(settle, async_req=True) + >>> thread = api.update_position_margin_with_http_info(settle, contract, change, 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 _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1592,7 +1592,7 @@ def list_futures_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesAccount, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1600,7 +1600,9 @@ def list_futures_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'settle' + 'settle', + 'contract', + 'change' ] all_params.extend( [ @@ -1615,22 +1617,34 @@ def list_futures_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_futures_accounts" % key + " to method update_position_margin" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_accounts`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `update_position_margin`") # noqa: E501 + # verify the required parameter 'contract' is set + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `update_position_margin`") # noqa: E501 + # verify the required parameter 'change' is set + if self.api_client.client_side_validation and ('change' not in local_var_params or # noqa: E501 + local_var_params['change'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `change` when calling `update_position_margin`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 + if 'contract' in local_var_params: + path_params['contract'] = local_var_params['contract'] # noqa: E501 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 header_params = {} @@ -1646,14 +1660,14 @@ def list_futures_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/accounts', 'GET', + '/futures/{settle}/positions/{contract}/margin', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='FuturesAccount', # noqa: E501 + response_type='Position', # 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 @@ -1661,22 +1675,18 @@ def list_futures_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_futures_candlesticks(self, settle, contract, **kwargs): # noqa: E501 - """Get futures candlesticks # noqa: E501 + def update_position_leverage(self, settle, contract, leverage, **kwargs): # noqa: E501 + """Update position leverage # noqa: E501 - Return specified contract candlesticks. If prefix `contract` with `mark_`, the contract's mark price candlesticks are returned; if prefix with `index_`, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` # 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_futures_candlesticks(settle, contract, async_req=True) + >>> thread = api.update_position_leverage(settle, contract, leverage, 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 float _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified - :param float to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time - :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. - :param str interval: Interval time between data points + :param str leverage: New position leverage (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1684,29 +1694,25 @@ def list_futures_candlesticks(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesCandlestick] + :return: Position If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_futures_candlesticks_with_http_info(settle, contract, **kwargs) # noqa: E501 + return self.update_position_leverage_with_http_info(settle, contract, leverage, **kwargs) # noqa: E501 - def list_futures_candlesticks_with_http_info(self, settle, contract, **kwargs): # noqa: E501 - """Get futures candlesticks # noqa: E501 + def update_position_leverage_with_http_info(self, settle, contract, leverage, **kwargs): # noqa: E501 + """Update position leverage # noqa: E501 - Return specified contract candlesticks. If prefix `contract` with `mark_`, the contract's mark price candlesticks are returned; if prefix with `index_`, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` # 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_futures_candlesticks_with_http_info(settle, contract, async_req=True) + >>> thread = api.update_position_leverage_with_http_info(settle, contract, leverage, 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 float _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified - :param float to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time - :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. - :param str interval: Interval time between data points + :param str leverage: New position leverage (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1716,7 +1722,7 @@ def list_futures_candlesticks_with_http_info(self, settle, contract, **kwargs): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesCandlestick], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1726,10 +1732,7 @@ def list_futures_candlesticks_with_http_info(self, settle, contract, **kwargs): all_params = [ 'settle', 'contract', - '_from', - 'to', - 'limit', - 'interval' + 'leverage' ] all_params.extend( [ @@ -1744,38 +1747,34 @@ def list_futures_candlesticks_with_http_info(self, settle, contract, **kwargs): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_futures_candlesticks" % key + " to method update_position_leverage" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_candlesticks`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `update_position_leverage`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_candlesticks`") # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `update_position_leverage`") # noqa: E501 + # verify the required parameter 'leverage' is set + if self.api_client.client_side_validation and ('leverage' not in local_var_params or # noqa: E501 + local_var_params['leverage'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `leverage` when calling `update_position_leverage`") # noqa: E501 - if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 2000: # noqa: E501 - raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_candlesticks`, must be a value less than or equal to `2000`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 + if 'contract' in local_var_params: + path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] - if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 - query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 - query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 - query_params.append(('to', local_var_params['to'])) # 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 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 - query_params.append(('interval', local_var_params['interval'])) # noqa: E501 + 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 header_params = {} @@ -1788,17 +1787,17 @@ def list_futures_candlesticks_with_http_info(self, settle, contract, **kwargs): ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/candlesticks', 'GET', + '/futures/{settle}/positions/{contract}/leverage', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FuturesCandlestick]', # noqa: E501 + response_type='Position', # 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 @@ -1806,16 +1805,18 @@ def list_futures_candlesticks_with_http_info(self, settle, contract, **kwargs): _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_futures_contracts(self, settle, **kwargs): # noqa: E501 - """List all futures contracts # noqa: E501 + def update_position_risk_limit(self, settle, contract, risk_limit, **kwargs): # noqa: E501 + """Update position risk limit # 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_futures_contracts(settle, async_req=True) + >>> thread = api.update_position_risk_limit(settle, contract, risk_limit, 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 risk_limit: New position risk limit (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1823,23 +1824,25 @@ def list_futures_contracts(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Contract] + :return: Position If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_futures_contracts_with_http_info(settle, **kwargs) # noqa: E501 + return self.update_position_risk_limit_with_http_info(settle, contract, risk_limit, **kwargs) # noqa: E501 - def list_futures_contracts_with_http_info(self, settle, **kwargs): # noqa: E501 - """List all futures contracts # noqa: E501 + def update_position_risk_limit_with_http_info(self, settle, contract, risk_limit, **kwargs): # noqa: E501 + """Update position risk limit # 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_futures_contracts_with_http_info(settle, async_req=True) + >>> thread = api.update_position_risk_limit_with_http_info(settle, contract, risk_limit, 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 risk_limit: New position risk limit (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1849,7 +1852,7 @@ def list_futures_contracts_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Contract], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1857,7 +1860,9 @@ def list_futures_contracts_with_http_info(self, settle, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'settle' + 'settle', + 'contract', + 'risk_limit' ] all_params.extend( [ @@ -1872,22 +1877,34 @@ def list_futures_contracts_with_http_info(self, settle, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_futures_contracts" % key + " to method update_position_risk_limit" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_contracts`") # noqa: E501 - - collection_formats = {} + raise ApiValueError("Missing the required parameter `settle` when calling `update_position_risk_limit`") # noqa: E501 + # verify the required parameter 'contract' is set + if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 + local_var_params['contract'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `update_position_risk_limit`") # noqa: E501 + # verify the required parameter 'risk_limit' is set + if self.api_client.client_side_validation and ('risk_limit' not in local_var_params or # noqa: E501 + local_var_params['risk_limit'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `risk_limit` when calling `update_position_risk_limit`") # noqa: E501 + + collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 + if 'contract' in local_var_params: + path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] + if 'risk_limit' in local_var_params and local_var_params['risk_limit'] is not None: # noqa: E501 + query_params.append(('risk_limit', local_var_params['risk_limit'])) # noqa: E501 header_params = {} @@ -1900,17 +1917,17 @@ def list_futures_contracts_with_http_info(self, settle, **kwargs): # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/contracts', 'GET', + '/futures/{settle}/positions/{contract}/risk_limit', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Contract]', # noqa: E501 + response_type='Position', # 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 @@ -1918,18 +1935,23 @@ def list_futures_contracts_with_http_info(self, settle, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_futures_funding_rate_history(self, settle, contract, **kwargs): # noqa: E501 - """Funding rate history # noqa: E501 + def list_futures_orders(self, settle, contract, status, **kwargs): # noqa: E501 + """List futures orders # noqa: E501 + Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_futures_funding_rate_history(settle, contract, async_req=True) + >>> thread = api.list_futures_orders(settle, contract, status, 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 status: List orders based on status (required) :param int limit: Maximum number of records returned in one list + :param int offset: List offset, starting from 0 + :param str last_id: Specify list staring point using the `id` of last record in previous list-query results + :param int count_total: Whether to return total number matched. Default to 0(no return) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1937,25 +1959,30 @@ def list_futures_funding_rate_history(self, settle, contract, **kwargs): # noqa number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FundingRateRecord] + :return: list[FuturesOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_futures_funding_rate_history_with_http_info(settle, contract, **kwargs) # noqa: E501 + return self.list_futures_orders_with_http_info(settle, contract, status, **kwargs) # noqa: E501 - def list_futures_funding_rate_history_with_http_info(self, settle, contract, **kwargs): # noqa: E501 - """Funding rate history # noqa: E501 + def list_futures_orders_with_http_info(self, settle, contract, status, **kwargs): # noqa: E501 + """List futures orders # noqa: E501 + Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_futures_funding_rate_history_with_http_info(settle, contract, async_req=True) + >>> thread = api.list_futures_orders_with_http_info(settle, contract, status, 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 status: List orders based on status (required) :param int limit: Maximum number of records returned in one list + :param int offset: List offset, starting from 0 + :param str last_id: Specify list staring point using the `id` of last record in previous list-query results + :param int count_total: Whether to return total number matched. Default to 0(no return) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1965,7 +1992,7 @@ def list_futures_funding_rate_history_with_http_info(self, settle, contract, **k number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FundingRateRecord], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1975,7 +2002,11 @@ def list_futures_funding_rate_history_with_http_info(self, settle, contract, **k all_params = [ 'settle', 'contract', - 'limit' + 'status', + 'limit', + 'offset', + 'last_id', + 'count_total' ] all_params.extend( [ @@ -1990,23 +2021,29 @@ def list_futures_funding_rate_history_with_http_info(self, settle, contract, **k if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_futures_funding_rate_history" % key + " to method list_futures_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_funding_rate_history`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_orders`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_funding_rate_history`") # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_orders`") # noqa: E501 + # verify the required parameter 'status' is set + if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 + local_var_params['status'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `status` when calling `list_futures_orders`") # 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_futures_funding_rate_history`, must be a value less than or equal to `1000`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_orders`, 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_futures_funding_rate_history`, must be a value greater than or equal to `1`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_orders`, 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_futures_orders`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} @@ -2016,8 +2053,16 @@ def list_futures_funding_rate_history_with_http_info(self, settle, contract, **k query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 + 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 '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 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 + query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 + if 'count_total' in local_var_params and local_var_params['count_total'] is not None: # noqa: E501 + query_params.append(('count_total', local_var_params['count_total'])) # noqa: E501 header_params = {} @@ -2030,17 +2075,17 @@ def list_futures_funding_rate_history_with_http_info(self, settle, contract, **k ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/funding_rate', 'GET', + '/futures/{settle}/orders', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FundingRateRecord]', # noqa: E501 + response_type='list[FuturesOrder]', # 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 @@ -2048,17 +2093,18 @@ def list_futures_funding_rate_history_with_http_info(self, settle, contract, **k _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_futures_insurance_ledger(self, settle, **kwargs): # noqa: E501 - """Futures insurance balance history # noqa: E501 + def create_futures_order(self, settle, futures_order, **kwargs): # noqa: E501 + """Create a futures order # noqa: E501 + Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_futures_insurance_ledger(settle, async_req=True) + >>> thread = api.create_futures_order(settle, futures_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param int limit: Maximum number of records returned in one list + :param FuturesOrder futures_order: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -2066,24 +2112,25 @@ def list_futures_insurance_ledger(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[InsuranceRecord] + :return: FuturesOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_futures_insurance_ledger_with_http_info(settle, **kwargs) # noqa: E501 + return self.create_futures_order_with_http_info(settle, futures_order, **kwargs) # noqa: E501 - def list_futures_insurance_ledger_with_http_info(self, settle, **kwargs): # noqa: E501 - """Futures insurance balance history # noqa: E501 + def create_futures_order_with_http_info(self, settle, futures_order, **kwargs): # noqa: E501 + """Create a futures order # noqa: E501 + Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_futures_insurance_ledger_with_http_info(settle, async_req=True) + >>> thread = api.create_futures_order_with_http_info(settle, futures_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param int limit: Maximum number of records returned in one list + :param FuturesOrder futures_order: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -2093,7 +2140,7 @@ def list_futures_insurance_ledger_with_http_info(self, settle, **kwargs): # noq number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[InsuranceRecord], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -2102,7 +2149,7 @@ def list_futures_insurance_ledger_with_http_info(self, settle, **kwargs): # noq all_params = [ 'settle', - 'limit' + 'futures_order' ] all_params.extend( [ @@ -2117,19 +2164,19 @@ def list_futures_insurance_ledger_with_http_info(self, settle, **kwargs): # noq if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_futures_insurance_ledger" % key + " to method create_futures_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_insurance_ledger`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `create_futures_order`") # noqa: E501 + # verify the required parameter 'futures_order' is set + if self.api_client.client_side_validation and ('futures_order' not in local_var_params or # noqa: E501 + local_var_params['futures_order'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `futures_order` when calling `create_futures_order`") # 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_futures_insurance_ledger`, 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_futures_insurance_ledger`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -2137,8 +2184,6 @@ def list_futures_insurance_ledger_with_http_info(self, settle, **kwargs): # noq path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] - 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 header_params = {} @@ -2146,22 +2191,28 @@ def list_futures_insurance_ledger_with_http_info(self, settle, **kwargs): # noq local_var_files = {} body_params = None + if 'futures_order' in local_var_params: + body_params = local_var_params['futures_order'] # 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 = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/insurance', 'GET', + '/futures/{settle}/orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[InsuranceRecord]', # noqa: E501 + response_type='FuturesOrder', # 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 @@ -2169,20 +2220,19 @@ def list_futures_insurance_ledger_with_http_info(self, settle, **kwargs): # noq _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_futures_order_book(self, settle, contract, **kwargs): # noqa: E501 - """Futures order book # noqa: E501 + def cancel_futures_orders(self, settle, contract, **kwargs): # noqa: E501 + """Cancel all `open` orders matched # noqa: E501 - Bids will be sorted by price from high to low, while asks sorted reversely # noqa: E501 + Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_futures_order_book(settle, contract, async_req=True) + >>> thread = api.cancel_futures_orders(settle, contract, 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 interval: Order depth. 0 means no aggregation is applied. default to 0 - :param int limit: Maximum number of order depth data in asks or bids + :param str side: All bids or asks. Both included in not specified :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -2190,27 +2240,26 @@ def list_futures_order_book(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesOrderBook + :return: list[FuturesOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_futures_order_book_with_http_info(settle, contract, **kwargs) # noqa: E501 + return self.cancel_futures_orders_with_http_info(settle, contract, **kwargs) # noqa: E501 - def list_futures_order_book_with_http_info(self, settle, contract, **kwargs): # noqa: E501 - """Futures order book # noqa: E501 + def cancel_futures_orders_with_http_info(self, settle, contract, **kwargs): # noqa: E501 + """Cancel all `open` orders matched # noqa: E501 - Bids will be sorted by price from high to low, while asks sorted reversely # noqa: E501 + Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_futures_order_book_with_http_info(settle, contract, async_req=True) + >>> thread = api.cancel_futures_orders_with_http_info(settle, contract, 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 interval: Order depth. 0 means no aggregation is applied. default to 0 - :param int limit: Maximum number of order depth data in asks or bids + :param str side: All bids or asks. Both included in not specified :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -2220,7 +2269,7 @@ def list_futures_order_book_with_http_info(self, settle, contract, **kwargs): # number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesOrderBook, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -2230,8 +2279,7 @@ def list_futures_order_book_with_http_info(self, settle, contract, **kwargs): # all_params = [ 'settle', 'contract', - 'interval', - 'limit' + 'side' ] all_params.extend( [ @@ -2246,23 +2294,19 @@ def list_futures_order_book_with_http_info(self, settle, contract, **kwargs): # if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_futures_order_book" % key + " to method cancel_futures_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_order_book`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `cancel_futures_orders`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_order_book`") # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `cancel_futures_orders`") # noqa: E501 - if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 20: # noqa: E501 - raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_order_book`, must be a value less than or equal to `20`") # 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_futures_order_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -2272,10 +2316,8 @@ def list_futures_order_book_with_http_info(self, settle, contract, **kwargs): # query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 - query_params.append(('interval', local_var_params['interval'])) # 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 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 + query_params.append(('side', local_var_params['side'])) # noqa: E501 header_params = {} @@ -2288,17 +2330,17 @@ def list_futures_order_book_with_http_info(self, settle, contract, **kwargs): # ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/order_book', 'GET', + '/futures/{settle}/orders', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='FuturesOrderBook', # noqa: E501 + response_type='list[FuturesOrder]', # 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 @@ -2306,23 +2348,18 @@ def list_futures_order_book_with_http_info(self, settle, contract, **kwargs): # _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_futures_orders(self, settle, contract, status, **kwargs): # noqa: E501 - """List futures orders # noqa: E501 + def get_futures_order(self, settle, order_id, **kwargs): # noqa: E501 + """Get a single order # noqa: E501 Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_futures_orders(settle, contract, status, async_req=True) + >>> thread = api.get_futures_order(settle, order_id, 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 status: List orders based on status (required) - :param int limit: Maximum number of records returned in one list - :param int offset: List offset, starting from 0 - :param str last_id: Specify list staring point using the `id` of last record in previous list-query results - :param int count_total: Whether to return total number matched. Default to 0(no return) + :param str order_id: ID returned on order successfully being created (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -2330,30 +2367,25 @@ def list_futures_orders(self, settle, contract, status, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesOrder] + :return: FuturesOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_futures_orders_with_http_info(settle, contract, status, **kwargs) # noqa: E501 + return self.get_futures_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - def list_futures_orders_with_http_info(self, settle, contract, status, **kwargs): # noqa: E501 - """List futures orders # noqa: E501 + def get_futures_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 + """Get a single order # noqa: E501 Zero-fill order cannot be retrieved 60 seconds after cancellation # 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_futures_orders_with_http_info(settle, contract, status, async_req=True) + >>> thread = api.get_futures_order_with_http_info(settle, order_id, 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 status: List orders based on status (required) - :param int limit: Maximum number of records returned in one list - :param int offset: List offset, starting from 0 - :param str last_id: Specify list staring point using the `id` of last record in previous list-query results - :param int count_total: Whether to return total number matched. Default to 0(no return) + :param str order_id: ID returned on order successfully being created (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -2363,7 +2395,7 @@ def list_futures_orders_with_http_info(self, settle, contract, status, **kwargs) number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesOrder], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -2372,12 +2404,7 @@ def list_futures_orders_with_http_info(self, settle, contract, status, **kwargs) all_params = [ 'settle', - 'contract', - 'status', - 'limit', - 'offset', - 'last_id', - 'count_total' + 'order_id' ] all_params.extend( [ @@ -2392,48 +2419,28 @@ def list_futures_orders_with_http_info(self, settle, contract, status, **kwargs) if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_futures_orders" % key + " to method get_futures_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_orders`") # noqa: E501 - # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_orders`") # noqa: E501 - # verify the required parameter 'status' is set - if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 - local_var_params['status'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `status` when calling `list_futures_orders`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_futures_order`") # noqa: E501 + # verify the required parameter 'order_id' is set + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `get_futures_order`") # 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_futures_orders`, 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_futures_orders`, 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_futures_orders`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 + if 'order_id' in local_var_params: + path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] - if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 - query_params.append(('contract', local_var_params['contract'])) # noqa: E501 - 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 '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 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 - query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 - if 'count_total' in local_var_params and local_var_params['count_total'] is not None: # noqa: E501 - query_params.append(('count_total', local_var_params['count_total'])) # noqa: E501 header_params = {} @@ -2449,14 +2456,14 @@ def list_futures_orders_with_http_info(self, settle, contract, status, **kwargs) auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/orders', 'GET', + '/futures/{settle}/orders/{order_id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FuturesOrder]', # noqa: E501 + response_type='FuturesOrder', # 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 @@ -2464,17 +2471,17 @@ def list_futures_orders_with_http_info(self, settle, contract, status, **kwargs) _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_futures_tickers(self, settle, **kwargs): # noqa: E501 - """List futures tickers # noqa: E501 + def cancel_futures_order(self, settle, order_id, **kwargs): # noqa: E501 + """Cancel a single order # 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_futures_tickers(settle, async_req=True) + >>> thread = api.cancel_futures_order(settle, order_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str contract: Futures contract, return related data only if specified + :param str order_id: ID returned on order successfully being created (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -2482,24 +2489,24 @@ def list_futures_tickers(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesTicker] + :return: FuturesOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_futures_tickers_with_http_info(settle, **kwargs) # noqa: E501 + return self.cancel_futures_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - def list_futures_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 - """List futures tickers # noqa: E501 + def cancel_futures_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 + """Cancel a single order # 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_futures_tickers_with_http_info(settle, async_req=True) + >>> thread = api.cancel_futures_order_with_http_info(settle, order_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str contract: Futures contract, return related data only if specified + :param str order_id: ID returned on order successfully being created (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -2509,7 +2516,7 @@ def list_futures_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesTicker], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -2518,7 +2525,7 @@ def list_futures_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 all_params = [ 'settle', - 'contract' + 'order_id' ] all_params.extend( [ @@ -2533,24 +2540,28 @@ def list_futures_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_futures_tickers" % key + " to method cancel_futures_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_tickers`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `cancel_futures_order`") # noqa: E501 + # verify the required parameter 'order_id' is set + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_futures_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 + if 'order_id' in local_var_params: + path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] - if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 - query_params.append(('contract', local_var_params['contract'])) # noqa: E501 header_params = {} @@ -2563,17 +2574,17 @@ def list_futures_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/tickers', 'GET', + '/futures/{settle}/orders/{order_id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FuturesTicker]', # noqa: E501 + response_type='FuturesOrder', # 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 @@ -2581,21 +2592,22 @@ def list_futures_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_futures_trades(self, settle, contract, **kwargs): # noqa: E501 - """Futures trading history # noqa: E501 + def get_my_trades(self, settle, **kwargs): # noqa: E501 + """List personal trading history # 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_futures_trades(settle, contract, async_req=True) + >>> thread = api.get_my_trades(settle, 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 contract: Futures contract, return related data only if specified + :param int order: Futures order ID, return related data only if specified :param int limit: Maximum number of records returned in one list - :param str last_id: Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range - :param float _from: Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. - :param float to: Specify end time in Unix seconds, default to current time + :param int offset: List offset, starting from 0 + :param str last_id: Specify list staring point using the `id` of last record in previous list-query results + :param int count_total: Whether to return total number matched. Default to 0(no return) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -2603,28 +2615,29 @@ def list_futures_trades(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesTrade] + :return: list[MyFuturesTrade] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_futures_trades_with_http_info(settle, contract, **kwargs) # noqa: E501 + return self.get_my_trades_with_http_info(settle, **kwargs) # noqa: E501 - def list_futures_trades_with_http_info(self, settle, contract, **kwargs): # noqa: E501 - """Futures trading history # noqa: E501 + def get_my_trades_with_http_info(self, settle, **kwargs): # noqa: E501 + """List personal trading history # 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_futures_trades_with_http_info(settle, contract, async_req=True) + >>> thread = api.get_my_trades_with_http_info(settle, 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 contract: Futures contract, return related data only if specified + :param int order: Futures order ID, return related data only if specified :param int limit: Maximum number of records returned in one list - :param str last_id: Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range - :param float _from: Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. - :param float to: Specify end time in Unix seconds, default to current time + :param int offset: List offset, starting from 0 + :param str last_id: Specify list staring point using the `id` of last record in previous list-query results + :param int count_total: Whether to return total number matched. Default to 0(no return) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -2634,7 +2647,7 @@ def list_futures_trades_with_http_info(self, settle, contract, **kwargs): # noq number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesTrade], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[MyFuturesTrade], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -2644,10 +2657,11 @@ def list_futures_trades_with_http_info(self, settle, contract, **kwargs): # noq all_params = [ 'settle', 'contract', + 'order', 'limit', + 'offset', 'last_id', - '_from', - 'to' + 'count_total' ] all_params.extend( [ @@ -2662,23 +2676,21 @@ def list_futures_trades_with_http_info(self, settle, contract, **kwargs): # noq if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_futures_trades" % key + " to method get_my_trades" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_trades`") # noqa: E501 - # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_trades`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_my_trades`") # 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_futures_trades`, must be a value less than or equal to `1000`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `get_my_trades`, 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_futures_trades`, must be a value greater than or equal to `1`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `get_my_trades`, 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 `get_my_trades`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} @@ -2688,14 +2700,16 @@ def list_futures_trades_with_http_info(self, settle, contract, **kwargs): # noq query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 + if 'order' in local_var_params and local_var_params['order'] is not None: # noqa: E501 + query_params.append(('order', local_var_params['order'])) # 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 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 - if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 - query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 - query_params.append(('to', local_var_params['to'])) # noqa: E501 + if 'count_total' in local_var_params and local_var_params['count_total'] is not None: # noqa: E501 + query_params.append(('count_total', local_var_params['count_total'])) # noqa: E501 header_params = {} @@ -2708,17 +2722,17 @@ def list_futures_trades_with_http_info(self, settle, contract, **kwargs): # noq ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/trades', 'GET', + '/futures/{settle}/my_trades', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FuturesTrade]', # noqa: E501 + response_type='list[MyFuturesTrade]', # 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 @@ -2726,19 +2740,18 @@ def list_futures_trades_with_http_info(self, settle, contract, **kwargs): # noq _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_liquidates(self, settle, **kwargs): # noqa: E501 - """List liquidation history # noqa: E501 + def list_position_close(self, settle, **kwargs): # noqa: E501 + """List position close history # 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_liquidates(settle, async_req=True) + >>> thread = api.list_position_close(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in one list - :param int at: Specify a liquidation timestamp :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -2746,26 +2759,25 @@ def list_liquidates(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesLiquidate] + :return: list[PositionClose] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_liquidates_with_http_info(settle, **kwargs) # noqa: E501 + return self.list_position_close_with_http_info(settle, **kwargs) # noqa: E501 - def list_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 - """List liquidation history # noqa: E501 + def list_position_close_with_http_info(self, settle, **kwargs): # noqa: E501 + """List position close history # 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_liquidates_with_http_info(settle, async_req=True) + >>> thread = api.list_position_close_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in one list - :param int at: Specify a liquidation timestamp :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -2775,7 +2787,7 @@ def list_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesLiquidate], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[PositionClose], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -2785,8 +2797,7 @@ def list_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 all_params = [ 'settle', 'contract', - 'limit', - 'at' + 'limit' ] all_params.extend( [ @@ -2801,19 +2812,19 @@ def list_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_liquidates" % key + " to method list_position_close" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_liquidates`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_position_close`") # 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_liquidates`, must be a value less than or equal to `1000`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_position_close`, 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_liquidates`, must be a value greater than or equal to `1`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_position_close`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -2825,8 +2836,6 @@ def list_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # 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 'at' in local_var_params and local_var_params['at'] is not None: # noqa: E501 - query_params.append(('at', local_var_params['at'])) # noqa: E501 header_params = {} @@ -2842,14 +2851,14 @@ def list_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/liquidates', 'GET', + '/futures/{settle}/position_close', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FuturesLiquidate]', # noqa: E501 + response_type='list[PositionClose]', # 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 @@ -2857,18 +2866,19 @@ def list_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_position_close(self, settle, **kwargs): # noqa: E501 - """List position close history # noqa: E501 + def list_liquidates(self, settle, **kwargs): # noqa: E501 + """List liquidation history # 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_position_close(settle, async_req=True) + >>> thread = api.list_liquidates(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in one list + :param int at: Specify a liquidation timestamp :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -2876,25 +2886,26 @@ def list_position_close(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[PositionClose] + :return: list[FuturesLiquidate] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_position_close_with_http_info(settle, **kwargs) # noqa: E501 + return self.list_liquidates_with_http_info(settle, **kwargs) # noqa: E501 - def list_position_close_with_http_info(self, settle, **kwargs): # noqa: E501 - """List position close history # noqa: E501 + def list_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 + """List liquidation history # 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_position_close_with_http_info(settle, async_req=True) + >>> thread = api.list_liquidates_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in one list + :param int at: Specify a liquidation timestamp :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -2904,7 +2915,7 @@ def list_position_close_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[PositionClose], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesLiquidate], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -2914,7 +2925,8 @@ def list_position_close_with_http_info(self, settle, **kwargs): # noqa: E501 all_params = [ 'settle', 'contract', - 'limit' + 'limit', + 'at' ] all_params.extend( [ @@ -2929,19 +2941,19 @@ def list_position_close_with_http_info(self, settle, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_position_close" % key + " to method list_liquidates" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_position_close`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_liquidates`") # 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_position_close`, must be a value less than or equal to `1000`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_liquidates`, 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_position_close`, must be a value greater than or equal to `1`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_liquidates`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -2953,6 +2965,8 @@ def list_position_close_with_http_info(self, settle, **kwargs): # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # 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 'at' in local_var_params and local_var_params['at'] is not None: # noqa: E501 + query_params.append(('at', local_var_params['at'])) # noqa: E501 header_params = {} @@ -2968,14 +2982,14 @@ def list_position_close_with_http_info(self, settle, **kwargs): # noqa: E501 auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/position_close', 'GET', + '/futures/{settle}/liquidates', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[PositionClose]', # noqa: E501 + response_type='list[FuturesLiquidate]', # 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 @@ -2983,16 +2997,20 @@ def list_position_close_with_http_info(self, settle, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_positions(self, settle, **kwargs): # noqa: E501 - """List all positions of a user # noqa: E501 + def list_price_triggered_orders(self, settle, status, **kwargs): # noqa: E501 + """List all auto orders # 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_positions(settle, async_req=True) + >>> thread = api.list_price_triggered_orders(settle, status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) + :param str status: List orders based on status (required) + :param str contract: Futures contract, return related data only if specified + :param int limit: Maximum number of records returned in one list + :param int offset: List offset, starting from 0 :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -3000,23 +3018,27 @@ def list_positions(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Position] + :return: list[FuturesPriceTriggeredOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_positions_with_http_info(settle, **kwargs) # noqa: E501 + return self.list_price_triggered_orders_with_http_info(settle, status, **kwargs) # noqa: E501 - def list_positions_with_http_info(self, settle, **kwargs): # noqa: E501 - """List all positions of a user # noqa: E501 + def list_price_triggered_orders_with_http_info(self, settle, status, **kwargs): # noqa: E501 + """List all auto orders # 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_positions_with_http_info(settle, async_req=True) + >>> thread = api.list_price_triggered_orders_with_http_info(settle, status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) + :param str status: List orders based on status (required) + :param str contract: Futures contract, return related data only if specified + :param int limit: Maximum number of records returned in one list + :param int offset: List offset, starting from 0 :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -3026,7 +3048,7 @@ def list_positions_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Position], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -3034,7 +3056,11 @@ def list_positions_with_http_info(self, settle, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'settle' + 'settle', + 'status', + 'contract', + 'limit', + 'offset' ] all_params.extend( [ @@ -3049,15 +3075,25 @@ def list_positions_with_http_info(self, settle, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_positions" % key + " to method list_price_triggered_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_positions`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `list_price_triggered_orders`") # noqa: E501 + # verify the required parameter 'status' is set + if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 + local_var_params['status'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `status` when calling `list_price_triggered_orders`") # 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_price_triggered_orders`, 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_price_triggered_orders`, 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_price_triggered_orders`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} @@ -3065,6 +3101,14 @@ def list_positions_with_http_info(self, settle, **kwargs): # noqa: E501 path_params['settle'] = local_var_params['settle'] # noqa: E501 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 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 + query_params.append(('contract', local_var_params['contract'])) # 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 header_params = {} @@ -3080,14 +3124,14 @@ def list_positions_with_http_info(self, settle, **kwargs): # noqa: E501 auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/positions', 'GET', + '/futures/{settle}/price_orders', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Position]', # noqa: E501 + response_type='list[FuturesPriceTriggeredOrder]', # 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 @@ -3095,20 +3139,17 @@ def list_positions_with_http_info(self, settle, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_price_triggered_orders(self, settle, status, **kwargs): # noqa: E501 - """List all auto orders # noqa: E501 + def create_price_triggered_order(self, settle, futures_price_triggered_order, **kwargs): # noqa: E501 + """Create a price-triggered order # 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_price_triggered_orders(settle, status, async_req=True) + >>> thread = api.create_price_triggered_order(settle, futures_price_triggered_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str status: List orders based on status (required) - :param str contract: Futures contract, return related data only if specified - :param int limit: Maximum number of records returned in one list - :param int offset: List offset, starting from 0 + :param FuturesPriceTriggeredOrder futures_price_triggered_order: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -3116,27 +3157,24 @@ def list_price_triggered_orders(self, settle, status, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesPriceTriggeredOrder] + :return: TriggerOrderResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_price_triggered_orders_with_http_info(settle, status, **kwargs) # noqa: E501 + return self.create_price_triggered_order_with_http_info(settle, futures_price_triggered_order, **kwargs) # noqa: E501 - def list_price_triggered_orders_with_http_info(self, settle, status, **kwargs): # noqa: E501 - """List all auto orders # noqa: E501 + def create_price_triggered_order_with_http_info(self, settle, futures_price_triggered_order, **kwargs): # noqa: E501 + """Create a price-triggered order # 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_price_triggered_orders_with_http_info(settle, status, async_req=True) + >>> thread = api.create_price_triggered_order_with_http_info(settle, futures_price_triggered_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) - :param str status: List orders based on status (required) - :param str contract: Futures contract, return related data only if specified - :param int limit: Maximum number of records returned in one list - :param int offset: List offset, starting from 0 + :param FuturesPriceTriggeredOrder futures_price_triggered_order: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -3146,7 +3184,7 @@ def list_price_triggered_orders_with_http_info(self, settle, status, **kwargs): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(TriggerOrderResponse, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -3155,10 +3193,7 @@ def list_price_triggered_orders_with_http_info(self, settle, status, **kwargs): all_params = [ 'settle', - 'status', - 'contract', - 'limit', - 'offset' + 'futures_price_triggered_order' ] all_params.extend( [ @@ -3173,25 +3208,19 @@ def list_price_triggered_orders_with_http_info(self, settle, status, **kwargs): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_price_triggered_orders" % key + " to method create_price_triggered_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_price_triggered_orders`") # noqa: E501 - # verify the required parameter 'status' is set - if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 - local_var_params['status'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `status` when calling `list_price_triggered_orders`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `create_price_triggered_order`") # noqa: E501 + # verify the required parameter 'futures_price_triggered_order' is set + if self.api_client.client_side_validation and ('futures_price_triggered_order' not in local_var_params or # noqa: E501 + local_var_params['futures_price_triggered_order'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `futures_price_triggered_order` when calling `create_price_triggered_order`") # 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_price_triggered_orders`, 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_price_triggered_orders`, 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_price_triggered_orders`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} @@ -3199,14 +3228,6 @@ def list_price_triggered_orders_with_http_info(self, settle, status, **kwargs): path_params['settle'] = local_var_params['settle'] # noqa: E501 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 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 - query_params.append(('contract', local_var_params['contract'])) # 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 header_params = {} @@ -3214,22 +3235,28 @@ def list_price_triggered_orders_with_http_info(self, settle, status, **kwargs): local_var_files = {} body_params = None + if 'futures_price_triggered_order' in local_var_params: + body_params = local_var_params['futures_price_triggered_order'] # 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( - '/futures/{settle}/price_orders', 'GET', + '/futures/{settle}/price_orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FuturesPriceTriggeredOrder]', # noqa: E501 + response_type='TriggerOrderResponse', # 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 @@ -3237,18 +3264,17 @@ def list_price_triggered_orders_with_http_info(self, settle, status, **kwargs): _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def update_position_leverage(self, settle, contract, leverage, **kwargs): # noqa: E501 - """Update position leverage # noqa: E501 + def cancel_price_triggered_order_list(self, settle, contract, **kwargs): # noqa: E501 + """Cancel all open orders # 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_position_leverage(settle, contract, leverage, async_req=True) + >>> thread = api.cancel_price_triggered_order_list(settle, contract, 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 leverage: New position leverage (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -3256,25 +3282,24 @@ def update_position_leverage(self, settle, contract, leverage, **kwargs): # noq number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Position + :return: list[FuturesPriceTriggeredOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.update_position_leverage_with_http_info(settle, contract, leverage, **kwargs) # noqa: E501 + return self.cancel_price_triggered_order_list_with_http_info(settle, contract, **kwargs) # noqa: E501 - def update_position_leverage_with_http_info(self, settle, contract, leverage, **kwargs): # noqa: E501 - """Update position leverage # noqa: E501 + def cancel_price_triggered_order_list_with_http_info(self, settle, contract, **kwargs): # noqa: E501 + """Cancel all open orders # 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_position_leverage_with_http_info(settle, contract, leverage, async_req=True) + >>> thread = api.cancel_price_triggered_order_list_with_http_info(settle, contract, 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 leverage: New position leverage (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -3284,7 +3309,7 @@ def update_position_leverage_with_http_info(self, settle, contract, leverage, ** number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -3293,8 +3318,7 @@ def update_position_leverage_with_http_info(self, settle, contract, leverage, ** all_params = [ 'settle', - 'contract', - 'leverage' + 'contract' ] all_params.extend( [ @@ -3309,34 +3333,28 @@ def update_position_leverage_with_http_info(self, settle, contract, leverage, ** if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method update_position_leverage" % key + " to method cancel_price_triggered_order_list" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `update_position_leverage`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_order_list`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `update_position_leverage`") # noqa: E501 - # verify the required parameter 'leverage' is set - if self.api_client.client_side_validation and ('leverage' not in local_var_params or # noqa: E501 - local_var_params['leverage'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `leverage` when calling `update_position_leverage`") # noqa: E501 + raise ApiValueError("Missing the required parameter `contract` when calling `cancel_price_triggered_order_list`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'contract' in local_var_params: - path_params['contract'] = local_var_params['contract'] # noqa: E501 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 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 + query_params.append(('contract', local_var_params['contract'])) # noqa: E501 header_params = {} @@ -3352,14 +3370,14 @@ def update_position_leverage_with_http_info(self, settle, contract, leverage, ** auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/positions/{contract}/leverage', 'POST', + '/futures/{settle}/price_orders', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Position', # noqa: E501 + response_type='list[FuturesPriceTriggeredOrder]', # 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 @@ -3367,18 +3385,17 @@ def update_position_leverage_with_http_info(self, settle, contract, leverage, ** _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def update_position_margin(self, settle, contract, change, **kwargs): # noqa: E501 - """Update position margin # noqa: E501 + def get_price_triggered_order(self, settle, order_id, **kwargs): # noqa: E501 + """Get a single order # 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_position_margin(settle, contract, change, async_req=True) + >>> thread = api.get_price_triggered_order(settle, order_id, 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 order_id: ID returned on order successfully being created (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -3386,25 +3403,24 @@ def update_position_margin(self, settle, contract, change, **kwargs): # noqa: E number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Position + :return: FuturesPriceTriggeredOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.update_position_margin_with_http_info(settle, contract, change, **kwargs) # noqa: E501 + return self.get_price_triggered_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - def update_position_margin_with_http_info(self, settle, contract, change, **kwargs): # noqa: E501 - """Update position margin # noqa: E501 + def get_price_triggered_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 + """Get a single order # 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_position_margin_with_http_info(settle, contract, change, async_req=True) + >>> thread = api.get_price_triggered_order_with_http_info(settle, order_id, 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 order_id: ID returned on order successfully being created (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -3414,7 +3430,7 @@ def update_position_margin_with_http_info(self, settle, contract, change, **kwar number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -3423,8 +3439,7 @@ def update_position_margin_with_http_info(self, settle, contract, change, **kwar all_params = [ 'settle', - 'contract', - 'change' + 'order_id' ] all_params.extend( [ @@ -3439,34 +3454,28 @@ def update_position_margin_with_http_info(self, settle, contract, change, **kwar if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method update_position_margin" % key + " to method get_price_triggered_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `update_position_margin`") # noqa: E501 - # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `update_position_margin`") # noqa: E501 - # verify the required parameter 'change' is set - if self.api_client.client_side_validation and ('change' not in local_var_params or # noqa: E501 - local_var_params['change'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `change` when calling `update_position_margin`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `get_price_triggered_order`") # noqa: E501 + # verify the required parameter 'order_id' is set + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `get_price_triggered_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'contract' in local_var_params: - path_params['contract'] = local_var_params['contract'] # noqa: E501 + if 'order_id' in local_var_params: + path_params['order_id'] = local_var_params['order_id'] # noqa: E501 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 header_params = {} @@ -3482,14 +3491,14 @@ def update_position_margin_with_http_info(self, settle, contract, change, **kwar auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/positions/{contract}/margin', 'POST', + '/futures/{settle}/price_orders/{order_id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Position', # noqa: E501 + response_type='FuturesPriceTriggeredOrder', # 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 @@ -3497,18 +3506,17 @@ def update_position_margin_with_http_info(self, settle, contract, change, **kwar _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def update_position_risk_limit(self, settle, contract, risk_limit, **kwargs): # noqa: E501 - """Update position risk limit # noqa: E501 + def cancel_price_triggered_order(self, settle, order_id, **kwargs): # noqa: E501 + """Cancel a single order # 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_position_risk_limit(settle, contract, risk_limit, async_req=True) + >>> thread = api.cancel_price_triggered_order(settle, order_id, 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 risk_limit: New position risk limit (required) + :param str order_id: ID returned on order successfully being created (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -3516,25 +3524,24 @@ def update_position_risk_limit(self, settle, contract, risk_limit, **kwargs): # number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Position + :return: FuturesPriceTriggeredOrder If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.update_position_risk_limit_with_http_info(settle, contract, risk_limit, **kwargs) # noqa: E501 + return self.cancel_price_triggered_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 - def update_position_risk_limit_with_http_info(self, settle, contract, risk_limit, **kwargs): # noqa: E501 - """Update position risk limit # noqa: E501 + def cancel_price_triggered_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 + """Cancel a single order # 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_position_risk_limit_with_http_info(settle, contract, risk_limit, async_req=True) + >>> thread = api.cancel_price_triggered_order_with_http_info(settle, order_id, 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 risk_limit: New position risk limit (required) + :param str order_id: ID returned on order successfully being created (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -3544,7 +3551,7 @@ def update_position_risk_limit_with_http_info(self, settle, contract, risk_limit number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -3553,8 +3560,7 @@ def update_position_risk_limit_with_http_info(self, settle, contract, risk_limit all_params = [ 'settle', - 'contract', - 'risk_limit' + 'order_id' ] all_params.extend( [ @@ -3569,34 +3575,28 @@ def update_position_risk_limit_with_http_info(self, settle, contract, risk_limit if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method update_position_risk_limit" % key + " to method cancel_price_triggered_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `update_position_risk_limit`") # noqa: E501 - # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `update_position_risk_limit`") # noqa: E501 - # verify the required parameter 'risk_limit' is set - if self.api_client.client_side_validation and ('risk_limit' not in local_var_params or # noqa: E501 - local_var_params['risk_limit'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `risk_limit` when calling `update_position_risk_limit`") # noqa: E501 + raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_order`") # noqa: E501 + # verify the required parameter 'order_id' is set + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_price_triggered_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 - if 'contract' in local_var_params: - path_params['contract'] = local_var_params['contract'] # noqa: E501 + if 'order_id' in local_var_params: + path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] - if 'risk_limit' in local_var_params and local_var_params['risk_limit'] is not None: # noqa: E501 - query_params.append(('risk_limit', local_var_params['risk_limit'])) # noqa: E501 header_params = {} @@ -3612,14 +3612,14 @@ def update_position_risk_limit_with_http_info(self, settle, contract, risk_limit auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/positions/{contract}/risk_limit', 'POST', + '/futures/{settle}/price_orders/{order_id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Position', # noqa: E501 + response_type='FuturesPriceTriggeredOrder', # 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 diff --git a/gate_api/api/margin_api.py b/gate_api/api/margin_api.py index ffb20c9..7a2c26d 100644 --- a/gate_api/api/margin_api.py +++ b/gate_api/api/margin_api.py @@ -36,18 +36,15 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def cancel_loan(self, loan_id, currency, **kwargs): # noqa: E501 - """Cancel lending loan # noqa: E501 + def list_margin_currency_pairs(self, **kwargs): # noqa: E501 + """List all supported currency pairs supported in margin trading # noqa: E501 - Only lending loans can be cancelled # 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_loan(loan_id, currency, async_req=True) + >>> thread = api.list_margin_currency_pairs(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str loan_id: Loan ID (required) - :param str currency: Retrieved specified currency related data (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -55,25 +52,22 @@ def cancel_loan(self, loan_id, currency, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Loan + :return: list[MarginCurrencyPair] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.cancel_loan_with_http_info(loan_id, currency, **kwargs) # noqa: E501 + return self.list_margin_currency_pairs_with_http_info(**kwargs) # noqa: E501 - def cancel_loan_with_http_info(self, loan_id, currency, **kwargs): # noqa: E501 - """Cancel lending loan # noqa: E501 + def list_margin_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 + """List all supported currency pairs supported in margin trading # noqa: E501 - Only lending loans can be cancelled # 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_loan_with_http_info(loan_id, currency, async_req=True) + >>> thread = api.list_margin_currency_pairs_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str loan_id: Loan ID (required) - :param str currency: Retrieved specified currency related data (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -83,7 +77,7 @@ def cancel_loan_with_http_info(self, loan_id, currency, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[MarginCurrencyPair], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -91,8 +85,6 @@ def cancel_loan_with_http_info(self, loan_id, currency, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'loan_id', - 'currency' ] all_params.extend( [ @@ -107,28 +99,16 @@ def cancel_loan_with_http_info(self, loan_id, currency, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method cancel_loan" % key + " to method list_margin_currency_pairs" % key ) local_var_params[key] = val 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 # noqa: E501 - local_var_params['loan_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `loan_id` when calling `cancel_loan`") # noqa: E501 - # verify the required parameter 'currency' is set - if self.api_client.client_side_validation and ('currency' not in local_var_params or # noqa: E501 - local_var_params['currency'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency` when calling `cancel_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 = [] - 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 header_params = {} @@ -141,17 +121,17 @@ def cancel_loan_with_http_info(self, loan_id, currency, **kwargs): # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ['apiv4'] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/margin/loans/{loan_id}', 'DELETE', + '/margin/currency_pairs', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Loan', # noqa: E501 + response_type='list[MarginCurrencyPair]', # 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 @@ -159,16 +139,16 @@ def cancel_loan_with_http_info(self, loan_id, currency, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def create_loan(self, loan, **kwargs): # noqa: E501 - """Lend or borrow # noqa: E501 + def list_funding_book(self, currency, **kwargs): # noqa: E501 + """Order book of lending loans # 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_loan(loan, async_req=True) + >>> thread = api.list_funding_book(currency, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param Loan loan: (required) + :param str currency: Retrieved specified currency related data (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -176,23 +156,23 @@ def create_loan(self, loan, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Loan + :return: list[FundingBookItem] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.create_loan_with_http_info(loan, **kwargs) # noqa: E501 + return self.list_funding_book_with_http_info(currency, **kwargs) # noqa: E501 - def create_loan_with_http_info(self, loan, **kwargs): # noqa: E501 - """Lend or borrow # noqa: E501 + def list_funding_book_with_http_info(self, currency, **kwargs): # noqa: E501 + """Order book of lending loans # 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_loan_with_http_info(loan, async_req=True) + >>> thread = api.list_funding_book_with_http_info(currency, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param Loan loan: (required) + :param str currency: Retrieved specified currency related data (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -202,7 +182,7 @@ def create_loan_with_http_info(self, loan, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[FundingBookItem], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -210,7 +190,7 @@ def create_loan_with_http_info(self, loan, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'loan' + 'currency' ] all_params.extend( [ @@ -225,20 +205,22 @@ def create_loan_with_http_info(self, loan, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method create_loan" % key + " to method list_funding_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] - # verify the required parameter 'loan' is set - if self.api_client.client_side_validation and ('loan' not in local_var_params or # noqa: E501 - local_var_params['loan'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `loan` when calling `create_loan`") # noqa: E501 + # verify the required parameter 'currency' is set + if self.api_client.client_side_validation and ('currency' not in local_var_params or # noqa: E501 + local_var_params['currency'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency` when calling `list_funding_book`") # 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 header_params = {} @@ -246,28 +228,22 @@ def create_loan_with_http_info(self, loan, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if 'loan' in local_var_params: - body_params = local_var_params['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 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/margin/loans', 'POST', + '/margin/funding_book', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Loan', # noqa: E501 + response_type='list[FundingBookItem]', # 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 @@ -275,17 +251,16 @@ def create_loan_with_http_info(self, loan, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def get_loan(self, loan_id, side, **kwargs): # noqa: E501 - """Retrieve one single loan detail # noqa: E501 + def list_margin_accounts(self, **kwargs): # noqa: E501 + """Margin account list # 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_loan(loan_id, side, async_req=True) + >>> thread = api.list_margin_accounts(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str loan_id: Loan ID (required) - :param str side: Lend or borrow (required) + :param str currency_pair: Currency pair :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -293,24 +268,23 @@ def get_loan(self, loan_id, side, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Loan + :return: list[MarginAccount] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_loan_with_http_info(loan_id, side, **kwargs) # noqa: E501 + return self.list_margin_accounts_with_http_info(**kwargs) # noqa: E501 - def get_loan_with_http_info(self, loan_id, side, **kwargs): # noqa: E501 - """Retrieve one single loan detail # noqa: E501 + def list_margin_accounts_with_http_info(self, **kwargs): # noqa: E501 + """Margin account list # 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_loan_with_http_info(loan_id, side, async_req=True) + >>> thread = api.list_margin_accounts_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str loan_id: Loan ID (required) - :param str side: Lend or borrow (required) + :param str currency_pair: Currency pair :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -320,7 +294,7 @@ def get_loan_with_http_info(self, loan_id, side, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[MarginAccount], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -328,8 +302,7 @@ def get_loan_with_http_info(self, loan_id, side, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'loan_id', - 'side' + 'currency_pair' ] all_params.extend( [ @@ -344,28 +317,18 @@ def get_loan_with_http_info(self, loan_id, side, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_loan" % key + " to method list_margin_accounts" % key ) local_var_params[key] = val 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 # noqa: E501 - local_var_params['loan_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `loan_id` when calling `get_loan`") # noqa: E501 - # verify the required parameter 'side' is set - if self.api_client.client_side_validation and ('side' not in local_var_params or # noqa: E501 - local_var_params['side'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `side` when calling `get_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 = [] - if 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 - query_params.append(('side', local_var_params['side'])) # noqa: E501 + 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 header_params = {} @@ -381,14 +344,14 @@ def get_loan_with_http_info(self, loan_id, side, **kwargs): # noqa: E501 auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/margin/loans/{loan_id}', 'GET', + '/margin/accounts', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Loan', # noqa: E501 + response_type='list[MarginAccount]', # 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 @@ -396,17 +359,22 @@ def get_loan_with_http_info(self, loan_id, side, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def get_loan_record(self, loan_record_id, loan_id, **kwargs): # noqa: E501 - """Get one single loan record # noqa: E501 + def list_margin_account_book(self, **kwargs): # noqa: E501 + """List margin account balance change history # noqa: E501 + Only transferring from or to margin account are provided for now. Time range allows 30 days at most # 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_loan_record(loan_record_id, loan_id, async_req=True) + >>> thread = api.list_margin_account_book(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str loan_record_id: Loan record ID (required) - :param str loan_id: Loan ID (required) + :param str currency: List records related to specified currency only. If specified, `currency_pair` is also required. + :param str currency_pair: List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided + :param int _from: Time range beginning, default to 7 days before current time + :param int to: Time range ending, default to current time + :param int page: Page number + :param int limit: Maximum number of records returned in one list :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -414,24 +382,29 @@ def get_loan_record(self, loan_record_id, loan_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: LoanRecord + :return: list[MarginAccountBook] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_loan_record_with_http_info(loan_record_id, loan_id, **kwargs) # noqa: E501 + return self.list_margin_account_book_with_http_info(**kwargs) # noqa: E501 - def get_loan_record_with_http_info(self, loan_record_id, loan_id, **kwargs): # noqa: E501 - """Get one single loan record # noqa: E501 + def list_margin_account_book_with_http_info(self, **kwargs): # noqa: E501 + """List margin account balance change history # noqa: E501 + Only transferring from or to margin account are provided for now. Time range allows 30 days at most # 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_loan_record_with_http_info(loan_record_id, loan_id, async_req=True) + >>> thread = api.list_margin_account_book_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str loan_record_id: Loan record ID (required) - :param str loan_id: Loan ID (required) + :param str currency: List records related to specified currency only. If specified, `currency_pair` is also required. + :param str currency_pair: List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided + :param int _from: Time range beginning, default to 7 days before current time + :param int to: Time range ending, default to current time + :param int page: Page number + :param int limit: Maximum number of records returned in one list :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -441,7 +414,7 @@ def get_loan_record_with_http_info(self, loan_record_id, loan_id, **kwargs): # number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(LoanRecord, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[MarginAccountBook], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -449,8 +422,12 @@ def get_loan_record_with_http_info(self, loan_record_id, loan_id, **kwargs): # local_var_params = locals() all_params = [ - 'loan_record_id', - 'loan_id' + 'currency', + 'currency_pair', + '_from', + 'to', + 'page', + 'limit' ] all_params.extend( [ @@ -465,28 +442,34 @@ def get_loan_record_with_http_info(self, loan_record_id, loan_id, **kwargs): # if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_loan_record" % key + " to method list_margin_account_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] - # verify the required parameter 'loan_record_id' is set - if self.api_client.client_side_validation and ('loan_record_id' not in local_var_params or # noqa: E501 - local_var_params['loan_record_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `loan_record_id` when calling `get_loan_record`") # noqa: E501 - # verify the required parameter 'loan_id' is set - if self.api_client.client_side_validation and ('loan_id' not in local_var_params or # noqa: E501 - local_var_params['loan_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `loan_id` when calling `get_loan_record`") # noqa: E501 + if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 + raise ApiValueError("Invalid value for parameter `page` when calling `list_margin_account_book`, must be a value greater than or equal to `1`") # 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_margin_account_book`, 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_margin_account_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} - if 'loan_record_id' in local_var_params: - path_params['loan_record_id'] = local_var_params['loan_record_id'] # noqa: E501 query_params = [] - 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 '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 '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 '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 + query_params.append(('from', local_var_params['_from'])) # noqa: E501 + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 + query_params.append(('to', local_var_params['to'])) # noqa: E501 + if 'page' in local_var_params and local_var_params['page'] is not None: # 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 header_params = {} @@ -502,14 +485,14 @@ def get_loan_record_with_http_info(self, loan_record_id, loan_id, **kwargs): # auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/margin/loan_records/{loan_record_id}', 'GET', + '/margin/account_book', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='LoanRecord', # noqa: E501 + response_type='list[MarginAccountBook]', # 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 @@ -625,16 +608,23 @@ def list_funding_accounts_with_http_info(self, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_funding_book(self, currency, **kwargs): # noqa: E501 - """Order book of lending loans # noqa: E501 + def list_loans(self, status, side, **kwargs): # noqa: E501 + """List all loans # 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_funding_book(currency, async_req=True) + >>> thread = api.list_loans(status, side, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency: Retrieved specified currency related data (required) + :param str status: Loan status (required) + :param str side: Lend or borrow (required) + :param str currency: Retrieved specified currency related data + :param str currency_pair: Currency pair + :param str sort_by: Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` + :param bool reverse_sort: Whether to sort in descending order. Default to `true` + :param int page: Page number + :param int limit: Maximum number of records returned in one list :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -642,23 +632,30 @@ def list_funding_book(self, currency, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FundingBookItem] + :return: list[Loan] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_funding_book_with_http_info(currency, **kwargs) # noqa: E501 + return self.list_loans_with_http_info(status, side, **kwargs) # noqa: E501 - def list_funding_book_with_http_info(self, currency, **kwargs): # noqa: E501 - """Order book of lending loans # noqa: E501 + def list_loans_with_http_info(self, status, side, **kwargs): # noqa: E501 + """List all loans # 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_funding_book_with_http_info(currency, async_req=True) + >>> thread = api.list_loans_with_http_info(status, side, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency: Retrieved specified currency related data (required) + :param str status: Loan status (required) + :param str side: Lend or borrow (required) + :param str currency: Retrieved specified currency related data + :param str currency_pair: Currency pair + :param str sort_by: Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` + :param bool reverse_sort: Whether to sort in descending order. Default to `true` + :param int page: Page number + :param int limit: Maximum number of records returned in one list :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -668,7 +665,7 @@ def list_funding_book_with_http_info(self, currency, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FundingBookItem], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[Loan], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -676,7 +673,14 @@ def list_funding_book_with_http_info(self, currency, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'currency' + 'status', + 'side', + 'currency', + 'currency_pair', + 'sort_by', + 'reverse_sort', + 'page', + 'limit' ] all_params.extend( [ @@ -691,22 +695,46 @@ def list_funding_book_with_http_info(self, currency, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_funding_book" % key + " to method list_loans" % key ) local_var_params[key] = val 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 # noqa: E501 - local_var_params['currency'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency` when calling `list_funding_book`") # noqa: E501 + # verify the required parameter 'status' is set + if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 + local_var_params['status'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `status` when calling `list_loans`") # noqa: E501 + # verify the required parameter 'side' is set + if self.api_client.client_side_validation and ('side' not in local_var_params or # noqa: E501 + local_var_params['side'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `side` when calling `list_loans`") # noqa: E501 + if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 + raise ApiValueError("Invalid value for parameter `page` when calling `list_loans`, must be a value greater than or equal to `1`") # 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_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_loans`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501 + 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 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 + query_params.append(('side', local_var_params['side'])) # 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 '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 'sort_by' in local_var_params and local_var_params['sort_by'] is not None: # noqa: E501 + query_params.append(('sort_by', local_var_params['sort_by'])) # noqa: E501 + if 'reverse_sort' in local_var_params and local_var_params['reverse_sort'] is not None: # noqa: E501 + query_params.append(('reverse_sort', local_var_params['reverse_sort'])) # noqa: E501 + if 'page' in local_var_params and local_var_params['page'] is not None: # 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 header_params = {} @@ -719,17 +747,17 @@ def list_funding_book_with_http_info(self, currency, **kwargs): # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/margin/funding_book', 'GET', + '/margin/loans', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[FundingBookItem]', # noqa: E501 + response_type='list[Loan]', # 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 @@ -737,19 +765,16 @@ def list_funding_book_with_http_info(self, currency, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_loan_records(self, loan_id, **kwargs): # noqa: E501 - """List repayment records of specified loan # noqa: E501 + def create_loan(self, loan, **kwargs): # noqa: E501 + """Lend or borrow # 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_loan_records(loan_id, async_req=True) + >>> thread = api.create_loan(loan, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str loan_id: Loan ID (required) - :param str status: Loan record status - :param int page: Page number - :param int limit: Maximum number of records returned in one list + :param Loan loan: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -757,26 +782,23 @@ def list_loan_records(self, loan_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[LoanRecord] + :return: Loan If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_loan_records_with_http_info(loan_id, **kwargs) # noqa: E501 + return self.create_loan_with_http_info(loan, **kwargs) # noqa: E501 - def list_loan_records_with_http_info(self, loan_id, **kwargs): # noqa: E501 - """List repayment records of specified loan # noqa: E501 + def create_loan_with_http_info(self, loan, **kwargs): # noqa: E501 + """Lend or borrow # 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_loan_records_with_http_info(loan_id, async_req=True) + >>> thread = api.create_loan_with_http_info(loan, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str loan_id: Loan ID (required) - :param str status: Loan record status - :param int page: Page number - :param int limit: Maximum number of records returned in one list + :param Loan 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 @@ -786,7 +808,7 @@ def list_loan_records_with_http_info(self, loan_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[LoanRecord], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -794,10 +816,7 @@ def list_loan_records_with_http_info(self, loan_id, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'loan_id', - 'status', - 'page', - 'limit' + 'loan' ] all_params.extend( [ @@ -812,34 +831,20 @@ def list_loan_records_with_http_info(self, loan_id, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_loan_records" % key + " to method create_loan" % key ) local_var_params[key] = val 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 # noqa: E501 - local_var_params['loan_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `loan_id` when calling `list_loan_records`") # noqa: E501 + # verify the required parameter 'loan' is set + if self.api_client.client_side_validation and ('loan' not in local_var_params or # noqa: E501 + local_var_params['loan'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan` when calling `create_loan`") # noqa: E501 - if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 - raise ApiValueError("Invalid value for parameter `page` when calling `list_loan_records`, must be a value greater than or equal to `1`") # 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_loan_records`, 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_loan_records`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - 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 '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 'page' in local_var_params and local_var_params['page'] is not None: # 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 header_params = {} @@ -847,22 +852,28 @@ def list_loan_records_with_http_info(self, loan_id, **kwargs): # noqa: E501 local_var_files = {} body_params = None + if 'loan' in local_var_params: + body_params = local_var_params['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/loan_records', 'GET', + '/margin/loans', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[LoanRecord]', # noqa: E501 + response_type='Loan', # 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 @@ -870,16 +881,17 @@ def list_loan_records_with_http_info(self, loan_id, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_loan_repayments(self, loan_id, **kwargs): # noqa: E501 - """List loan repayment records # noqa: E501 + def merge_loans(self, currency, ids, **kwargs): # noqa: E501 + """Merge multiple lending loans # 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_loan_repayments(loan_id, async_req=True) + >>> thread = api.merge_loans(currency, ids, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str loan_id: Loan ID (required) + :param str currency: Retrieved specified currency related data (required) + :param str ids: Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -887,23 +899,24 @@ def list_loan_repayments(self, loan_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Repayment] + :return: Loan If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_loan_repayments_with_http_info(loan_id, **kwargs) # noqa: E501 + return self.merge_loans_with_http_info(currency, ids, **kwargs) # noqa: E501 - def list_loan_repayments_with_http_info(self, loan_id, **kwargs): # noqa: E501 - """List loan repayment records # noqa: E501 + def merge_loans_with_http_info(self, currency, ids, **kwargs): # noqa: E501 + """Merge multiple lending loans # 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_loan_repayments_with_http_info(loan_id, async_req=True) + >>> thread = api.merge_loans_with_http_info(currency, ids, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str loan_id: Loan ID (required) + :param str currency: Retrieved specified currency related data (required) + :param str ids: Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one 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 @@ -913,7 +926,7 @@ def list_loan_repayments_with_http_info(self, loan_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Repayment], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -921,7 +934,8 @@ def list_loan_repayments_with_http_info(self, loan_id, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'loan_id' + 'currency', + 'ids' ] all_params.extend( [ @@ -936,22 +950,28 @@ def list_loan_repayments_with_http_info(self, loan_id, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_loan_repayments" % key + " to method merge_loans" % key ) local_var_params[key] = val 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 # noqa: E501 - local_var_params['loan_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `loan_id` when calling `list_loan_repayments`") # noqa: E501 + # verify the required parameter 'currency' is set + if self.api_client.client_side_validation and ('currency' not in local_var_params or # noqa: E501 + local_var_params['currency'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency` when calling `merge_loans`") # noqa: E501 + # verify the required parameter 'ids' is set + if self.api_client.client_side_validation and ('ids' not in local_var_params or # noqa: E501 + local_var_params['ids'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `ids` when calling `merge_loans`") # 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 = [] + 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 'ids' in local_var_params and local_var_params['ids'] is not None: # noqa: E501 + query_params.append(('ids', local_var_params['ids'])) # noqa: E501 header_params = {} @@ -967,14 +987,14 @@ def list_loan_repayments_with_http_info(self, loan_id, **kwargs): # noqa: E501 auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/margin/loans/{loan_id}/repayment', 'GET', + '/margin/merged_loans', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Repayment]', # noqa: E501 + response_type='Loan', # 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 @@ -982,23 +1002,17 @@ def list_loan_repayments_with_http_info(self, loan_id, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_loans(self, status, side, **kwargs): # noqa: E501 - """List all loans # noqa: E501 + def get_loan(self, loan_id, side, **kwargs): # noqa: E501 + """Retrieve one single 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.list_loans(status, side, async_req=True) + >>> thread = api.get_loan(loan_id, side, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str status: Loan status (required) + :param str loan_id: Loan ID (required) :param str side: Lend or borrow (required) - :param str currency: Retrieved specified currency related data - :param str currency_pair: Currency pair - :param str sort_by: Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` - :param bool reverse_sort: Whether to sort in descending order. Default to `true` - :param int page: Page number - :param int limit: Maximum number of records returned in one list :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1006,30 +1020,24 @@ def list_loans(self, status, side, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Loan] + :return: Loan If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_loans_with_http_info(status, side, **kwargs) # noqa: E501 + return self.get_loan_with_http_info(loan_id, side, **kwargs) # noqa: E501 - def list_loans_with_http_info(self, status, side, **kwargs): # noqa: E501 - """List all loans # noqa: E501 + def get_loan_with_http_info(self, loan_id, side, **kwargs): # noqa: E501 + """Retrieve one single 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.list_loans_with_http_info(status, side, async_req=True) + >>> thread = api.get_loan_with_http_info(loan_id, side, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str status: Loan status (required) + :param str loan_id: Loan ID (required) :param str side: Lend or borrow (required) - :param str currency: Retrieved specified currency related data - :param str currency_pair: Currency pair - :param str sort_by: Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` - :param bool reverse_sort: Whether to sort in descending order. Default to `true` - :param int page: Page number - :param int limit: Maximum number of records returned in one list :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1039,7 +1047,7 @@ def list_loans_with_http_info(self, status, side, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Loan], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1047,14 +1055,8 @@ def list_loans_with_http_info(self, status, side, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'status', - 'side', - 'currency', - 'currency_pair', - 'sort_by', - 'reverse_sort', - 'page', - 'limit' + 'loan_id', + 'side' ] all_params.extend( [ @@ -1069,46 +1071,151 @@ def list_loans_with_http_info(self, status, side, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_loans" % key + " to method get_loan" % key ) local_var_params[key] = val 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 # noqa: E501 - local_var_params['status'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `status` when calling `list_loans`") # noqa: E501 + # verify the required parameter 'loan_id' is set + if self.api_client.client_side_validation and ('loan_id' not in local_var_params or # noqa: E501 + local_var_params['loan_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_id` when calling `get_loan`") # noqa: E501 # verify the required parameter 'side' is set if self.api_client.client_side_validation and ('side' not in local_var_params or # noqa: E501 local_var_params['side'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `side` when calling `list_loans`") # noqa: E501 + raise ApiValueError("Missing the required parameter `side` when calling `get_loan`") # noqa: E501 - if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 - raise ApiValueError("Invalid value for parameter `page` when calling `list_loans`, must be a value greater than or equal to `1`") # 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_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_loans`, must be a value greater than or equal to `1`") # 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 = [] - 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 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 query_params.append(('side', local_var_params['side'])) # 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/loans/{loan_id}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Loan', # 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 cancel_loan(self, loan_id, currency, **kwargs): # noqa: E501 + """Cancel lending loan # noqa: E501 + + Only lending loans can be cancelled # 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_loan(loan_id, currency, async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param str loan_id: Loan ID (required) + :param str currency: Retrieved specified currency related data (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. + :return: Loan + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.cancel_loan_with_http_info(loan_id, currency, **kwargs) # noqa: E501 + + def cancel_loan_with_http_info(self, loan_id, currency, **kwargs): # noqa: E501 + """Cancel lending loan # noqa: E501 + + Only lending loans can be cancelled # 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_loan_with_http_info(loan_id, currency, async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param str loan_id: Loan ID (required) + :param str currency: Retrieved specified currency related data (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. + :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'loan_id', + 'currency' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method cancel_loan" % key + ) + local_var_params[key] = val + 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 # noqa: E501 + local_var_params['loan_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_id` when calling `cancel_loan`") # noqa: E501 + # verify the required parameter 'currency' is set + if self.api_client.client_side_validation and ('currency' not in local_var_params or # noqa: E501 + local_var_params['currency'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency` when calling `cancel_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 = [] 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 '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 'sort_by' in local_var_params and local_var_params['sort_by'] is not None: # noqa: E501 - query_params.append(('sort_by', local_var_params['sort_by'])) # noqa: E501 - if 'reverse_sort' in local_var_params and local_var_params['reverse_sort'] is not None: # noqa: E501 - query_params.append(('reverse_sort', local_var_params['reverse_sort'])) # noqa: E501 - if 'page' in local_var_params and local_var_params['page'] is not None: # 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 header_params = {} @@ -1124,14 +1231,14 @@ def list_loans_with_http_info(self, status, side, **kwargs): # noqa: E501 auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/margin/loans', 'GET', + '/margin/loans/{loan_id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Loan]', # noqa: E501 + response_type='Loan', # 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 @@ -1139,16 +1246,18 @@ def list_loans_with_http_info(self, status, side, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_margin_accounts(self, **kwargs): # noqa: E501 - """Margin account list # noqa: E501 + def update_loan(self, loan_id, loan_patch, **kwargs): # noqa: E501 + """Modify a loan # noqa: E501 + Only `auto_renew` modification is supported currently # 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_margin_accounts(async_req=True) + >>> thread = api.update_loan(loan_id, loan_patch, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency_pair: Currency pair + :param str loan_id: Loan ID (required) + :param LoanPatch loan_patch: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1156,23 +1265,25 @@ def list_margin_accounts(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[MarginAccount] + :return: Loan If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_margin_accounts_with_http_info(**kwargs) # noqa: E501 + return self.update_loan_with_http_info(loan_id, loan_patch, **kwargs) # noqa: E501 - def list_margin_accounts_with_http_info(self, **kwargs): # noqa: E501 - """Margin account list # noqa: E501 + def update_loan_with_http_info(self, loan_id, loan_patch, **kwargs): # noqa: E501 + """Modify a loan # noqa: E501 + Only `auto_renew` modification is supported currently # 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_margin_accounts_with_http_info(async_req=True) + >>> thread = api.update_loan_with_http_info(loan_id, loan_patch, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency_pair: Currency pair + :param str loan_id: Loan ID (required) + :param LoanPatch loan_patch: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1182,7 +1293,7 @@ def list_margin_accounts_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[MarginAccount], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1190,7 +1301,8 @@ def list_margin_accounts_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'currency_pair' + 'loan_id', + 'loan_patch' ] all_params.extend( [ @@ -1205,18 +1317,26 @@ def list_margin_accounts_with_http_info(self, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_margin_accounts" % key + " to method update_loan" % key ) local_var_params[key] = val 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 # noqa: E501 + local_var_params['loan_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_id` when calling `update_loan`") # noqa: E501 + # verify the required parameter 'loan_patch' is set + if self.api_client.client_side_validation and ('loan_patch' not in local_var_params or # noqa: E501 + local_var_params['loan_patch'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_patch` when calling `update_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 = [] - 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 header_params = {} @@ -1224,22 +1344,28 @@ def list_margin_accounts_with_http_info(self, **kwargs): # noqa: E501 local_var_files = {} body_params = None + if 'loan_patch' in local_var_params: + body_params = local_var_params['loan_patch'] # 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/accounts', 'GET', + '/margin/loans/{loan_id}', 'PATCH', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[MarginAccount]', # noqa: E501 + response_type='Loan', # 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 @@ -1247,15 +1373,16 @@ def list_margin_accounts_with_http_info(self, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_margin_currency_pairs(self, **kwargs): # noqa: E501 - """List all supported currency pairs supported in margin trading # noqa: E501 + def list_loan_repayments(self, loan_id, **kwargs): # noqa: E501 + """List loan repayment records # 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_margin_currency_pairs(async_req=True) + >>> thread = api.list_loan_repayments(loan_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously + :param str loan_id: Loan ID (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1263,22 +1390,23 @@ def list_margin_currency_pairs(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[MarginCurrencyPair] + :return: list[Repayment] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_margin_currency_pairs_with_http_info(**kwargs) # noqa: E501 + return self.list_loan_repayments_with_http_info(loan_id, **kwargs) # noqa: E501 - def list_margin_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 - """List all supported currency pairs supported in margin trading # noqa: E501 + def list_loan_repayments_with_http_info(self, loan_id, **kwargs): # noqa: E501 + """List loan repayment records # 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_margin_currency_pairs_with_http_info(async_req=True) + >>> thread = api.list_loan_repayments_with_http_info(loan_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously + :param str loan_id: 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 @@ -1288,7 +1416,7 @@ def list_margin_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[MarginCurrencyPair], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[Repayment], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1296,6 +1424,7 @@ def list_margin_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ + 'loan_id' ] all_params.extend( [ @@ -1310,14 +1439,20 @@ def list_margin_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_margin_currency_pairs" % key + " to method list_loan_repayments" % key ) local_var_params[key] = val 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 # noqa: E501 + local_var_params['loan_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_id` when calling `list_loan_repayments`") # 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 = [] @@ -1332,17 +1467,17 @@ def list_margin_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/margin/currency_pairs', 'GET', + '/margin/loans/{loan_id}/repayment', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[MarginCurrencyPair]', # noqa: E501 + response_type='list[Repayment]', # 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 @@ -1350,17 +1485,17 @@ def list_margin_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def merge_loans(self, currency, ids, **kwargs): # noqa: E501 - """Merge multiple lending loans # noqa: E501 + def repay_loan(self, loan_id, repay_request, **kwargs): # noqa: E501 + """Repay a 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.merge_loans(currency, ids, async_req=True) + >>> thread = api.repay_loan(loan_id, repay_request, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency: Retrieved specified currency related data (required) - :param str ids: Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request (required) + :param str loan_id: Loan ID (required) + :param RepayRequest repay_request: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1373,19 +1508,19 @@ def merge_loans(self, currency, ids, **kwargs): # noqa: E501 returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.merge_loans_with_http_info(currency, ids, **kwargs) # noqa: E501 + return self.repay_loan_with_http_info(loan_id, repay_request, **kwargs) # noqa: E501 - def merge_loans_with_http_info(self, currency, ids, **kwargs): # noqa: E501 - """Merge multiple lending loans # noqa: E501 + def repay_loan_with_http_info(self, loan_id, repay_request, **kwargs): # noqa: E501 + """Repay a 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.merge_loans_with_http_info(currency, ids, async_req=True) + >>> thread = api.repay_loan_with_http_info(loan_id, repay_request, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency: Retrieved specified currency related data (required) - :param str ids: Lending loan ID list separated by `,`. Maximum of 20 IDs are allowed in one request (required) + :param str loan_id: Loan ID (required) + :param RepayRequest 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 @@ -1403,8 +1538,8 @@ def merge_loans_with_http_info(self, currency, ids, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'currency', - 'ids' + 'loan_id', + 'repay_request' ] all_params.extend( [ @@ -1419,28 +1554,26 @@ def merge_loans_with_http_info(self, currency, ids, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method merge_loans" % key + " to method repay_loan" % key ) local_var_params[key] = val 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 # noqa: E501 - local_var_params['currency'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency` when calling `merge_loans`") # noqa: E501 - # verify the required parameter 'ids' is set - if self.api_client.client_side_validation and ('ids' not in local_var_params or # noqa: E501 - local_var_params['ids'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `ids` when calling `merge_loans`") # noqa: E501 + # verify the required parameter 'loan_id' is set + if self.api_client.client_side_validation and ('loan_id' not in local_var_params or # noqa: E501 + local_var_params['loan_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_id` when calling `repay_loan`") # noqa: E501 + # verify the required parameter 'repay_request' is set + if self.api_client.client_side_validation and ('repay_request' not in local_var_params or # noqa: E501 + local_var_params['repay_request'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `repay_request` when calling `repay_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 = [] - 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 'ids' in local_var_params and local_var_params['ids'] is not None: # noqa: E501 - query_params.append(('ids', local_var_params['ids'])) # noqa: E501 header_params = {} @@ -1448,15 +1581,21 @@ def merge_loans_with_http_info(self, currency, ids, **kwargs): # noqa: E501 local_var_files = {} body_params = None + if 'repay_request' in local_var_params: + body_params = local_var_params['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/merged_loans', 'POST', + '/margin/loans/{loan_id}/repayment', 'POST', path_params, query_params, header_params, @@ -1471,17 +1610,19 @@ def merge_loans_with_http_info(self, currency, ids, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def repay_loan(self, loan_id, repay_request, **kwargs): # noqa: E501 - """Repay a loan # noqa: E501 + def list_loan_records(self, loan_id, **kwargs): # noqa: E501 + """List repayment records of specified 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_loan(loan_id, repay_request, async_req=True) + >>> thread = api.list_loan_records(loan_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str loan_id: Loan ID (required) - :param RepayRequest repay_request: (required) + :param str status: Loan record status + :param int page: Page number + :param int limit: Maximum number of records returned in one list :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1489,24 +1630,26 @@ def repay_loan(self, loan_id, repay_request, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Loan + :return: list[LoanRecord] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.repay_loan_with_http_info(loan_id, repay_request, **kwargs) # noqa: E501 + return self.list_loan_records_with_http_info(loan_id, **kwargs) # noqa: E501 - def repay_loan_with_http_info(self, loan_id, repay_request, **kwargs): # noqa: E501 - """Repay a loan # noqa: E501 + def list_loan_records_with_http_info(self, loan_id, **kwargs): # noqa: E501 + """List repayment records of specified 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_loan_with_http_info(loan_id, repay_request, async_req=True) + >>> thread = api.list_loan_records_with_http_info(loan_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str loan_id: Loan ID (required) - :param RepayRequest repay_request: (required) + :param str status: Loan record status + :param int page: Page number + :param int limit: Maximum number of records returned in one list :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1516,7 +1659,7 @@ def repay_loan_with_http_info(self, loan_id, repay_request, **kwargs): # noqa: number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[LoanRecord], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1525,7 +1668,9 @@ def repay_loan_with_http_info(self, loan_id, repay_request, **kwargs): # noqa: all_params = [ 'loan_id', - 'repay_request' + 'status', + 'page', + 'limit' ] all_params.extend( [ @@ -1540,26 +1685,34 @@ def repay_loan_with_http_info(self, loan_id, repay_request, **kwargs): # noqa: if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method repay_loan" % key + " to method list_loan_records" % key ) local_var_params[key] = val 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 # noqa: E501 local_var_params['loan_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `loan_id` when calling `repay_loan`") # noqa: E501 - # verify the required parameter 'repay_request' is set - if self.api_client.client_side_validation and ('repay_request' not in local_var_params or # noqa: E501 - local_var_params['repay_request'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `repay_request` when calling `repay_loan`") # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_id` when calling `list_loan_records`") # noqa: E501 + if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 + raise ApiValueError("Invalid value for parameter `page` when calling `list_loan_records`, must be a value greater than or equal to `1`") # 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_loan_records`, 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_loan_records`, must be a value greater than or equal to `1`") # 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 = [] + 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 '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 'page' in local_var_params and local_var_params['page'] is not None: # 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 header_params = {} @@ -1567,28 +1720,22 @@ def repay_loan_with_http_info(self, loan_id, repay_request, **kwargs): # noqa: local_var_files = {} body_params = None - if 'repay_request' in local_var_params: - body_params = local_var_params['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/loans/{loan_id}/repayment', 'POST', + '/margin/loan_records', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Loan', # noqa: E501 + response_type='list[LoanRecord]', # 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 @@ -1596,18 +1743,17 @@ def repay_loan_with_http_info(self, loan_id, repay_request, **kwargs): # noqa: _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def update_loan(self, loan_id, loan_patch, **kwargs): # noqa: E501 - """Modify a loan # noqa: E501 + def get_loan_record(self, loan_record_id, loan_id, **kwargs): # noqa: E501 + """Get one single loan record # noqa: E501 - Only `auto_renew` modification is supported currently # 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_loan(loan_id, loan_patch, async_req=True) + >>> thread = api.get_loan_record(loan_record_id, loan_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously + :param str loan_record_id: Loan record ID (required) :param str loan_id: Loan ID (required) - :param LoanPatch loan_patch: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1615,25 +1761,24 @@ def update_loan(self, loan_id, loan_patch, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Loan + :return: LoanRecord If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.update_loan_with_http_info(loan_id, loan_patch, **kwargs) # noqa: E501 + return self.get_loan_record_with_http_info(loan_record_id, loan_id, **kwargs) # noqa: E501 - def update_loan_with_http_info(self, loan_id, loan_patch, **kwargs): # noqa: E501 - """Modify a loan # noqa: E501 + def get_loan_record_with_http_info(self, loan_record_id, loan_id, **kwargs): # noqa: E501 + """Get one single loan record # noqa: E501 - Only `auto_renew` modification is supported currently # 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_loan_with_http_info(loan_id, loan_patch, async_req=True) + >>> thread = api.get_loan_record_with_http_info(loan_record_id, loan_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously + :param str loan_record_id: Loan record ID (required) :param str loan_id: Loan ID (required) - :param LoanPatch loan_patch: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1643,7 +1788,7 @@ def update_loan_with_http_info(self, loan_id, loan_patch, **kwargs): # noqa: E5 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(LoanRecord, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1651,8 +1796,8 @@ def update_loan_with_http_info(self, loan_id, loan_patch, **kwargs): # noqa: E5 local_var_params = locals() all_params = [ - 'loan_id', - 'loan_patch' + 'loan_record_id', + 'loan_id' ] all_params.extend( [ @@ -1667,26 +1812,28 @@ def update_loan_with_http_info(self, loan_id, loan_patch, **kwargs): # noqa: E5 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method update_loan" % key + " to method get_loan_record" % key ) local_var_params[key] = val del local_var_params['kwargs'] + # verify the required parameter 'loan_record_id' is set + if self.api_client.client_side_validation and ('loan_record_id' not in local_var_params or # noqa: E501 + local_var_params['loan_record_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_record_id` when calling `get_loan_record`") # noqa: E501 # verify the required parameter 'loan_id' is set if self.api_client.client_side_validation and ('loan_id' not in local_var_params or # noqa: E501 local_var_params['loan_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `loan_id` when calling `update_loan`") # noqa: E501 - # verify the required parameter 'loan_patch' is set - if self.api_client.client_side_validation and ('loan_patch' not in local_var_params or # noqa: E501 - local_var_params['loan_patch'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `loan_patch` when calling `update_loan`") # noqa: E501 + raise ApiValueError("Missing the required parameter `loan_id` when calling `get_loan_record`") # noqa: E501 collection_formats = {} path_params = {} - if 'loan_id' in local_var_params: - path_params['loan_id'] = local_var_params['loan_id'] # noqa: E501 + if 'loan_record_id' in local_var_params: + path_params['loan_record_id'] = local_var_params['loan_record_id'] # noqa: E501 query_params = [] + 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 header_params = {} @@ -1694,28 +1841,22 @@ def update_loan_with_http_info(self, loan_id, loan_patch, **kwargs): # noqa: E5 local_var_files = {} body_params = None - if 'loan_patch' in local_var_params: - body_params = local_var_params['loan_patch'] # 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/loans/{loan_id}', 'PATCH', + '/margin/loan_records/{loan_record_id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Loan', # noqa: E501 + response_type='LoanRecord', # 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 diff --git a/gate_api/api/spot_api.py b/gate_api/api/spot_api.py index 22fabee..0461d4f 100644 --- a/gate_api/api/spot_api.py +++ b/gate_api/api/spot_api.py @@ -36,17 +36,15 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def cancel_batch_orders(self, cancel_order, **kwargs): # noqa: E501 - """Cancel a batch of orders with an ID list # noqa: E501 + def list_currency_pairs(self, **kwargs): # noqa: E501 + """List all currency pairs supported # noqa: E501 - Multiple currency pairs can be specified, but maximum 20 orders are allowed per request # 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_batch_orders(cancel_order, async_req=True) + >>> thread = api.list_currency_pairs(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param list[CancelOrder] cancel_order: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -54,24 +52,22 @@ def cancel_batch_orders(self, cancel_order, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[CancelOrderResult] + :return: list[CurrencyPair] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.cancel_batch_orders_with_http_info(cancel_order, **kwargs) # noqa: E501 + return self.list_currency_pairs_with_http_info(**kwargs) # noqa: E501 - def cancel_batch_orders_with_http_info(self, cancel_order, **kwargs): # noqa: E501 - """Cancel a batch of orders with an ID list # noqa: E501 + def list_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 + """List all currency pairs supported # noqa: E501 - Multiple currency pairs can be specified, but maximum 20 orders are allowed per request # 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_batch_orders_with_http_info(cancel_order, async_req=True) + >>> thread = api.list_currency_pairs_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param list[CancelOrder] cancel_order: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -81,7 +77,7 @@ def cancel_batch_orders_with_http_info(self, cancel_order, **kwargs): # noqa: E number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[CancelOrderResult], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[CurrencyPair], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -89,7 +85,6 @@ def cancel_batch_orders_with_http_info(self, cancel_order, **kwargs): # noqa: E local_var_params = locals() all_params = [ - 'cancel_order' ] all_params.extend( [ @@ -104,14 +99,10 @@ def cancel_batch_orders_with_http_info(self, cancel_order, **kwargs): # noqa: E if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method cancel_batch_orders" % key + " to method list_currency_pairs" % key ) local_var_params[key] = val del local_var_params['kwargs'] - # verify the required parameter 'cancel_order' is set - if self.api_client.client_side_validation and ('cancel_order' not in local_var_params or # noqa: E501 - local_var_params['cancel_order'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `cancel_order` when calling `cancel_batch_orders`") # noqa: E501 collection_formats = {} @@ -125,28 +116,22 @@ def cancel_batch_orders_with_http_info(self, cancel_order, **kwargs): # noqa: E local_var_files = {} body_params = None - if 'cancel_order' in local_var_params: - body_params = local_var_params['cancel_order'] # 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 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/spot/cancel_batch_orders', 'POST', + '/spot/currency_pairs', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[CancelOrderResult]', # noqa: E501 + response_type='list[CurrencyPair]', # 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 @@ -154,16 +139,15 @@ def cancel_batch_orders_with_http_info(self, cancel_order, **kwargs): # noqa: E _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def cancel_order(self, order_id, currency_pair, **kwargs): # noqa: E501 - """Cancel a single order # noqa: E501 + def get_currency_pair(self, currency_pair, **kwargs): # noqa: E501 + """Get detail of one single order # 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) + >>> thread = api.get_currency_pair(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str order_id: ID returned on order successfully being created (required) :param str currency_pair: Currency pair (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response @@ -172,23 +156,22 @@ def cancel_order(self, order_id, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Order + :return: CurrencyPair If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.cancel_order_with_http_info(order_id, currency_pair, **kwargs) # noqa: E501 + return self.get_currency_pair_with_http_info(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 + def get_currency_pair_with_http_info(self, currency_pair, **kwargs): # noqa: E501 + """Get detail of one single order # 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) + >>> thread = api.get_currency_pair_with_http_info(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str order_id: ID returned on order successfully being created (required) :param str currency_pair: Currency pair (required) :param _return_http_data_only: response data without head status code and headers @@ -199,7 +182,7 @@ def cancel_order_with_http_info(self, order_id, currency_pair, **kwargs): # noq number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Order, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(CurrencyPair, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -207,7 +190,6 @@ 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.extend( @@ -223,28 +205,22 @@ def cancel_order_with_http_info(self, order_id, currency_pair, **kwargs): # noq if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method cancel_order" % key + " to method get_currency_pair" % key ) local_var_params[key] = val del local_var_params['kwargs'] - # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_order`") # noqa: E501 # verify the required parameter 'currency_pair' is set if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 local_var_params['currency_pair'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency_pair` when calling `cancel_order`") # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `get_currency_pair`") # noqa: E501 collection_formats = {} path_params = {} - if 'order_id' in local_var_params: - path_params['order_id'] = local_var_params['order_id'] # noqa: E501 + if 'currency_pair' in local_var_params: + path_params['currency_pair'] = local_var_params['currency_pair'] # noqa: E501 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 header_params = {} @@ -257,17 +233,17 @@ def cancel_order_with_http_info(self, order_id, currency_pair, **kwargs): # noq ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ['apiv4'] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/spot/orders/{order_id}', 'DELETE', + '/spot/currency_pairs/{currency_pair}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Order', # noqa: E501 + response_type='CurrencyPair', # 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 @@ -275,18 +251,17 @@ def cancel_order_with_http_info(self, order_id, currency_pair, **kwargs): # noq _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def cancel_orders(self, currency_pair, **kwargs): # noqa: E501 - """Cancel all `open` orders in specified currency pair # noqa: E501 + def list_tickers(self, **kwargs): # noqa: E501 + """Retrieve ticker information # noqa: E501 + Return only related data if `currency_pair` is specified; otherwise return all of them # 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) + >>> thread = api.list_tickers(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency_pair: Currency pair (required) - :param str side: All bids or asks. Both included in not specified - :param str account: Specify account type. Default to all account types being included + :param str currency_pair: Currency pair :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -294,25 +269,24 @@ def cancel_orders(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Order] + :return: list[Ticker] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.cancel_orders_with_http_info(currency_pair, **kwargs) # noqa: E501 + return self.list_tickers_with_http_info(**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 + def list_tickers_with_http_info(self, **kwargs): # noqa: E501 + """Retrieve ticker information # noqa: E501 + Return only related data if `currency_pair` is specified; otherwise return all of them # 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) + >>> thread = api.list_tickers_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency_pair: Currency pair (required) - :param str side: All bids or asks. Both included in not specified - :param str account: Specify account type. Default to all account types being included + :param str currency_pair: Currency pair :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -322,7 +296,7 @@ def cancel_orders_with_http_info(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Order], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[Ticker], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -330,9 +304,7 @@ def cancel_orders_with_http_info(self, currency_pair, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'currency_pair', - 'side', - 'account' + 'currency_pair' ] all_params.extend( [ @@ -347,14 +319,10 @@ def cancel_orders_with_http_info(self, currency_pair, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method cancel_orders" % key + " to method list_tickers" % key ) local_var_params[key] = val del local_var_params['kwargs'] - # verify the required parameter 'currency_pair' is set - if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 - local_var_params['currency_pair'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency_pair` when calling `cancel_orders`") # noqa: E501 collection_formats = {} @@ -363,10 +331,6 @@ def cancel_orders_with_http_info(self, currency_pair, **kwargs): # noqa: E501 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 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 - query_params.append(('side', local_var_params['side'])) # 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 = {} @@ -379,17 +343,17 @@ def cancel_orders_with_http_info(self, currency_pair, **kwargs): # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting - auth_settings = ['apiv4'] # noqa: E501 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/spot/orders', 'DELETE', + '/spot/tickers', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Order]', # noqa: E501 + response_type='list[Ticker]', # 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 @@ -397,17 +361,19 @@ def cancel_orders_with_http_info(self, currency_pair, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def create_batch_orders(self, order, **kwargs): # noqa: E501 - """Create a batch of orders # noqa: E501 + def list_order_book(self, currency_pair, **kwargs): # noqa: E501 + """Retrieve order book # noqa: E501 - Batch orders requirements: 1. custom order field `text` is required 2. At most 4 currency pairs, maximum 5 orders each, are allowed in one request 3. No mixture of spot orders and margin orders, i.e. `account` must be identical for all orders # noqa: E501 + Order book will be sorted by price from high to low on bids; reversed on asks # 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_batch_orders(order, async_req=True) + >>> thread = api.list_order_book(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param list[Order] order: (required) + :param str currency_pair: Currency pair (required) + :param str interval: Order depth. 0 means no aggregation is applied. default to 0 + :param int limit: Maximum number of order depth data in asks or bids :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -415,24 +381,26 @@ def create_batch_orders(self, order, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[BatchOrder] + :return: OrderBook If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.create_batch_orders_with_http_info(order, **kwargs) # noqa: E501 + return self.list_order_book_with_http_info(currency_pair, **kwargs) # noqa: E501 - def create_batch_orders_with_http_info(self, order, **kwargs): # noqa: E501 - """Create a batch of orders # noqa: E501 + def list_order_book_with_http_info(self, currency_pair, **kwargs): # noqa: E501 + """Retrieve order book # noqa: E501 - Batch orders requirements: 1. custom order field `text` is required 2. At most 4 currency pairs, maximum 5 orders each, are allowed in one request 3. No mixture of spot orders and margin orders, i.e. `account` must be identical for all orders # noqa: E501 + Order book will be sorted by price from high to low on bids; reversed on asks # 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_batch_orders_with_http_info(order, async_req=True) + >>> thread = api.list_order_book_with_http_info(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param list[Order] order: (required) + :param str currency_pair: Currency pair (required) + :param str interval: Order depth. 0 means no aggregation is applied. default to 0 + :param int limit: Maximum number of order depth data in asks or bids :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -442,7 +410,7 @@ def create_batch_orders_with_http_info(self, order, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[BatchOrder], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(OrderBook, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -450,7 +418,9 @@ def create_batch_orders_with_http_info(self, order, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'order' + 'currency_pair', + 'interval', + 'limit' ] all_params.extend( [ @@ -465,20 +435,30 @@ def create_batch_orders_with_http_info(self, order, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method create_batch_orders" % key + " to method list_order_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] - # verify the required parameter 'order' is set - if self.api_client.client_side_validation and ('order' not in local_var_params or # noqa: E501 - local_var_params['order'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order` when calling `create_batch_orders`") # noqa: E501 + # verify the required parameter 'currency_pair' is set + if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 + local_var_params['currency_pair'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_order_book`") # noqa: E501 + if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 30: # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_order_book`, must be a value less than or equal to `30`") # 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_order_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} 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 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 + query_params.append(('interval', local_var_params['interval'])) # 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 header_params = {} @@ -486,28 +466,22 @@ def create_batch_orders_with_http_info(self, order, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if 'order' in local_var_params: - body_params = local_var_params['order'] # 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 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/spot/batch_orders', 'POST', + '/spot/order_book', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[BatchOrder]', # noqa: E501 + response_type='OrderBook', # 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 @@ -515,16 +489,18 @@ def create_batch_orders_with_http_info(self, order, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def create_order(self, order, **kwargs): # noqa: E501 - """Create an order # noqa: E501 + def list_trades(self, currency_pair, **kwargs): # noqa: E501 + """Retrieve market trades # 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) + >>> thread = api.list_trades(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param Order order: (required) + :param str currency_pair: Currency pair (required) + :param int limit: Maximum number of records returned in one list + :param str last_id: Specify list staring point using the `id` of last record in previous list-query results :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -532,23 +508,25 @@ def create_order(self, order, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Order + :return: list[Trade] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.create_order_with_http_info(order, **kwargs) # noqa: E501 + return self.list_trades_with_http_info(currency_pair, **kwargs) # noqa: E501 - def create_order_with_http_info(self, order, **kwargs): # noqa: E501 - """Create an order # noqa: E501 + def list_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 + """Retrieve market trades # 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) + >>> thread = api.list_trades_with_http_info(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param Order order: (required) + :param str currency_pair: Currency pair (required) + :param int limit: Maximum number of records returned in one list + :param str last_id: Specify list staring point using the `id` of last record in previous list-query results :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -558,7 +536,7 @@ def create_order_with_http_info(self, order, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Order, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[Trade], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -566,7 +544,9 @@ def create_order_with_http_info(self, order, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'order' + 'currency_pair', + 'limit', + 'last_id' ] all_params.extend( [ @@ -581,20 +561,30 @@ def create_order_with_http_info(self, order, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method create_order" % key + " to method list_trades" % key ) local_var_params[key] = val del local_var_params['kwargs'] - # verify the required parameter 'order' is set - if self.api_client.client_side_validation and ('order' not in local_var_params or # noqa: E501 - local_var_params['order'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order` when calling `create_order`") # noqa: E501 + # verify the required parameter 'currency_pair' is set + if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 + local_var_params['currency_pair'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_trades`") # 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_trades`, 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_trades`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} 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 '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 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 + query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 header_params = {} @@ -602,28 +592,22 @@ def create_order_with_http_info(self, order, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if 'order' in local_var_params: - body_params = local_var_params['order'] # 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 + auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/spot/orders', 'POST', + '/spot/trades', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Order', # noqa: E501 + response_type='list[Trade]', # 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 @@ -631,16 +615,21 @@ def create_order_with_http_info(self, order, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def get_currency_pair(self, currency_pair, **kwargs): # noqa: E501 - """Get detail of one single order # noqa: E501 + def list_candlesticks(self, currency_pair, **kwargs): # noqa: E501 + """Market candlesticks # noqa: E501 + Maximum of 1000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` # 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_currency_pair(currency_pair, async_req=True) + >>> thread = api.list_candlesticks(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) + :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. + :param int _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified + :param int to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time + :param str interval: Interval time between data points :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -648,23 +637,28 @@ def get_currency_pair(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: CurrencyPair + :return: list[list[str]] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_currency_pair_with_http_info(currency_pair, **kwargs) # noqa: E501 + return self.list_candlesticks_with_http_info(currency_pair, **kwargs) # noqa: E501 - def get_currency_pair_with_http_info(self, currency_pair, **kwargs): # noqa: E501 - """Get detail of one single order # noqa: E501 + def list_candlesticks_with_http_info(self, currency_pair, **kwargs): # noqa: E501 + """Market candlesticks # noqa: E501 + Maximum of 1000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` # 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_currency_pair_with_http_info(currency_pair, async_req=True) + >>> thread = api.list_candlesticks_with_http_info(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) + :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. + :param int _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified + :param int to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time + :param str interval: Interval time between data points :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -674,7 +668,7 @@ def get_currency_pair_with_http_info(self, currency_pair, **kwargs): # noqa: E5 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(CurrencyPair, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[list[str]], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -682,7 +676,11 @@ def get_currency_pair_with_http_info(self, currency_pair, **kwargs): # noqa: E5 local_var_params = locals() all_params = [ - 'currency_pair' + 'currency_pair', + 'limit', + '_from', + 'to', + 'interval' ] all_params.extend( [ @@ -697,22 +695,32 @@ def get_currency_pair_with_http_info(self, currency_pair, **kwargs): # noqa: E5 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_currency_pair" % key + " to method list_candlesticks" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 local_var_params['currency_pair'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency_pair` when calling `get_currency_pair`") # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_candlesticks`") # 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_candlesticks`, must be a value less than or equal to `1000`") # noqa: E501 collection_formats = {} path_params = {} - if 'currency_pair' in local_var_params: - path_params['currency_pair'] = local_var_params['currency_pair'] # noqa: E501 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 '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 '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 + query_params.append(('from', local_var_params['_from'])) # noqa: E501 + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 + query_params.append(('to', local_var_params['to'])) # noqa: E501 + if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 + query_params.append(('interval', local_var_params['interval'])) # noqa: E501 header_params = {} @@ -728,14 +736,14 @@ def get_currency_pair_with_http_info(self, currency_pair, **kwargs): # noqa: E5 auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/spot/currency_pairs/{currency_pair}', 'GET', + '/spot/candlesticks', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='CurrencyPair', # noqa: E501 + response_type='list[list[str]]', # 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 @@ -743,17 +751,16 @@ def get_currency_pair_with_http_info(self, currency_pair, **kwargs): # noqa: E5 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def get_order(self, order_id, currency_pair, **kwargs): # noqa: E501 - """Get a single order # noqa: E501 + def list_spot_accounts(self, **kwargs): # noqa: E501 + """List spot accounts # 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) + >>> thread = api.list_spot_accounts(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str order_id: ID returned on order successfully being created (required) - :param str currency_pair: Currency pair (required) + :param str currency: Retrieved specified currency related data :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -761,24 +768,23 @@ def get_order(self, order_id, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Order + :return: list[SpotAccount] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_order_with_http_info(order_id, currency_pair, **kwargs) # noqa: E501 + return self.list_spot_accounts_with_http_info(**kwargs) # noqa: E501 - def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: E501 - """Get a single order # noqa: E501 + def list_spot_accounts_with_http_info(self, **kwargs): # noqa: E501 + """List spot accounts # 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) + >>> thread = api.list_spot_accounts_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str order_id: ID returned on order successfully being created (required) - :param str currency_pair: Currency pair (required) + :param str currency: Retrieved specified currency related data :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -788,7 +794,7 @@ def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Order, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[SpotAccount], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -796,8 +802,7 @@ def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: local_var_params = locals() all_params = [ - 'order_id', - 'currency_pair' + 'currency' ] all_params.extend( [ @@ -812,28 +817,18 @@ def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_order" % key + " to method list_spot_accounts" % key ) local_var_params[key] = val del local_var_params['kwargs'] - # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `get_order`") # noqa: E501 - # verify the required parameter 'currency_pair' is set - if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 - local_var_params['currency_pair'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency_pair` when calling `get_order`") # noqa: E501 collection_formats = {} path_params = {} - if 'order_id' in local_var_params: - path_params['order_id'] = local_var_params['order_id'] # noqa: E501 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 '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 header_params = {} @@ -849,14 +844,14 @@ def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/spot/orders/{order_id}', 'GET', + '/spot/accounts', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Order', # noqa: E501 + response_type='list[SpotAccount]', # 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 @@ -864,21 +859,17 @@ def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_candlesticks(self, currency_pair, **kwargs): # noqa: E501 - """Market candlesticks # noqa: E501 + def create_batch_orders(self, order, **kwargs): # noqa: E501 + """Create a batch of orders # noqa: E501 - Maximum of 1000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` # noqa: E501 + Batch orders requirements: 1. custom order field `text` is required 2. At most 4 currency pairs, maximum 5 orders each, are allowed in one request 3. No mixture of spot orders and margin orders, i.e. `account` must be identical for all orders # 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_candlesticks(currency_pair, async_req=True) + >>> thread = api.create_batch_orders(order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency_pair: Currency pair (required) - :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. - :param int _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified - :param int to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time - :param str interval: Interval time between data points + :param list[Order] order: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -886,28 +877,24 @@ def list_candlesticks(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[list[str]] + :return: list[BatchOrder] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_candlesticks_with_http_info(currency_pair, **kwargs) # noqa: E501 + return self.create_batch_orders_with_http_info(order, **kwargs) # noqa: E501 - def list_candlesticks_with_http_info(self, currency_pair, **kwargs): # noqa: E501 - """Market candlesticks # noqa: E501 + def create_batch_orders_with_http_info(self, order, **kwargs): # noqa: E501 + """Create a batch of orders # noqa: E501 - Maximum of 1000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` # noqa: E501 + Batch orders requirements: 1. custom order field `text` is required 2. At most 4 currency pairs, maximum 5 orders each, are allowed in one request 3. No mixture of spot orders and margin orders, i.e. `account` must be identical for all orders # 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_candlesticks_with_http_info(currency_pair, async_req=True) + >>> thread = api.create_batch_orders_with_http_info(order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency_pair: Currency pair (required) - :param int limit: Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. - :param int _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified - :param int to: End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time - :param str interval: Interval time between data points + :param list[Order] order: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -917,7 +904,7 @@ def list_candlesticks_with_http_info(self, currency_pair, **kwargs): # noqa: E5 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[list[str]], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[BatchOrder], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -925,11 +912,7 @@ def list_candlesticks_with_http_info(self, currency_pair, **kwargs): # noqa: E5 local_var_params = locals() all_params = [ - 'currency_pair', - 'limit', - '_from', - 'to', - 'interval' + 'order' ] all_params.extend( [ @@ -944,32 +927,20 @@ def list_candlesticks_with_http_info(self, currency_pair, **kwargs): # noqa: E5 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_candlesticks" % key + " to method create_batch_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] - # verify the required parameter 'currency_pair' is set - if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 - local_var_params['currency_pair'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_candlesticks`") # noqa: E501 + # verify the required parameter 'order' is set + if self.api_client.client_side_validation and ('order' not in local_var_params or # noqa: E501 + local_var_params['order'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order` when calling `create_batch_orders`") # 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_candlesticks`, must be a value less than or equal to `1000`") # noqa: E501 collection_formats = {} path_params = {} 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 '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 '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 - query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 - query_params.append(('to', local_var_params['to'])) # noqa: E501 - if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 - query_params.append(('interval', local_var_params['interval'])) # noqa: E501 header_params = {} @@ -977,22 +948,28 @@ def list_candlesticks_with_http_info(self, currency_pair, **kwargs): # noqa: E5 local_var_files = {} body_params = None + if 'order' in local_var_params: + body_params = local_var_params['order'] # 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 = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/spot/candlesticks', 'GET', + '/spot/batch_orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[list[str]]', # noqa: E501 + response_type='list[BatchOrder]', # 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 @@ -1000,15 +977,18 @@ def list_candlesticks_with_http_info(self, currency_pair, **kwargs): # noqa: E5 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_currency_pairs(self, **kwargs): # noqa: E501 - """List all currency pairs supported # noqa: E501 + def list_all_open_orders(self, **kwargs): # noqa: E501 + """List all open orders # noqa: E501 + List all open orders in all currency pairs. Each currency pair has its own pagination # 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_currency_pairs(async_req=True) + >>> thread = api.list_all_open_orders(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously + :param int page: Page number + :param int limit: Maximum number of records returned in one list :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1016,22 +996,25 @@ def list_currency_pairs(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[CurrencyPair] + :return: list[OpenOrders] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_currency_pairs_with_http_info(**kwargs) # noqa: E501 + return self.list_all_open_orders_with_http_info(**kwargs) # noqa: E501 - def list_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 - """List all currency pairs supported # noqa: E501 + def list_all_open_orders_with_http_info(self, **kwargs): # noqa: E501 + """List all open orders # noqa: E501 + List all open orders in all currency pairs. Each currency pair has its own pagination # 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_currency_pairs_with_http_info(async_req=True) + >>> thread = api.list_all_open_orders_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously + :param int page: Page number + :param int limit: Maximum number of records returned in one list :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1041,7 +1024,7 @@ def list_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[CurrencyPair], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[OpenOrders], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1049,6 +1032,8 @@ def list_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ + 'page', + 'limit' ] all_params.extend( [ @@ -1063,16 +1048,26 @@ def list_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_currency_pairs" % key + " to method list_all_open_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] + if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 + raise ApiValueError("Invalid value for parameter `page` when calling `list_all_open_orders`, must be a value greater than or equal to `1`") # 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_all_open_orders`, 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_all_open_orders`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] + if 'page' in local_var_params and local_var_params['page'] is not None: # 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 header_params = {} @@ -1085,17 +1080,17 @@ def list_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/spot/currency_pairs', 'GET', + '/spot/open_orders', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[CurrencyPair]', # noqa: E501 + response_type='list[OpenOrders]', # 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 @@ -1103,19 +1098,19 @@ def list_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_my_trades(self, currency_pair, **kwargs): # noqa: E501 - """List personal trading history # noqa: E501 + def list_orders(self, currency_pair, status, **kwargs): # noqa: E501 + """List orders # 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) + >>> thread = api.list_orders(currency_pair, status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) - :param int limit: Maximum number of records returned in one list + :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 str order_id: List all trades of specified order + :param int limit: Maximum number of records returned in one list :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1123,26 +1118,26 @@ def list_my_trades(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Trade] + :return: list[Order] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_my_trades_with_http_info(currency_pair, **kwargs) # noqa: E501 + return self.list_orders_with_http_info(currency_pair, status, **kwargs) # noqa: E501 - def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 - """List personal trading history # noqa: E501 + def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: E501 + """List orders # 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) + >>> thread = api.list_orders_with_http_info(currency_pair, status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) - :param int limit: Maximum number of records returned in one list + :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 str order_id: List all trades of specified order + :param int limit: Maximum number of records returned in one list :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1152,7 +1147,7 @@ def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Trade], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[Order], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1161,9 +1156,9 @@ def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 all_params = [ 'currency_pair', - 'limit', + 'status', 'page', - 'order_id' + 'limit' ] all_params.extend( [ @@ -1178,21 +1173,25 @@ def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_my_trades" % key + " to method list_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 local_var_params['currency_pair'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_my_trades`") # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_orders`") # noqa: E501 + # verify the required parameter 'status' is set + if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 + local_var_params['status'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `status` when calling `list_orders`") # noqa: E501 + if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 + raise ApiValueError("Invalid value for parameter `page` when calling `list_orders`, must be a value greater than or equal to `1`") # 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_my_trades`, must be a value less than or equal to `1000`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_orders`, 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_my_trades`, must be a value greater than or equal to `1`") # noqa: E501 - if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 - raise ApiValueError("Invalid value for parameter `page` when calling `list_my_trades`, must be a value greater than or equal to `1`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_orders`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -1200,12 +1199,12 @@ def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 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 '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 '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 'page' in local_var_params and local_var_params['page'] is not None: # 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 '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 header_params = {} @@ -1221,14 +1220,14 @@ def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/spot/my_trades', 'GET', + '/spot/orders', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Trade]', # noqa: E501 + response_type='list[Order]', # 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 @@ -1236,19 +1235,134 @@ def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_order_book(self, currency_pair, **kwargs): # noqa: E501 - """Retrieve order book # noqa: E501 + def create_order(self, order, **kwargs): # noqa: E501 + """Create an order # noqa: E501 - Order book will be sorted by price from high to low on bids; reversed on asks # 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_order_book(currency_pair, async_req=True) + >>> thread = api.create_order(order, async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param Order order: (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. + :return: Order + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.create_order_with_http_info(order, **kwargs) # noqa: E501 + + def create_order_with_http_info(self, order, **kwargs): # noqa: E501 + """Create an order # 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) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param Order order: (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. + :return: tuple(Order, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = [ + 'order' + ] + all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout' + ] + ) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method create_order" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'order' is set + if self.api_client.client_side_validation and ('order' not in local_var_params or # noqa: E501 + local_var_params['order'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order` when calling `create_order`") # noqa: E501 + + collection_formats = {} + + path_params = {} + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'order' in local_var_params: + body_params = local_var_params['order'] + # 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( + '/spot/orders', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Order', # 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 cancel_orders(self, currency_pair, **kwargs): # noqa: E501 + """Cancel all `open` orders in specified currency pair # 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) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) - :param str interval: Order depth. 0 means no aggregation is applied. default to 0 - :param int limit: Maximum number of order depth data in asks or bids + :param str side: All bids or asks. Both included in not specified + :param str account: Specify account type. Default to all account types being included :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1256,26 +1370,25 @@ def list_order_book(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: OrderBook + :return: list[Order] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_order_book_with_http_info(currency_pair, **kwargs) # noqa: E501 + return self.cancel_orders_with_http_info(currency_pair, **kwargs) # noqa: E501 - def list_order_book_with_http_info(self, currency_pair, **kwargs): # noqa: E501 - """Retrieve order book # noqa: E501 + def cancel_orders_with_http_info(self, currency_pair, **kwargs): # noqa: E501 + """Cancel all `open` orders in specified currency pair # noqa: E501 - Order book will be sorted by price from high to low on bids; reversed on asks # 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_order_book_with_http_info(currency_pair, async_req=True) + >>> thread = api.cancel_orders_with_http_info(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) - :param str interval: Order depth. 0 means no aggregation is applied. default to 0 - :param int limit: Maximum number of order depth data in asks or bids + :param str side: All bids or asks. Both included in not specified + :param str account: Specify account type. Default to all account types being included :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1285,7 +1398,7 @@ def list_order_book_with_http_info(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(OrderBook, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[Order], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1294,8 +1407,8 @@ def list_order_book_with_http_info(self, currency_pair, **kwargs): # noqa: E501 all_params = [ 'currency_pair', - 'interval', - 'limit' + 'side', + 'account' ] all_params.extend( [ @@ -1310,19 +1423,15 @@ def list_order_book_with_http_info(self, currency_pair, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_order_book" % key + " to method cancel_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 local_var_params['currency_pair'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_order_book`") # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `cancel_orders`") # noqa: E501 - if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 30: # noqa: E501 - raise ApiValueError("Invalid value for parameter `limit` when calling `list_order_book`, must be a value less than or equal to `30`") # 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_order_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -1330,10 +1439,10 @@ def list_order_book_with_http_info(self, currency_pair, **kwargs): # noqa: E501 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 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 - query_params.append(('interval', local_var_params['interval'])) # 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 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 + query_params.append(('side', local_var_params['side'])) # 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 = {} @@ -1346,17 +1455,17 @@ def list_order_book_with_http_info(self, currency_pair, **kwargs): # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/spot/order_book', 'GET', + '/spot/orders', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='OrderBook', # noqa: E501 + response_type='list[Order]', # 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 @@ -1364,19 +1473,17 @@ def list_order_book_with_http_info(self, currency_pair, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_orders(self, currency_pair, status, **kwargs): # noqa: E501 - """List orders # noqa: E501 + def cancel_batch_orders(self, cancel_order, **kwargs): # noqa: E501 + """Cancel a batch of orders with an ID list # noqa: E501 + Multiple currency pairs can be specified, but maximum 20 orders are allowed per request # 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) + >>> thread = api.cancel_batch_orders(cancel_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency_pair: Currency pair (required) - :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 in one list + :param list[CancelOrder] cancel_order: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1384,26 +1491,24 @@ def list_orders(self, currency_pair, status, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Order] + :return: list[CancelOrderResult] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_orders_with_http_info(currency_pair, status, **kwargs) # noqa: E501 + return self.cancel_batch_orders_with_http_info(cancel_order, **kwargs) # noqa: E501 - def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: E501 - """List orders # noqa: E501 + def cancel_batch_orders_with_http_info(self, cancel_order, **kwargs): # noqa: E501 + """Cancel a batch of orders with an ID list # noqa: E501 + Multiple currency pairs can be specified, but maximum 20 orders are allowed per request # 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) + >>> thread = api.cancel_batch_orders_with_http_info(cancel_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency_pair: Currency pair (required) - :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 in one list + :param list[CancelOrder] cancel_order: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1413,7 +1518,7 @@ def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Order], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[CancelOrderResult], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1421,10 +1526,7 @@ def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: local_var_params = locals() all_params = [ - 'currency_pair', - 'status', - 'page', - 'limit' + 'cancel_order' ] all_params.extend( [ @@ -1439,38 +1541,20 @@ def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_orders" % key + " to method cancel_batch_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] - # verify the required parameter 'currency_pair' is set - if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 - local_var_params['currency_pair'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_orders`") # noqa: E501 - # verify the required parameter 'status' is set - if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 - local_var_params['status'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `status` when calling `list_orders`") # noqa: E501 + # verify the required parameter 'cancel_order' is set + if self.api_client.client_side_validation and ('cancel_order' not in local_var_params or # noqa: E501 + local_var_params['cancel_order'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `cancel_order` when calling `cancel_batch_orders`") # noqa: E501 - if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 - raise ApiValueError("Invalid value for parameter `page` when calling `list_orders`, must be a value greater than or equal to `1`") # 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_orders`, 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_orders`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} 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 '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 'page' in local_var_params and local_var_params['page'] is not None: # 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 header_params = {} @@ -1478,22 +1562,28 @@ def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: local_var_files = {} body_params = None + if 'cancel_order' in local_var_params: + body_params = local_var_params['cancel_order'] # 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( - '/spot/orders', 'GET', + '/spot/cancel_batch_orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Order]', # noqa: E501 + response_type='list[CancelOrderResult]', # 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 @@ -1501,16 +1591,17 @@ def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_spot_accounts(self, **kwargs): # noqa: E501 - """List spot accounts # noqa: E501 + def get_order(self, order_id, currency_pair, **kwargs): # noqa: E501 + """Get a single order # 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_spot_accounts(async_req=True) + >>> thread = api.get_order(order_id, currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency: Retrieved specified currency related data + :param str order_id: ID returned on order successfully being created (required) + :param str currency_pair: Currency pair (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1518,23 +1609,24 @@ def list_spot_accounts(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[SpotAccount] + :return: Order If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_spot_accounts_with_http_info(**kwargs) # noqa: E501 + return self.get_order_with_http_info(order_id, currency_pair, **kwargs) # noqa: E501 - def list_spot_accounts_with_http_info(self, **kwargs): # noqa: E501 - """List spot accounts # noqa: E501 + def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: E501 + """Get a single order # 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_spot_accounts_with_http_info(async_req=True) + >>> thread = api.get_order_with_http_info(order_id, currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency: Retrieved specified currency related data + :param str order_id: ID returned on order successfully being created (required) + :param str currency_pair: Currency pair (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1544,7 +1636,7 @@ def list_spot_accounts_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[SpotAccount], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(Order, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1552,7 +1644,8 @@ def list_spot_accounts_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'currency' + 'order_id', + 'currency_pair' ] all_params.extend( [ @@ -1567,18 +1660,28 @@ def list_spot_accounts_with_http_info(self, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_spot_accounts" % key + " to method get_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] + # verify the required parameter 'order_id' is set + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `get_order`") # noqa: E501 + # verify the required parameter 'currency_pair' is set + if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 + local_var_params['currency_pair'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `get_order`") # noqa: E501 collection_formats = {} path_params = {} + if 'order_id' in local_var_params: + path_params['order_id'] = local_var_params['order_id'] # noqa: E501 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 '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 header_params = {} @@ -1594,14 +1697,14 @@ def list_spot_accounts_with_http_info(self, **kwargs): # noqa: E501 auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/spot/accounts', 'GET', + '/spot/orders/{order_id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[SpotAccount]', # noqa: E501 + response_type='Order', # 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 @@ -1609,17 +1712,17 @@ def list_spot_accounts_with_http_info(self, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_tickers(self, **kwargs): # noqa: E501 - """Retrieve ticker information # noqa: E501 + def cancel_order(self, order_id, currency_pair, **kwargs): # noqa: E501 + """Cancel a single order # noqa: E501 - Return only related data if `currency_pair` is specified; otherwise return all of them # 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_tickers(async_req=True) + >>> thread = api.cancel_order(order_id, currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency_pair: Currency pair + :param str order_id: ID returned on order successfully being created (required) + :param str currency_pair: Currency pair (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1627,24 +1730,24 @@ def list_tickers(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Ticker] + :return: Order If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_tickers_with_http_info(**kwargs) # noqa: E501 + return self.cancel_order_with_http_info(order_id, currency_pair, **kwargs) # noqa: E501 - def list_tickers_with_http_info(self, **kwargs): # noqa: E501 - """Retrieve ticker information # noqa: E501 + def cancel_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: E501 + """Cancel a single order # noqa: E501 - Return only related data if `currency_pair` is specified; otherwise return all of them # 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_tickers_with_http_info(async_req=True) + >>> thread = api.cancel_order_with_http_info(order_id, currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency_pair: Currency pair + :param str order_id: ID returned on order successfully being created (required) + :param str currency_pair: Currency pair (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1654,7 +1757,7 @@ def list_tickers_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Ticker], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(Order, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -1662,6 +1765,7 @@ def list_tickers_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ + 'order_id', 'currency_pair' ] all_params.extend( @@ -1677,14 +1781,24 @@ def list_tickers_with_http_info(self, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_tickers" % key + " to method cancel_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] + # verify the required parameter 'order_id' is set + if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 + local_var_params['order_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_order`") # noqa: E501 + # verify the required parameter 'currency_pair' is set + if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 + local_var_params['currency_pair'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `cancel_order`") # noqa: E501 collection_formats = {} path_params = {} + if 'order_id' in local_var_params: + path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 @@ -1701,17 +1815,17 @@ def list_tickers_with_http_info(self, **kwargs): # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/spot/tickers', 'GET', + '/spot/orders/{order_id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Ticker]', # noqa: E501 + response_type='Order', # 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 @@ -1719,18 +1833,19 @@ def list_tickers_with_http_info(self, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_trades(self, currency_pair, **kwargs): # noqa: E501 - """Retrieve market trades # noqa: E501 + def list_my_trades(self, currency_pair, **kwargs): # noqa: E501 + """List personal trading history # 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_trades(currency_pair, async_req=True) + >>> thread = api.list_my_trades(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param int limit: Maximum number of records returned in one list - :param str last_id: Specify list staring point using the `id` of last record in previous list-query results + :param int page: Page number + :param str order_id: List all trades of specified order :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1743,20 +1858,21 @@ def list_trades(self, currency_pair, **kwargs): # noqa: E501 returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_trades_with_http_info(currency_pair, **kwargs) # noqa: E501 + return self.list_my_trades_with_http_info(currency_pair, **kwargs) # noqa: E501 - def list_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 - """Retrieve market trades # noqa: E501 + def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 + """List personal trading history # 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_trades_with_http_info(currency_pair, async_req=True) + >>> thread = api.list_my_trades_with_http_info(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param int limit: Maximum number of records returned in one list - :param str last_id: Specify list staring point using the `id` of last record in previous list-query results + :param int page: Page number + :param str order_id: List all trades of specified order :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1776,7 +1892,8 @@ def list_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 all_params = [ 'currency_pair', 'limit', - 'last_id' + 'page', + 'order_id' ] all_params.extend( [ @@ -1791,19 +1908,21 @@ def list_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_trades" % key + " to method list_my_trades" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 local_var_params['currency_pair'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_trades`") # noqa: E501 + raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_my_trades`") # 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_trades`, must be a value less than or equal to `1000`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_my_trades`, 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_trades`, must be a value greater than or equal to `1`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_my_trades`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 + raise ApiValueError("Invalid value for parameter `page` when calling `list_my_trades`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} @@ -1813,8 +1932,10 @@ def list_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # 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 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 - query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 + if 'page' in local_var_params and local_var_params['page'] is not None: # 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 header_params = {} @@ -1827,10 +1948,10 @@ def list_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting - auth_settings = [] # noqa: E501 + auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/spot/trades', 'GET', + '/spot/my_trades', 'GET', path_params, query_params, header_params, diff --git a/gate_api/api/wallet_api.py b/gate_api/api/wallet_api.py index c01e8da..6e8626a 100644 --- a/gate_api/api/wallet_api.py +++ b/gate_api/api/wallet_api.py @@ -148,13 +148,13 @@ def get_deposit_address_with_http_info(self, currency, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_deposits(self, **kwargs): # noqa: E501 - """Retrieve deposit records # noqa: E501 + def list_withdrawals(self, **kwargs): # noqa: E501 + """Retrieve withdrawal records # noqa: E501 Record time range cannot exceed 30 days # 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_deposits(async_req=True) + >>> thread = api.list_withdrawals(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously @@ -175,15 +175,15 @@ def list_deposits(self, **kwargs): # noqa: E501 returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_deposits_with_http_info(**kwargs) # noqa: E501 + return self.list_withdrawals_with_http_info(**kwargs) # noqa: E501 - def list_deposits_with_http_info(self, **kwargs): # noqa: E501 - """Retrieve deposit records # noqa: E501 + def list_withdrawals_with_http_info(self, **kwargs): # noqa: E501 + """Retrieve withdrawal records # noqa: E501 Record time range cannot exceed 30 days # 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_deposits_with_http_info(async_req=True) + >>> thread = api.list_withdrawals_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously @@ -228,17 +228,17 @@ def list_deposits_with_http_info(self, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_deposits" % key + " to method list_withdrawals" % key ) local_var_params[key] = val 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_deposits`, must be a value less than or equal to `1000`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_withdrawals`, 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_deposits`, must be a value greater than or equal to `1`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_withdrawals`, 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_deposits`, must be a value greater than or equal to `0`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `offset` when calling `list_withdrawals`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} @@ -269,7 +269,7 @@ def list_deposits_with_http_info(self, **kwargs): # noqa: E501 auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/wallet/deposits', 'GET', + '/wallet/withdrawals', 'GET', path_params, query_params, header_params, @@ -284,17 +284,17 @@ def list_deposits_with_http_info(self, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_sub_account_transfers(self, **kwargs): # noqa: E501 - """Transfer records between main and sub accounts # noqa: E501 + def list_deposits(self, **kwargs): # noqa: E501 + """Retrieve deposit records # noqa: E501 - Record time range cannot exceed 30 days > Note: only records after 2020-04-10 can be retrieved # noqa: E501 + Record time range cannot exceed 30 days # 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_sub_account_transfers(async_req=True) + >>> thread = api.list_deposits(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str sub_uid: Sub account user ID. Return records related to all sub accounts if not specified + :param str currency: Filter by currency. Return all currency records if not specified :param int _from: Time range beginning, default to 7 days before current time :param int to: Time range ending, default to current time :param int limit: Maximum number of records returned in one list @@ -306,24 +306,24 @@ def list_sub_account_transfers(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[SubAccountTransfer] + :return: list[LedgerRecord] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_sub_account_transfers_with_http_info(**kwargs) # noqa: E501 + return self.list_deposits_with_http_info(**kwargs) # noqa: E501 - def list_sub_account_transfers_with_http_info(self, **kwargs): # noqa: E501 - """Transfer records between main and sub accounts # noqa: E501 + def list_deposits_with_http_info(self, **kwargs): # noqa: E501 + """Retrieve deposit records # noqa: E501 - Record time range cannot exceed 30 days > Note: only records after 2020-04-10 can be retrieved # noqa: E501 + Record time range cannot exceed 30 days # 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_sub_account_transfers_with_http_info(async_req=True) + >>> thread = api.list_deposits_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str sub_uid: Sub account user ID. Return records related to all sub accounts if not specified + :param str currency: Filter by currency. Return all currency records if not specified :param int _from: Time range beginning, default to 7 days before current time :param int to: Time range ending, default to current time :param int limit: Maximum number of records returned in one list @@ -337,7 +337,7 @@ def list_sub_account_transfers_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[SubAccountTransfer], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[LedgerRecord], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -345,7 +345,7 @@ def list_sub_account_transfers_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'sub_uid', + 'currency', '_from', 'to', 'limit', @@ -364,24 +364,24 @@ def list_sub_account_transfers_with_http_info(self, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_sub_account_transfers" % key + " to method list_deposits" % key ) local_var_params[key] = val 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_sub_account_transfers`, must be a value less than or equal to `1000`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_deposits`, 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_sub_account_transfers`, must be a value greater than or equal to `1`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `limit` when calling `list_deposits`, 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_sub_account_transfers`, must be a value greater than or equal to `0`") # noqa: E501 + raise ApiValueError("Invalid value for parameter `offset` when calling `list_deposits`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] - if 'sub_uid' in local_var_params and local_var_params['sub_uid'] is not None: # noqa: E501 - query_params.append(('sub_uid', local_var_params['sub_uid'])) # 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 '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 @@ -405,14 +405,14 @@ def list_sub_account_transfers_with_http_info(self, **kwargs): # noqa: E501 auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/wallet/sub_account_transfers', 'GET', + '/wallet/deposits', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[SubAccountTransfer]', # noqa: E501 + response_type='list[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 @@ -420,21 +420,17 @@ def list_sub_account_transfers_with_http_info(self, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def list_withdrawals(self, **kwargs): # noqa: E501 - """Retrieve withdrawal records # noqa: E501 + def transfer(self, transfer, **kwargs): # noqa: E501 + """Transfer between trading accounts # noqa: E501 - Record time range cannot exceed 30 days # noqa: E501 + Transfer between different accounts. Currently support transfers between the following: 1. spot - margin 2. spot - futures(perpetual) 3. spot - delivery # 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_withdrawals(async_req=True) + >>> thread = api.transfer(transfer, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency: Filter by currency. Return all currency records if not specified - :param int _from: Time range beginning, default to 7 days before current time - :param int to: Time range ending, default to current time - :param int limit: Maximum number of records returned in one list - :param int offset: List offset, starting from 0 + :param Transfer transfer: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -442,28 +438,24 @@ def list_withdrawals(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[LedgerRecord] + :return: None If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.list_withdrawals_with_http_info(**kwargs) # noqa: E501 + return self.transfer_with_http_info(transfer, **kwargs) # noqa: E501 - def list_withdrawals_with_http_info(self, **kwargs): # noqa: E501 - """Retrieve withdrawal records # noqa: E501 + def transfer_with_http_info(self, transfer, **kwargs): # noqa: E501 + """Transfer between trading accounts # noqa: E501 - Record time range cannot exceed 30 days # noqa: E501 + Transfer between different accounts. Currently support transfers between the following: 1. spot - margin 2. spot - futures(perpetual) 3. spot - delivery # 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_withdrawals_with_http_info(async_req=True) + >>> thread = api.transfer_with_http_info(transfer, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param str currency: Filter by currency. Return all currency records if not specified - :param int _from: Time range beginning, default to 7 days before current time - :param int to: Time range ending, default to current time - :param int limit: Maximum number of records returned in one list - :param int offset: List offset, starting from 0 + :param Transfer transfer: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -473,7 +465,7 @@ def list_withdrawals_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[LedgerRecord], status_code(int), headers(HTTPHeaderDict)) + :return: None If the method is called asynchronously, returns the request thread. """ @@ -481,11 +473,7 @@ def list_withdrawals_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'currency', - '_from', - 'to', - 'limit', - 'offset' + 'transfer' ] all_params.extend( [ @@ -500,32 +488,20 @@ def list_withdrawals_with_http_info(self, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method list_withdrawals" % key + " to method transfer" % key ) local_var_params[key] = val del local_var_params['kwargs'] + # verify the required parameter 'transfer' is set + if self.api_client.client_side_validation and ('transfer' not in local_var_params or # noqa: E501 + local_var_params['transfer'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `transfer` when calling `transfer`") # 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_withdrawals`, 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_withdrawals`, 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_withdrawals`, 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 '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 - query_params.append(('from', local_var_params['_from'])) # noqa: E501 - if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 - query_params.append(('to', local_var_params['to'])) # 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 header_params = {} @@ -533,22 +509,24 @@ def list_withdrawals_with_http_info(self, **kwargs): # noqa: E501 local_var_files = {} body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( + if 'transfer' in local_var_params: + body_params = local_var_params['transfer'] + # 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( - '/wallet/withdrawals', 'GET', + '/wallet/transfers', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[LedgerRecord]', # noqa: E501 + response_type=None, # 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 @@ -556,17 +534,21 @@ def list_withdrawals_with_http_info(self, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def transfer(self, transfer, **kwargs): # noqa: E501 - """Transfer between accounts # noqa: E501 + def list_sub_account_transfers(self, **kwargs): # noqa: E501 + """Transfer records between main and sub accounts # noqa: E501 - Transfer between different accounts. Currently support transfers between the following: 1. spot - margin 2. spot - futures(perpetual) 2. spot - delivery # noqa: E501 + Record time range cannot exceed 30 days > Note: only records after 2020-04-10 can be retrieved # 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) + >>> thread = api.list_sub_account_transfers(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param Transfer transfer: (required) + :param str sub_uid: Sub account user ID. Return records related to all sub accounts if not specified + :param int _from: Time range beginning, default to 7 days before current time + :param int to: Time range ending, default to current time + :param int limit: Maximum number of records returned in one list + :param int offset: List offset, starting from 0 :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -574,24 +556,28 @@ def transfer(self, transfer, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: None + :return: list[SubAccountTransfer] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.transfer_with_http_info(transfer, **kwargs) # noqa: E501 + return self.list_sub_account_transfers_with_http_info(**kwargs) # noqa: E501 - def transfer_with_http_info(self, transfer, **kwargs): # noqa: E501 - """Transfer between accounts # noqa: E501 + def list_sub_account_transfers_with_http_info(self, **kwargs): # noqa: E501 + """Transfer records between main and sub accounts # noqa: E501 - Transfer between different accounts. Currently support transfers between the following: 1. spot - margin 2. spot - futures(perpetual) 2. spot - delivery # noqa: E501 + Record time range cannot exceed 30 days > Note: only records after 2020-04-10 can be retrieved # 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) + >>> thread = api.list_sub_account_transfers_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously - :param Transfer transfer: (required) + :param str sub_uid: Sub account user ID. Return records related to all sub accounts if not specified + :param int _from: Time range beginning, default to 7 days before current time + :param int to: Time range ending, default to current time + :param int limit: Maximum number of records returned in one list + :param int offset: List offset, starting from 0 :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -601,7 +587,7 @@ def transfer_with_http_info(self, transfer, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: None + :return: tuple(list[SubAccountTransfer], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ @@ -609,7 +595,11 @@ def transfer_with_http_info(self, transfer, **kwargs): # noqa: E501 local_var_params = locals() all_params = [ - 'transfer' + 'sub_uid', + '_from', + 'to', + 'limit', + 'offset' ] all_params.extend( [ @@ -624,20 +614,32 @@ def transfer_with_http_info(self, transfer, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method transfer" % key + " to method list_sub_account_transfers" % key ) local_var_params[key] = val del local_var_params['kwargs'] - # verify the required parameter 'transfer' is set - if self.api_client.client_side_validation and ('transfer' not in local_var_params or # noqa: E501 - local_var_params['transfer'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `transfer` when calling `transfer`") # 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_sub_account_transfers`, 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_sub_account_transfers`, 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_sub_account_transfers`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] + if 'sub_uid' in local_var_params and local_var_params['sub_uid'] is not None: # noqa: E501 + query_params.append(('sub_uid', local_var_params['sub_uid'])) # noqa: E501 + if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 + query_params.append(('from', local_var_params['_from'])) # noqa: E501 + if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 + query_params.append(('to', local_var_params['to'])) # 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 header_params = {} @@ -645,24 +647,22 @@ def transfer_with_http_info(self, transfer, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if 'transfer' in local_var_params: - body_params = local_var_params['transfer'] - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + # 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( - '/wallet/transfers', 'POST', + '/wallet/sub_account_transfers', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_type='list[SubAccountTransfer]', # 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 diff --git a/gate_api/api_client.py b/gate_api/api_client.py index a7aed1b..c52f7cf 100644 --- a/gate_api/api_client.py +++ b/gate_api/api_client.py @@ -83,7 +83,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None, self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/4.15.0/python' + self.user_agent = 'OpenAPI-Generator/4.15.1/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 a867fb0..a75ae27 100644 --- a/gate_api/configuration.py +++ b/gate_api/configuration.py @@ -313,8 +313,8 @@ def to_debug_report(self): return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: 4.15.0\n"\ - "SDK Package Version: 4.15.0".\ + "Version of the API: 4.15.1\n"\ + "SDK Package Version: 4.15.1".\ 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 b708d5b..e98e608 100644 --- a/gate_api/models/__init__.py +++ b/gate_api/models/__init__.py @@ -37,16 +37,17 @@ from gate_api.models.futures_price_triggered_order import FuturesPriceTriggeredOrder from gate_api.models.futures_ticker import FuturesTicker from gate_api.models.futures_trade import FuturesTrade -from gate_api.models.gate_error_response import GateErrorResponse from gate_api.models.insurance_record import InsuranceRecord from gate_api.models.ledger_record import LedgerRecord from gate_api.models.loan import Loan from gate_api.models.loan_patch import LoanPatch from gate_api.models.loan_record import LoanRecord from gate_api.models.margin_account import MarginAccount +from gate_api.models.margin_account_book import MarginAccountBook from gate_api.models.margin_account_currency import MarginAccountCurrency from gate_api.models.margin_currency_pair import MarginCurrencyPair from gate_api.models.my_futures_trade import MyFuturesTrade +from gate_api.models.open_orders import OpenOrders from gate_api.models.order import Order from gate_api.models.order_book import OrderBook from gate_api.models.position import Position diff --git a/gate_api/models/margin_account_book.py b/gate_api/models/margin_account_book.py new file mode 100644 index 0000000..e544576 --- /dev/null +++ b/gate_api/models/margin_account_book.py @@ -0,0 +1,262 @@ +# coding: utf-8 + +""" + Gate API v4 + + APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # 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 MarginAccountBook(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', + 'time': 'str', + 'currency': 'str', + 'currency_pair': 'str', + 'change': 'str', + 'balance': 'str' + } + + attribute_map = { + 'id': 'id', + 'time': 'time', + 'currency': 'currency', + 'currency_pair': 'currency_pair', + 'change': 'change', + 'balance': 'balance' + } + + def __init__(self, id=None, time=None, currency=None, currency_pair=None, change=None, balance=None, local_vars_configuration=None): # noqa: E501 + """MarginAccountBook - 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._time = None + self._currency = None + self._currency_pair = None + self._change = None + self._balance = None + self.discriminator = None + + if id is not None: + self.id = id + if time is not None: + self.time = time + if currency is not None: + self.currency = currency + if currency_pair is not None: + self.currency_pair = currency_pair + if change is not None: + self.change = change + if balance is not None: + self.balance = balance + + @property + def id(self): + """Gets the id of this MarginAccountBook. # noqa: E501 + + Balance change record ID # noqa: E501 + + :return: The id of this MarginAccountBook. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this MarginAccountBook. + + Balance change record ID # noqa: E501 + + :param id: The id of this MarginAccountBook. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def time(self): + """Gets the time of this MarginAccountBook. # noqa: E501 + + Balance changed timestamp # noqa: E501 + + :return: The time of this MarginAccountBook. # noqa: E501 + :rtype: str + """ + return self._time + + @time.setter + def time(self, time): + """Sets the time of this MarginAccountBook. + + Balance changed timestamp # noqa: E501 + + :param time: The time of this MarginAccountBook. # noqa: E501 + :type: str + """ + + self._time = time + + @property + def currency(self): + """Gets the currency of this MarginAccountBook. # noqa: E501 + + Currency changed # noqa: E501 + + :return: The currency of this MarginAccountBook. # noqa: E501 + :rtype: str + """ + return self._currency + + @currency.setter + def currency(self, currency): + """Sets the currency of this MarginAccountBook. + + Currency changed # noqa: E501 + + :param currency: The currency of this MarginAccountBook. # noqa: E501 + :type: str + """ + + self._currency = currency + + @property + def currency_pair(self): + """Gets the currency_pair of this MarginAccountBook. # noqa: E501 + + Account currency pair # noqa: E501 + + :return: The currency_pair of this MarginAccountBook. # noqa: E501 + :rtype: str + """ + return self._currency_pair + + @currency_pair.setter + def currency_pair(self, currency_pair): + """Sets the currency_pair of this MarginAccountBook. + + Account currency pair # noqa: E501 + + :param currency_pair: The currency_pair of this MarginAccountBook. # noqa: E501 + :type: str + """ + + self._currency_pair = currency_pair + + @property + def change(self): + """Gets the change of this MarginAccountBook. # noqa: E501 + + Amount changed. Positive value means transferring in, while negative out # noqa: E501 + + :return: The change of this MarginAccountBook. # noqa: E501 + :rtype: str + """ + return self._change + + @change.setter + def change(self, change): + """Sets the change of this MarginAccountBook. + + Amount changed. Positive value means transferring in, while negative out # noqa: E501 + + :param change: The change of this MarginAccountBook. # noqa: E501 + :type: str + """ + + self._change = change + + @property + def balance(self): + """Gets the balance of this MarginAccountBook. # noqa: E501 + + Balance after change # noqa: E501 + + :return: The balance of this MarginAccountBook. # noqa: E501 + :rtype: str + """ + return self._balance + + @balance.setter + def balance(self, balance): + """Sets the balance of this MarginAccountBook. + + Balance after change # noqa: E501 + + :param balance: The balance of this MarginAccountBook. # noqa: E501 + :type: str + """ + + self._balance = balance + + 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, MarginAccountBook): + 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, MarginAccountBook): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/open_orders.py b/gate_api/models/open_orders.py new file mode 100644 index 0000000..7b8a5cf --- /dev/null +++ b/gate_api/models/open_orders.py @@ -0,0 +1,176 @@ +# coding: utf-8 + +""" + Gate API v4 + + APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # 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 OpenOrders(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_pair': 'str', + 'total': 'int', + 'orders': 'list[Order]' + } + + attribute_map = { + 'currency_pair': 'currency_pair', + 'total': 'total', + 'orders': 'orders' + } + + def __init__(self, currency_pair=None, total=None, orders=None, local_vars_configuration=None): # noqa: E501 + """OpenOrders - 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_pair = None + self._total = None + self._orders = None + self.discriminator = None + + if currency_pair is not None: + self.currency_pair = currency_pair + if total is not None: + self.total = total + if orders is not None: + self.orders = orders + + @property + def currency_pair(self): + """Gets the currency_pair of this OpenOrders. # noqa: E501 + + Currency pair # noqa: E501 + + :return: The currency_pair of this OpenOrders. # noqa: E501 + :rtype: str + """ + return self._currency_pair + + @currency_pair.setter + def currency_pair(self, currency_pair): + """Sets the currency_pair of this OpenOrders. + + Currency pair # noqa: E501 + + :param currency_pair: The currency_pair of this OpenOrders. # noqa: E501 + :type: str + """ + + self._currency_pair = currency_pair + + @property + def total(self): + """Gets the total of this OpenOrders. # noqa: E501 + + Total open orders in this currency pair # noqa: E501 + + :return: The total of this OpenOrders. # noqa: E501 + :rtype: int + """ + return self._total + + @total.setter + def total(self, total): + """Sets the total of this OpenOrders. + + Total open orders in this currency pair # noqa: E501 + + :param total: The total of this OpenOrders. # noqa: E501 + :type: int + """ + + self._total = total + + @property + def orders(self): + """Gets the orders of this OpenOrders. # noqa: E501 + + + :return: The orders of this OpenOrders. # noqa: E501 + :rtype: list[Order] + """ + return self._orders + + @orders.setter + def orders(self, orders): + """Sets the orders of this OpenOrders. + + + :param orders: The orders of this OpenOrders. # noqa: E501 + :type: list[Order] + """ + + self._orders = orders + + 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, OpenOrders): + 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, OpenOrders): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/transfer.py b/gate_api/models/transfer.py index 418a75d..e03289e 100644 --- a/gate_api/models/transfer.py +++ b/gate_api/models/transfer.py @@ -33,6 +33,8 @@ class Transfer(object): and the value is json key in definition. """ openapi_types = { + 'id': 'str', + 'created_at': 'str', 'currency': 'str', '_from': 'str', 'to': 'str', @@ -42,6 +44,8 @@ class Transfer(object): } attribute_map = { + 'id': 'id', + 'created_at': 'created_at', 'currency': 'currency', '_from': 'from', 'to': 'to', @@ -50,12 +54,14 @@ class Transfer(object): 'settle': 'settle' } - def __init__(self, currency=None, _from=None, to=None, amount=None, currency_pair=None, settle=None, local_vars_configuration=None): # noqa: E501 + def __init__(self, id=None, created_at=None, currency=None, _from=None, to=None, amount=None, currency_pair=None, settle=None, local_vars_configuration=None): # noqa: E501 """Transfer - 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._created_at = None self._currency = None self.__from = None self._to = None @@ -64,6 +70,10 @@ def __init__(self, currency=None, _from=None, to=None, amount=None, currency_pai self._settle = None self.discriminator = None + if id is not None: + self.id = id + if created_at is not None: + self.created_at = created_at self.currency = currency self._from = _from self.to = to @@ -73,6 +83,52 @@ def __init__(self, currency=None, _from=None, to=None, amount=None, currency_pai if settle is not None: self.settle = settle + @property + def id(self): + """Gets the id of this Transfer. # noqa: E501 + + Transfer ID # noqa: E501 + + :return: The id of this Transfer. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Transfer. + + Transfer ID # noqa: E501 + + :param id: The id of this Transfer. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def created_at(self): + """Gets the created_at of this Transfer. # noqa: E501 + + Timestamp when the transfer occurred # noqa: E501 + + :return: The created_at of this Transfer. # noqa: E501 + :rtype: str + """ + return self._created_at + + @created_at.setter + def created_at(self, created_at): + """Sets the created_at of this Transfer. + + Timestamp when the transfer occurred # noqa: E501 + + :param created_at: The created_at of this Transfer. # noqa: E501 + :type: str + """ + + self._created_at = created_at + @property def currency(self): """Gets the currency of this Transfer. # noqa: E501 diff --git a/setup.py b/setup.py index f186b65..fb39965 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "gate-api" -VERSION = "4.15.0" +VERSION = "4.15.1" # To install the library, run the following # # python setup.py install From e37291a88c2335c19b805a22595518949873dcf3 Mon Sep 17 00:00:00 2001 From: Revil Wang Date: Wed, 5 Aug 2020 16:08:20 +0800 Subject: [PATCH 3/3] add return type hints; format code --- .gitignore | 2 + .gitlab-ci.yml | 33 + .openapi-generator-ignore | 23 - .openapi-generator/VERSION | 1 - .travis.yml | 11 +- README.md | 30 +- docs/DeliveryApi.md | 34 +- docs/DeliveryContract.md | 2 +- docs/FuturesApi.md | 4 +- docs/FuturesErrorResponse.md | 11 - docs/GateErrorResponse.md | 12 - docs/MarginApi.md | 8 +- docs/SpotApi.md | 82 +- docs/TradeFee.md | 16 + docs/Transfer.md | 2 - docs/WalletApi.md | 4 +- docs/WithdrawalApi.md | 2 +- gate_api/__init__.py | 5 +- gate_api/api/delivery_api.py | 1686 ++++++++--------- gate_api/api/futures_api.py | 1686 ++++++++--------- gate_api/api/margin_api.py | 796 ++++---- gate_api/api/spot_api.py | 936 +++++---- gate_api/api/wallet_api.py | 319 ++-- gate_api/api/withdrawal_api.py | 48 +- gate_api/api_client.py | 323 ++-- gate_api/configuration.py | 55 +- gate_api/exceptions.py | 10 +- gate_api/models/__init__.py | 1 + gate_api/models/batch_order.py | 69 +- gate_api/models/cancel_order.py | 27 +- gate_api/models/cancel_order_result.py | 31 +- gate_api/models/contract.py | 65 +- gate_api/models/currency_pair.py | 40 +- gate_api/models/delivery_contract.py | 102 +- gate_api/models/delivery_settlement.py | 35 +- gate_api/models/deposit_address.py | 27 +- gate_api/models/funding_account.py | 31 +- gate_api/models/funding_book_item.py | 31 +- gate_api/models/funding_rate_history.py | 85 - gate_api/models/funding_rate_history_inner.py | 143 -- gate_api/models/funding_rate_record.py | 27 +- gate_api/models/futures_account.py | 33 +- gate_api/models/futures_account_book.py | 44 +- gate_api/models/futures_candlestick.py | 37 +- gate_api/models/futures_candlesticks.py | 85 - gate_api/models/futures_candlesticks_inner.py | 255 --- gate_api/models/futures_error_response.py | 149 -- gate_api/models/futures_initial_order.py | 38 +- gate_api/models/futures_liquidate.py | 38 +- gate_api/models/futures_order.py | 59 +- gate_api/models/futures_order_book.py | 27 +- gate_api/models/futures_order_book_asks.py | 143 -- gate_api/models/futures_order_book_item.py | 27 +- gate_api/models/futures_price_trigger.py | 44 +- .../models/futures_price_triggered_order.py | 44 +- gate_api/models/futures_ticker.py | 43 +- gate_api/models/futures_trade.py | 41 +- gate_api/models/gate_error_response.py | 150 -- gate_api/models/insurance_record.py | 27 +- gate_api/models/insurance_record_inner.py | 143 -- gate_api/models/ledger_record.py | 37 +- gate_api/models/loan.py | 49 +- gate_api/models/loan_patch.py | 34 +- gate_api/models/loan_record.py | 43 +- gate_api/models/margin_account.py | 31 +- gate_api/models/margin_account_book.py | 32 +- gate_api/models/margin_account_currency.py | 39 +- gate_api/models/margin_currency_pair.py | 33 +- gate_api/models/my_futures_trade.py | 36 +- gate_api/models/open_orders.py | 31 +- gate_api/models/order.py | 66 +- gate_api/models/order_book.py | 27 +- gate_api/models/position.py | 47 +- gate_api/models/position_close.py | 44 +- gate_api/models/position_close_order.py | 31 +- gate_api/models/repay_request.py | 42 +- gate_api/models/repayment.py | 39 +- gate_api/models/spot_account.py | 31 +- gate_api/models/sub_account_transfer.py | 38 +- gate_api/models/ticker.py | 35 +- gate_api/models/trade.py | 43 +- gate_api/models/trade_fee.py | 299 +++ gate_api/models/transfer.py | 94 +- gate_api/models/trigger_order_response.py | 25 +- gate_api/rest.py | 242 ++- setup.py | 4 +- 86 files changed, 4414 insertions(+), 5340 deletions(-) create mode 100644 .gitlab-ci.yml delete mode 100644 .openapi-generator-ignore delete mode 100644 .openapi-generator/VERSION delete mode 100644 docs/FuturesErrorResponse.md delete mode 100644 docs/GateErrorResponse.md create mode 100644 docs/TradeFee.md delete mode 100644 gate_api/models/funding_rate_history.py delete mode 100644 gate_api/models/funding_rate_history_inner.py delete mode 100644 gate_api/models/futures_candlesticks.py delete mode 100644 gate_api/models/futures_candlesticks_inner.py delete mode 100644 gate_api/models/futures_error_response.py delete mode 100644 gate_api/models/futures_order_book_asks.py delete mode 100644 gate_api/models/gate_error_response.py delete mode 100644 gate_api/models/insurance_record_inner.py create mode 100644 gate_api/models/trade_fee.py diff --git a/.gitignore b/.gitignore index a655050..43995bd 100644 --- a/.gitignore +++ b/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..a086da0 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,33 @@ +# ref: https://docs.gitlab.com/ee/ci/README.html + +stages: + - test + +.nosetest: + stage: test + script: + - pip install -r requirements.txt + - pip install -r test-requirements.txt + - pytest --cov=gate_api + +nosetest-2.7: + extends: .nosetest + image: python:2.7-alpine +nosetest-3.3: + extends: .nosetest + image: python:3.3-alpine +nosetest-3.4: + extends: .nosetest + image: python:3.4-alpine +nosetest-3.5: + extends: .nosetest + image: python:3.5-alpine +nosetest-3.6: + extends: .nosetest + image: python:3.6-alpine +nosetest-3.7: + extends: .nosetest + image: python:3.7-alpine +nosetest-3.8: + extends: .nosetest + image: python:3.8-alpine diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore deleted file mode 100644 index 7484ee5..0000000 --- a/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION deleted file mode 100644 index 2c6109e..0000000 --- a/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -3.3.4 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 86211e2..4e32d1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,9 +6,12 @@ python: - "3.3" - "3.4" - "3.5" - #- "3.5-dev" # 3.5 development branch - #- "nightly" # points to the latest development branch e.g. 3.6-dev + - "3.6" + - "3.7" + - "3.8" # command to install dependencies -install: "pip install -r requirements.txt" +install: + - "pip install -r requirements.txt" + - "pip install -r test-requirements.txt" # command to run tests -script: nosetests +script: pytest --cov=gate_api diff --git a/README.md b/README.md index 4f29c8d..951933d 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,35 @@ 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.15.1 -- Package version: 4.15.1 +- API version: 4.15.2 +- Package version: 4.15.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) +## Versioning + +Trying our best to follow the [semantic versioning](https://semver.org/), while enjoying recent features +provided by programming language and libraries, from 4.15.2, one major versioning difference will be +introduced: + +If extra code rewrite is required when you upgrade the SDK, such as: + +- some outdated programming language version support is dropped +- API method signature has breaking changes. + +**the MAJOR version will be incremented, but the MINOR and PATCH version are still following REST API's +instead of resetting to 0**, so that you can recognize it has some breaking changes, but still getting +the idea of from which REST API version the change is introduced. + +For example, the previous REST API and SDK version are both 4.14.0. But if we decide to introduce +some breaking changes in SDK along with REST API 4.15.2 upgrade, then the version of next SDK release +will be 5.15.2(the MAJOR version is incremented to denote breaking changes, but the MINOR and PATCH +version are identical to REST API's instead of resetting them to 0) + +If MAJOR version is incremented, make sure you read the release note on +[Releases](https://github.com/gateio/gateapi-python/releases) +page + ## Requirements. Python 2.7 and 3.4+ @@ -156,6 +180,7 @@ Class | Method | HTTP request | Description *SpotApi* | [**list_order_book**](docs/SpotApi.md#list_order_book) | **GET** /spot/order_book | Retrieve order book *SpotApi* | [**list_trades**](docs/SpotApi.md#list_trades) | **GET** /spot/trades | Retrieve market trades *SpotApi* | [**list_candlesticks**](docs/SpotApi.md#list_candlesticks) | **GET** /spot/candlesticks | Market candlesticks +*SpotApi* | [**get_fee**](docs/SpotApi.md#get_fee) | **GET** /spot/fee | Query user trading fee rates *SpotApi* | [**list_spot_accounts**](docs/SpotApi.md#list_spot_accounts) | **GET** /spot/accounts | List spot accounts *SpotApi* | [**create_batch_orders**](docs/SpotApi.md#create_batch_orders) | **POST** /spot/batch_orders | Create a batch of orders *SpotApi* | [**list_all_open_orders**](docs/SpotApi.md#list_all_open_orders) | **GET** /spot/open_orders | List all open orders @@ -222,6 +247,7 @@ Class | Method | HTTP request | Description - [SubAccountTransfer](docs/SubAccountTransfer.md) - [Ticker](docs/Ticker.md) - [Trade](docs/Trade.md) + - [TradeFee](docs/TradeFee.md) - [Transfer](docs/Transfer.md) - [TriggerOrderResponse](docs/TriggerOrderResponse.md) diff --git a/docs/DeliveryApi.md b/docs/DeliveryApi.md index c2a707a..5c1d34c 100644 --- a/docs/DeliveryApi.md +++ b/docs/DeliveryApi.md @@ -111,7 +111,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +contract = 'BTC_USDT_20200814' # str | Futures contract try: # Get a single contract @@ -171,7 +171,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +contract = 'BTC_USDT_20200814' # str | Futures contract interval = '0' # str | Order depth. 0 means no aggregation is applied. default to 0 (optional) (default to '0') limit = 10 # int | Maximum number of order depth data in asks or bids (optional) (default to 10) @@ -233,7 +233,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +contract = 'BTC_USDT_20200814' # str | Futures contract limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) last_id = '12345' # str | Specify list staring point using the id of last record in previous list-query results This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) _from = 1546905600 # float | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional) @@ -301,7 +301,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +contract = 'BTC_USDT_20200814' # str | Futures contract _from = 1546905600 # float | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) to = 1546935600 # float | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) limit = 100 # int | Maximum recent data points returned. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional) (default to 100) @@ -367,7 +367,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) +contract = 'BTC_USDT_20200814' # str | Futures contract (optional) try: # List futures tickers @@ -695,7 +695,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +contract = 'BTC_USDT_20200814' # str | Futures contract try: # Get single position @@ -762,7 +762,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +contract = 'BTC_USDT_20200814' # str | Futures contract change = '0.01' # str | Margin change. Use positive number to increase margin, negative number otherwise. try: @@ -831,7 +831,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +contract = 'BTC_USDT_20200814' # str | Futures contract leverage = '10' # str | New position leverage try: @@ -900,7 +900,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +contract = 'BTC_USDT_20200814' # str | Futures contract risk_limit = '10' # str | New position risk limit try: @@ -972,7 +972,7 @@ api_client = gate_api.ApiClient(configuration) api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency status = 'open' # str | List orders based on status -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) +contract = 'BTC_USDT_20200814' # str | Futures contract (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) last_id = '12345' # str | Specify list staring point using the `id` of last record in previous list-query results (optional) @@ -1050,7 +1050,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -futures_order = {"id":15675394,"user":100000,"contract":"BTC_USD","create_time":1546569968,"size":6024,"iceberg":0,"left":6024,"price":"3765","fill_price":"0","mkfr":"-0.00025","tkfr":"0.00075","tif":"gtc","refu":0,"is_reduce_only":false,"is_close":false,"is_liq":false,"text":"t-my-custom-id","status":"finished","finish_time":1514764900,"finish_as":"cancelled"} # FuturesOrder | +futures_order = gate_api.FuturesOrder() # FuturesOrder | try: # Create a futures order @@ -1119,7 +1119,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract +contract = 'BTC_USDT_20200814' # str | Futures contract side = 'ask' # str | All bids or asks. Both included in not specified (optional) try: @@ -1324,7 +1324,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) +contract = 'BTC_USDT_20200814' # str | Futures contract (optional) order = 12345 # int | Futures order ID, return related data only if specified (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) @@ -1401,7 +1401,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) +contract = 'BTC_USDT_20200814' # str | Futures contract (optional) limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) try: @@ -1470,7 +1470,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) +contract = 'BTC_USDT_20200814' # str | Futures contract (optional) limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) at = 0 # int | Specify a liquidation timestamp (optional) (default to 0) @@ -1541,7 +1541,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -contract = 'BTC_USDT_WEEKLY_20200703' # str | Futures contract (optional) +contract = 'BTC_USDT_20200814' # str | Futures contract (optional) limit = 100 # int | Maximum number of records returned in one list (optional) (default to 100) at = 0 # int | Specify a settlement timestamp (optional) (default to 0) @@ -1685,7 +1685,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency -futures_price_triggered_order = {"initial":{"contract":"BTC_USD","size":100,"price":"5.03","close":false,"tif":"gtc","text":"web"},"trigger":{"strategy_type":0,"price_type":0,"price":"3000","rule":1,"expiration":86400},"id":1283293,"user":1234,"create_time":1514764800,"finish_time":1514764900,"trade_id":13566,"status":"finished","finish_as":"cancelled","reason":""} # FuturesPriceTriggeredOrder | +futures_price_triggered_order = gate_api.FuturesPriceTriggeredOrder() # FuturesPriceTriggeredOrder | try: # Create a price-triggered order diff --git a/docs/DeliveryContract.md b/docs/DeliveryContract.md index 004f877..9568e5d 100644 --- a/docs/DeliveryContract.md +++ b/docs/DeliveryContract.md @@ -5,7 +5,7 @@ Futures contract details Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **str** | Futures contract | [optional] -**underling** | **str** | Underlying | [optional] +**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] diff --git a/docs/FuturesApi.md b/docs/FuturesApi.md index 5729d60..224a44d 100644 --- a/docs/FuturesApi.md +++ b/docs/FuturesApi.md @@ -1110,7 +1110,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -futures_order = {"id":15675394,"user":100000,"contract":"BTC_USD","create_time":1546569968,"size":6024,"iceberg":0,"left":6024,"price":"3765","fill_price":"0","mkfr":"-0.00025","tkfr":"0.00075","tif":"gtc","refu":0,"is_reduce_only":false,"is_close":false,"is_liq":false,"text":"t-my-custom-id","status":"finished","finish_time":1514764900,"finish_as":"cancelled"} # FuturesOrder | +futures_order = gate_api.FuturesOrder() # FuturesOrder | try: # Create a futures order @@ -1674,7 +1674,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.FuturesApi(api_client) settle = 'btc' # str | Settle currency (default to 'btc') -futures_price_triggered_order = {"initial":{"contract":"BTC_USD","size":100,"price":"5.03","close":false,"tif":"gtc","text":"web"},"trigger":{"strategy_type":0,"price_type":0,"price":"3000","rule":1,"expiration":86400},"id":1283293,"user":1234,"create_time":1514764800,"finish_time":1514764900,"trade_id":13566,"status":"finished","finish_as":"cancelled","reason":""} # FuturesPriceTriggeredOrder | +futures_price_triggered_order = gate_api.FuturesPriceTriggeredOrder() # FuturesPriceTriggeredOrder | try: # Create a price-triggered order diff --git a/docs/FuturesErrorResponse.md b/docs/FuturesErrorResponse.md deleted file mode 100644 index e8fe220..0000000 --- a/docs/FuturesErrorResponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# FuturesErrorResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**label** | **str** | 错误标识符,错误描述如下: 请求参数或格式问题: - INVALID_PARAM_VALUE: 参数输入值无效 - INVALID_REQUEST_BODY: 无效请求体 - MISSING_REQUIRED_PARAM: 缺少必选参数 - DUPLICATE_REQUEST: 请求过于频繁 认证相关: - INVALID_CREDENTIALS: 认证接口缺少用户认证信息 - NO_FUTURES_ACCOUNT: 用户无期货账户 业务相关: - NO_MATCHING: 没有匹配的对手单 - NO_MARKING_PRICE: 合约当前无标记价格 - CONTRACT_NOT_FOUND: 合约未找到 - NOT_FOUND: 请求路径不存在 - RISK_LIMIT_EXCEEDED: 委托超出风险限额 - INSUFFICIENT_BALANCE: 余额不足 - POTENTIAL_LIQUIDATION: 操作可能导致爆仓 - LEVERAGE_TOO_HIGH: 杠杆倍数设置过高 - LEVERAGE_TOO_LOW: 杠杆倍数设置过低 - ORDER_NOT_FOUND: 委托不存在 - ORDER_FINISHED: 订单已结束 - TOO_MANY_ORDERS: 过多未交易的挂单 - POSITION_NOT_FOUND: 合约无头寸信息 - POSITION_CROSS_MARGIN: 全仓不支持更新保证金 - POSITION_LOCKED: 头寸当前被锁定 - TOO_MUCH_CHANGE: 保证金超过可调范围 - RISK_LIMIT_NOT_MULTIPLE: 风险限额未按照步长调整 - RISK_LIMIT_TOO_HIGH: 超出最大风险限额 - RISK_LIMIT_TOO_lOW: 风险限额设置过低 - PRICE_TOO_DEVIATED: 下单价与标记价格相差过大 - SIZE_TOO_LARGE: 下单数量超过上限 - SIZE_TOO_SMALL: 下单数量不足下限 - LIQUIDATION_PRICE_EXCEEDED: 补仓时价格不能超过平仓价 - POSITION_IN_CLOSE: 仓位正在平仓 - POTENTIAL_BANKRUPTCY: 下单若成交,保证金无法弥补损失 服务异常: - SERVER_ERROR: 内部错误 - TOO_BUSY: 服务当前忙 | [optional] -**message** | **str** | 详细错误描述。如果指定了 `Accept-Language` 请求头部,且支持指定语言,则描述信息会返回对应的语言 | [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/GateErrorResponse.md b/docs/GateErrorResponse.md deleted file mode 100644 index 1fc4dbe..0000000 --- a/docs/GateErrorResponse.md +++ /dev/null @@ -1,12 +0,0 @@ -# GateErrorResponse - -error response body format when status code is non-2xx -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**label** | **str** | Error label | [optional] -**message** | **str** | Detailed error message | [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 4f303ed..8c24d0c 100644 --- a/docs/MarginApi.md +++ b/docs/MarginApi.md @@ -445,7 +445,7 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.MarginApi(api_client) -loan = {"id":"123435","create_time":"1548000000","expire_time":"1548100000","side":"borrow","status":"loaned","currency":"BTC","rate":"0.002","amount":"1.5","days":10,"auto_renew":true,"currency_pair":"ETH_BTC","left":"0","repaid":"0","paid_interest":"0","unpaid_interest":"0","fee_rate":"0.18","orig_id":"123424"} # Loan | +loan = gate_api.Loan() # Loan | try: # Lend or borrow @@ -716,7 +716,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.MarginApi(api_client) loan_id = '12345' # str | Loan ID -loan_patch = {"currency":"BTC","side":"borrow","currency_pair":"BTC_USDT","auto_renew":false} # LoanPatch | +loan_patch = gate_api.LoanPatch() # LoanPatch | try: # Modify a loan @@ -848,7 +848,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.MarginApi(api_client) loan_id = '12345' # str | Loan ID -repay_request = {"currency_pair":"ETH_BTC","currency":"ETH","mode":"partial","amount":"100"} # RepayRequest | +repay_request = gate_api.RepayRequest() # RepayRequest | try: # Repay a loan @@ -1055,7 +1055,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.MarginApi(api_client) loan_record_id = '12345' # str | Loan record ID -loan_patch = {"currency":"BTC","side":"borrow","currency_pair":"BTC_USDT","auto_renew":false} # LoanPatch | +loan_patch = gate_api.LoanPatch() # LoanPatch | try: # Modify a loan record diff --git a/docs/SpotApi.md b/docs/SpotApi.md index 0d1c12e..4cf4fa0 100644 --- a/docs/SpotApi.md +++ b/docs/SpotApi.md @@ -10,6 +10,7 @@ Method | HTTP request | Description [**list_order_book**](SpotApi.md#list_order_book) | **GET** /spot/order_book | Retrieve order book [**list_trades**](SpotApi.md#list_trades) | **GET** /spot/trades | Retrieve market trades [**list_candlesticks**](SpotApi.md#list_candlesticks) | **GET** /spot/candlesticks | Market candlesticks +[**get_fee**](SpotApi.md#get_fee) | **GET** /spot/fee | Query user trading fee rates [**list_spot_accounts**](SpotApi.md#list_spot_accounts) | **GET** /spot/accounts | List spot accounts [**create_batch_orders**](SpotApi.md#create_batch_orders) | **POST** /spot/batch_orders | Create a batch of orders [**list_all_open_orders**](SpotApi.md#list_all_open_orders) | **GET** /spot/open_orders | List all open orders @@ -376,6 +377,71 @@ No authorization required [[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_fee** +> TradeFee get_fee(currency_pair=currency_pair) + +Query user trading fee rates + +### Example + +* Api Key Authentication (apiv4): +```python +from __future__ import print_function +import gate_api +from gate_api.exceptions import ApiException +# 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.SpotApi(api_client) +currency_pair = 'BTC_USDT' # str | Specify a currency pair to retrieve precise fee rate This field is optional. In most cases, the fee rate is identical among all currency pairs (optional) + +try: + # Query user trading fee rates + api_response = api_instance.get_fee(currency_pair=currency_pair) + print(api_response) +except ApiException as e: + print("Exception when calling SpotApi->get_fee: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **currency_pair** | **str**| Specify a currency pair to retrieve precise fee rate This field is optional. In most cases, the fee rate is identical among all currency pairs | [optional] + +### Return type + +[**TradeFee**](TradeFee.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_spot_accounts** > list[SpotAccount] list_spot_accounts(currency=currency) @@ -472,7 +538,7 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.SpotApi(api_client) -order = [{"id":"12332324","text":"t-123456","create_time":"1548000000","update_time":"1548000100","currency_pair":"ETH_BTC","status":"cancelled","type":"limit","account":"spot","side":"buy","amount":"1","price":"5.00032","time_in_force":"gtc","auto_borrow":false,"left":"0.5","filled_total":"2.50016","fee":"0.005","fee_currency":"ETH","point_fee":"0","gt_fee":"0","gt_discount":false,"rebated_fee":"0","rebated_fee_currency":"BTC"}] # list[Order] | +order = [gate_api.Order()] # list[Order] | try: # Create a batch of orders @@ -513,7 +579,7 @@ Name | Type | Description | Notes List all open orders -List all open orders in all currency pairs. Each currency pair has its own pagination +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 ### Example @@ -540,7 +606,7 @@ api_client = gate_api.ApiClient(configuration) # Create an instance of the API class 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 list (optional) (default to 100) +limit = 100 # int | Maximum number of records returned in one page in each currency pair (optional) (default to 100) try: # List all open orders @@ -555,7 +621,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **page** | **int**| Page number | [optional] [default to 1] - **limit** | **int**| Maximum number of records returned in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records returned in one page in each currency pair | [optional] [default to 100] ### Return type @@ -609,7 +675,7 @@ api_instance = gate_api.SpotApi(api_client) 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 in one list (optional) (default to 100) +limit = 100 # int | Maximum number of records returned. If `status` is `open`, maximum of `limit` is 100 (optional) (default to 100) try: # List orders @@ -626,7 +692,7 @@ Name | Type | Description | Notes **currency_pair** | **str**| Currency pair | **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 in one list | [optional] [default to 100] + **limit** | **int**| Maximum number of records returned. If `status` is `open`, maximum of `limit` is 100 | [optional] [default to 100] ### Return type @@ -677,7 +743,7 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.SpotApi(api_client) -order = {"id":"12332324","text":"t-123456","create_time":"1548000000","update_time":"1548000100","currency_pair":"ETH_BTC","status":"cancelled","type":"limit","account":"spot","side":"buy","amount":"1","price":"5.00032","time_in_force":"gtc","auto_borrow":false,"left":"0.5","filled_total":"2.50016","fee":"0.005","fee_currency":"ETH","point_fee":"0","gt_fee":"0","gt_discount":false,"rebated_fee":"0","rebated_fee_currency":"BTC"} # Order | +order = gate_api.Order() # Order | try: # Create an order @@ -813,7 +879,7 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.SpotApi(api_client) -cancel_order = [{"currency_pair":"BTC_USDT","id":"123456"}] # list[CancelOrder] | +cancel_order = [gate_api.CancelOrder()] # list[CancelOrder] | try: # Cancel a batch of orders with an ID list diff --git a/docs/TradeFee.md b/docs/TradeFee.md new file mode 100644 index 0000000..15ddaf0 --- /dev/null +++ b/docs/TradeFee.md @@ -0,0 +1,16 @@ +# TradeFee + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**user_id** | **int** | User ID | [optional] +**taker_fee** | **str** | taker fee rate | [optional] +**maker_fee** | **str** | maker fee rate | [optional] +**gt_discount** | **bool** | Is GT deduction is enabled | [optional] +**gt_taker_fee** | **str** | Taker fee rate if using GT deduction. It will be 0 if GT deduction is disabled | [optional] +**gt_maker_fee** | **str** | Maker fee rate if using GT deduction. It will be 0 if GT deduction is disabled | [optional] +**loan_fee** | **str** | Loan fee rate of margin lending | [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/Transfer.md b/docs/Transfer.md index 9106bf6..2c7e018 100644 --- a/docs/Transfer.md +++ b/docs/Transfer.md @@ -4,8 +4,6 @@ Accounts available to transfer: - `spot`: spot account - `margin`: margin accou ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **str** | Transfer ID | [optional] [readonly] -**created_at** | **str** | Timestamp when the transfer occurred | [optional] [readonly] **currency** | **str** | Transfer currency. For futures account, `currency` can be set to `POINT` or settle currency | **_from** | **str** | Account transferred from | **to** | **str** | Account transferred to | diff --git a/docs/WalletApi.md b/docs/WalletApi.md index 2a31068..21f5474 100644 --- a/docs/WalletApi.md +++ b/docs/WalletApi.md @@ -258,7 +258,7 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.WalletApi(api_client) -transfer = {"id":"129012","created_at":"1596100000","currency":"BTC","from":"spot","to":"margin","amount":"1","currency_pair":"BTC_USDT"} # Transfer | +transfer = gate_api.Transfer() # Transfer | try: # Transfer between trading accounts @@ -397,7 +397,7 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.WalletApi(api_client) -sub_account_transfer = {"uid":"10001","timest":"1592809000","source":"web","currency":"BTC","sub_account":"10002","direction":"to","amount":"1"} # SubAccountTransfer | +sub_account_transfer = gate_api.SubAccountTransfer() # SubAccountTransfer | try: # Transfer between main and sub accounts diff --git a/docs/WithdrawalApi.md b/docs/WithdrawalApi.md index c62d280..a45ac37 100644 --- a/docs/WithdrawalApi.md +++ b/docs/WithdrawalApi.md @@ -36,7 +36,7 @@ configuration = gate_api.Configuration( api_client = gate_api.ApiClient(configuration) # Create an instance of the API class api_instance = gate_api.WithdrawalApi(api_client) -ledger_record = {"id":"210496","timestamp":"1542000000","currency":"ETH","address":"1HkxtBAMrA3tP5ENnYY2CZortjZvFDH5Cs","txid":"128988928203223323290","amount":"222.61","memo":"","status":"DONE"} # LedgerRecord | +ledger_record = gate_api.LedgerRecord() # LedgerRecord | try: # Withdraw diff --git a/gate_api/__init__.py b/gate_api/__init__.py index 831a590..02e4168 100644 --- a/gate_api/__init__.py +++ b/gate_api/__init__.py @@ -14,7 +14,7 @@ from __future__ import absolute_import -__version__ = "4.15.1" +__version__ = "4.15.2" # import apis into sdk package from gate_api.api.delivery_api import DeliveryApi @@ -32,6 +32,7 @@ from gate_api.exceptions import ApiValueError from gate_api.exceptions import ApiKeyError from gate_api.exceptions import ApiException + # import models into sdk package from gate_api.models.batch_order import BatchOrder from gate_api.models.cancel_order import CancelOrder @@ -78,6 +79,6 @@ from gate_api.models.sub_account_transfer import SubAccountTransfer from gate_api.models.ticker import Ticker from gate_api.models.trade import Trade +from gate_api.models.trade_fee import TradeFee from gate_api.models.transfer import Transfer from gate_api.models.trigger_order_response import TriggerOrderResponse - diff --git a/gate_api/api/delivery_api.py b/gate_api/api/delivery_api.py index 486a2fb..275389e 100644 --- a/gate_api/api/delivery_api.py +++ b/gate_api/api/delivery_api.py @@ -18,10 +18,7 @@ import six from gate_api.api_client import ApiClient -from gate_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from gate_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 class DeliveryApi(object): @@ -53,8 +50,8 @@ def list_delivery_contracts(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[DeliveryContract] - If the method is called asynchronously, + :rtype: list[gate_api.DeliveryContract] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -79,37 +76,28 @@ def list_delivery_contracts_with_http_info(self, settle, **kwargs): # noqa: E50 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[DeliveryContract], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.DeliveryContract], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_delivery_contracts" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_delivery_contracts" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_contracts`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_delivery_contracts`" + ) # noqa: E501 collection_formats = {} @@ -126,14 +114,14 @@ def list_delivery_contracts_with_http_info(self, settle, **kwargs): # noqa: E50 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/contracts', 'GET', + '/delivery/{settle}/contracts', + 'GET', path_params, query_params, header_params, @@ -146,7 +134,8 @@ def list_delivery_contracts_with_http_info(self, settle, **kwargs): # noqa: E50 _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) + collection_formats=collection_formats, + ) def get_delivery_contract(self, settle, contract, **kwargs): # noqa: E501 """Get a single contract # noqa: E501 @@ -166,8 +155,8 @@ def get_delivery_contract(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: DeliveryContract - If the method is called asynchronously, + :rtype: gate_api.DeliveryContract + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -193,42 +182,35 @@ def get_delivery_contract_with_http_info(self, settle, contract, **kwargs): # n number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(DeliveryContract, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.DeliveryContract, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_delivery_contract" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_delivery_contract" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_delivery_contract`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `get_delivery_contract`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `get_delivery_contract`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `get_delivery_contract`" + ) # noqa: E501 collection_formats = {} @@ -247,14 +229,14 @@ def get_delivery_contract_with_http_info(self, settle, contract, **kwargs): # n body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/contracts/{contract}', 'GET', + '/delivery/{settle}/contracts/{contract}', + 'GET', path_params, query_params, header_params, @@ -267,7 +249,8 @@ def get_delivery_contract_with_http_info(self, settle, contract, **kwargs): # n _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) + collection_formats=collection_formats, + ) def list_delivery_order_book(self, settle, contract, **kwargs): # noqa: E501 """Futures order book # noqa: E501 @@ -290,8 +273,8 @@ def list_delivery_order_book(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesOrderBook - If the method is called asynchronously, + :rtype: gate_api.FuturesOrderBook + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -320,49 +303,50 @@ def list_delivery_order_book_with_http_info(self, settle, contract, **kwargs): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesOrderBook, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.FuturesOrderBook, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'interval', - 'limit' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'interval', 'limit'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_delivery_order_book" % key + "Got an unexpected keyword argument '%s'" " to method list_delivery_order_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_order_book`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_delivery_order_book`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `list_delivery_order_book`") # noqa: E501 - - if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 20: # noqa: E501 - raise ApiValueError("Invalid value for parameter `limit` when calling `list_delivery_order_book`, must be a value less than or equal to `20`") # 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_delivery_order_book`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `list_delivery_order_book`" + ) # noqa: E501 + + if ( + self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 20 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `limit` when calling `list_delivery_order_book`, must be a value less than or equal to `20`" + ) # 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_delivery_order_book`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -384,14 +368,14 @@ def list_delivery_order_book_with_http_info(self, settle, contract, **kwargs): body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/order_book', 'GET', + '/delivery/{settle}/order_book', + 'GET', path_params, query_params, header_params, @@ -404,7 +388,8 @@ def list_delivery_order_book_with_http_info(self, settle, contract, **kwargs): _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) + collection_formats=collection_formats, + ) def list_delivery_trades(self, settle, contract, **kwargs): # noqa: E501 """Futures trading history # noqa: E501 @@ -428,8 +413,8 @@ def list_delivery_trades(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesTrade] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesTrade] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -459,51 +444,48 @@ def list_delivery_trades_with_http_info(self, settle, contract, **kwargs): # no number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesTrade], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesTrade], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'limit', - 'last_id', - '_from', - 'to' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'limit', 'last_id', '_from', 'to'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_delivery_trades" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_delivery_trades" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_trades`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_delivery_trades`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `list_delivery_trades`") # 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_delivery_trades`, 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_delivery_trades`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `list_delivery_trades`" + ) # 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_delivery_trades`, 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_delivery_trades`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -529,14 +511,14 @@ def list_delivery_trades_with_http_info(self, settle, contract, **kwargs): # no body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/trades', 'GET', + '/delivery/{settle}/trades', + 'GET', path_params, query_params, header_params, @@ -549,7 +531,8 @@ def list_delivery_trades_with_http_info(self, settle, contract, **kwargs): # no _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) + collection_formats=collection_formats, + ) def list_delivery_candlesticks(self, settle, contract, **kwargs): # noqa: E501 """Get futures candlesticks # noqa: E501 @@ -574,8 +557,8 @@ def list_delivery_candlesticks(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesCandlestick] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesCandlestick] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -606,49 +589,44 @@ def list_delivery_candlesticks_with_http_info(self, settle, contract, **kwargs): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesCandlestick], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesCandlestick], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - '_from', - 'to', - 'limit', - 'interval' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', '_from', 'to', 'limit', 'interval'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_delivery_candlesticks" % key + "Got an unexpected keyword argument '%s'" " to method list_delivery_candlesticks" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_candlesticks`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_delivery_candlesticks`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `list_delivery_candlesticks`") # noqa: E501 - - if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 2000: # noqa: E501 - raise ApiValueError("Invalid value for parameter `limit` when calling `list_delivery_candlesticks`, must be a value less than or equal to `2000`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `list_delivery_candlesticks`" + ) # noqa: E501 + + if ( + self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 2000 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `limit` when calling `list_delivery_candlesticks`, must be a value less than or equal to `2000`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -674,14 +652,14 @@ def list_delivery_candlesticks_with_http_info(self, settle, contract, **kwargs): body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/candlesticks', 'GET', + '/delivery/{settle}/candlesticks', + 'GET', path_params, query_params, header_params, @@ -694,7 +672,8 @@ def list_delivery_candlesticks_with_http_info(self, settle, contract, **kwargs): _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) + collection_formats=collection_formats, + ) def list_delivery_tickers(self, settle, **kwargs): # noqa: E501 """List futures tickers # noqa: E501 @@ -714,8 +693,8 @@ def list_delivery_tickers(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesTicker] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesTicker] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -741,38 +720,28 @@ def list_delivery_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesTicker], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesTicker], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_delivery_tickers" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_delivery_tickers" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_tickers`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_delivery_tickers`" + ) # noqa: E501 collection_formats = {} @@ -791,14 +760,14 @@ def list_delivery_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/tickers', 'GET', + '/delivery/{settle}/tickers', + 'GET', path_params, query_params, header_params, @@ -811,7 +780,8 @@ def list_delivery_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_delivery_insurance_ledger(self, settle, **kwargs): # noqa: E501 """Futures insurance balance history # noqa: E501 @@ -831,8 +801,8 @@ def list_delivery_insurance_ledger(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[InsuranceRecord] - If the method is called asynchronously, + :rtype: list[gate_api.InsuranceRecord] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -858,43 +828,43 @@ def list_delivery_insurance_ledger_with_http_info(self, settle, **kwargs): # no number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[InsuranceRecord], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.InsuranceRecord], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'limit' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'limit'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_delivery_insurance_ledger" % key + "Got an unexpected keyword argument '%s'" " to method list_delivery_insurance_ledger" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_insurance_ledger`") # 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_delivery_insurance_ledger`, 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_delivery_insurance_ledger`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_delivery_insurance_ledger`" + ) # 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_delivery_insurance_ledger`, 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_delivery_insurance_ledger`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -912,14 +882,14 @@ def list_delivery_insurance_ledger_with_http_info(self, settle, **kwargs): # no body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/insurance', 'GET', + '/delivery/{settle}/insurance', + 'GET', path_params, query_params, header_params, @@ -932,7 +902,8 @@ def list_delivery_insurance_ledger_with_http_info(self, settle, **kwargs): # no _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) + collection_formats=collection_formats, + ) def list_delivery_accounts(self, settle, **kwargs): # noqa: E501 """Query futures account # noqa: E501 @@ -951,8 +922,8 @@ def list_delivery_accounts(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesAccount - If the method is called asynchronously, + :rtype: gate_api.FuturesAccount + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -977,37 +948,28 @@ def list_delivery_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesAccount, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.FuturesAccount, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_delivery_accounts" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_delivery_accounts" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_accounts`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_delivery_accounts`" + ) # noqa: E501 collection_formats = {} @@ -1024,14 +986,14 @@ def list_delivery_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/accounts', 'GET', + '/delivery/{settle}/accounts', + 'GET', path_params, query_params, header_params, @@ -1044,7 +1006,8 @@ def list_delivery_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_delivery_account_book(self, settle, **kwargs): # noqa: E501 """Query account book # noqa: E501 @@ -1067,8 +1030,8 @@ def list_delivery_account_book(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesAccountBook] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesAccountBook] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1097,46 +1060,43 @@ def list_delivery_account_book_with_http_info(self, settle, **kwargs): # noqa: number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesAccountBook], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesAccountBook], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'limit', - '_from', - 'to', - 'type' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'limit', '_from', 'to', 'type'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_delivery_account_book" % key + "Got an unexpected keyword argument '%s'" " to method list_delivery_account_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_account_book`") # 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_delivery_account_book`, 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_delivery_account_book`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_delivery_account_book`" + ) # 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_delivery_account_book`, 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_delivery_account_book`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -1160,14 +1120,14 @@ def list_delivery_account_book_with_http_info(self, settle, **kwargs): # noqa: body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/account_book', 'GET', + '/delivery/{settle}/account_book', + 'GET', path_params, query_params, header_params, @@ -1180,7 +1140,8 @@ def list_delivery_account_book_with_http_info(self, settle, **kwargs): # noqa: _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) + collection_formats=collection_formats, + ) def list_delivery_positions(self, settle, **kwargs): # noqa: E501 """List all positions of a user # noqa: E501 @@ -1199,8 +1160,8 @@ def list_delivery_positions(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Position] - If the method is called asynchronously, + :rtype: list[gate_api.Position] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1225,37 +1186,28 @@ def list_delivery_positions_with_http_info(self, settle, **kwargs): # noqa: E50 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Position], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.Position], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_delivery_positions" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_delivery_positions" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_positions`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_delivery_positions`" + ) # noqa: E501 collection_formats = {} @@ -1272,14 +1224,14 @@ def list_delivery_positions_with_http_info(self, settle, **kwargs): # noqa: E50 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/positions', 'GET', + '/delivery/{settle}/positions', + 'GET', path_params, query_params, header_params, @@ -1292,7 +1244,8 @@ def list_delivery_positions_with_http_info(self, settle, **kwargs): # noqa: E50 _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) + collection_formats=collection_formats, + ) def get_delivery_position(self, settle, contract, **kwargs): # noqa: E501 """Get single position # noqa: E501 @@ -1312,8 +1265,8 @@ def get_delivery_position(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Position - If the method is called asynchronously, + :rtype: gate_api.Position + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1339,42 +1292,35 @@ def get_delivery_position_with_http_info(self, settle, contract, **kwargs): # n number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Position, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_delivery_position" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_delivery_position" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_delivery_position`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `get_delivery_position`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `get_delivery_position`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `get_delivery_position`" + ) # noqa: E501 collection_formats = {} @@ -1393,14 +1339,14 @@ def get_delivery_position_with_http_info(self, settle, contract, **kwargs): # n body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/positions/{contract}', 'GET', + '/delivery/{settle}/positions/{contract}', + 'GET', path_params, query_params, header_params, @@ -1413,7 +1359,8 @@ def get_delivery_position_with_http_info(self, settle, contract, **kwargs): # n _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) + collection_formats=collection_formats, + ) def update_delivery_position_margin(self, settle, contract, change, **kwargs): # noqa: E501 """Update position margin # noqa: E501 @@ -1434,8 +1381,8 @@ def update_delivery_position_margin(self, settle, contract, change, **kwargs): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Position - If the method is called asynchronously, + :rtype: gate_api.Position + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1462,47 +1409,44 @@ def update_delivery_position_margin_with_http_info(self, settle, contract, chang number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Position, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'change' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'change'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_delivery_position_margin" % key + "Got an unexpected keyword argument '%s'" " to method update_delivery_position_margin" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `update_delivery_position_margin`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `update_delivery_position_margin`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `update_delivery_position_margin`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `update_delivery_position_margin`" + ) # noqa: E501 # verify the required parameter 'change' is set - if self.api_client.client_side_validation and ('change' not in local_var_params or # noqa: E501 - local_var_params['change'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `change` when calling `update_delivery_position_margin`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'change' not in local_var_params or local_var_params['change'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `change` when calling `update_delivery_position_margin`" + ) # noqa: E501 collection_formats = {} @@ -1523,14 +1467,14 @@ def update_delivery_position_margin_with_http_info(self, settle, contract, chang body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/positions/{contract}/margin', 'POST', + '/delivery/{settle}/positions/{contract}/margin', + 'POST', path_params, query_params, header_params, @@ -1543,7 +1487,8 @@ def update_delivery_position_margin_with_http_info(self, settle, contract, chang _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) + collection_formats=collection_formats, + ) def update_delivery_position_leverage(self, settle, contract, leverage, **kwargs): # noqa: E501 """Update position leverage # noqa: E501 @@ -1564,8 +1509,8 @@ def update_delivery_position_leverage(self, settle, contract, leverage, **kwargs number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Position - If the method is called asynchronously, + :rtype: gate_api.Position + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1592,47 +1537,44 @@ def update_delivery_position_leverage_with_http_info(self, settle, contract, lev number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Position, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'leverage' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'leverage'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_delivery_position_leverage" % key + "Got an unexpected keyword argument '%s'" " to method update_delivery_position_leverage" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `update_delivery_position_leverage`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `update_delivery_position_leverage`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `update_delivery_position_leverage`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `update_delivery_position_leverage`" + ) # noqa: E501 # verify the required parameter 'leverage' is set - if self.api_client.client_side_validation and ('leverage' not in local_var_params or # noqa: E501 - local_var_params['leverage'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `leverage` when calling `update_delivery_position_leverage`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'leverage' not in local_var_params or local_var_params['leverage'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `leverage` when calling `update_delivery_position_leverage`" + ) # noqa: E501 collection_formats = {} @@ -1653,14 +1595,14 @@ def update_delivery_position_leverage_with_http_info(self, settle, contract, lev body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/positions/{contract}/leverage', 'POST', + '/delivery/{settle}/positions/{contract}/leverage', + 'POST', path_params, query_params, header_params, @@ -1673,7 +1615,8 @@ def update_delivery_position_leverage_with_http_info(self, settle, contract, lev _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) + collection_formats=collection_formats, + ) def update_delivery_position_risk_limit(self, settle, contract, risk_limit, **kwargs): # noqa: E501 """Update position risk limit # noqa: E501 @@ -1694,12 +1637,14 @@ def update_delivery_position_risk_limit(self, settle, contract, risk_limit, **kw number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Position - If the method is called asynchronously, + :rtype: gate_api.Position + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.update_delivery_position_risk_limit_with_http_info(settle, contract, risk_limit, **kwargs) # noqa: E501 + return self.update_delivery_position_risk_limit_with_http_info( + settle, contract, risk_limit, **kwargs + ) # noqa: E501 def update_delivery_position_risk_limit_with_http_info(self, settle, contract, risk_limit, **kwargs): # noqa: E501 """Update position risk limit # noqa: E501 @@ -1722,47 +1667,44 @@ def update_delivery_position_risk_limit_with_http_info(self, settle, contract, r number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Position, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'risk_limit' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'risk_limit'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_delivery_position_risk_limit" % key + "Got an unexpected keyword argument '%s'" " to method update_delivery_position_risk_limit" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `update_delivery_position_risk_limit`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `update_delivery_position_risk_limit`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `update_delivery_position_risk_limit`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `update_delivery_position_risk_limit`" + ) # noqa: E501 # verify the required parameter 'risk_limit' is set - if self.api_client.client_side_validation and ('risk_limit' not in local_var_params or # noqa: E501 - local_var_params['risk_limit'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `risk_limit` when calling `update_delivery_position_risk_limit`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'risk_limit' not in local_var_params or local_var_params['risk_limit'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `risk_limit` when calling `update_delivery_position_risk_limit`" + ) # noqa: E501 collection_formats = {} @@ -1783,14 +1725,14 @@ def update_delivery_position_risk_limit_with_http_info(self, settle, contract, r body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/positions/{contract}/risk_limit', 'POST', + '/delivery/{settle}/positions/{contract}/risk_limit', + 'POST', path_params, query_params, header_params, @@ -1803,7 +1745,8 @@ def update_delivery_position_risk_limit_with_http_info(self, settle, contract, r _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) + collection_formats=collection_formats, + ) def list_delivery_orders(self, settle, status, **kwargs): # noqa: E501 """List futures orders # noqa: E501 @@ -1829,8 +1772,8 @@ def list_delivery_orders(self, settle, status, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesOrder] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesOrder] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1862,54 +1805,54 @@ def list_delivery_orders_with_http_info(self, settle, status, **kwargs): # noqa number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesOrder], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesOrder], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'status', - 'contract', - 'limit', - 'offset', - 'last_id', - 'count_total' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'status', 'contract', 'limit', 'offset', 'last_id', 'count_total'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_delivery_orders" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_delivery_orders" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_orders`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_delivery_orders`" + ) # noqa: E501 # verify the required parameter 'status' is set - if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 - local_var_params['status'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `status` when calling `list_delivery_orders`") # 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_delivery_orders`, 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_delivery_orders`, 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_delivery_orders`, must be a value greater than or equal to `0`") # noqa: E501 + 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_delivery_orders`" + ) # 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_delivery_orders`, 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_delivery_orders`, 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_delivery_orders`, must be a value greater than or equal to `0`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -1937,14 +1880,14 @@ def list_delivery_orders_with_http_info(self, settle, status, **kwargs): # noqa body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/orders', 'GET', + '/delivery/{settle}/orders', + 'GET', path_params, query_params, header_params, @@ -1957,7 +1900,8 @@ def list_delivery_orders_with_http_info(self, settle, status, **kwargs): # noqa _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) + collection_formats=collection_formats, + ) def create_delivery_order(self, settle, futures_order, **kwargs): # noqa: E501 """Create a futures order # noqa: E501 @@ -1978,8 +1922,8 @@ def create_delivery_order(self, settle, futures_order, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesOrder - If the method is called asynchronously, + :rtype: gate_api.FuturesOrder + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -2006,42 +1950,35 @@ def create_delivery_order_with_http_info(self, settle, futures_order, **kwargs): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.FuturesOrder, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'futures_order' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'futures_order'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_delivery_order" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_delivery_order" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `create_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `create_delivery_order`" + ) # noqa: E501 # verify the required parameter 'futures_order' is set - if self.api_client.client_side_validation and ('futures_order' not in local_var_params or # noqa: E501 - local_var_params['futures_order'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `futures_order` when calling `create_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'futures_order' not in local_var_params or local_var_params['futures_order'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `futures_order` when calling `create_delivery_order`" + ) # noqa: E501 collection_formats = {} @@ -2060,18 +1997,19 @@ def create_delivery_order_with_http_info(self, settle, futures_order, **kwargs): if 'futures_order' in local_var_params: body_params = local_var_params['futures_order'] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + ['application/json'] + ) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/orders', 'POST', + '/delivery/{settle}/orders', + 'POST', path_params, query_params, header_params, @@ -2084,7 +2022,8 @@ def create_delivery_order_with_http_info(self, settle, futures_order, **kwargs): _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) + collection_formats=collection_formats, + ) def cancel_delivery_orders(self, settle, contract, **kwargs): # noqa: E501 """Cancel all `open` orders matched # noqa: E501 @@ -2106,8 +2045,8 @@ def cancel_delivery_orders(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesOrder] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesOrder] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -2135,43 +2074,35 @@ def cancel_delivery_orders_with_http_info(self, settle, contract, **kwargs): # number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesOrder], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesOrder], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'side' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'side'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method cancel_delivery_orders" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method cancel_delivery_orders" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `cancel_delivery_orders`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `cancel_delivery_orders`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `cancel_delivery_orders`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `cancel_delivery_orders`" + ) # noqa: E501 collection_formats = {} @@ -2192,14 +2123,14 @@ def cancel_delivery_orders_with_http_info(self, settle, contract, **kwargs): # body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/orders', 'DELETE', + '/delivery/{settle}/orders', + 'DELETE', path_params, query_params, header_params, @@ -2212,7 +2143,8 @@ def cancel_delivery_orders_with_http_info(self, settle, contract, **kwargs): # _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) + collection_formats=collection_formats, + ) def get_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 """Get a single order # noqa: E501 @@ -2233,8 +2165,8 @@ def get_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesOrder - If the method is called asynchronously, + :rtype: gate_api.FuturesOrder + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -2261,42 +2193,35 @@ def get_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.FuturesOrder, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'order_id' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'order_id'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_delivery_order" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_delivery_order" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `get_delivery_order`" + ) # noqa: E501 # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `get_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'order_id' not in local_var_params or local_var_params['order_id'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `order_id` when calling `get_delivery_order`" + ) # noqa: E501 collection_formats = {} @@ -2315,14 +2240,14 @@ def get_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/orders/{order_id}', 'GET', + '/delivery/{settle}/orders/{order_id}', + 'GET', path_params, query_params, header_params, @@ -2335,7 +2260,8 @@ def get_delivery_order_with_http_info(self, settle, order_id, **kwargs): # noqa _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) + collection_formats=collection_formats, + ) def cancel_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 """Cancel a single order # noqa: E501 @@ -2355,8 +2281,8 @@ def cancel_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesOrder - If the method is called asynchronously, + :rtype: gate_api.FuturesOrder + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -2382,42 +2308,35 @@ def cancel_delivery_order_with_http_info(self, settle, order_id, **kwargs): # n number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.FuturesOrder, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'order_id' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'order_id'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method cancel_delivery_order" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method cancel_delivery_order" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `cancel_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `cancel_delivery_order`" + ) # noqa: E501 # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'order_id' not in local_var_params or local_var_params['order_id'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `order_id` when calling `cancel_delivery_order`" + ) # noqa: E501 collection_formats = {} @@ -2436,14 +2355,14 @@ def cancel_delivery_order_with_http_info(self, settle, order_id, **kwargs): # n body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/orders/{order_id}', 'DELETE', + '/delivery/{settle}/orders/{order_id}', + 'DELETE', path_params, query_params, header_params, @@ -2456,7 +2375,8 @@ def cancel_delivery_order_with_http_info(self, settle, order_id, **kwargs): # n _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) + collection_formats=collection_formats, + ) def get_my_delivery_trades(self, settle, **kwargs): # noqa: E501 """List personal trading history # noqa: E501 @@ -2481,8 +2401,8 @@ def get_my_delivery_trades(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[MyFuturesTrade] - If the method is called asynchronously, + :rtype: list[gate_api.MyFuturesTrade] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -2513,50 +2433,47 @@ def get_my_delivery_trades_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[MyFuturesTrade], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.MyFuturesTrade], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'order', - 'limit', - 'offset', - 'last_id', - 'count_total' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'order', 'limit', 'offset', 'last_id', 'count_total'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_my_delivery_trades" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_my_delivery_trades" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_my_delivery_trades`") # 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 `get_my_delivery_trades`, 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 `get_my_delivery_trades`, 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 `get_my_delivery_trades`, must be a value greater than or equal to `0`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `get_my_delivery_trades`" + ) # 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 `get_my_delivery_trades`, 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 `get_my_delivery_trades`, 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 `get_my_delivery_trades`, must be a value greater than or equal to `0`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -2584,14 +2501,14 @@ def get_my_delivery_trades_with_http_info(self, settle, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/my_trades', 'GET', + '/delivery/{settle}/my_trades', + 'GET', path_params, query_params, header_params, @@ -2604,7 +2521,8 @@ def get_my_delivery_trades_with_http_info(self, settle, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_delivery_position_close(self, settle, **kwargs): # noqa: E501 """List position close history # noqa: E501 @@ -2625,8 +2543,8 @@ def list_delivery_position_close(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[PositionClose] - If the method is called asynchronously, + :rtype: list[gate_api.PositionClose] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -2653,44 +2571,43 @@ def list_delivery_position_close_with_http_info(self, settle, **kwargs): # noqa number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[PositionClose], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.PositionClose], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'limit' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'limit'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_delivery_position_close" % key + "Got an unexpected keyword argument '%s'" " to method list_delivery_position_close" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_position_close`") # 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_delivery_position_close`, 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_delivery_position_close`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_delivery_position_close`" + ) # 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_delivery_position_close`, 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_delivery_position_close`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -2710,14 +2627,14 @@ def list_delivery_position_close_with_http_info(self, settle, **kwargs): # noqa body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/position_close', 'GET', + '/delivery/{settle}/position_close', + 'GET', path_params, query_params, header_params, @@ -2730,7 +2647,8 @@ def list_delivery_position_close_with_http_info(self, settle, **kwargs): # noqa _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) + collection_formats=collection_formats, + ) def list_delivery_liquidates(self, settle, **kwargs): # noqa: E501 """List liquidation history # noqa: E501 @@ -2752,8 +2670,8 @@ def list_delivery_liquidates(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesLiquidate] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesLiquidate] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -2781,45 +2699,43 @@ def list_delivery_liquidates_with_http_info(self, settle, **kwargs): # noqa: E5 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesLiquidate], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesLiquidate], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'limit', - 'at' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'limit', 'at'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_delivery_liquidates" % key + "Got an unexpected keyword argument '%s'" " to method list_delivery_liquidates" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_liquidates`") # 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_delivery_liquidates`, 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_delivery_liquidates`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_delivery_liquidates`" + ) # 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_delivery_liquidates`, 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_delivery_liquidates`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -2841,14 +2757,14 @@ def list_delivery_liquidates_with_http_info(self, settle, **kwargs): # noqa: E5 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/liquidates', 'GET', + '/delivery/{settle}/liquidates', + 'GET', path_params, query_params, header_params, @@ -2861,7 +2777,8 @@ def list_delivery_liquidates_with_http_info(self, settle, **kwargs): # noqa: E5 _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) + collection_formats=collection_formats, + ) def list_delivery_settlements(self, settle, **kwargs): # noqa: E501 """List settlement history # noqa: E501 @@ -2883,8 +2800,8 @@ def list_delivery_settlements(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[DeliverySettlement] - If the method is called asynchronously, + :rtype: list[gate_api.DeliverySettlement] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -2912,45 +2829,43 @@ def list_delivery_settlements_with_http_info(self, settle, **kwargs): # noqa: E number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[DeliverySettlement], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.DeliverySettlement], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'limit', - 'at' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'limit', 'at'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_delivery_settlements" % key + "Got an unexpected keyword argument '%s'" " to method list_delivery_settlements" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_delivery_settlements`") # 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_delivery_settlements`, 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_delivery_settlements`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_delivery_settlements`" + ) # 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_delivery_settlements`, 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_delivery_settlements`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -2972,14 +2887,14 @@ def list_delivery_settlements_with_http_info(self, settle, **kwargs): # noqa: E body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/settlements', 'GET', + '/delivery/{settle}/settlements', + 'GET', path_params, query_params, header_params, @@ -2992,7 +2907,8 @@ def list_delivery_settlements_with_http_info(self, settle, **kwargs): # noqa: E _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) + collection_formats=collection_formats, + ) def list_price_triggered_delivery_orders(self, settle, status, **kwargs): # noqa: E501 """List all auto orders # noqa: E501 @@ -3015,8 +2931,8 @@ def list_price_triggered_delivery_orders(self, settle, status, **kwargs): # noq number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesPriceTriggeredOrder] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesPriceTriggeredOrder] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -3045,52 +2961,56 @@ def list_price_triggered_delivery_orders_with_http_info(self, settle, status, ** number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'status', - 'contract', - 'limit', - 'offset' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'status', 'contract', 'limit', 'offset'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_price_triggered_delivery_orders" % key + "Got an unexpected keyword argument '%s'" " to method list_price_triggered_delivery_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_price_triggered_delivery_orders`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_price_triggered_delivery_orders`" + ) # noqa: E501 # verify the required parameter 'status' is set - if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 - local_var_params['status'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `status` when calling `list_price_triggered_delivery_orders`") # 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_price_triggered_delivery_orders`, 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_price_triggered_delivery_orders`, 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_price_triggered_delivery_orders`, must be a value greater than or equal to `0`") # noqa: E501 + 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_price_triggered_delivery_orders`" + ) # 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_price_triggered_delivery_orders`, 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_price_triggered_delivery_orders`, 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_price_triggered_delivery_orders`, must be a value greater than or equal to `0`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -3114,14 +3034,14 @@ def list_price_triggered_delivery_orders_with_http_info(self, settle, status, ** body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/price_orders', 'GET', + '/delivery/{settle}/price_orders', + 'GET', path_params, query_params, header_params, @@ -3134,7 +3054,8 @@ def list_price_triggered_delivery_orders_with_http_info(self, settle, status, ** _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) + collection_formats=collection_formats, + ) def create_price_triggered_delivery_order(self, settle, futures_price_triggered_order, **kwargs): # noqa: E501 """Create a price-triggered order # noqa: E501 @@ -3154,14 +3075,18 @@ def create_price_triggered_delivery_order(self, settle, futures_price_triggered_ number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: TriggerOrderResponse - If the method is called asynchronously, + :rtype: gate_api.TriggerOrderResponse + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.create_price_triggered_delivery_order_with_http_info(settle, futures_price_triggered_order, **kwargs) # noqa: E501 + return self.create_price_triggered_delivery_order_with_http_info( + settle, futures_price_triggered_order, **kwargs + ) # noqa: E501 - def create_price_triggered_delivery_order_with_http_info(self, settle, futures_price_triggered_order, **kwargs): # noqa: E501 + def create_price_triggered_delivery_order_with_http_info( + self, settle, futures_price_triggered_order, **kwargs + ): # noqa: E501 """Create a price-triggered order # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -3181,42 +3106,38 @@ def create_price_triggered_delivery_order_with_http_info(self, settle, futures_p number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(TriggerOrderResponse, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.TriggerOrderResponse, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'futures_price_triggered_order' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'futures_price_triggered_order'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_price_triggered_delivery_order" % key + "Got an unexpected keyword argument '%s'" " to method create_price_triggered_delivery_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `create_price_triggered_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `create_price_triggered_delivery_order`" + ) # noqa: E501 # verify the required parameter 'futures_price_triggered_order' is set - if self.api_client.client_side_validation and ('futures_price_triggered_order' not in local_var_params or # noqa: E501 - local_var_params['futures_price_triggered_order'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `futures_price_triggered_order` when calling `create_price_triggered_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'futures_price_triggered_order' not in local_var_params + or local_var_params['futures_price_triggered_order'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `futures_price_triggered_order` when calling `create_price_triggered_delivery_order`" + ) # noqa: E501 collection_formats = {} @@ -3235,18 +3156,19 @@ def create_price_triggered_delivery_order_with_http_info(self, settle, futures_p if 'futures_price_triggered_order' in local_var_params: body_params = local_var_params['futures_price_triggered_order'] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + ['application/json'] + ) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/delivery/{settle}/price_orders', 'POST', + '/delivery/{settle}/price_orders', + 'POST', path_params, query_params, header_params, @@ -3259,7 +3181,8 @@ def create_price_triggered_delivery_order_with_http_info(self, settle, futures_p _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) + collection_formats=collection_formats, + ) def cancel_price_triggered_delivery_order_list(self, settle, contract, **kwargs): # noqa: E501 """Cancel all open orders # noqa: E501 @@ -3279,8 +3202,8 @@ def cancel_price_triggered_delivery_order_list(self, settle, contract, **kwargs) number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesPriceTriggeredOrder] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesPriceTriggeredOrder] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -3306,25 +3229,15 @@ def cancel_price_triggered_delivery_order_list_with_http_info(self, settle, cont number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: @@ -3335,13 +3248,19 @@ def cancel_price_triggered_delivery_order_list_with_http_info(self, settle, cont local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_delivery_order_list`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `cancel_price_triggered_delivery_order_list`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `cancel_price_triggered_delivery_order_list`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `cancel_price_triggered_delivery_order_list`" + ) # noqa: E501 collection_formats = {} @@ -3360,14 +3279,14 @@ def cancel_price_triggered_delivery_order_list_with_http_info(self, settle, cont body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/price_orders', 'DELETE', + '/delivery/{settle}/price_orders', + 'DELETE', path_params, query_params, header_params, @@ -3380,7 +3299,8 @@ def cancel_price_triggered_delivery_order_list_with_http_info(self, settle, cont _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) + collection_formats=collection_formats, + ) def get_price_triggered_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 """Get a single order # noqa: E501 @@ -3400,8 +3320,8 @@ def get_price_triggered_delivery_order(self, settle, order_id, **kwargs): # noq number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesPriceTriggeredOrder - If the method is called asynchronously, + :rtype: gate_api.FuturesPriceTriggeredOrder + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -3427,42 +3347,37 @@ def get_price_triggered_delivery_order_with_http_info(self, settle, order_id, ** number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'order_id' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'order_id'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_price_triggered_delivery_order" % key + "Got an unexpected keyword argument '%s'" " to method get_price_triggered_delivery_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_price_triggered_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `get_price_triggered_delivery_order`" + ) # noqa: E501 # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `get_price_triggered_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'order_id' not in local_var_params or local_var_params['order_id'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `order_id` when calling `get_price_triggered_delivery_order`" + ) # noqa: E501 collection_formats = {} @@ -3481,14 +3396,14 @@ def get_price_triggered_delivery_order_with_http_info(self, settle, order_id, ** body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/price_orders/{order_id}', 'GET', + '/delivery/{settle}/price_orders/{order_id}', + 'GET', path_params, query_params, header_params, @@ -3501,7 +3416,8 @@ def get_price_triggered_delivery_order_with_http_info(self, settle, order_id, ** _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) + collection_formats=collection_formats, + ) def cancel_price_triggered_delivery_order(self, settle, order_id, **kwargs): # noqa: E501 """Cancel a single order # noqa: E501 @@ -3521,8 +3437,8 @@ def cancel_price_triggered_delivery_order(self, settle, order_id, **kwargs): # number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesPriceTriggeredOrder - If the method is called asynchronously, + :rtype: gate_api.FuturesPriceTriggeredOrder + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -3548,42 +3464,37 @@ def cancel_price_triggered_delivery_order_with_http_info(self, settle, order_id, number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'order_id' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'order_id'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method cancel_price_triggered_delivery_order" % key + "Got an unexpected keyword argument '%s'" " to method cancel_price_triggered_delivery_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `cancel_price_triggered_delivery_order`" + ) # noqa: E501 # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_price_triggered_delivery_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'order_id' not in local_var_params or local_var_params['order_id'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `order_id` when calling `cancel_price_triggered_delivery_order`" + ) # noqa: E501 collection_formats = {} @@ -3602,14 +3513,14 @@ def cancel_price_triggered_delivery_order_with_http_info(self, settle, order_id, body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/delivery/{settle}/price_orders/{order_id}', 'DELETE', + '/delivery/{settle}/price_orders/{order_id}', + 'DELETE', path_params, query_params, header_params, @@ -3622,4 +3533,5 @@ def cancel_price_triggered_delivery_order_with_http_info(self, settle, order_id, _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) + collection_formats=collection_formats, + ) diff --git a/gate_api/api/futures_api.py b/gate_api/api/futures_api.py index 8bf4b20..d3d255c 100644 --- a/gate_api/api/futures_api.py +++ b/gate_api/api/futures_api.py @@ -18,10 +18,7 @@ import six from gate_api.api_client import ApiClient -from gate_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from gate_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 class FuturesApi(object): @@ -53,8 +50,8 @@ def list_futures_contracts(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Contract] - If the method is called asynchronously, + :rtype: list[gate_api.Contract] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -79,37 +76,28 @@ def list_futures_contracts_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Contract], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.Contract], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_futures_contracts" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_futures_contracts" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_contracts`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_futures_contracts`" + ) # noqa: E501 collection_formats = {} @@ -126,14 +114,14 @@ def list_futures_contracts_with_http_info(self, settle, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/contracts', 'GET', + '/futures/{settle}/contracts', + 'GET', path_params, query_params, header_params, @@ -146,7 +134,8 @@ def list_futures_contracts_with_http_info(self, settle, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def get_futures_contract(self, settle, contract, **kwargs): # noqa: E501 """Get a single contract # noqa: E501 @@ -166,8 +155,8 @@ def get_futures_contract(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Contract - If the method is called asynchronously, + :rtype: gate_api.Contract + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -193,42 +182,35 @@ def get_futures_contract_with_http_info(self, settle, contract, **kwargs): # no number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Contract, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Contract, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_futures_contract" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_futures_contract" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_futures_contract`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `get_futures_contract`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `get_futures_contract`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `get_futures_contract`" + ) # noqa: E501 collection_formats = {} @@ -247,14 +229,14 @@ def get_futures_contract_with_http_info(self, settle, contract, **kwargs): # no body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/contracts/{contract}', 'GET', + '/futures/{settle}/contracts/{contract}', + 'GET', path_params, query_params, header_params, @@ -267,7 +249,8 @@ def get_futures_contract_with_http_info(self, settle, contract, **kwargs): # no _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) + collection_formats=collection_formats, + ) def list_futures_order_book(self, settle, contract, **kwargs): # noqa: E501 """Futures order book # noqa: E501 @@ -290,8 +273,8 @@ def list_futures_order_book(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesOrderBook - If the method is called asynchronously, + :rtype: gate_api.FuturesOrderBook + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -320,49 +303,48 @@ def list_futures_order_book_with_http_info(self, settle, contract, **kwargs): # number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesOrderBook, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.FuturesOrderBook, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'interval', - 'limit' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'interval', 'limit'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_futures_order_book" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_futures_order_book" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_order_book`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_futures_order_book`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_order_book`") # noqa: E501 - - if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 20: # noqa: E501 - raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_order_book`, must be a value less than or equal to `20`") # 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_futures_order_book`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `list_futures_order_book`" + ) # noqa: E501 + + if ( + self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 20 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `limit` when calling `list_futures_order_book`, must be a value less than or equal to `20`" + ) # 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_futures_order_book`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -384,14 +366,14 @@ def list_futures_order_book_with_http_info(self, settle, contract, **kwargs): # body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/order_book', 'GET', + '/futures/{settle}/order_book', + 'GET', path_params, query_params, header_params, @@ -404,7 +386,8 @@ def list_futures_order_book_with_http_info(self, settle, contract, **kwargs): # _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) + collection_formats=collection_formats, + ) def list_futures_trades(self, settle, contract, **kwargs): # noqa: E501 """Futures trading history # noqa: E501 @@ -428,8 +411,8 @@ def list_futures_trades(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesTrade] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesTrade] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -459,51 +442,48 @@ def list_futures_trades_with_http_info(self, settle, contract, **kwargs): # noq number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesTrade], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesTrade], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'limit', - 'last_id', - '_from', - 'to' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'limit', 'last_id', '_from', 'to'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_futures_trades" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_futures_trades" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_trades`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_futures_trades`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_trades`") # 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_futures_trades`, 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_futures_trades`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `list_futures_trades`" + ) # 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_futures_trades`, 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_futures_trades`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -529,14 +509,14 @@ def list_futures_trades_with_http_info(self, settle, contract, **kwargs): # noq body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/trades', 'GET', + '/futures/{settle}/trades', + 'GET', path_params, query_params, header_params, @@ -549,7 +529,8 @@ def list_futures_trades_with_http_info(self, settle, contract, **kwargs): # noq _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) + collection_formats=collection_formats, + ) def list_futures_candlesticks(self, settle, contract, **kwargs): # noqa: E501 """Get futures candlesticks # noqa: E501 @@ -574,8 +555,8 @@ def list_futures_candlesticks(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesCandlestick] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesCandlestick] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -606,49 +587,44 @@ def list_futures_candlesticks_with_http_info(self, settle, contract, **kwargs): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesCandlestick], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesCandlestick], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - '_from', - 'to', - 'limit', - 'interval' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', '_from', 'to', 'limit', 'interval'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_futures_candlesticks" % key + "Got an unexpected keyword argument '%s'" " to method list_futures_candlesticks" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_candlesticks`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_futures_candlesticks`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_candlesticks`") # noqa: E501 - - if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 2000: # noqa: E501 - raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_candlesticks`, must be a value less than or equal to `2000`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `list_futures_candlesticks`" + ) # noqa: E501 + + if ( + self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 2000 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `limit` when calling `list_futures_candlesticks`, must be a value less than or equal to `2000`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -674,14 +650,14 @@ def list_futures_candlesticks_with_http_info(self, settle, contract, **kwargs): body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/candlesticks', 'GET', + '/futures/{settle}/candlesticks', + 'GET', path_params, query_params, header_params, @@ -694,7 +670,8 @@ def list_futures_candlesticks_with_http_info(self, settle, contract, **kwargs): _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) + collection_formats=collection_formats, + ) def list_futures_tickers(self, settle, **kwargs): # noqa: E501 """List futures tickers # noqa: E501 @@ -714,8 +691,8 @@ def list_futures_tickers(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesTicker] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesTicker] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -741,38 +718,28 @@ def list_futures_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesTicker], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesTicker], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_futures_tickers" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_futures_tickers" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_tickers`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_futures_tickers`" + ) # noqa: E501 collection_formats = {} @@ -791,14 +758,14 @@ def list_futures_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/tickers', 'GET', + '/futures/{settle}/tickers', + 'GET', path_params, query_params, header_params, @@ -811,7 +778,8 @@ def list_futures_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_futures_funding_rate_history(self, settle, contract, **kwargs): # noqa: E501 """Funding rate history # noqa: E501 @@ -832,8 +800,8 @@ def list_futures_funding_rate_history(self, settle, contract, **kwargs): # noqa number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FundingRateRecord] - If the method is called asynchronously, + :rtype: list[gate_api.FundingRateRecord] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -860,48 +828,50 @@ def list_futures_funding_rate_history_with_http_info(self, settle, contract, **k number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FundingRateRecord], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FundingRateRecord], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'limit' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'limit'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_futures_funding_rate_history" % key + "Got an unexpected keyword argument '%s'" " to method list_futures_funding_rate_history" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_funding_rate_history`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_futures_funding_rate_history`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_funding_rate_history`") # 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_futures_funding_rate_history`, 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_futures_funding_rate_history`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `list_futures_funding_rate_history`" + ) # 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_futures_funding_rate_history`, 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_futures_funding_rate_history`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -921,14 +891,14 @@ def list_futures_funding_rate_history_with_http_info(self, settle, contract, **k body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/funding_rate', 'GET', + '/futures/{settle}/funding_rate', + 'GET', path_params, query_params, header_params, @@ -941,7 +911,8 @@ def list_futures_funding_rate_history_with_http_info(self, settle, contract, **k _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) + collection_formats=collection_formats, + ) def list_futures_insurance_ledger(self, settle, **kwargs): # noqa: E501 """Futures insurance balance history # noqa: E501 @@ -961,8 +932,8 @@ def list_futures_insurance_ledger(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[InsuranceRecord] - If the method is called asynchronously, + :rtype: list[gate_api.InsuranceRecord] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -988,43 +959,43 @@ def list_futures_insurance_ledger_with_http_info(self, settle, **kwargs): # noq number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[InsuranceRecord], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.InsuranceRecord], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'limit' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'limit'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_futures_insurance_ledger" % key + "Got an unexpected keyword argument '%s'" " to method list_futures_insurance_ledger" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_insurance_ledger`") # 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_futures_insurance_ledger`, 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_futures_insurance_ledger`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_futures_insurance_ledger`" + ) # 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_futures_insurance_ledger`, 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_futures_insurance_ledger`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -1042,14 +1013,14 @@ def list_futures_insurance_ledger_with_http_info(self, settle, **kwargs): # noq body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/insurance', 'GET', + '/futures/{settle}/insurance', + 'GET', path_params, query_params, header_params, @@ -1062,7 +1033,8 @@ def list_futures_insurance_ledger_with_http_info(self, settle, **kwargs): # noq _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) + collection_formats=collection_formats, + ) def list_futures_accounts(self, settle, **kwargs): # noqa: E501 """Query futures account # noqa: E501 @@ -1081,8 +1053,8 @@ def list_futures_accounts(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesAccount - If the method is called asynchronously, + :rtype: gate_api.FuturesAccount + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1107,37 +1079,28 @@ def list_futures_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesAccount, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.FuturesAccount, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_futures_accounts" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_futures_accounts" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_accounts`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_futures_accounts`" + ) # noqa: E501 collection_formats = {} @@ -1154,14 +1117,14 @@ def list_futures_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/accounts', 'GET', + '/futures/{settle}/accounts', + 'GET', path_params, query_params, header_params, @@ -1174,7 +1137,8 @@ def list_futures_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_futures_account_book(self, settle, **kwargs): # noqa: E501 """Query account book # noqa: E501 @@ -1197,8 +1161,8 @@ def list_futures_account_book(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesAccountBook] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesAccountBook] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1227,46 +1191,43 @@ def list_futures_account_book_with_http_info(self, settle, **kwargs): # noqa: E number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesAccountBook], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesAccountBook], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'limit', - '_from', - 'to', - 'type' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'limit', '_from', 'to', 'type'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_futures_account_book" % key + "Got an unexpected keyword argument '%s'" " to method list_futures_account_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_account_book`") # 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_futures_account_book`, 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_futures_account_book`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_futures_account_book`" + ) # 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_futures_account_book`, 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_futures_account_book`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -1290,14 +1251,14 @@ def list_futures_account_book_with_http_info(self, settle, **kwargs): # noqa: E body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/account_book', 'GET', + '/futures/{settle}/account_book', + 'GET', path_params, query_params, header_params, @@ -1310,7 +1271,8 @@ def list_futures_account_book_with_http_info(self, settle, **kwargs): # noqa: E _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) + collection_formats=collection_formats, + ) def list_positions(self, settle, **kwargs): # noqa: E501 """List all positions of a user # noqa: E501 @@ -1329,8 +1291,8 @@ def list_positions(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Position] - If the method is called asynchronously, + :rtype: list[gate_api.Position] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1355,36 +1317,25 @@ def list_positions_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Position], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.Position], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_positions" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_positions" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_positions`") # noqa: E501 collection_formats = {} @@ -1402,14 +1353,14 @@ def list_positions_with_http_info(self, settle, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/positions', 'GET', + '/futures/{settle}/positions', + 'GET', path_params, query_params, header_params, @@ -1422,7 +1373,8 @@ def list_positions_with_http_info(self, settle, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def get_position(self, settle, contract, **kwargs): # noqa: E501 """Get single position # noqa: E501 @@ -1442,8 +1394,8 @@ def get_position(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Position - If the method is called asynchronously, + :rtype: gate_api.Position + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1469,41 +1421,30 @@ def get_position_with_http_info(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Position, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_position" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_position" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_position`") # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `get_position`") # noqa: E501 collection_formats = {} @@ -1523,14 +1464,14 @@ def get_position_with_http_info(self, settle, contract, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/positions/{contract}', 'GET', + '/futures/{settle}/positions/{contract}', + 'GET', path_params, query_params, header_params, @@ -1543,7 +1484,8 @@ def get_position_with_http_info(self, settle, contract, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def update_position_margin(self, settle, contract, change, **kwargs): # noqa: E501 """Update position margin # noqa: E501 @@ -1564,8 +1506,8 @@ def update_position_margin(self, settle, contract, change, **kwargs): # noqa: E number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Position - If the method is called asynchronously, + :rtype: gate_api.Position + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1592,47 +1534,42 @@ def update_position_margin_with_http_info(self, settle, contract, change, **kwar number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Position, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'change' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'change'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_position_margin" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method update_position_margin" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `update_position_margin`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `update_position_margin`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `update_position_margin`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `update_position_margin`" + ) # noqa: E501 # verify the required parameter 'change' is set - if self.api_client.client_side_validation and ('change' not in local_var_params or # noqa: E501 - local_var_params['change'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `change` when calling `update_position_margin`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'change' not in local_var_params or local_var_params['change'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `change` when calling `update_position_margin`" + ) # noqa: E501 collection_formats = {} @@ -1653,14 +1590,14 @@ def update_position_margin_with_http_info(self, settle, contract, change, **kwar body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/positions/{contract}/margin', 'POST', + '/futures/{settle}/positions/{contract}/margin', + 'POST', path_params, query_params, header_params, @@ -1673,7 +1610,8 @@ def update_position_margin_with_http_info(self, settle, contract, change, **kwar _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) + collection_formats=collection_formats, + ) def update_position_leverage(self, settle, contract, leverage, **kwargs): # noqa: E501 """Update position leverage # noqa: E501 @@ -1694,8 +1632,8 @@ def update_position_leverage(self, settle, contract, leverage, **kwargs): # noq number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Position - If the method is called asynchronously, + :rtype: gate_api.Position + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1722,47 +1660,44 @@ def update_position_leverage_with_http_info(self, settle, contract, leverage, ** number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Position, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'leverage' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'leverage'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_position_leverage" % key + "Got an unexpected keyword argument '%s'" " to method update_position_leverage" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `update_position_leverage`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `update_position_leverage`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `update_position_leverage`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `update_position_leverage`" + ) # noqa: E501 # verify the required parameter 'leverage' is set - if self.api_client.client_side_validation and ('leverage' not in local_var_params or # noqa: E501 - local_var_params['leverage'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `leverage` when calling `update_position_leverage`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'leverage' not in local_var_params or local_var_params['leverage'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `leverage` when calling `update_position_leverage`" + ) # noqa: E501 collection_formats = {} @@ -1783,14 +1718,14 @@ def update_position_leverage_with_http_info(self, settle, contract, leverage, ** body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/positions/{contract}/leverage', 'POST', + '/futures/{settle}/positions/{contract}/leverage', + 'POST', path_params, query_params, header_params, @@ -1803,7 +1738,8 @@ def update_position_leverage_with_http_info(self, settle, contract, leverage, ** _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) + collection_formats=collection_formats, + ) def update_position_risk_limit(self, settle, contract, risk_limit, **kwargs): # noqa: E501 """Update position risk limit # noqa: E501 @@ -1824,8 +1760,8 @@ def update_position_risk_limit(self, settle, contract, risk_limit, **kwargs): # number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Position - If the method is called asynchronously, + :rtype: gate_api.Position + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1852,47 +1788,44 @@ def update_position_risk_limit_with_http_info(self, settle, contract, risk_limit number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Position, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Position, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'risk_limit' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'risk_limit'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_position_risk_limit" % key + "Got an unexpected keyword argument '%s'" " to method update_position_risk_limit" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `update_position_risk_limit`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `update_position_risk_limit`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `update_position_risk_limit`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `update_position_risk_limit`" + ) # noqa: E501 # verify the required parameter 'risk_limit' is set - if self.api_client.client_side_validation and ('risk_limit' not in local_var_params or # noqa: E501 - local_var_params['risk_limit'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `risk_limit` when calling `update_position_risk_limit`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'risk_limit' not in local_var_params or local_var_params['risk_limit'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `risk_limit` when calling `update_position_risk_limit`" + ) # noqa: E501 collection_formats = {} @@ -1913,14 +1846,14 @@ def update_position_risk_limit_with_http_info(self, settle, contract, risk_limit body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/positions/{contract}/risk_limit', 'POST', + '/futures/{settle}/positions/{contract}/risk_limit', + 'POST', path_params, query_params, header_params, @@ -1933,7 +1866,8 @@ def update_position_risk_limit_with_http_info(self, settle, contract, risk_limit _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) + collection_formats=collection_formats, + ) def list_futures_orders(self, settle, contract, status, **kwargs): # noqa: E501 """List futures orders # noqa: E501 @@ -1959,8 +1893,8 @@ def list_futures_orders(self, settle, contract, status, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesOrder] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesOrder] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1992,58 +1926,61 @@ def list_futures_orders_with_http_info(self, settle, contract, status, **kwargs) number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesOrder], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesOrder], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'status', - 'limit', - 'offset', - 'last_id', - 'count_total' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'status', 'limit', 'offset', 'last_id', 'count_total'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_futures_orders" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_futures_orders" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_orders`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_futures_orders`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_orders`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `list_futures_orders`" + ) # noqa: E501 # verify the required parameter 'status' is set - if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 - local_var_params['status'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `status` when calling `list_futures_orders`") # 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_futures_orders`, 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_futures_orders`, 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_futures_orders`, must be a value greater than or equal to `0`") # noqa: E501 + 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_futures_orders`" + ) # 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_futures_orders`, 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_futures_orders`, 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_futures_orders`, must be a value greater than or equal to `0`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -2071,14 +2008,14 @@ def list_futures_orders_with_http_info(self, settle, contract, status, **kwargs) body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/orders', 'GET', + '/futures/{settle}/orders', + 'GET', path_params, query_params, header_params, @@ -2091,7 +2028,8 @@ def list_futures_orders_with_http_info(self, settle, contract, status, **kwargs) _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) + collection_formats=collection_formats, + ) def create_futures_order(self, settle, futures_order, **kwargs): # noqa: E501 """Create a futures order # noqa: E501 @@ -2112,8 +2050,8 @@ def create_futures_order(self, settle, futures_order, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesOrder - If the method is called asynchronously, + :rtype: gate_api.FuturesOrder + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -2140,42 +2078,35 @@ def create_futures_order_with_http_info(self, settle, futures_order, **kwargs): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.FuturesOrder, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'futures_order' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'futures_order'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_futures_order" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_futures_order" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `create_futures_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `create_futures_order`" + ) # noqa: E501 # verify the required parameter 'futures_order' is set - if self.api_client.client_side_validation and ('futures_order' not in local_var_params or # noqa: E501 - local_var_params['futures_order'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `futures_order` when calling `create_futures_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'futures_order' not in local_var_params or local_var_params['futures_order'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `futures_order` when calling `create_futures_order`" + ) # noqa: E501 collection_formats = {} @@ -2194,18 +2125,19 @@ def create_futures_order_with_http_info(self, settle, futures_order, **kwargs): if 'futures_order' in local_var_params: body_params = local_var_params['futures_order'] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + ['application/json'] + ) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/orders', 'POST', + '/futures/{settle}/orders', + 'POST', path_params, query_params, header_params, @@ -2218,7 +2150,8 @@ def create_futures_order_with_http_info(self, settle, futures_order, **kwargs): _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) + collection_formats=collection_formats, + ) def cancel_futures_orders(self, settle, contract, **kwargs): # noqa: E501 """Cancel all `open` orders matched # noqa: E501 @@ -2240,8 +2173,8 @@ def cancel_futures_orders(self, settle, contract, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesOrder] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesOrder] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -2269,43 +2202,35 @@ def cancel_futures_orders_with_http_info(self, settle, contract, **kwargs): # n number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesOrder], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesOrder], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'side' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'side'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method cancel_futures_orders" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method cancel_futures_orders" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `cancel_futures_orders`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `cancel_futures_orders`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `cancel_futures_orders`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `cancel_futures_orders`" + ) # noqa: E501 collection_formats = {} @@ -2326,14 +2251,14 @@ def cancel_futures_orders_with_http_info(self, settle, contract, **kwargs): # n body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/orders', 'DELETE', + '/futures/{settle}/orders', + 'DELETE', path_params, query_params, header_params, @@ -2346,7 +2271,8 @@ def cancel_futures_orders_with_http_info(self, settle, contract, **kwargs): # n _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) + collection_formats=collection_formats, + ) def get_futures_order(self, settle, order_id, **kwargs): # noqa: E501 """Get a single order # noqa: E501 @@ -2367,8 +2293,8 @@ def get_futures_order(self, settle, order_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesOrder - If the method is called asynchronously, + :rtype: gate_api.FuturesOrder + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -2395,42 +2321,35 @@ def get_futures_order_with_http_info(self, settle, order_id, **kwargs): # noqa: number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.FuturesOrder, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'order_id' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'order_id'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_futures_order" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_futures_order" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_futures_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `get_futures_order`" + ) # noqa: E501 # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `get_futures_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'order_id' not in local_var_params or local_var_params['order_id'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `order_id` when calling `get_futures_order`" + ) # noqa: E501 collection_formats = {} @@ -2449,14 +2368,14 @@ def get_futures_order_with_http_info(self, settle, order_id, **kwargs): # noqa: body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/orders/{order_id}', 'GET', + '/futures/{settle}/orders/{order_id}', + 'GET', path_params, query_params, header_params, @@ -2469,7 +2388,8 @@ def get_futures_order_with_http_info(self, settle, order_id, **kwargs): # noqa: _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) + collection_formats=collection_formats, + ) def cancel_futures_order(self, settle, order_id, **kwargs): # noqa: E501 """Cancel a single order # noqa: E501 @@ -2489,8 +2409,8 @@ def cancel_futures_order(self, settle, order_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesOrder - If the method is called asynchronously, + :rtype: gate_api.FuturesOrder + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -2516,42 +2436,35 @@ def cancel_futures_order_with_http_info(self, settle, order_id, **kwargs): # no number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesOrder, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.FuturesOrder, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'order_id' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'order_id'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method cancel_futures_order" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method cancel_futures_order" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `cancel_futures_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `cancel_futures_order`" + ) # noqa: E501 # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_futures_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'order_id' not in local_var_params or local_var_params['order_id'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `order_id` when calling `cancel_futures_order`" + ) # noqa: E501 collection_formats = {} @@ -2570,14 +2483,14 @@ def cancel_futures_order_with_http_info(self, settle, order_id, **kwargs): # no body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/orders/{order_id}', 'DELETE', + '/futures/{settle}/orders/{order_id}', + 'DELETE', path_params, query_params, header_params, @@ -2590,7 +2503,8 @@ def cancel_futures_order_with_http_info(self, settle, order_id, **kwargs): # no _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) + collection_formats=collection_formats, + ) def get_my_trades(self, settle, **kwargs): # noqa: E501 """List personal trading history # noqa: E501 @@ -2615,8 +2529,8 @@ def get_my_trades(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[MyFuturesTrade] - If the method is called asynchronously, + :rtype: list[gate_api.MyFuturesTrade] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -2647,50 +2561,45 @@ def get_my_trades_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[MyFuturesTrade], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.MyFuturesTrade], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'order', - 'limit', - 'offset', - 'last_id', - 'count_total' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'order', 'limit', 'offset', 'last_id', 'count_total'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_my_trades" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_my_trades" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_my_trades`") # 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 `get_my_trades`, 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 `get_my_trades`, 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 `get_my_trades`, must be a value greater than or equal to `0`") # 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 `get_my_trades`, 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 `get_my_trades`, 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 `get_my_trades`, must be a value greater than or equal to `0`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -2718,14 +2627,14 @@ def get_my_trades_with_http_info(self, settle, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/my_trades', 'GET', + '/futures/{settle}/my_trades', + 'GET', path_params, query_params, header_params, @@ -2738,7 +2647,8 @@ def get_my_trades_with_http_info(self, settle, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_position_close(self, settle, **kwargs): # noqa: E501 """List position close history # noqa: E501 @@ -2759,8 +2669,8 @@ def list_position_close(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[PositionClose] - If the method is called asynchronously, + :rtype: list[gate_api.PositionClose] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -2787,44 +2697,41 @@ def list_position_close_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[PositionClose], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.PositionClose], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'limit' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'limit'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_position_close" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_position_close" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_position_close`") # 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_position_close`, 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_position_close`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_position_close`" + ) # 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_position_close`, 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_position_close`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -2844,14 +2751,14 @@ def list_position_close_with_http_info(self, settle, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/position_close', 'GET', + '/futures/{settle}/position_close', + 'GET', path_params, query_params, header_params, @@ -2864,7 +2771,8 @@ def list_position_close_with_http_info(self, settle, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_liquidates(self, settle, **kwargs): # noqa: E501 """List liquidation history # noqa: E501 @@ -2886,8 +2794,8 @@ def list_liquidates(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesLiquidate] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesLiquidate] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -2915,45 +2823,39 @@ def list_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesLiquidate], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesLiquidate], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract', - 'limit', - 'at' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract', 'limit', 'at'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_liquidates" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_liquidates" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_liquidates`") # 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_liquidates`, 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_liquidates`, must be a value greater than or equal to `1`") # 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_liquidates`, 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_liquidates`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -2975,14 +2877,14 @@ def list_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/liquidates', 'GET', + '/futures/{settle}/liquidates', + 'GET', path_params, query_params, header_params, @@ -2995,7 +2897,8 @@ def list_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_price_triggered_orders(self, settle, status, **kwargs): # noqa: E501 """List all auto orders # noqa: E501 @@ -3018,8 +2921,8 @@ def list_price_triggered_orders(self, settle, status, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesPriceTriggeredOrder] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesPriceTriggeredOrder] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -3048,52 +2951,56 @@ def list_price_triggered_orders_with_http_info(self, settle, status, **kwargs): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'status', - 'contract', - 'limit', - 'offset' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'status', 'contract', 'limit', 'offset'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_price_triggered_orders" % key + "Got an unexpected keyword argument '%s'" " to method list_price_triggered_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `list_price_triggered_orders`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `list_price_triggered_orders`" + ) # noqa: E501 # verify the required parameter 'status' is set - if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 - local_var_params['status'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `status` when calling `list_price_triggered_orders`") # 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_price_triggered_orders`, 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_price_triggered_orders`, 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_price_triggered_orders`, must be a value greater than or equal to `0`") # noqa: E501 + 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_price_triggered_orders`" + ) # 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_price_triggered_orders`, 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_price_triggered_orders`, 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_price_triggered_orders`, must be a value greater than or equal to `0`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -3117,14 +3024,14 @@ def list_price_triggered_orders_with_http_info(self, settle, status, **kwargs): body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/price_orders', 'GET', + '/futures/{settle}/price_orders', + 'GET', path_params, query_params, header_params, @@ -3137,7 +3044,8 @@ def list_price_triggered_orders_with_http_info(self, settle, status, **kwargs): _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) + collection_formats=collection_formats, + ) def create_price_triggered_order(self, settle, futures_price_triggered_order, **kwargs): # noqa: E501 """Create a price-triggered order # noqa: E501 @@ -3157,14 +3065,18 @@ def create_price_triggered_order(self, settle, futures_price_triggered_order, ** number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: TriggerOrderResponse - If the method is called asynchronously, + :rtype: gate_api.TriggerOrderResponse + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.create_price_triggered_order_with_http_info(settle, futures_price_triggered_order, **kwargs) # noqa: E501 + return self.create_price_triggered_order_with_http_info( + settle, futures_price_triggered_order, **kwargs + ) # noqa: E501 - def create_price_triggered_order_with_http_info(self, settle, futures_price_triggered_order, **kwargs): # noqa: E501 + def create_price_triggered_order_with_http_info( + self, settle, futures_price_triggered_order, **kwargs + ): # noqa: E501 """Create a price-triggered order # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -3184,42 +3096,38 @@ def create_price_triggered_order_with_http_info(self, settle, futures_price_trig number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(TriggerOrderResponse, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.TriggerOrderResponse, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'futures_price_triggered_order' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'futures_price_triggered_order'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_price_triggered_order" % key + "Got an unexpected keyword argument '%s'" " to method create_price_triggered_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `create_price_triggered_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `create_price_triggered_order`" + ) # noqa: E501 # verify the required parameter 'futures_price_triggered_order' is set - if self.api_client.client_side_validation and ('futures_price_triggered_order' not in local_var_params or # noqa: E501 - local_var_params['futures_price_triggered_order'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `futures_price_triggered_order` when calling `create_price_triggered_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'futures_price_triggered_order' not in local_var_params + or local_var_params['futures_price_triggered_order'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `futures_price_triggered_order` when calling `create_price_triggered_order`" + ) # noqa: E501 collection_formats = {} @@ -3238,18 +3146,19 @@ def create_price_triggered_order_with_http_info(self, settle, futures_price_trig if 'futures_price_triggered_order' in local_var_params: body_params = local_var_params['futures_price_triggered_order'] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + ['application/json'] + ) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/futures/{settle}/price_orders', 'POST', + '/futures/{settle}/price_orders', + 'POST', path_params, query_params, header_params, @@ -3262,7 +3171,8 @@ def create_price_triggered_order_with_http_info(self, settle, futures_price_trig _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) + collection_formats=collection_formats, + ) def cancel_price_triggered_order_list(self, settle, contract, **kwargs): # noqa: E501 """Cancel all open orders # noqa: E501 @@ -3282,8 +3192,8 @@ def cancel_price_triggered_order_list(self, settle, contract, **kwargs): # noqa number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FuturesPriceTriggeredOrder] - If the method is called asynchronously, + :rtype: list[gate_api.FuturesPriceTriggeredOrder] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -3309,42 +3219,37 @@ def cancel_price_triggered_order_list_with_http_info(self, settle, contract, **k number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'contract' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'contract'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method cancel_price_triggered_order_list" % key + "Got an unexpected keyword argument '%s'" " to method cancel_price_triggered_order_list" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_order_list`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `cancel_price_triggered_order_list`" + ) # noqa: E501 # verify the required parameter 'contract' is set - if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 - local_var_params['contract'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `contract` when calling `cancel_price_triggered_order_list`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `contract` when calling `cancel_price_triggered_order_list`" + ) # noqa: E501 collection_formats = {} @@ -3363,14 +3268,14 @@ def cancel_price_triggered_order_list_with_http_info(self, settle, contract, **k body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/price_orders', 'DELETE', + '/futures/{settle}/price_orders', + 'DELETE', path_params, query_params, header_params, @@ -3383,7 +3288,8 @@ def cancel_price_triggered_order_list_with_http_info(self, settle, contract, **k _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) + collection_formats=collection_formats, + ) def get_price_triggered_order(self, settle, order_id, **kwargs): # noqa: E501 """Get a single order # noqa: E501 @@ -3403,8 +3309,8 @@ def get_price_triggered_order(self, settle, order_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesPriceTriggeredOrder - If the method is called asynchronously, + :rtype: gate_api.FuturesPriceTriggeredOrder + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -3430,42 +3336,37 @@ def get_price_triggered_order_with_http_info(self, settle, order_id, **kwargs): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'order_id' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'order_id'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_price_triggered_order" % key + "Got an unexpected keyword argument '%s'" " to method get_price_triggered_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `get_price_triggered_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `get_price_triggered_order`" + ) # noqa: E501 # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `get_price_triggered_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'order_id' not in local_var_params or local_var_params['order_id'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `order_id` when calling `get_price_triggered_order`" + ) # noqa: E501 collection_formats = {} @@ -3484,14 +3385,14 @@ def get_price_triggered_order_with_http_info(self, settle, order_id, **kwargs): body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/price_orders/{order_id}', 'GET', + '/futures/{settle}/price_orders/{order_id}', + 'GET', path_params, query_params, header_params, @@ -3504,7 +3405,8 @@ def get_price_triggered_order_with_http_info(self, settle, order_id, **kwargs): _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) + collection_formats=collection_formats, + ) def cancel_price_triggered_order(self, settle, order_id, **kwargs): # noqa: E501 """Cancel a single order # noqa: E501 @@ -3524,8 +3426,8 @@ def cancel_price_triggered_order(self, settle, order_id, **kwargs): # noqa: E50 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: FuturesPriceTriggeredOrder - If the method is called asynchronously, + :rtype: gate_api.FuturesPriceTriggeredOrder + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -3551,42 +3453,37 @@ def cancel_price_triggered_order_with_http_info(self, settle, order_id, **kwargs number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'settle', - 'order_id' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['settle', 'order_id'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method cancel_price_triggered_order" % key + "Got an unexpected keyword argument '%s'" " to method cancel_price_triggered_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'settle' is set - if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 - local_var_params['settle'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'settle' not in local_var_params or local_var_params['settle'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `settle` when calling `cancel_price_triggered_order`" + ) # noqa: E501 # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_price_triggered_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'order_id' not in local_var_params or local_var_params['order_id'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `order_id` when calling `cancel_price_triggered_order`" + ) # noqa: E501 collection_formats = {} @@ -3605,14 +3502,14 @@ def cancel_price_triggered_order_with_http_info(self, settle, order_id, **kwargs body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/futures/{settle}/price_orders/{order_id}', 'DELETE', + '/futures/{settle}/price_orders/{order_id}', + 'DELETE', path_params, query_params, header_params, @@ -3625,4 +3522,5 @@ def cancel_price_triggered_order_with_http_info(self, settle, order_id, **kwargs _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) + collection_formats=collection_formats, + ) diff --git a/gate_api/api/margin_api.py b/gate_api/api/margin_api.py index 7a2c26d..b8cb615 100644 --- a/gate_api/api/margin_api.py +++ b/gate_api/api/margin_api.py @@ -18,10 +18,7 @@ import six from gate_api.api_client import ApiClient -from gate_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from gate_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 class MarginApi(object): @@ -52,8 +49,8 @@ def list_margin_currency_pairs(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[MarginCurrencyPair] - If the method is called asynchronously, + :rtype: list[gate_api.MarginCurrencyPair] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -77,29 +74,20 @@ def list_margin_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[MarginCurrencyPair], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.MarginCurrencyPair], 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' - ] - ) + all_params = [] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_margin_currency_pairs" % key + "Got an unexpected keyword argument '%s'" " to method list_margin_currency_pairs" % key ) local_var_params[key] = val del local_var_params['kwargs'] @@ -117,14 +105,14 @@ def list_margin_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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/currency_pairs', 'GET', + '/margin/currency_pairs', + 'GET', path_params, query_params, header_params, @@ -137,7 +125,8 @@ def list_margin_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_funding_book(self, currency, **kwargs): # noqa: E501 """Order book of lending loans # noqa: E501 @@ -156,8 +145,8 @@ def list_funding_book(self, currency, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FundingBookItem] - If the method is called asynchronously, + :rtype: list[gate_api.FundingBookItem] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -182,37 +171,28 @@ def list_funding_book_with_http_info(self, currency, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FundingBookItem], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FundingBookItem], 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' - ] - ) + all_params = ['currency'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_funding_book" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_funding_book" % key) local_var_params[key] = val 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 # noqa: E501 - local_var_params['currency'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency` when calling `list_funding_book`") # noqa: E501 + 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 `list_funding_book`" + ) # noqa: E501 collection_formats = {} @@ -229,14 +209,14 @@ def list_funding_book_with_http_info(self, currency, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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/funding_book', 'GET', + '/margin/funding_book', + 'GET', path_params, query_params, header_params, @@ -249,7 +229,8 @@ def list_funding_book_with_http_info(self, currency, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_margin_accounts(self, **kwargs): # noqa: E501 """Margin account list # noqa: E501 @@ -268,8 +249,8 @@ def list_margin_accounts(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[MarginAccount] - If the method is called asynchronously, + :rtype: list[gate_api.MarginAccount] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -294,31 +275,19 @@ def list_margin_accounts_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[MarginAccount], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.MarginAccount], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'currency_pair' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['currency_pair'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_margin_accounts" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_margin_accounts" % key) local_var_params[key] = val del local_var_params['kwargs'] @@ -337,14 +306,14 @@ def list_margin_accounts_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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/accounts', 'GET', + '/margin/accounts', + 'GET', path_params, query_params, header_params, @@ -357,7 +326,8 @@ def list_margin_accounts_with_http_info(self, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_margin_account_book(self, **kwargs): # noqa: E501 """List margin account balance change history # noqa: E501 @@ -382,8 +352,8 @@ def list_margin_account_book(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[MarginAccountBook] - If the method is called asynchronously, + :rtype: list[gate_api.MarginAccountBook] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -414,45 +384,42 @@ def list_margin_account_book_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[MarginAccountBook], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.MarginAccountBook], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'currency', - 'currency_pair', - '_from', - 'to', - 'page', - 'limit' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['currency', 'currency_pair', '_from', 'to', 'page', 'limit'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_margin_account_book" % key + "Got an unexpected keyword argument '%s'" " to method list_margin_account_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] - if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 - raise ApiValueError("Invalid value for parameter `page` when calling `list_margin_account_book`, must be a value greater than or equal to `1`") # 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_margin_account_book`, 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_margin_account_book`, must be a value greater than or equal to `1`") # noqa: E501 + if ( + self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `page` when calling `list_margin_account_book`, must be a value greater than or equal to `1`" + ) # noqa: E501 + if ( + self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 500 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `limit` when calling `list_margin_account_book`, must be a value less than or equal to `500`" + ) # 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_margin_account_book`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -478,14 +445,14 @@ def list_margin_account_book_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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/account_book', 'GET', + '/margin/account_book', + 'GET', path_params, query_params, header_params, @@ -498,7 +465,8 @@ def list_margin_account_book_with_http_info(self, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_funding_accounts(self, **kwargs): # noqa: E501 """Funding account list # noqa: E501 @@ -517,8 +485,8 @@ def list_funding_accounts(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[FundingAccount] - If the method is called asynchronously, + :rtype: list[gate_api.FundingAccount] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -543,31 +511,19 @@ def list_funding_accounts_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[FundingAccount], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.FundingAccount], 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' - ] - ) + all_params = ['currency'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_funding_accounts" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_funding_accounts" % key) local_var_params[key] = val del local_var_params['kwargs'] @@ -586,14 +542,14 @@ def list_funding_accounts_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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/funding_accounts', 'GET', + '/margin/funding_accounts', + 'GET', path_params, query_params, header_params, @@ -606,7 +562,8 @@ def list_funding_accounts_with_http_info(self, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_loans(self, status, side, **kwargs): # noqa: E501 """List all loans # noqa: E501 @@ -632,8 +589,8 @@ def list_loans(self, status, side, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Loan] - If the method is called asynchronously, + :rtype: list[gate_api.Loan] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -665,55 +622,50 @@ def list_loans_with_http_info(self, status, side, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Loan], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.Loan], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'status', - 'side', - 'currency', - 'currency_pair', - 'sort_by', - 'reverse_sort', - 'page', - 'limit' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['status', 'side', 'currency', 'currency_pair', 'sort_by', 'reverse_sort', 'page', 'limit'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_loans" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_loans" % key) local_var_params[key] = val 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 # noqa: E501 - local_var_params['status'] is None): # noqa: E501 + 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_loans`") # noqa: E501 # verify the required parameter 'side' is set - if self.api_client.client_side_validation and ('side' not in local_var_params or # noqa: E501 - local_var_params['side'] is None): # noqa: E501 + if self.api_client.client_side_validation and ( + 'side' not in local_var_params or local_var_params['side'] is None # noqa: E501 + ): # noqa: E501 raise ApiValueError("Missing the required parameter `side` when calling `list_loans`") # noqa: E501 - if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 - raise ApiValueError("Invalid value for parameter `page` when calling `list_loans`, must be a value greater than or equal to `1`") # 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_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_loans`, must be a value greater than or equal to `1`") # noqa: E501 + if ( + self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `page` when calling `list_loans`, must be a value greater than or equal to `1`" + ) # 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_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_loans`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -743,14 +695,14 @@ def list_loans_with_http_info(self, status, side, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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/loans', 'GET', + '/margin/loans', + 'GET', path_params, query_params, header_params, @@ -763,7 +715,8 @@ def list_loans_with_http_info(self, status, side, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def create_loan(self, loan, **kwargs): # noqa: E501 """Lend or borrow # noqa: E501 @@ -782,8 +735,8 @@ def create_loan(self, loan, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Loan - If the method is called asynchronously, + :rtype: gate_api.Loan + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -808,36 +761,25 @@ def create_loan_with_http_info(self, loan, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Loan, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'loan' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['loan'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_loan" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_loan" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'loan' is set - if self.api_client.client_side_validation and ('loan' not in local_var_params or # noqa: E501 - local_var_params['loan'] is None): # noqa: E501 + if self.api_client.client_side_validation and ( + 'loan' not in local_var_params or local_var_params['loan'] is None # noqa: E501 + ): # noqa: E501 raise ApiValueError("Missing the required parameter `loan` when calling `create_loan`") # noqa: E501 collection_formats = {} @@ -855,18 +797,19 @@ def create_loan_with_http_info(self, loan, **kwargs): # noqa: E501 if 'loan' in local_var_params: body_params = local_var_params['loan'] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + ['application/json'] + ) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/margin/loans', 'POST', + '/margin/loans', + 'POST', path_params, query_params, header_params, @@ -879,7 +822,8 @@ def create_loan_with_http_info(self, loan, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def merge_loans(self, currency, ids, **kwargs): # noqa: E501 """Merge multiple lending loans # noqa: E501 @@ -899,8 +843,8 @@ def merge_loans(self, currency, ids, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Loan - If the method is called asynchronously, + :rtype: gate_api.Loan + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -926,41 +870,30 @@ def merge_loans_with_http_info(self, currency, ids, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Loan, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'currency', - 'ids' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['currency', 'ids'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method merge_loans" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method merge_loans" % key) local_var_params[key] = val 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 # noqa: E501 - local_var_params['currency'] is None): # noqa: E501 + 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 `merge_loans`") # noqa: E501 # verify the required parameter 'ids' is set - if self.api_client.client_side_validation and ('ids' not in local_var_params or # noqa: E501 - local_var_params['ids'] is None): # noqa: E501 + if self.api_client.client_side_validation and ( + 'ids' not in local_var_params or local_var_params['ids'] is None # noqa: E501 + ): # noqa: E501 raise ApiValueError("Missing the required parameter `ids` when calling `merge_loans`") # noqa: E501 collection_formats = {} @@ -980,14 +913,14 @@ def merge_loans_with_http_info(self, currency, ids, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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/merged_loans', 'POST', + '/margin/merged_loans', + 'POST', path_params, query_params, header_params, @@ -1000,7 +933,8 @@ def merge_loans_with_http_info(self, currency, ids, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def get_loan(self, loan_id, side, **kwargs): # noqa: E501 """Retrieve one single loan detail # noqa: E501 @@ -1020,8 +954,8 @@ def get_loan(self, loan_id, side, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Loan - If the method is called asynchronously, + :rtype: gate_api.Loan + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1047,41 +981,30 @@ def get_loan_with_http_info(self, loan_id, side, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Loan, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'loan_id', - 'side' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['loan_id', 'side'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_loan" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_loan" % key) local_var_params[key] = val 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 # noqa: E501 - local_var_params['loan_id'] is None): # noqa: E501 + 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_loan`") # noqa: E501 # verify the required parameter 'side' is set - if self.api_client.client_side_validation and ('side' not in local_var_params or # noqa: E501 - local_var_params['side'] is None): # noqa: E501 + if self.api_client.client_side_validation and ( + 'side' not in local_var_params or local_var_params['side'] is None # noqa: E501 + ): # noqa: E501 raise ApiValueError("Missing the required parameter `side` when calling `get_loan`") # noqa: E501 collection_formats = {} @@ -1101,14 +1024,14 @@ def get_loan_with_http_info(self, loan_id, side, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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/loans/{loan_id}', 'GET', + '/margin/loans/{loan_id}', + 'GET', path_params, query_params, header_params, @@ -1121,7 +1044,8 @@ def get_loan_with_http_info(self, loan_id, side, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def cancel_loan(self, loan_id, currency, **kwargs): # noqa: E501 """Cancel lending loan # noqa: E501 @@ -1142,8 +1066,8 @@ def cancel_loan(self, loan_id, currency, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Loan - If the method is called asynchronously, + :rtype: gate_api.Loan + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1170,41 +1094,30 @@ def cancel_loan_with_http_info(self, loan_id, currency, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Loan, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'loan_id', - 'currency' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['loan_id', 'currency'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method cancel_loan" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method cancel_loan" % key) local_var_params[key] = val 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 # noqa: E501 - local_var_params['loan_id'] is None): # noqa: E501 + 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 `cancel_loan`") # noqa: E501 # verify the required parameter 'currency' is set - if self.api_client.client_side_validation and ('currency' not in local_var_params or # noqa: E501 - local_var_params['currency'] is None): # noqa: E501 + 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 `cancel_loan`") # noqa: E501 collection_formats = {} @@ -1224,14 +1137,14 @@ def cancel_loan_with_http_info(self, loan_id, currency, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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/loans/{loan_id}', 'DELETE', + '/margin/loans/{loan_id}', + 'DELETE', path_params, query_params, header_params, @@ -1244,7 +1157,8 @@ def cancel_loan_with_http_info(self, loan_id, currency, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def update_loan(self, loan_id, loan_patch, **kwargs): # noqa: E501 """Modify a loan # noqa: E501 @@ -1265,8 +1179,8 @@ def update_loan(self, loan_id, loan_patch, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Loan - If the method is called asynchronously, + :rtype: gate_api.Loan + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1293,41 +1207,30 @@ def update_loan_with_http_info(self, loan_id, loan_patch, **kwargs): # noqa: E5 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Loan, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'loan_id', - 'loan_patch' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['loan_id', 'loan_patch'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_loan" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method update_loan" % key) local_var_params[key] = val 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 # noqa: E501 - local_var_params['loan_id'] is None): # noqa: E501 + 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 `update_loan`") # noqa: E501 # verify the required parameter 'loan_patch' is set - if self.api_client.client_side_validation and ('loan_patch' not in local_var_params or # noqa: E501 - local_var_params['loan_patch'] is None): # noqa: E501 + if self.api_client.client_side_validation and ( + 'loan_patch' not in local_var_params or local_var_params['loan_patch'] is None # noqa: E501 + ): # noqa: E501 raise ApiValueError("Missing the required parameter `loan_patch` when calling `update_loan`") # noqa: E501 collection_formats = {} @@ -1347,18 +1250,19 @@ def update_loan_with_http_info(self, loan_id, loan_patch, **kwargs): # noqa: E5 if 'loan_patch' in local_var_params: body_params = local_var_params['loan_patch'] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + ['application/json'] + ) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/margin/loans/{loan_id}', 'PATCH', + '/margin/loans/{loan_id}', + 'PATCH', path_params, query_params, header_params, @@ -1371,7 +1275,8 @@ def update_loan_with_http_info(self, loan_id, loan_patch, **kwargs): # noqa: E5 _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) + collection_formats=collection_formats, + ) def list_loan_repayments(self, loan_id, **kwargs): # noqa: E501 """List loan repayment records # noqa: E501 @@ -1390,8 +1295,8 @@ def list_loan_repayments(self, loan_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Repayment] - If the method is called asynchronously, + :rtype: list[gate_api.Repayment] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1416,37 +1321,28 @@ def list_loan_repayments_with_http_info(self, loan_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Repayment], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.Repayment], 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' - ] - ) + all_params = ['loan_id'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_loan_repayments" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_loan_repayments" % key) local_var_params[key] = val 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 # noqa: E501 - local_var_params['loan_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `loan_id` when calling `list_loan_repayments`") # noqa: E501 + 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 `list_loan_repayments`" + ) # noqa: E501 collection_formats = {} @@ -1463,14 +1359,14 @@ def list_loan_repayments_with_http_info(self, loan_id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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/loans/{loan_id}/repayment', 'GET', + '/margin/loans/{loan_id}/repayment', + 'GET', path_params, query_params, header_params, @@ -1483,7 +1379,8 @@ def list_loan_repayments_with_http_info(self, loan_id, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def repay_loan(self, loan_id, repay_request, **kwargs): # noqa: E501 """Repay a loan # noqa: E501 @@ -1503,8 +1400,8 @@ def repay_loan(self, loan_id, repay_request, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Loan - If the method is called asynchronously, + :rtype: gate_api.Loan + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1530,42 +1427,33 @@ def repay_loan_with_http_info(self, loan_id, repay_request, **kwargs): # noqa: number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Loan, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Loan, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'loan_id', - 'repay_request' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['loan_id', 'repay_request'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method repay_loan" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method repay_loan" % key) local_var_params[key] = val 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 # noqa: E501 - local_var_params['loan_id'] is None): # noqa: E501 + 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 `repay_loan`") # noqa: E501 # verify the required parameter 'repay_request' is set - if self.api_client.client_side_validation and ('repay_request' not in local_var_params or # noqa: E501 - local_var_params['repay_request'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `repay_request` when calling `repay_loan`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'repay_request' not in local_var_params or local_var_params['repay_request'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `repay_request` when calling `repay_loan`" + ) # noqa: E501 collection_formats = {} @@ -1584,18 +1472,19 @@ def repay_loan_with_http_info(self, loan_id, repay_request, **kwargs): # noqa: if 'repay_request' in local_var_params: body_params = local_var_params['repay_request'] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + ['application/json'] + ) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/margin/loans/{loan_id}/repayment', 'POST', + '/margin/loans/{loan_id}/repayment', + 'POST', path_params, query_params, header_params, @@ -1608,7 +1497,8 @@ def repay_loan_with_http_info(self, loan_id, repay_request, **kwargs): # noqa: _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) + collection_formats=collection_formats, + ) def list_loan_records(self, loan_id, **kwargs): # noqa: E501 """List repayment records of specified loan # noqa: E501 @@ -1630,8 +1520,8 @@ def list_loan_records(self, loan_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[LoanRecord] - If the method is called asynchronously, + :rtype: list[gate_api.LoanRecord] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1659,47 +1549,47 @@ def list_loan_records_with_http_info(self, loan_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[LoanRecord], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.LoanRecord], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'loan_id', - 'status', - 'page', - 'limit' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['loan_id', 'status', 'page', 'limit'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_loan_records" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_loan_records" % key) local_var_params[key] = val 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 # noqa: E501 - local_var_params['loan_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `loan_id` when calling `list_loan_records`") # noqa: E501 - - if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 - raise ApiValueError("Invalid value for parameter `page` when calling `list_loan_records`, must be a value greater than or equal to `1`") # 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_loan_records`, 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_loan_records`, must be a value greater than or equal to `1`") # noqa: E501 + 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 `list_loan_records`" + ) # noqa: E501 + + if ( + self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `page` when calling `list_loan_records`, must be a value greater than or equal to `1`" + ) # 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_loan_records`, 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_loan_records`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -1721,14 +1611,14 @@ def list_loan_records_with_http_info(self, loan_id, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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/loan_records', 'GET', + '/margin/loan_records', + 'GET', path_params, query_params, header_params, @@ -1741,7 +1631,8 @@ def list_loan_records_with_http_info(self, loan_id, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def get_loan_record(self, loan_record_id, loan_id, **kwargs): # noqa: E501 """Get one single loan record # noqa: E501 @@ -1761,8 +1652,8 @@ def get_loan_record(self, loan_record_id, loan_id, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: LoanRecord - If the method is called asynchronously, + :rtype: gate_api.LoanRecord + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1788,41 +1679,32 @@ def get_loan_record_with_http_info(self, loan_record_id, loan_id, **kwargs): # number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(LoanRecord, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.LoanRecord, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'loan_record_id', - 'loan_id' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['loan_record_id', 'loan_id'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_loan_record" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_loan_record" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'loan_record_id' is set - if self.api_client.client_side_validation and ('loan_record_id' not in local_var_params or # noqa: E501 - local_var_params['loan_record_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `loan_record_id` when calling `get_loan_record`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'loan_record_id' not in local_var_params or local_var_params['loan_record_id'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `loan_record_id` when calling `get_loan_record`" + ) # noqa: E501 # verify the required parameter 'loan_id' is set - if self.api_client.client_side_validation and ('loan_id' not in local_var_params or # noqa: E501 - local_var_params['loan_id'] is None): # noqa: E501 + 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_loan_record`") # noqa: E501 collection_formats = {} @@ -1842,14 +1724,14 @@ def get_loan_record_with_http_info(self, loan_record_id, loan_id, **kwargs): # body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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/loan_records/{loan_record_id}', 'GET', + '/margin/loan_records/{loan_record_id}', + 'GET', path_params, query_params, header_params, @@ -1862,7 +1744,8 @@ def get_loan_record_with_http_info(self, loan_record_id, loan_id, **kwargs): # _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) + collection_formats=collection_formats, + ) def update_loan_record(self, loan_record_id, loan_patch, **kwargs): # noqa: E501 """Modify a loan record # noqa: E501 @@ -1883,8 +1766,8 @@ def update_loan_record(self, loan_record_id, loan_patch, **kwargs): # noqa: E50 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: LoanRecord - If the method is called asynchronously, + :rtype: gate_api.LoanRecord + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1911,42 +1794,35 @@ def update_loan_record_with_http_info(self, loan_record_id, loan_patch, **kwargs number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(LoanRecord, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.LoanRecord, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'loan_record_id', - 'loan_patch' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['loan_record_id', 'loan_patch'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method update_loan_record" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method update_loan_record" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'loan_record_id' is set - if self.api_client.client_side_validation and ('loan_record_id' not in local_var_params or # noqa: E501 - local_var_params['loan_record_id'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `loan_record_id` when calling `update_loan_record`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'loan_record_id' not in local_var_params or local_var_params['loan_record_id'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `loan_record_id` when calling `update_loan_record`" + ) # noqa: E501 # verify the required parameter 'loan_patch' is set - if self.api_client.client_side_validation and ('loan_patch' not in local_var_params or # noqa: E501 - local_var_params['loan_patch'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `loan_patch` when calling `update_loan_record`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'loan_patch' not in local_var_params or local_var_params['loan_patch'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `loan_patch` when calling `update_loan_record`" + ) # noqa: E501 collection_formats = {} @@ -1965,18 +1841,19 @@ def update_loan_record_with_http_info(self, loan_record_id, loan_patch, **kwargs if 'loan_patch' in local_var_params: body_params = local_var_params['loan_patch'] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + ['application/json'] + ) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/margin/loan_records/{loan_record_id}', 'PATCH', + '/margin/loan_records/{loan_record_id}', + 'PATCH', path_params, query_params, header_params, @@ -1989,4 +1866,5 @@ def update_loan_record_with_http_info(self, loan_record_id, loan_patch, **kwargs _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) + collection_formats=collection_formats, + ) diff --git a/gate_api/api/spot_api.py b/gate_api/api/spot_api.py index 0461d4f..94524af 100644 --- a/gate_api/api/spot_api.py +++ b/gate_api/api/spot_api.py @@ -18,10 +18,7 @@ import six from gate_api.api_client import ApiClient -from gate_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from gate_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 class SpotApi(object): @@ -52,8 +49,8 @@ def list_currency_pairs(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[CurrencyPair] - If the method is called asynchronously, + :rtype: list[gate_api.CurrencyPair] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -77,30 +74,19 @@ def list_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[CurrencyPair], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.CurrencyPair], 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' - ] - ) + all_params = [] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_currency_pairs" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_currency_pairs" % key) local_var_params[key] = val del local_var_params['kwargs'] @@ -117,14 +103,14 @@ def list_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/spot/currency_pairs', 'GET', + '/spot/currency_pairs', + 'GET', path_params, query_params, header_params, @@ -137,7 +123,8 @@ def list_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def get_currency_pair(self, currency_pair, **kwargs): # noqa: E501 """Get detail of one single order # noqa: E501 @@ -156,8 +143,8 @@ def get_currency_pair(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: CurrencyPair - If the method is called asynchronously, + :rtype: gate_api.CurrencyPair + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -182,37 +169,28 @@ def get_currency_pair_with_http_info(self, currency_pair, **kwargs): # noqa: E5 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(CurrencyPair, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.CurrencyPair, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'currency_pair' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['currency_pair'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_currency_pair" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_currency_pair" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set - if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 - local_var_params['currency_pair'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency_pair` when calling `get_currency_pair`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'currency_pair' not in local_var_params or local_var_params['currency_pair'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `currency_pair` when calling `get_currency_pair`" + ) # noqa: E501 collection_formats = {} @@ -229,14 +207,14 @@ def get_currency_pair_with_http_info(self, currency_pair, **kwargs): # noqa: E5 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/spot/currency_pairs/{currency_pair}', 'GET', + '/spot/currency_pairs/{currency_pair}', + 'GET', path_params, query_params, header_params, @@ -249,7 +227,8 @@ def get_currency_pair_with_http_info(self, currency_pair, **kwargs): # noqa: E5 _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) + collection_formats=collection_formats, + ) def list_tickers(self, **kwargs): # noqa: E501 """Retrieve ticker information # noqa: E501 @@ -269,8 +248,8 @@ def list_tickers(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Ticker] - If the method is called asynchronously, + :rtype: list[gate_api.Ticker] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -296,31 +275,19 @@ def list_tickers_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Ticker], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.Ticker], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'currency_pair' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['currency_pair'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_tickers" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_tickers" % key) local_var_params[key] = val del local_var_params['kwargs'] @@ -339,14 +306,14 @@ def list_tickers_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/spot/tickers', 'GET', + '/spot/tickers', + 'GET', path_params, query_params, header_params, @@ -359,7 +326,8 @@ def list_tickers_with_http_info(self, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_order_book(self, currency_pair, **kwargs): # noqa: E501 """Retrieve order book # noqa: E501 @@ -381,8 +349,8 @@ def list_order_book(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: OrderBook - If the method is called asynchronously, + :rtype: gate_api.OrderBook + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -410,44 +378,41 @@ def list_order_book_with_http_info(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(OrderBook, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.OrderBook, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'currency_pair', - 'interval', - 'limit' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['currency_pair', 'interval', 'limit'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_order_book" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_order_book" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set - if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 - local_var_params['currency_pair'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_order_book`") # noqa: E501 - - if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 30: # noqa: E501 - raise ApiValueError("Invalid value for parameter `limit` when calling `list_order_book`, must be a value less than or equal to `30`") # 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_order_book`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'currency_pair' not in local_var_params or local_var_params['currency_pair'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `currency_pair` when calling `list_order_book`" + ) # noqa: E501 + + if ( + self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 30 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `limit` when calling `list_order_book`, must be a value less than or equal to `30`" + ) # 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_order_book`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -467,14 +432,14 @@ def list_order_book_with_http_info(self, currency_pair, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/spot/order_book', 'GET', + '/spot/order_book', + 'GET', path_params, query_params, header_params, @@ -487,7 +452,8 @@ def list_order_book_with_http_info(self, currency_pair, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_trades(self, currency_pair, **kwargs): # noqa: E501 """Retrieve market trades # noqa: E501 @@ -508,8 +474,8 @@ def list_trades(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Trade] - If the method is called asynchronously, + :rtype: list[gate_api.Trade] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -536,44 +502,41 @@ def list_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Trade], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.Trade], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'currency_pair', - 'limit', - 'last_id' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['currency_pair', 'limit', 'last_id'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_trades" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_trades" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set - if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 - local_var_params['currency_pair'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_trades`") # 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_trades`, 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_trades`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'currency_pair' not in local_var_params or local_var_params['currency_pair'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `currency_pair` when calling `list_trades`" + ) # 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_trades`, 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_trades`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -593,14 +556,14 @@ def list_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/spot/trades', 'GET', + '/spot/trades', + 'GET', path_params, query_params, header_params, @@ -613,7 +576,8 @@ def list_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_candlesticks(self, currency_pair, **kwargs): # noqa: E501 """Market candlesticks # noqa: E501 @@ -637,8 +601,8 @@ def list_candlesticks(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[list[str]] - If the method is called asynchronously, + :rtype: list[list[str]] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -668,44 +632,35 @@ def list_candlesticks_with_http_info(self, currency_pair, **kwargs): # noqa: E5 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[list[str]], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[list[str]], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'currency_pair', - 'limit', - '_from', - 'to', - 'interval' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['currency_pair', 'limit', '_from', 'to', 'interval'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_candlesticks" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_candlesticks" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set - if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 - local_var_params['currency_pair'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_candlesticks`") # 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_candlesticks`, must be a value less than or equal to `1000`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'currency_pair' not in local_var_params or local_var_params['currency_pair'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `currency_pair` when calling `list_candlesticks`" + ) # 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_candlesticks`, must be a value less than or equal to `1000`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -729,14 +684,14 @@ def list_candlesticks_with_http_info(self, currency_pair, **kwargs): # noqa: E5 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/spot/candlesticks', 'GET', + '/spot/candlesticks', + 'GET', path_params, query_params, header_params, @@ -749,7 +704,105 @@ def list_candlesticks_with_http_info(self, currency_pair, **kwargs): # noqa: E5 _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) + collection_formats=collection_formats, + ) + + def get_fee(self, **kwargs): # noqa: E501 + """Query user trading fee rates # 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_fee(async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param str currency_pair: Specify a currency pair to retrieve precise fee rate This field is optional. In most cases, the fee rate is identical among all currency pairs + :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.TradeFee + :return: If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.get_fee_with_http_info(**kwargs) # noqa: E501 + + def get_fee_with_http_info(self, **kwargs): # noqa: E501 + """Query user trading fee rates # 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_fee_with_http_info(async_req=True) + >>> result = thread.get() + + :param bool async_req: execute request asynchronously + :param str currency_pair: Specify a currency pair to retrieve precise fee rate This field is optional. In most cases, the fee rate is identical among all currency pairs + :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.TradeFee, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = ['currency_pair'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_fee" % key) + local_var_params[key] = val + del local_var_params['kwargs'] + + collection_formats = {} + + path_params = {} + + 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 + + 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( + '/spot/fee', + 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='TradeFee', # 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_spot_accounts(self, **kwargs): # noqa: E501 """List spot accounts # noqa: E501 @@ -768,8 +821,8 @@ def list_spot_accounts(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[SpotAccount] - If the method is called asynchronously, + :rtype: list[gate_api.SpotAccount] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -794,31 +847,19 @@ def list_spot_accounts_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[SpotAccount], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.SpotAccount], 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' - ] - ) + all_params = ['currency'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_spot_accounts" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_spot_accounts" % key) local_var_params[key] = val del local_var_params['kwargs'] @@ -837,14 +878,14 @@ def list_spot_accounts_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/spot/accounts', 'GET', + '/spot/accounts', + 'GET', path_params, query_params, header_params, @@ -857,7 +898,8 @@ def list_spot_accounts_with_http_info(self, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def create_batch_orders(self, order, **kwargs): # noqa: E501 """Create a batch of orders # noqa: E501 @@ -877,8 +919,8 @@ def create_batch_orders(self, order, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[BatchOrder] - If the method is called asynchronously, + :rtype: list[gate_api.BatchOrder] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -904,37 +946,28 @@ def create_batch_orders_with_http_info(self, order, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[BatchOrder], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.BatchOrder], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'order' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['order'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_batch_orders" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_batch_orders" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'order' is set - if self.api_client.client_side_validation and ('order' not in local_var_params or # noqa: E501 - local_var_params['order'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `order` when calling `create_batch_orders`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'order' not in local_var_params or local_var_params['order'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `order` when calling `create_batch_orders`" + ) # noqa: E501 collection_formats = {} @@ -951,18 +984,19 @@ def create_batch_orders_with_http_info(self, order, **kwargs): # noqa: E501 if 'order' in local_var_params: body_params = local_var_params['order'] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + ['application/json'] + ) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/spot/batch_orders', 'POST', + '/spot/batch_orders', + 'POST', path_params, query_params, header_params, @@ -975,12 +1009,13 @@ def create_batch_orders_with_http_info(self, order, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_all_open_orders(self, **kwargs): # noqa: E501 """List all open orders # noqa: E501 - List all open orders in all currency pairs. Each currency pair has its own pagination # 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 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) @@ -988,7 +1023,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 list + :param int limit: Maximum number of records returned in one page in each currency pair :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -996,8 +1031,8 @@ def list_all_open_orders(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[OpenOrders] - If the method is called asynchronously, + :rtype: list[gate_api.OpenOrders] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1006,7 +1041,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 all open orders in all currency pairs. Each currency pair has its own pagination # 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 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) @@ -1014,7 +1049,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 list + :param int limit: Maximum number of records returned in one page in each currency pair :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1024,41 +1059,40 @@ def list_all_open_orders_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[OpenOrders], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.OpenOrders], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'page', - 'limit' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['page', 'limit'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_all_open_orders" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_all_open_orders" % key) local_var_params[key] = val del local_var_params['kwargs'] - if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 - raise ApiValueError("Invalid value for parameter `page` when calling `list_all_open_orders`, must be a value greater than or equal to `1`") # 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_all_open_orders`, 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_all_open_orders`, must be a value greater than or equal to `1`") # noqa: E501 + if ( + self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `page` when calling `list_all_open_orders`, must be a value greater than or equal to `1`" + ) # noqa: E501 + if ( + self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 100 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `limit` when calling `list_all_open_orders`, must be a value less than or equal to `100`" + ) # 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_all_open_orders`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -1076,14 +1110,14 @@ def list_all_open_orders_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/spot/open_orders', 'GET', + '/spot/open_orders', + 'GET', path_params, query_params, header_params, @@ -1096,7 +1130,8 @@ def list_all_open_orders_with_http_info(self, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_orders(self, currency_pair, status, **kwargs): # noqa: E501 """List orders # noqa: E501 @@ -1110,7 +1145,7 @@ def list_orders(self, currency_pair, status, **kwargs): # noqa: E501 :param str currency_pair: Currency pair (required) :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 in one list + :param int limit: Maximum number of records returned. If `status` is `open`, maximum of `limit` is 100 :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -1118,8 +1153,8 @@ def list_orders(self, currency_pair, status, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Order] - If the method is called asynchronously, + :rtype: list[gate_api.Order] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1137,7 +1172,7 @@ def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: :param str currency_pair: Currency pair (required) :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 in one list + :param int limit: Maximum number of records returned. If `status` is `open`, maximum of `limit` is 100 :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -1147,51 +1182,52 @@ def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Order], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.Order], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'currency_pair', - 'status', - 'page', - 'limit' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['currency_pair', 'status', 'page', 'limit'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_orders" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_orders" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set - if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 - local_var_params['currency_pair'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_orders`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'currency_pair' not in local_var_params or local_var_params['currency_pair'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `currency_pair` when calling `list_orders`" + ) # noqa: E501 # verify the required parameter 'status' is set - if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 - local_var_params['status'] is None): # noqa: E501 + 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_orders`") # noqa: E501 - if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 - raise ApiValueError("Invalid value for parameter `page` when calling `list_orders`, must be a value greater than or equal to `1`") # 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_orders`, 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_orders`, must be a value greater than or equal to `1`") # noqa: E501 + if ( + self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `page` when calling `list_orders`, must be a value greater than or equal to `1`" + ) # 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_orders`, 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_orders`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -1213,14 +1249,14 @@ def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/spot/orders', 'GET', + '/spot/orders', + 'GET', path_params, query_params, header_params, @@ -1233,7 +1269,8 @@ def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: _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) + collection_formats=collection_formats, + ) def create_order(self, order, **kwargs): # noqa: E501 """Create an order # noqa: E501 @@ -1252,8 +1289,8 @@ def create_order(self, order, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Order - If the method is called asynchronously, + :rtype: gate_api.Order + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1278,36 +1315,25 @@ def create_order_with_http_info(self, order, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Order, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Order, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'order' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['order'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_order" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_order" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'order' is set - if self.api_client.client_side_validation and ('order' not in local_var_params or # noqa: E501 - local_var_params['order'] is None): # noqa: E501 + if self.api_client.client_side_validation and ( + 'order' not in local_var_params or local_var_params['order'] is None # noqa: E501 + ): # noqa: E501 raise ApiValueError("Missing the required parameter `order` when calling `create_order`") # noqa: E501 collection_formats = {} @@ -1325,18 +1351,19 @@ def create_order_with_http_info(self, order, **kwargs): # noqa: E501 if 'order' in local_var_params: body_params = local_var_params['order'] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + ['application/json'] + ) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/spot/orders', 'POST', + '/spot/orders', + 'POST', path_params, query_params, header_params, @@ -1349,7 +1376,8 @@ def create_order_with_http_info(self, order, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def cancel_orders(self, currency_pair, **kwargs): # noqa: E501 """Cancel all `open` orders in specified currency pair # noqa: E501 @@ -1370,8 +1398,8 @@ def cancel_orders(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Order] - If the method is called asynchronously, + :rtype: list[gate_api.Order] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1398,39 +1426,28 @@ def cancel_orders_with_http_info(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Order], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.Order], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'currency_pair', - 'side', - 'account' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['currency_pair', 'side', 'account'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method cancel_orders" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method cancel_orders" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set - if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 - local_var_params['currency_pair'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency_pair` when calling `cancel_orders`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'currency_pair' not in local_var_params or local_var_params['currency_pair'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `currency_pair` when calling `cancel_orders`" + ) # noqa: E501 collection_formats = {} @@ -1451,14 +1468,14 @@ def cancel_orders_with_http_info(self, currency_pair, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/spot/orders', 'DELETE', + '/spot/orders', + 'DELETE', path_params, query_params, header_params, @@ -1471,7 +1488,8 @@ def cancel_orders_with_http_info(self, currency_pair, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def cancel_batch_orders(self, cancel_order, **kwargs): # noqa: E501 """Cancel a batch of orders with an ID list # noqa: E501 @@ -1491,8 +1509,8 @@ def cancel_batch_orders(self, cancel_order, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[CancelOrderResult] - If the method is called asynchronously, + :rtype: list[gate_api.CancelOrderResult] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1518,37 +1536,28 @@ def cancel_batch_orders_with_http_info(self, cancel_order, **kwargs): # noqa: E number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[CancelOrderResult], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.CancelOrderResult], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'cancel_order' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['cancel_order'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method cancel_batch_orders" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method cancel_batch_orders" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'cancel_order' is set - if self.api_client.client_side_validation and ('cancel_order' not in local_var_params or # noqa: E501 - local_var_params['cancel_order'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `cancel_order` when calling `cancel_batch_orders`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'cancel_order' not in local_var_params or local_var_params['cancel_order'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `cancel_order` when calling `cancel_batch_orders`" + ) # noqa: E501 collection_formats = {} @@ -1565,18 +1574,19 @@ def cancel_batch_orders_with_http_info(self, cancel_order, **kwargs): # noqa: E if 'cancel_order' in local_var_params: body_params = local_var_params['cancel_order'] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + ['application/json'] + ) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/spot/cancel_batch_orders', 'POST', + '/spot/cancel_batch_orders', + 'POST', path_params, query_params, header_params, @@ -1589,7 +1599,8 @@ def cancel_batch_orders_with_http_info(self, cancel_order, **kwargs): # noqa: E _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) + collection_formats=collection_formats, + ) def get_order(self, order_id, currency_pair, **kwargs): # noqa: E501 """Get a single order # noqa: E501 @@ -1609,8 +1620,8 @@ def get_order(self, order_id, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Order - If the method is called asynchronously, + :rtype: gate_api.Order + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1636,41 +1647,30 @@ def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Order, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Order, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'order_id', - 'currency_pair' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['order_id', 'currency_pair'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_order" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_order" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 + if self.api_client.client_side_validation and ( + 'order_id' not in local_var_params or local_var_params['order_id'] is None # noqa: E501 + ): # noqa: E501 raise ApiValueError("Missing the required parameter `order_id` when calling `get_order`") # noqa: E501 # verify the required parameter 'currency_pair' is set - if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 - local_var_params['currency_pair'] is None): # noqa: E501 + if self.api_client.client_side_validation and ( + 'currency_pair' not in local_var_params or local_var_params['currency_pair'] is None # noqa: E501 + ): # noqa: E501 raise ApiValueError("Missing the required parameter `currency_pair` when calling `get_order`") # noqa: E501 collection_formats = {} @@ -1690,14 +1690,14 @@ def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/spot/orders/{order_id}', 'GET', + '/spot/orders/{order_id}', + 'GET', path_params, query_params, header_params, @@ -1710,7 +1710,8 @@ def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: _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) + collection_formats=collection_formats, + ) def cancel_order(self, order_id, currency_pair, **kwargs): # noqa: E501 """Cancel a single order # noqa: E501 @@ -1730,8 +1731,8 @@ def cancel_order(self, order_id, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Order - If the method is called asynchronously, + :rtype: gate_api.Order + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1757,42 +1758,33 @@ def cancel_order_with_http_info(self, order_id, currency_pair, **kwargs): # noq number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Order, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.Order, status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'order_id', - 'currency_pair' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['order_id', 'currency_pair'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method cancel_order" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method cancel_order" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'order_id' is set - if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 - local_var_params['order_id'] is None): # noqa: E501 + if self.api_client.client_side_validation and ( + 'order_id' not in local_var_params or local_var_params['order_id'] is None # noqa: E501 + ): # noqa: E501 raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_order`") # noqa: E501 # verify the required parameter 'currency_pair' is set - if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 - local_var_params['currency_pair'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency_pair` when calling `cancel_order`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'currency_pair' not in local_var_params or local_var_params['currency_pair'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `currency_pair` when calling `cancel_order`" + ) # noqa: E501 collection_formats = {} @@ -1811,14 +1803,14 @@ def cancel_order_with_http_info(self, order_id, currency_pair, **kwargs): # noq body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/spot/orders/{order_id}', 'DELETE', + '/spot/orders/{order_id}', + 'DELETE', path_params, query_params, header_params, @@ -1831,7 +1823,8 @@ def cancel_order_with_http_info(self, order_id, currency_pair, **kwargs): # noq _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) + collection_formats=collection_formats, + ) def list_my_trades(self, currency_pair, **kwargs): # noqa: E501 """List personal trading history # noqa: E501 @@ -1853,8 +1846,8 @@ def list_my_trades(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Trade] - If the method is called asynchronously, + :rtype: list[gate_api.Trade] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -1882,47 +1875,47 @@ def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Trade], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.Trade], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'currency_pair', - 'limit', - 'page', - 'order_id' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['currency_pair', 'limit', 'page', 'order_id'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_my_trades" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_my_trades" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set - if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 - local_var_params['currency_pair'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_my_trades`") # 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_my_trades`, 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_my_trades`, must be a value greater than or equal to `1`") # noqa: E501 - if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 - raise ApiValueError("Invalid value for parameter `page` when calling `list_my_trades`, must be a value greater than or equal to `1`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'currency_pair' not in local_var_params or local_var_params['currency_pair'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `currency_pair` when calling `list_my_trades`" + ) # 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_my_trades`, 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_my_trades`, must be a value greater than or equal to `1`" + ) # noqa: E501 + if ( + self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1 + ): # noqa: E501 + raise ApiValueError( + "Invalid value for parameter `page` when calling `list_my_trades`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -1944,14 +1937,14 @@ def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/spot/my_trades', 'GET', + '/spot/my_trades', + 'GET', path_params, query_params, header_params, @@ -1964,4 +1957,5 @@ def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) diff --git a/gate_api/api/wallet_api.py b/gate_api/api/wallet_api.py index 6e8626a..3d5a45e 100644 --- a/gate_api/api/wallet_api.py +++ b/gate_api/api/wallet_api.py @@ -18,10 +18,7 @@ import six from gate_api.api_client import ApiClient -from gate_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from gate_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 class WalletApi(object): @@ -53,8 +50,8 @@ def get_deposit_address(self, currency, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: DepositAddress - If the method is called asynchronously, + :rtype: gate_api.DepositAddress + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -79,37 +76,28 @@ def get_deposit_address_with_http_info(self, currency, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(DepositAddress, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(gate_api.DepositAddress, 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' - ] - ) + all_params = ['currency'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_deposit_address" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_deposit_address" % key) local_var_params[key] = val 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 # noqa: E501 - local_var_params['currency'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `currency` when calling `get_deposit_address`") # noqa: E501 + 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_deposit_address`" + ) # noqa: E501 collection_formats = {} @@ -126,14 +114,14 @@ def get_deposit_address_with_http_info(self, currency, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/wallet/deposit_address', 'GET', + '/wallet/deposit_address', + 'GET', path_params, query_params, header_params, @@ -146,7 +134,8 @@ def get_deposit_address_with_http_info(self, currency, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_withdrawals(self, **kwargs): # noqa: E501 """Retrieve withdrawal records # noqa: E501 @@ -170,8 +159,8 @@ def list_withdrawals(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[LedgerRecord] - If the method is called asynchronously, + :rtype: list[gate_api.LedgerRecord] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -201,44 +190,40 @@ def list_withdrawals_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[LedgerRecord], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[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 = [ - 'currency', - '_from', - 'to', - 'limit', - 'offset' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['currency', '_from', 'to', 'limit', 'offset'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_withdrawals" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_withdrawals" % key) local_var_params[key] = val 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_withdrawals`, 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_withdrawals`, 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_withdrawals`, must be a value greater than or equal to `0`") # 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_withdrawals`, 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_withdrawals`, 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_withdrawals`, must be a value greater than or equal to `0`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -262,14 +247,14 @@ def list_withdrawals_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/wallet/withdrawals', 'GET', + '/wallet/withdrawals', + 'GET', path_params, query_params, header_params, @@ -282,7 +267,8 @@ def list_withdrawals_with_http_info(self, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_deposits(self, **kwargs): # noqa: E501 """Retrieve deposit records # noqa: E501 @@ -306,8 +292,8 @@ def list_deposits(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[LedgerRecord] - If the method is called asynchronously, + :rtype: list[gate_api.LedgerRecord] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -337,44 +323,40 @@ def list_deposits_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[LedgerRecord], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[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 = [ - 'currency', - '_from', - 'to', - 'limit', - 'offset' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['currency', '_from', 'to', 'limit', 'offset'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_deposits" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_deposits" % key) local_var_params[key] = val 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_deposits`, 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_deposits`, 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_deposits`, must be a value greater than or equal to `0`") # 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_deposits`, 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_deposits`, 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_deposits`, must be a value greater than or equal to `0`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -398,14 +380,14 @@ def list_deposits_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/wallet/deposits', 'GET', + '/wallet/deposits', + 'GET', path_params, query_params, header_params, @@ -418,7 +400,8 @@ def list_deposits_with_http_info(self, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def transfer(self, transfer, **kwargs): # noqa: E501 """Transfer between trading accounts # noqa: E501 @@ -438,8 +421,8 @@ def transfer(self, transfer, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: None - If the method is called asynchronously, + :rtype: None + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -465,36 +448,25 @@ def transfer_with_http_info(self, transfer, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: None - If the method is called asynchronously, + :rtype: None + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'transfer' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['transfer'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method transfer" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method transfer" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'transfer' is set - if self.api_client.client_side_validation and ('transfer' not in local_var_params or # noqa: E501 - local_var_params['transfer'] is None): # noqa: E501 + if self.api_client.client_side_validation and ( + 'transfer' not in local_var_params or local_var_params['transfer'] is None # noqa: E501 + ): # noqa: E501 raise ApiValueError("Missing the required parameter `transfer` when calling `transfer`") # noqa: E501 collection_formats = {} @@ -513,13 +485,15 @@ def transfer_with_http_info(self, transfer, **kwargs): # noqa: E501 body_params = local_var_params['transfer'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 + ['application/json'] + ) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/wallet/transfers', 'POST', + '/wallet/transfers', + 'POST', path_params, query_params, header_params, @@ -532,7 +506,8 @@ def transfer_with_http_info(self, transfer, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def list_sub_account_transfers(self, **kwargs): # noqa: E501 """Transfer records between main and sub accounts # noqa: E501 @@ -556,8 +531,8 @@ def list_sub_account_transfers(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[SubAccountTransfer] - If the method is called asynchronously, + :rtype: list[gate_api.SubAccountTransfer] + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -587,44 +562,42 @@ def list_sub_account_transfers_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[SubAccountTransfer], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :rtype: tuple(list[gate_api.SubAccountTransfer], status_code(int), headers(HTTPHeaderDict)) + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'sub_uid', - '_from', - 'to', - 'limit', - 'offset' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['sub_uid', '_from', 'to', 'limit', 'offset'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method list_sub_account_transfers" % key + "Got an unexpected keyword argument '%s'" " to method list_sub_account_transfers" % key ) local_var_params[key] = val 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_sub_account_transfers`, 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_sub_account_transfers`, 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_sub_account_transfers`, must be a value greater than or equal to `0`") # 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_sub_account_transfers`, 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_sub_account_transfers`, 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_sub_account_transfers`, must be a value greater than or equal to `0`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -648,14 +621,14 @@ def list_sub_account_transfers_with_http_info(self, **kwargs): # noqa: E501 body_params = None # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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( - '/wallet/sub_account_transfers', 'GET', + '/wallet/sub_account_transfers', + 'GET', path_params, query_params, header_params, @@ -668,7 +641,8 @@ def list_sub_account_transfers_with_http_info(self, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) def transfer_with_sub_account(self, sub_account_transfer, **kwargs): # noqa: E501 """Transfer between main and sub accounts # noqa: E501 @@ -687,8 +661,8 @@ def transfer_with_sub_account(self, sub_account_transfer, **kwargs): # noqa: E5 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: None - If the method is called asynchronously, + :rtype: None + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -713,37 +687,31 @@ def transfer_with_sub_account_with_http_info(self, sub_account_transfer, **kwarg number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: None - If the method is called asynchronously, + :rtype: None + :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [ - 'sub_account_transfer' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['sub_account_transfer'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method transfer_with_sub_account" % key + "Got an unexpected keyword argument '%s'" " to method transfer_with_sub_account" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'sub_account_transfer' is set - if self.api_client.client_side_validation and ('sub_account_transfer' not in local_var_params or # noqa: E501 - local_var_params['sub_account_transfer'] is None): # noqa: E501 - raise ApiValueError("Missing the required parameter `sub_account_transfer` when calling `transfer_with_sub_account`") # noqa: E501 + if self.api_client.client_side_validation and ( + 'sub_account_transfer' not in local_var_params + or local_var_params['sub_account_transfer'] is None # noqa: E501 + ): # noqa: E501 + raise ApiValueError( + "Missing the required parameter `sub_account_transfer` when calling `transfer_with_sub_account`" + ) # noqa: E501 collection_formats = {} @@ -761,13 +729,15 @@ def transfer_with_sub_account_with_http_info(self, sub_account_transfer, **kwarg body_params = local_var_params['sub_account_transfer'] # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 + ['application/json'] + ) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/wallet/sub_account_transfers', 'POST', + '/wallet/sub_account_transfers', + 'POST', path_params, query_params, header_params, @@ -780,4 +750,5 @@ def transfer_with_sub_account_with_http_info(self, sub_account_transfer, **kwarg _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) + collection_formats=collection_formats, + ) diff --git a/gate_api/api/withdrawal_api.py b/gate_api/api/withdrawal_api.py index 84b37ca..00f241b 100644 --- a/gate_api/api/withdrawal_api.py +++ b/gate_api/api/withdrawal_api.py @@ -18,10 +18,7 @@ import six from gate_api.api_client import ApiClient -from gate_api.exceptions import ( # noqa: F401 - ApiTypeError, - ApiValueError -) +from gate_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 class WithdrawalApi(object): @@ -53,8 +50,8 @@ def withdraw(self, ledger_record, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: LedgerRecord - If the method is called asynchronously, + :rtype: gate_api.LedgerRecord + :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True @@ -79,36 +76,25 @@ def withdraw_with_http_info(self, ledger_record, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(LedgerRecord, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, + :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 = [ - 'ledger_record' - ] - all_params.extend( - [ - 'async_req', - '_return_http_data_only', - '_preload_content', - '_request_timeout' - ] - ) + all_params = ['ledger_record'] + all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method withdraw" % key - ) + raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method withdraw" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'ledger_record' is set - if self.api_client.client_side_validation and ('ledger_record' not in local_var_params or # noqa: E501 - local_var_params['ledger_record'] is None): # noqa: E501 + if self.api_client.client_side_validation and ( + 'ledger_record' not in local_var_params or local_var_params['ledger_record'] is None # noqa: E501 + ): # noqa: E501 raise ApiValueError("Missing the required parameter `ledger_record` when calling `withdraw`") # noqa: E501 collection_formats = {} @@ -126,18 +112,19 @@ def withdraw_with_http_info(self, ledger_record, **kwargs): # noqa: E501 if 'ledger_record' in local_var_params: body_params = local_var_params['ledger_record'] # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 + 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 + ['application/json'] + ) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( - '/withdrawals', 'POST', + '/withdrawals', + 'POST', path_params, query_params, header_params, @@ -150,4 +137,5 @@ def withdraw_with_http_info(self, ledger_record, **kwargs): # noqa: E501 _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) + collection_formats=collection_formats, + ) diff --git a/gate_api/api_client.py b/gate_api/api_client.py index c52f7cf..a4d2c06 100644 --- a/gate_api/api_client.py +++ b/gate_api/api_client.py @@ -15,7 +15,7 @@ import hashlib import hmac import time -from urllib.parse import unquote_plus, urlencode, urlparse +from six.moves.urllib.parse import unquote_plus, urlencode, urlparse from dateutil.parser import parse import json @@ -70,8 +70,7 @@ class ApiClient(object): } _pool = None - def __init__(self, configuration=None, header_name=None, header_value=None, - cookie=None, pool_threads=1): + def __init__(self, configuration=None, header_name=None, header_value=None, cookie=None, pool_threads=1): if configuration is None: configuration = Configuration.get_default_copy() self.configuration = configuration @@ -83,7 +82,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None, self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/4.15.1/python' + self.user_agent = 'OpenAPI-Generator/4.15.2/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): @@ -123,11 +122,23 @@ def set_default_header(self, header_name, header_value): self.default_headers[header_name] = header_value def __call_api( - self, resource_path, method, path_params=None, - query_params=None, header_params=None, body=None, post_params=None, - files=None, response_type=None, auth_settings=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None): + self, + resource_path, + method, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, + response_type=None, + auth_settings=None, + _return_http_data_only=None, + collection_formats=None, + _preload_content=True, + _request_timeout=None, + _host=None, + ): config = self.configuration @@ -138,33 +149,26 @@ def __call_api( header_params['Cookie'] = self.cookie if header_params: header_params = self.sanitize_for_serialization(header_params) - header_params = dict(self.parameters_to_tuples(header_params, - collection_formats)) + header_params = dict(self.parameters_to_tuples(header_params, collection_formats)) # path parameters if path_params: path_params = self.sanitize_for_serialization(path_params) - path_params = self.parameters_to_tuples(path_params, - collection_formats) + path_params = self.parameters_to_tuples(path_params, collection_formats) for k, v in path_params: # specified safe chars, encode everything - resource_path = resource_path.replace( - '{%s}' % k, - quote(str(v), safe=config.safe_chars_for_path_param) - ) + resource_path = resource_path.replace('{%s}' % k, quote(str(v), safe=config.safe_chars_for_path_param)) # query parameters if query_params: query_params = self.sanitize_for_serialization(query_params) - query_params = self.parameters_to_tuples(query_params, - collection_formats) + query_params = self.parameters_to_tuples(query_params, collection_formats) # post parameters if post_params or files: post_params = post_params if post_params else [] post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples(post_params, - collection_formats) + post_params = self.parameters_to_tuples(post_params, collection_formats) post_params.extend(self.files_parameters(files)) # body @@ -184,10 +188,15 @@ def __call_api( try: # perform request and return response response_data = self.request( - method, url, query_params=query_params, headers=header_params, - post_params=post_params, body=body, + method, + url, + query_params=query_params, + headers=header_params, + post_params=post_params, + body=body, _preload_content=_preload_content, - _request_timeout=_request_timeout) + _request_timeout=_request_timeout, + ) except ApiException as e: e.body = e.body.decode('utf-8') if six.PY3 else e.body raise e @@ -217,8 +226,7 @@ def __call_api( if _return_http_data_only: return return_data else: - return (return_data, response_data.status, - response_data.getheaders()) + return (return_data, response_data.status, response_data.getheaders()) def sanitize_for_serialization(self, obj): """Builds a JSON POST object. @@ -239,11 +247,9 @@ def sanitize_for_serialization(self, obj): elif isinstance(obj, self.PRIMITIVE_TYPES): return obj elif isinstance(obj, list): - return [self.sanitize_for_serialization(sub_obj) - for sub_obj in obj] + return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj] elif isinstance(obj, tuple): - return tuple(self.sanitize_for_serialization(sub_obj) - for sub_obj in obj) + return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj) elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() @@ -255,12 +261,13 @@ def sanitize_for_serialization(self, obj): # and attributes which value is not None. # Convert attribute name to json key in # model definition for request. - obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) - for attr, _ in six.iteritems(obj.openapi_types) - if getattr(obj, attr) is not None} + obj_dict = { + obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in six.iteritems(obj.openapi_types) + if getattr(obj, attr) is not None + } - return {key: self.sanitize_for_serialization(val) - for key, val in six.iteritems(obj_dict)} + return {key: self.sanitize_for_serialization(val) for key, val in six.iteritems(obj_dict)} def deserialize(self, response, response_type): """Deserializes response into an object. @@ -298,13 +305,11 @@ def __deserialize(self, data, klass): if type(klass) == str: if klass.startswith('list['): sub_kls = re.match(r'list\[(.*)\]', klass).group(1) - return [self.__deserialize(sub_data, sub_kls) - for sub_data in data] + return [self.__deserialize(sub_data, sub_kls) for sub_data in data] if klass.startswith('dict('): sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) - return {k: self.__deserialize(v, sub_kls) - for k, v in six.iteritems(data)} + return {k: self.__deserialize(v, sub_kls) for k, v in six.iteritems(data)} # convert str to class if klass in self.NATIVE_TYPES_MAPPING: @@ -323,12 +328,25 @@ def __deserialize(self, data, klass): else: return self.__deserialize_model(data, klass) - def call_api(self, resource_path, method, - path_params=None, query_params=None, header_params=None, - body=None, post_params=None, files=None, - response_type=None, auth_settings=None, async_req=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None): + def call_api( + self, + resource_path, + method, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, + response_type=None, + auth_settings=None, + async_req=None, + _return_http_data_only=None, + collection_formats=None, + _preload_content=True, + _request_timeout=None, + _host=None, + ): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async_req request, set the async_req parameter. @@ -367,84 +385,122 @@ def call_api(self, resource_path, method, then the method will return the response directly. """ if not async_req: - return self.__call_api(resource_path, method, - path_params, query_params, header_params, - body, post_params, files, - response_type, auth_settings, - _return_http_data_only, collection_formats, - _preload_content, _request_timeout, _host) - - return self.pool.apply_async(self.__call_api, (resource_path, - method, path_params, - query_params, - header_params, body, - post_params, files, - response_type, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host)) - - def request(self, method, url, query_params=None, headers=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): + return self.__call_api( + resource_path, + method, + path_params, + query_params, + header_params, + body, + post_params, + files, + response_type, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host, + ) + + return self.pool.apply_async( + self.__call_api, + ( + resource_path, + method, + path_params, + query_params, + header_params, + body, + post_params, + files, + response_type, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host, + ), + ) + + def request( + self, + method, + url, + query_params=None, + headers=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): """Makes the HTTP request using RESTClient.""" if method == "GET": - return self.rest_client.GET(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) + return self.rest_client.GET( + url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers, + ) elif method == "HEAD": - return self.rest_client.HEAD(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) + return self.rest_client.HEAD( + url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers, + ) elif method == "OPTIONS": - return self.rest_client.OPTIONS(url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout) + return self.rest_client.OPTIONS( + url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + ) elif method == "POST": - return self.rest_client.POST(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.POST( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "PUT": - return self.rest_client.PUT(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.PUT( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "PATCH": - return self.rest_client.PATCH(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.PATCH( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "DELETE": - return self.rest_client.DELETE(url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - else: - raise ApiValueError( - "http method must be `GET`, `HEAD`, `OPTIONS`," - " `POST`, `PATCH`, `PUT` or `DELETE`." + return self.rest_client.DELETE( + url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, ) + else: + raise ApiValueError("http method must be `GET`, `HEAD`, `OPTIONS`," " `POST`, `PATCH`, `PUT` or `DELETE`.") def parameters_to_tuples(self, params, collection_formats): """Get parameters as list of tuples, formatting collections. @@ -470,8 +526,7 @@ def parameters_to_tuples(self, params, collection_formats): delimiter = '|' else: # csv is the default delimiter = ',' - new_params.append( - (k, delimiter.join(str(value) for value in v))) + new_params.append((k, delimiter.join(str(value) for value in v))) else: new_params.append((k, v)) return new_params @@ -493,10 +548,8 @@ def files_parameters(self, files=None): with open(n, 'rb') as f: filename = os.path.basename(f.name) filedata = f.read() - mimetype = (mimetypes.guess_type(filename)[0] or - 'application/octet-stream') - params.append( - tuple([k, tuple([filename, filedata, mimetype])])) + mimetype = mimetypes.guess_type(filename)[0] or 'application/octet-stream' + params.append(tuple([k, tuple([filename, filedata, mimetype])])) return params @@ -559,9 +612,7 @@ def update_params_for_auth(self, method, url, headers, querys, body, auth_settin elif auth_setting['in'] == 'query': querys.append((auth_setting['key'], auth_setting['value'])) else: - raise ApiValueError( - 'Authentication token must be in `query` or `header`' - ) + raise ApiValueError('Authentication token must be in `query` or `header`') def gen_sign(self, method, url, query_string=None, body=None): """generate authentication headers @@ -580,8 +631,7 @@ def gen_sign(self, method, url, query_string=None, body=None): m.update(body.encode('utf-8')) hashed_payload = m.hexdigest() s = '%s\n%s\n%s\n%s\n%s' % (method, url, query_string or "", hashed_payload, t) - sign = hmac.new(self.configuration.secret.encode('utf-8'), s.encode('utf-8'), - hashlib.sha512).hexdigest() + sign = hmac.new(self.configuration.secret.encode('utf-8'), s.encode('utf-8'), hashlib.sha512).hexdigest() return {'KEY': self.configuration.key, 'Timestamp': str(t), 'SIGN': sign} def __deserialize_file(self, response): @@ -599,8 +649,7 @@ def __deserialize_file(self, response): content_disposition = response.getheader("Content-Disposition") if content_disposition: - filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', - content_disposition).group(1) + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition).group(1) path = os.path.join(os.path.dirname(path), filename) with open(path, "wb") as f: @@ -641,10 +690,7 @@ def __deserialize_date(self, string): except ImportError: return string except ValueError: - raise rest.ApiException( - status=0, - reason="Failed to parse `{0}` as date object".format(string) - ) + raise rest.ApiException(status=0, reason="Failed to parse `{0}` as date object".format(string)) def __deserialize_datetime(self, string): """Deserializes string to datetime. @@ -659,13 +705,7 @@ def __deserialize_datetime(self, string): except ImportError: return string except ValueError: - raise rest.ApiException( - status=0, - reason=( - "Failed to parse `{0}` as datetime object" - .format(string) - ) - ) + raise rest.ApiException(status=0, reason=("Failed to parse `{0}` as datetime object".format(string))) def __deserialize_model(self, data, klass): """Deserializes list or dict to model. @@ -675,17 +715,14 @@ def __deserialize_model(self, data, klass): :return: model object. """ has_discriminator = False - if (hasattr(klass, 'get_real_child_model') - and klass.discriminator_value_class_map): + if hasattr(klass, 'get_real_child_model') and klass.discriminator_value_class_map: has_discriminator = True if not klass.openapi_types and has_discriminator is False: return data kwargs = {} - if (data is not None and - klass.openapi_types is not None and - isinstance(data, (list, dict))): + if data is not None and klass.openapi_types is not None and isinstance(data, (list, dict)): for attr, attr_type in six.iteritems(klass.openapi_types): if klass.attribute_map[attr] in data: value = data[klass.attribute_map[attr]] diff --git a/gate_api/configuration.py b/gate_api/configuration.py index a75ae27..7850577 100644 --- a/gate_api/configuration.py +++ b/gate_api/configuration.py @@ -62,11 +62,15 @@ class Configuration(object): _default = None - def __init__(self, host="https://api.gateio.ws/api/v4", - key=None, secret=None, - username=None, password=None, - discard_unknown_keys=False, - ): + def __init__( + self, + host="https://api.gateio.ws/api/v4", + key=None, + secret=None, + username=None, + password=None, + discard_unknown_keys=False, + ): """Constructor """ self.host = host @@ -287,9 +291,7 @@ def get_basic_auth_token(self): password = "" if self.password is not None: password = self.password - return urllib3.util.make_headers( - basic_auth=username + ':' + password - ).get('authorization') + return urllib3.util.make_headers(basic_auth=username + ':' + password).get('authorization') def auth_settings(self): """Gets Auth Settings dict for api client. @@ -310,12 +312,13 @@ def to_debug_report(self): :return: The report for debugging. """ - return "Python SDK Debug Report:\n"\ - "OS: {env}\n"\ - "Python Version: {pyversion}\n"\ - "Version of the API: 4.15.1\n"\ - "SDK Package Version: 4.15.1".\ - format(env=sys.platform, pyversion=sys.version) + return ( + "Python SDK Debug Report:\n" + "OS: {env}\n" + "Python Version: {pyversion}\n" + "Version of the API: 4.15.2\n" + "SDK Package Version: 4.15.2".format(env=sys.platform, pyversion=sys.version) + ) def get_host_settings(self): """Gets an array of host settings @@ -323,14 +326,8 @@ def get_host_settings(self): :return: An array of host settings """ return [ - { - 'url': "https://api.gateio.ws/api/v4", - 'description': "Real Trading", - }, - { - 'url': "https://fx-api-testnet.gateio.ws/api/v4", - 'description': "TestNet Trading", - } + {'url': "https://api.gateio.ws/api/v4", 'description': "Real Trading",}, + {'url': "https://fx-api-testnet.gateio.ws/api/v4", 'description': "TestNet Trading",}, ] def get_host_from_settings(self, index, variables=None): @@ -347,22 +344,20 @@ def get_host_from_settings(self, index, variables=None): except IndexError: raise ValueError( "Invalid index {0} when selecting the host settings. " - "Must be less than {1}".format(index, len(servers))) + "Must be less than {1}".format(index, len(servers)) + ) url = server['url'] # go through variables and replace placeholders for variable_name, variable in server['variables'].items(): - used_value = variables.get( - variable_name, variable['default_value']) + used_value = variables.get(variable_name, variable['default_value']) - if 'enum_values' in variable \ - and used_value not in variable['enum_values']: + if 'enum_values' in variable and used_value not in variable['enum_values']: raise ValueError( "The variable `{0}` in the host URL has invalid value " - "{1}. Must be {2}.".format( - variable_name, variables[variable_name], - variable['enum_values'])) + "{1}. Must be {2}.".format(variable_name, variables[variable_name], variable['enum_values']) + ) url = url.replace("{" + variable_name + "}", used_value) diff --git a/gate_api/exceptions.py b/gate_api/exceptions.py index 2754470..697fc65 100644 --- a/gate_api/exceptions.py +++ b/gate_api/exceptions.py @@ -18,8 +18,7 @@ class OpenApiException(Exception): class ApiTypeError(OpenApiException, TypeError): - def __init__(self, msg, path_to_item=None, valid_classes=None, - key_type=None): + def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None): """ Raises an exception for TypeErrors Args: @@ -82,7 +81,6 @@ def __init__(self, msg, path_to_item=None): class ApiException(OpenApiException): - def __init__(self, status=None, reason=None, http_resp=None): if http_resp: self.status = http_resp.status @@ -97,11 +95,9 @@ def __init__(self, status=None, reason=None, http_resp=None): def __str__(self): """Custom error messages for exception""" - error_message = "({0})\n"\ - "Reason: {1}\n".format(self.status, self.reason) + error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason) if self.headers: - error_message += "HTTP response headers: {0}\n".format( - self.headers) + error_message += "HTTP response headers: {0}\n".format(self.headers) if self.body: error_message += "HTTP response body: {0}\n".format(self.body) diff --git a/gate_api/models/__init__.py b/gate_api/models/__init__.py index e98e608..ac954ad 100644 --- a/gate_api/models/__init__.py +++ b/gate_api/models/__init__.py @@ -59,5 +59,6 @@ from gate_api.models.sub_account_transfer import SubAccountTransfer from gate_api.models.ticker import Ticker from gate_api.models.trade import Trade +from gate_api.models.trade_fee import TradeFee from gate_api.models.transfer import Transfer from gate_api.models.trigger_order_response import TriggerOrderResponse diff --git a/gate_api/models/batch_order.py b/gate_api/models/batch_order.py index 6d4932d..d819e43 100644 --- a/gate_api/models/batch_order.py +++ b/gate_api/models/batch_order.py @@ -58,7 +58,7 @@ class BatchOrder(object): 'gt_fee': 'str', 'gt_discount': 'bool', 'rebated_fee': 'str', - 'rebated_fee_currency': 'str' + 'rebated_fee_currency': 'str', } attribute_map = { @@ -87,10 +87,40 @@ class BatchOrder(object): 'gt_fee': 'gt_fee', 'gt_discount': 'gt_discount', 'rebated_fee': 'rebated_fee', - 'rebated_fee_currency': 'rebated_fee_currency' + 'rebated_fee_currency': 'rebated_fee_currency', } - def __init__(self, text=None, succeeded=None, label=None, message=None, id=None, create_time=None, update_time=None, status=None, currency_pair=None, type='limit', account='spot', side=None, amount=None, price=None, time_in_force='gtc', auto_borrow=None, left=None, fill_price=None, filled_total=None, fee=None, fee_currency=None, point_fee=None, gt_fee=None, gt_discount=None, rebated_fee=None, rebated_fee_currency=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + text=None, + succeeded=None, + label=None, + message=None, + id=None, + create_time=None, + update_time=None, + status=None, + currency_pair=None, + type='limit', + account='spot', + side=None, + amount=None, + price=None, + time_in_force='gtc', + auto_borrow=None, + left=None, + fill_price=None, + filled_total=None, + fee=None, + fee_currency=None, + point_fee=None, + gt_fee=None, + gt_discount=None, + rebated_fee=None, + 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, 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() @@ -361,8 +391,7 @@ def status(self, status): allowed_values = ["open", "closed", "cancelled"] # 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}" # noqa: E501 - .format(status, allowed_values) + "Invalid value for `status` ({0}), must be one of {1}".format(status, allowed_values) # noqa: E501 ) self._status = status @@ -413,8 +442,7 @@ def type(self, type): allowed_values = ["limit"] # noqa: E501 if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 - .format(type, allowed_values) + "Invalid value for `type` ({0}), must be one of {1}".format(type, allowed_values) # noqa: E501 ) self._type = type @@ -442,8 +470,7 @@ def account(self, account): allowed_values = ["spot", "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}" # noqa: E501 - .format(account, allowed_values) + "Invalid value for `account` ({0}), must be one of {1}".format(account, allowed_values) # noqa: E501 ) self._account = account @@ -471,8 +498,7 @@ def side(self, side): allowed_values = ["buy", "sell"] # noqa: E501 if self.local_vars_configuration.client_side_validation and side not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `side` ({0}), must be one of {1}" # noqa: E501 - .format(side, allowed_values) + "Invalid value for `side` ({0}), must be one of {1}".format(side, allowed_values) # noqa: E501 ) self._side = side @@ -546,8 +572,9 @@ def time_in_force(self, time_in_force): allowed_values = ["gtc", "ioc", "poc"] # noqa: E501 if self.local_vars_configuration.client_side_validation and time_in_force not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `time_in_force` ({0}), must be one of {1}" # noqa: E501 - .format(time_in_force, allowed_values) + "Invalid value for `time_in_force` ({0}), must be one of {1}".format( # noqa: E501 + time_in_force, allowed_values + ) ) self._time_in_force = time_in_force @@ -812,18 +839,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/cancel_order.py b/gate_api/models/cancel_order.py index 6fc0aad..d367b76 100644 --- a/gate_api/models/cancel_order.py +++ b/gate_api/models/cancel_order.py @@ -32,17 +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'} - attribute_map = { - 'currency_pair': 'currency_pair', - 'id': 'id' - } + attribute_map = {'currency_pair': 'currency_pair', 'id': 'id'} def __init__(self, currency_pair=None, id=None, local_vars_configuration=None): # noqa: E501 + # type: (str, str, Configuration) -> None """CancelOrder - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -112,18 +107,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/cancel_order_result.py b/gate_api/models/cancel_order_result.py index f056805..c6e715a 100644 --- a/gate_api/models/cancel_order_result.py +++ b/gate_api/models/cancel_order_result.py @@ -32,23 +32,20 @@ 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'} attribute_map = { 'currency_pair': 'currency_pair', 'id': 'id', 'succeeded': 'succeeded', 'label': 'label', - 'message': 'message' + 'message': 'message', } - def __init__(self, currency_pair=None, id=None, succeeded=None, label=None, message=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, currency_pair=None, id=None, succeeded=None, label=None, message=None, local_vars_configuration=None + ): # noqa: E501 + # type: (str, str, bool, str, str, Configuration) -> None """CancelOrderResult - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -194,18 +191,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/contract.py b/gate_api/models/contract.py index e797d7c..fdbf5e0 100644 --- a/gate_api/models/contract.py +++ b/gate_api/models/contract.py @@ -63,7 +63,7 @@ class Contract(object): 'trade_size': 'int', 'position_size': 'int', 'config_change_time': 'float', - 'in_delisting': 'bool' + 'in_delisting': 'bool', } attribute_map = { @@ -97,10 +97,45 @@ class Contract(object): 'trade_size': 'trade_size', 'position_size': 'position_size', 'config_change_time': 'config_change_time', - 'in_delisting': 'in_delisting' + 'in_delisting': 'in_delisting', } - def __init__(self, name=None, type=None, quanto_multiplier=None, leverage_min=None, leverage_max=None, maintenance_rate=None, mark_type=None, mark_price=None, index_price=None, last_price=None, maker_fee_rate=None, taker_fee_rate=None, order_price_round=None, mark_price_round=None, funding_rate=None, funding_interval=None, funding_next_apply=None, risk_limit_base=None, risk_limit_step=None, risk_limit_max=None, order_size_min=None, order_size_max=None, order_price_deviate=None, ref_discount_rate=None, ref_rebate_rate=None, orderbook_id=None, trade_id=None, trade_size=None, position_size=None, config_change_time=None, in_delisting=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + name=None, + type=None, + quanto_multiplier=None, + leverage_min=None, + leverage_max=None, + maintenance_rate=None, + mark_type=None, + mark_price=None, + index_price=None, + last_price=None, + maker_fee_rate=None, + taker_fee_rate=None, + order_price_round=None, + mark_price_round=None, + funding_rate=None, + funding_interval=None, + funding_next_apply=None, + risk_limit_base=None, + risk_limit_step=None, + risk_limit_max=None, + order_size_min=None, + order_size_max=None, + order_price_deviate=None, + ref_discount_rate=None, + ref_rebate_rate=None, + orderbook_id=None, + trade_id=None, + trade_size=None, + position_size=None, + config_change_time=None, + in_delisting=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, str, str, str, str, str, str, str, str, str, str, str, str, str, str, int, float, str, str, str, int, int, str, str, str, int, int, int, int, float, bool, Configuration) -> None """Contract - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -248,8 +283,7 @@ def type(self, type): allowed_values = ["inverse", "direct"] # noqa: E501 if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 - .format(type, allowed_values) + "Invalid value for `type` ({0}), must be one of {1}".format(type, allowed_values) # noqa: E501 ) self._type = type @@ -369,8 +403,9 @@ def mark_type(self, mark_type): allowed_values = ["internal", "index"] # noqa: E501 if self.local_vars_configuration.client_side_validation and mark_type not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `mark_type` ({0}), must be one of {1}" # noqa: E501 - .format(mark_type, allowed_values) + "Invalid value for `mark_type` ({0}), must be one of {1}".format( # noqa: E501 + mark_type, allowed_values + ) ) self._mark_type = mark_type @@ -934,18 +969,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/currency_pair.py b/gate_api/models/currency_pair.py index bed0dd1..9e1936a 100644 --- a/gate_api/models/currency_pair.py +++ b/gate_api/models/currency_pair.py @@ -41,7 +41,7 @@ class CurrencyPair(object): 'min_quote_amount': 'str', 'amount_precision': 'int', 'precision': 'int', - 'trade_status': 'str' + 'trade_status': 'str', } attribute_map = { @@ -53,10 +53,23 @@ class CurrencyPair(object): 'min_quote_amount': 'min_quote_amount', 'amount_precision': 'amount_precision', 'precision': 'precision', - 'trade_status': 'trade_status' + 'trade_status': 'trade_status', } - def __init__(self, id=None, base=None, quote=None, fee=None, min_base_amount=None, min_quote_amount=None, amount_precision=None, precision=None, trade_status=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + base=None, + quote=None, + fee=None, + min_base_amount=None, + min_quote_amount=None, + amount_precision=None, + precision=None, + trade_status=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, str, str, str, str, str, int, int, str, Configuration) -> None """CurrencyPair - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -299,8 +312,9 @@ def trade_status(self, trade_status): allowed_values = ["untradable", "buyable", "sellable", "tradable"] # noqa: E501 if self.local_vars_configuration.client_side_validation and trade_status not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `trade_status` ({0}), must be one of {1}" # noqa: E501 - .format(trade_status, allowed_values) + "Invalid value for `trade_status` ({0}), must be one of {1}".format( # noqa: E501 + trade_status, allowed_values + ) ) self._trade_status = trade_status @@ -312,18 +326,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/delivery_contract.py b/gate_api/models/delivery_contract.py index 96c51fd..5ec221d 100644 --- a/gate_api/models/delivery_contract.py +++ b/gate_api/models/delivery_contract.py @@ -34,7 +34,7 @@ class DeliveryContract(object): """ openapi_types = { 'name': 'str', - 'underling': 'str', + 'underlying': 'str', 'cycle': 'str', 'type': 'str', 'quanto_multiplier': 'str', @@ -69,12 +69,12 @@ class DeliveryContract(object): 'trade_size': 'int', 'position_size': 'int', 'config_change_time': 'float', - 'in_delisting': 'bool' + 'in_delisting': 'bool', } attribute_map = { 'name': 'name', - 'underling': 'underling', + 'underlying': 'underlying', 'cycle': 'cycle', 'type': 'type', 'quanto_multiplier': 'quanto_multiplier', @@ -109,17 +109,58 @@ class DeliveryContract(object): 'trade_size': 'trade_size', 'position_size': 'position_size', 'config_change_time': 'config_change_time', - 'in_delisting': 'in_delisting' + 'in_delisting': 'in_delisting', } - def __init__(self, name=None, underling=None, cycle=None, type=None, quanto_multiplier=None, leverage_min=None, leverage_max=None, maintenance_rate=None, mark_type=None, mark_price=None, index_price=None, last_price=None, maker_fee_rate=None, taker_fee_rate=None, order_price_round=None, mark_price_round=None, basis_rate=None, basis_value=None, basis_impact_value=None, settle_price=None, settle_price_interval=None, settle_price_duration=None, expire_time=None, risk_limit_base=None, risk_limit_step=None, risk_limit_max=None, order_size_min=None, order_size_max=None, order_price_deviate=None, ref_discount_rate=None, ref_rebate_rate=None, orderbook_id=None, trade_id=None, trade_size=None, position_size=None, config_change_time=None, in_delisting=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + name=None, + underlying=None, + cycle=None, + type=None, + quanto_multiplier=None, + leverage_min=None, + leverage_max=None, + maintenance_rate=None, + mark_type=None, + mark_price=None, + index_price=None, + last_price=None, + maker_fee_rate=None, + taker_fee_rate=None, + order_price_round=None, + mark_price_round=None, + basis_rate=None, + basis_value=None, + basis_impact_value=None, + settle_price=None, + settle_price_interval=None, + settle_price_duration=None, + expire_time=None, + risk_limit_base=None, + risk_limit_step=None, + risk_limit_max=None, + order_size_min=None, + order_size_max=None, + order_price_deviate=None, + ref_discount_rate=None, + ref_rebate_rate=None, + orderbook_id=None, + trade_id=None, + trade_size=None, + position_size=None, + config_change_time=None, + in_delisting=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, str, str, str, str, str, str, str, str, str, str, str, str, str, str, str, str, str, str, str, int, int, int, str, str, str, int, int, str, str, str, int, int, int, int, float, bool, Configuration) -> None """DeliveryContract - 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._underling = None + self._underlying = None self._cycle = None self._type = None self._quanto_multiplier = None @@ -159,8 +200,8 @@ def __init__(self, name=None, underling=None, cycle=None, type=None, quanto_mult if name is not None: self.name = name - if underling is not None: - self.underling = underling + if underlying is not None: + self.underlying = underlying if cycle is not None: self.cycle = cycle if type is not None: @@ -256,27 +297,27 @@ def name(self, name): self._name = name @property - def underling(self): - """Gets the underling of this DeliveryContract. # noqa: E501 + def underlying(self): + """Gets the underlying of this DeliveryContract. # noqa: E501 Underlying # noqa: E501 - :return: The underling of this DeliveryContract. # noqa: E501 + :return: The underlying of this DeliveryContract. # noqa: E501 :rtype: str """ - return self._underling + return self._underlying - @underling.setter - def underling(self, underling): - """Sets the underling of this DeliveryContract. + @underlying.setter + def underlying(self, underlying): + """Sets the underlying of this DeliveryContract. Underlying # noqa: E501 - :param underling: The underling of this DeliveryContract. # noqa: E501 + :param underlying: The underlying of this DeliveryContract. # noqa: E501 :type: str """ - self._underling = underling + self._underlying = underlying @property def cycle(self): @@ -301,8 +342,7 @@ def cycle(self, cycle): allowed_values = ["WEEKLY", "BI-WEEKLY", "QUARTERLY", "BI-QUARTERLY"] # noqa: E501 if self.local_vars_configuration.client_side_validation and cycle not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `cycle` ({0}), must be one of {1}" # noqa: E501 - .format(cycle, allowed_values) + "Invalid value for `cycle` ({0}), must be one of {1}".format(cycle, allowed_values) # noqa: E501 ) self._cycle = cycle @@ -330,8 +370,7 @@ def type(self, type): allowed_values = ["inverse", "direct"] # noqa: E501 if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 - .format(type, allowed_values) + "Invalid value for `type` ({0}), must be one of {1}".format(type, allowed_values) # noqa: E501 ) self._type = type @@ -451,8 +490,9 @@ def mark_type(self, mark_type): allowed_values = ["internal", "index"] # noqa: E501 if self.local_vars_configuration.client_side_validation and mark_type not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `mark_type` ({0}), must be one of {1}" # noqa: E501 - .format(mark_type, allowed_values) + "Invalid value for `mark_type` ({0}), must be one of {1}".format( # noqa: E501 + mark_type, allowed_values + ) ) self._mark_type = mark_type @@ -1108,18 +1148,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/delivery_settlement.py b/gate_api/models/delivery_settlement.py index 9acbbc6..a273442 100644 --- a/gate_api/models/delivery_settlement.py +++ b/gate_api/models/delivery_settlement.py @@ -41,7 +41,7 @@ class DeliverySettlement(object): 'entry_price': 'str', 'settle_price': 'str', 'profit': 'str', - 'fee': 'str' + 'fee': 'str', } attribute_map = { @@ -53,10 +53,23 @@ class DeliverySettlement(object): 'entry_price': 'entry_price', 'settle_price': 'settle_price', 'profit': 'profit', - 'fee': 'fee' + 'fee': 'fee', } - def __init__(self, time=None, contract=None, leverage=None, size=None, margin=None, entry_price=None, settle_price=None, profit=None, fee=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + time=None, + contract=None, + leverage=None, + size=None, + margin=None, + entry_price=None, + settle_price=None, + profit=None, + fee=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (int, str, str, int, str, str, str, str, str, Configuration) -> None """DeliverySettlement - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -306,18 +319,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/deposit_address.py b/gate_api/models/deposit_address.py index 284e559..9910068 100644 --- a/gate_api/models/deposit_address.py +++ b/gate_api/models/deposit_address.py @@ -32,17 +32,12 @@ class DepositAddress(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'currency': 'str', - 'address': 'str' - } + openapi_types = {'currency': 'str', 'address': 'str'} - attribute_map = { - 'currency': 'currency', - 'address': 'address' - } + attribute_map = {'currency': 'currency', 'address': 'address'} def __init__(self, currency=None, address=None, local_vars_configuration=None): # noqa: E501 + # type: (str, str, Configuration) -> None """DepositAddress - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -112,18 +107,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/funding_account.py b/gate_api/models/funding_account.py index 47acf07..9096ee9 100644 --- a/gate_api/models/funding_account.py +++ b/gate_api/models/funding_account.py @@ -32,23 +32,20 @@ class FundingAccount(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', - 'lent': 'str', - 'total_lent': 'str' - } + openapi_types = {'currency': 'str', 'available': 'str', 'locked': 'str', 'lent': 'str', 'total_lent': 'str'} attribute_map = { 'currency': 'currency', 'available': 'available', 'locked': 'locked', 'lent': 'lent', - 'total_lent': 'total_lent' + 'total_lent': 'total_lent', } - def __init__(self, currency=None, available=None, locked=None, lent=None, total_lent=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, currency=None, available=None, locked=None, lent=None, total_lent=None, local_vars_configuration=None + ): # noqa: E501 + # type: (str, str, str, str, str, Configuration) -> None """FundingAccount - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -194,18 +191,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/funding_book_item.py b/gate_api/models/funding_book_item.py index 58fd885..0733f4c 100644 --- a/gate_api/models/funding_book_item.py +++ b/gate_api/models/funding_book_item.py @@ -32,19 +32,12 @@ class FundingBookItem(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'rate': 'str', - 'amount': 'str', - 'days': 'int' - } - - attribute_map = { - 'rate': 'rate', - 'amount': 'amount', - 'days': 'days' - } + openapi_types = {'rate': 'str', 'amount': 'str', 'days': 'int'} + + attribute_map = {'rate': 'rate', 'amount': 'amount', 'days': 'days'} def __init__(self, rate=None, amount=None, days=None, local_vars_configuration=None): # noqa: E501 + # type: (str, str, int, Configuration) -> None """FundingBookItem - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -138,18 +131,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/funding_rate_history.py b/gate_api/models/funding_rate_history.py deleted file mode 100644 index fc06829..0000000 --- a/gate_api/models/funding_rate_history.py +++ /dev/null @@ -1,85 +0,0 @@ -# coding: utf-8 - -""" - Gate API v4 - - APIv4 合约接口提供了与合约交易相关的操作,包括公共接口查询合约市场行情,以及需要认证的私有接口, 实现基于 API 的自动交易。 API 文档按照 OpenAPI v3 标准制定 API 文档, 方便 API 使用者能够轻松生成需要的客户端代码,快速接入新的功能 # noqa: E501 - - OpenAPI spec version: 1.0.0 - Contact: support@mail.gate.io - Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six - - -class FundingRateHistory(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 = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """FundingRateHistory - a model defined in OpenAPI""" # noqa: E501 - self.discriminator = None - - 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, FundingRateHistory): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/gate_api/models/funding_rate_history_inner.py b/gate_api/models/funding_rate_history_inner.py deleted file mode 100644 index 2aca1f4..0000000 --- a/gate_api/models/funding_rate_history_inner.py +++ /dev/null @@ -1,143 +0,0 @@ -# coding: utf-8 - -""" - Gate API v4 - - APIv4 合约接口提供了与合约交易相关的操作,包括公共接口查询合约市场行情,以及需要认证的私有接口, 实现基于 API 的自动交易。 API 文档按照 OpenAPI v3 标准制定 API 文档, 方便 API 使用者能够轻松生成需要的客户端代码,快速接入新的功能 # noqa: E501 - - OpenAPI spec version: 1.0.0 - Contact: support@mail.gate.io - Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six - - -class FundingRateHistoryInner(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 = { - 't': 'int', - 'r': 'str' - } - - attribute_map = { - 't': 't', - 'r': 'r' - } - - def __init__(self, t=None, r=None): # noqa: E501 - """FundingRateHistoryInner - a model defined in OpenAPI""" # noqa: E501 - - self._t = None - self._r = None - self.discriminator = None - - if t is not None: - self.t = t - if r is not None: - self.r = r - - @property - def t(self): - """Gets the t of this FundingRateHistoryInner. # noqa: E501 - - 秒 s 精度的 Unix 时间戳 # noqa: E501 - - :return: The t of this FundingRateHistoryInner. # noqa: E501 - :rtype: int - """ - return self._t - - @t.setter - def t(self, t): - """Sets the t of this FundingRateHistoryInner. - - 秒 s 精度的 Unix 时间戳 # noqa: E501 - - :param t: The t of this FundingRateHistoryInner. # noqa: E501 - :type: int - """ - - self._t = t - - @property - def r(self): - """Gets the r of this FundingRateHistoryInner. # noqa: E501 - - 资金费率 # noqa: E501 - - :return: The r of this FundingRateHistoryInner. # noqa: E501 - :rtype: str - """ - return self._r - - @r.setter - def r(self, r): - """Sets the r of this FundingRateHistoryInner. - - 资金费率 # noqa: E501 - - :param r: The r of this FundingRateHistoryInner. # noqa: E501 - :type: str - """ - - self._r = r - - 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, FundingRateHistoryInner): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/gate_api/models/funding_rate_record.py b/gate_api/models/funding_rate_record.py index df1956d..a235ab3 100644 --- a/gate_api/models/funding_rate_record.py +++ b/gate_api/models/funding_rate_record.py @@ -32,17 +32,12 @@ class FundingRateRecord(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 't': 'int', - 'r': 'str' - } + openapi_types = {'t': 'int', 'r': 'str'} - attribute_map = { - 't': 't', - 'r': 'r' - } + attribute_map = {'t': 't', 'r': 'r'} def __init__(self, t=None, r=None, local_vars_configuration=None): # noqa: E501 + # type: (int, str, Configuration) -> None """FundingRateRecord - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -110,18 +105,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/futures_account.py b/gate_api/models/futures_account.py index fc21a04..6852e3d 100644 --- a/gate_api/models/futures_account.py +++ b/gate_api/models/futures_account.py @@ -39,7 +39,7 @@ class FuturesAccount(object): 'order_margin': 'str', 'available': 'str', 'point': 'str', - 'currency': 'str' + 'currency': 'str', } attribute_map = { @@ -49,10 +49,21 @@ class FuturesAccount(object): 'order_margin': 'order_margin', 'available': 'available', 'point': 'point', - 'currency': 'currency' + 'currency': 'currency', } - def __init__(self, total=None, unrealised_pnl=None, position_margin=None, order_margin=None, available=None, point=None, currency=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + total=None, + unrealised_pnl=None, + position_margin=None, + order_margin=None, + available=None, + point=None, + currency=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, str, str, str, str, str, str, Configuration) -> None """FuturesAccount - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -250,18 +261,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/futures_account_book.py b/gate_api/models/futures_account_book.py index 3ff3a15..ab23a03 100644 --- a/gate_api/models/futures_account_book.py +++ b/gate_api/models/futures_account_book.py @@ -32,23 +32,14 @@ class FuturesAccountBook(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'time': 'float', - 'change': 'str', - 'balance': 'str', - 'type': 'str', - 'text': 'str' - } - - attribute_map = { - 'time': 'time', - 'change': 'change', - 'balance': 'balance', - 'type': 'type', - 'text': 'text' - } - - def __init__(self, time=None, change=None, balance=None, type=None, text=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {'time': 'float', 'change': 'str', 'balance': 'str', 'type': 'str', 'text': 'str'} + + attribute_map = {'time': 'time', 'change': 'change', 'balance': 'balance', 'type': 'type', 'text': 'text'} + + def __init__( + self, time=None, change=None, balance=None, type=None, text=None, local_vars_configuration=None + ): # noqa: E501 + # type: (float, str, str, str, str, Configuration) -> None """FuturesAccountBook - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -164,8 +155,7 @@ def type(self, type): allowed_values = ["dnw", "pnl", "fee", "refr", "fund", "point_dnw", "point_fee", "point_refr"] # noqa: E501 if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 - .format(type, allowed_values) + "Invalid value for `type` ({0}), must be one of {1}".format(type, allowed_values) # noqa: E501 ) self._type = type @@ -200,18 +190,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/futures_candlestick.py b/gate_api/models/futures_candlestick.py index 424fe0c..66f4508 100644 --- a/gate_api/models/futures_candlestick.py +++ b/gate_api/models/futures_candlestick.py @@ -32,25 +32,12 @@ class FuturesCandlestick(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 't': 'float', - 'v': 'int', - 'c': 'str', - 'h': 'str', - 'l': 'str', - 'o': 'str' - } - - attribute_map = { - 't': 't', - 'v': 'v', - 'c': 'c', - 'h': 'h', - 'l': 'l', - 'o': 'o' - } + openapi_types = {'t': 'float', 'v': 'int', 'c': 'str', 'h': 'str', 'l': 'str', 'o': 'str'} + + attribute_map = {'t': 't', 'v': 'v', 'c': 'c', 'h': 'h', 'l': 'l', 'o': 'o'} def __init__(self, t=None, v=None, c=None, h=None, l=None, o=None, local_vars_configuration=None): # noqa: E501 + # type: (float, int, str, str, str, str, Configuration) -> None """FuturesCandlestick - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -222,18 +209,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/futures_candlesticks.py b/gate_api/models/futures_candlesticks.py deleted file mode 100644 index 39e3a5d..0000000 --- a/gate_api/models/futures_candlesticks.py +++ /dev/null @@ -1,85 +0,0 @@ -# coding: utf-8 - -""" - Gate API v4 - - APIv4 合约接口提供了与合约交易相关的操作,包括公共接口查询合约市场行情,以及需要认证的私有接口, 实现基于 API 的自动交易。 API 文档按照 OpenAPI v3 标准制定 API 文档, 方便 API 使用者能够轻松生成需要的客户端代码,快速接入新的功能 # noqa: E501 - - OpenAPI spec version: 1.0.0 - Contact: support@mail.gate.io - Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six - - -class FuturesCandlesticks(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 = { - } - - attribute_map = { - } - - def __init__(self): # noqa: E501 - """FuturesCandlesticks - a model defined in OpenAPI""" # noqa: E501 - self.discriminator = None - - 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, FuturesCandlesticks): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/gate_api/models/futures_candlesticks_inner.py b/gate_api/models/futures_candlesticks_inner.py deleted file mode 100644 index b62eb39..0000000 --- a/gate_api/models/futures_candlesticks_inner.py +++ /dev/null @@ -1,255 +0,0 @@ -# coding: utf-8 - -""" - Gate API v4 - - APIv4 合约接口提供了与合约交易相关的操作,包括公共接口查询合约市场行情,以及需要认证的私有接口, 实现基于 API 的自动交易。 API 文档按照 OpenAPI v3 标准制定 API 文档, 方便 API 使用者能够轻松生成需要的客户端代码,快速接入新的功能 # noqa: E501 - - OpenAPI spec version: 1.0.0 - Contact: support@mail.gate.io - Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six - - -class FuturesCandlesticksInner(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 = { - 't': 'float', - 'v': 'int', - 'c': 'str', - 'h': 'str', - 'l': 'str', - 'o': 'str' - } - - attribute_map = { - 't': 't', - 'v': 'v', - 'c': 'c', - 'h': 'h', - 'l': 'l', - 'o': 'o' - } - - def __init__(self, t=None, v=None, c=None, h=None, l=None, o=None): # noqa: E501 - """FuturesCandlesticksInner - a model defined in OpenAPI""" # noqa: E501 - - self._t = None - self._v = None - self._c = None - self._h = None - self._l = None - self._o = None - self.discriminator = None - - if t is not None: - self.t = t - if v is not None: - self.v = v - if c is not None: - self.c = c - if h is not None: - self.h = h - if l is not None: - self.l = l - if o is not None: - self.o = o - - @property - def t(self): - """Gets the t of this FuturesCandlesticksInner. # noqa: E501 - - 秒 s 精度的 Unix 时间戳 # noqa: E501 - - :return: The t of this FuturesCandlesticksInner. # noqa: E501 - :rtype: float - """ - return self._t - - @t.setter - def t(self, t): - """Sets the t of this FuturesCandlesticksInner. - - 秒 s 精度的 Unix 时间戳 # noqa: E501 - - :param t: The t of this FuturesCandlesticksInner. # noqa: E501 - :type: float - """ - - self._t = t - - @property - def v(self): - """Gets the v of this FuturesCandlesticksInner. # noqa: E501 - - 交易量,只有市场行情的 K 线数据里有该值 # noqa: E501 - - :return: The v of this FuturesCandlesticksInner. # noqa: E501 - :rtype: int - """ - return self._v - - @v.setter - def v(self, v): - """Sets the v of this FuturesCandlesticksInner. - - 交易量,只有市场行情的 K 线数据里有该值 # noqa: E501 - - :param v: The v of this FuturesCandlesticksInner. # noqa: E501 - :type: int - """ - - self._v = v - - @property - def c(self): - """Gets the c of this FuturesCandlesticksInner. # noqa: E501 - - 收盘价 # noqa: E501 - - :return: The c of this FuturesCandlesticksInner. # noqa: E501 - :rtype: str - """ - return self._c - - @c.setter - def c(self, c): - """Sets the c of this FuturesCandlesticksInner. - - 收盘价 # noqa: E501 - - :param c: The c of this FuturesCandlesticksInner. # noqa: E501 - :type: str - """ - - self._c = c - - @property - def h(self): - """Gets the h of this FuturesCandlesticksInner. # noqa: E501 - - 最高价 # noqa: E501 - - :return: The h of this FuturesCandlesticksInner. # noqa: E501 - :rtype: str - """ - return self._h - - @h.setter - def h(self, h): - """Sets the h of this FuturesCandlesticksInner. - - 最高价 # noqa: E501 - - :param h: The h of this FuturesCandlesticksInner. # noqa: E501 - :type: str - """ - - self._h = h - - @property - def l(self): - """Gets the l of this FuturesCandlesticksInner. # noqa: E501 - - 最低价 # noqa: E501 - - :return: The l of this FuturesCandlesticksInner. # noqa: E501 - :rtype: str - """ - return self._l - - @l.setter - def l(self, l): - """Sets the l of this FuturesCandlesticksInner. - - 最低价 # noqa: E501 - - :param l: The l of this FuturesCandlesticksInner. # noqa: E501 - :type: str - """ - - self._l = l - - @property - def o(self): - """Gets the o of this FuturesCandlesticksInner. # noqa: E501 - - 开盘价 # noqa: E501 - - :return: The o of this FuturesCandlesticksInner. # noqa: E501 - :rtype: str - """ - return self._o - - @o.setter - def o(self, o): - """Sets the o of this FuturesCandlesticksInner. - - 开盘价 # noqa: E501 - - :param o: The o of this FuturesCandlesticksInner. # noqa: E501 - :type: str - """ - - self._o = o - - 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, FuturesCandlesticksInner): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/gate_api/models/futures_error_response.py b/gate_api/models/futures_error_response.py deleted file mode 100644 index ac19a90..0000000 --- a/gate_api/models/futures_error_response.py +++ /dev/null @@ -1,149 +0,0 @@ -# coding: utf-8 - -""" - Gate API v4 - - APIv4 futures provides all sorts of 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 - - OpenAPI spec version: 1.0.0 - Contact: support@mail.gate.io - Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six - - -class FuturesErrorResponse(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 = { - 'label': 'str', - 'message': 'str' - } - - attribute_map = { - 'label': 'label', - 'message': 'message' - } - - def __init__(self, label=None, message=None): # noqa: E501 - """FuturesErrorResponse - a model defined in OpenAPI""" # noqa: E501 - - self._label = None - self._message = None - self.discriminator = None - - if label is not None: - self.label = label - if message is not None: - self.message = message - - @property - def label(self): - """Gets the label of this FuturesErrorResponse. # noqa: E501 - - 错误标识符,错误描述如下: 请求参数或格式问题: - INVALID_PARAM_VALUE: 参数输入值无效 - INVALID_REQUEST_BODY: 无效请求体 - MISSING_REQUIRED_PARAM: 缺少必选参数 - DUPLICATE_REQUEST: 请求过于频繁 认证相关: - INVALID_CREDENTIALS: 认证接口缺少用户认证信息 - NO_FUTURES_ACCOUNT: 用户无期货账户 业务相关: - NO_MATCHING: 没有匹配的对手单 - NO_MARKING_PRICE: 合约当前无标记价格 - CONTRACT_NOT_FOUND: 合约未找到 - NOT_FOUND: 请求路径不存在 - RISK_LIMIT_EXCEEDED: 委托超出风险限额 - INSUFFICIENT_BALANCE: 余额不足 - POTENTIAL_LIQUIDATION: 操作可能导致爆仓 - LEVERAGE_TOO_HIGH: 杠杆倍数设置过高 - LEVERAGE_TOO_LOW: 杠杆倍数设置过低 - ORDER_NOT_FOUND: 委托不存在 - ORDER_FINISHED: 订单已结束 - TOO_MANY_ORDERS: 过多未交易的挂单 - POSITION_NOT_FOUND: 合约无头寸信息 - POSITION_CROSS_MARGIN: 全仓不支持更新保证金 - POSITION_LOCKED: 头寸当前被锁定 - TOO_MUCH_CHANGE: 保证金超过可调范围 - RISK_LIMIT_NOT_MULTIPLE: 风险限额未按照步长调整 - RISK_LIMIT_TOO_HIGH: 超出最大风险限额 - RISK_LIMIT_TOO_lOW: 风险限额设置过低 - PRICE_TOO_DEVIATED: 下单价与标记价格相差过大 - SIZE_TOO_LARGE: 下单数量超过上限 - SIZE_TOO_SMALL: 下单数量不足下限 - LIQUIDATION_PRICE_EXCEEDED: 补仓时价格不能超过平仓价 - POSITION_IN_CLOSE: 仓位正在平仓 - POTENTIAL_BANKRUPTCY: 下单若成交,保证金无法弥补损失 服务异常: - SERVER_ERROR: 内部错误 - TOO_BUSY: 服务当前忙 # noqa: E501 - - :return: The label of this FuturesErrorResponse. # noqa: E501 - :rtype: str - """ - return self._label - - @label.setter - def label(self, label): - """Sets the label of this FuturesErrorResponse. - - 错误标识符,错误描述如下: 请求参数或格式问题: - INVALID_PARAM_VALUE: 参数输入值无效 - INVALID_REQUEST_BODY: 无效请求体 - MISSING_REQUIRED_PARAM: 缺少必选参数 - DUPLICATE_REQUEST: 请求过于频繁 认证相关: - INVALID_CREDENTIALS: 认证接口缺少用户认证信息 - NO_FUTURES_ACCOUNT: 用户无期货账户 业务相关: - NO_MATCHING: 没有匹配的对手单 - NO_MARKING_PRICE: 合约当前无标记价格 - CONTRACT_NOT_FOUND: 合约未找到 - NOT_FOUND: 请求路径不存在 - RISK_LIMIT_EXCEEDED: 委托超出风险限额 - INSUFFICIENT_BALANCE: 余额不足 - POTENTIAL_LIQUIDATION: 操作可能导致爆仓 - LEVERAGE_TOO_HIGH: 杠杆倍数设置过高 - LEVERAGE_TOO_LOW: 杠杆倍数设置过低 - ORDER_NOT_FOUND: 委托不存在 - ORDER_FINISHED: 订单已结束 - TOO_MANY_ORDERS: 过多未交易的挂单 - POSITION_NOT_FOUND: 合约无头寸信息 - POSITION_CROSS_MARGIN: 全仓不支持更新保证金 - POSITION_LOCKED: 头寸当前被锁定 - TOO_MUCH_CHANGE: 保证金超过可调范围 - RISK_LIMIT_NOT_MULTIPLE: 风险限额未按照步长调整 - RISK_LIMIT_TOO_HIGH: 超出最大风险限额 - RISK_LIMIT_TOO_lOW: 风险限额设置过低 - PRICE_TOO_DEVIATED: 下单价与标记价格相差过大 - SIZE_TOO_LARGE: 下单数量超过上限 - SIZE_TOO_SMALL: 下单数量不足下限 - LIQUIDATION_PRICE_EXCEEDED: 补仓时价格不能超过平仓价 - POSITION_IN_CLOSE: 仓位正在平仓 - POTENTIAL_BANKRUPTCY: 下单若成交,保证金无法弥补损失 服务异常: - SERVER_ERROR: 内部错误 - TOO_BUSY: 服务当前忙 # noqa: E501 - - :param label: The label of this FuturesErrorResponse. # noqa: E501 - :type: str - """ - allowed_values = ["INVALID_PARAM_VALUE", "INVALID_REQUEST_BODY", "MISSING_REQUIRED_PARAM", "INVALID_CREDENTIALS", "NO_FUTURES_ACCOUNT", "DUPLICATE_REQUEST", "NO_MATCHING", "NO_MARKING_PRICE", "CONTRACT_NOT_FOUND", "NOT_FOUND", "RISK_LIMIT_EXCEEDED", "INSUFFICIENT_BALANCE", "POTENTIAL_LIQUIDATION", "LEVERAGE_TOO_HIGH", "LEVERAGE_TOO_LOW", "ORDER_NOT_FOUND", "ORDER_FINISHED", "TOO_MANY_ORDERS", "POSITION_NOT_FOUND", "POSITION_CROSS_MARGIN", "POSITION_LOCKED", "TOO_MUCH_CHANGE", "RISK_LIMIT_NOT_MULTIPLE", "RISK_LIMIT_TOO_HIGH", "RISK_LIMIT_TOO_lOW", "PRICE_TOO_DEVIATED", "SIZE_TOO_LARGE", "SIZE_TOO_SMALL", "LIQUIDATION_PRICE_EXCEEDED", "POSITION_IN_CLOSE", "SERVER_ERROR", "TOO_BUSY"] # noqa: E501 - if label not in allowed_values: - raise ValueError( - "Invalid value for `label` ({0}), must be one of {1}" # noqa: E501 - .format(label, allowed_values) - ) - - self._label = label - - @property - def message(self): - """Gets the message of this FuturesErrorResponse. # noqa: E501 - - 详细错误描述。如果指定了 `Accept-Language` 请求头部,且支持指定语言,则描述信息会返回对应的语言 # noqa: E501 - - :return: The message of this FuturesErrorResponse. # noqa: E501 - :rtype: str - """ - return self._message - - @message.setter - def message(self, message): - """Sets the message of this FuturesErrorResponse. - - 详细错误描述。如果指定了 `Accept-Language` 请求头部,且支持指定语言,则描述信息会返回对应的语言 # noqa: E501 - - :param message: The message of this FuturesErrorResponse. # noqa: E501 - :type: str - """ - - self._message = message - - 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, FuturesErrorResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/gate_api/models/futures_initial_order.py b/gate_api/models/futures_initial_order.py index a291caf..65416a4 100644 --- a/gate_api/models/futures_initial_order.py +++ b/gate_api/models/futures_initial_order.py @@ -41,7 +41,7 @@ class FuturesInitialOrder(object): 'text': 'str', 'reduce_only': 'bool', 'is_reduce_only': 'bool', - 'is_close': 'bool' + 'is_close': 'bool', } attribute_map = { @@ -53,10 +53,23 @@ class FuturesInitialOrder(object): 'text': 'text', 'reduce_only': 'reduce_only', 'is_reduce_only': 'is_reduce_only', - 'is_close': 'is_close' + 'is_close': 'is_close', } - def __init__(self, contract=None, size=None, price=None, close=False, tif='gtc', text=None, reduce_only=False, is_reduce_only=None, is_close=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + contract=None, + size=None, + price=None, + close=False, + tif='gtc', + text=None, + reduce_only=False, + is_reduce_only=None, + is_close=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, int, str, bool, str, str, bool, bool, bool, Configuration) -> None """FuturesInitialOrder - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -209,8 +222,7 @@ def tif(self, tif): allowed_values = ["gtc", "ioc"] # noqa: E501 if self.local_vars_configuration.client_side_validation and tif not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `tif` ({0}), must be one of {1}" # noqa: E501 - .format(tif, allowed_values) + "Invalid value for `tif` ({0}), must be one of {1}".format(tif, allowed_values) # noqa: E501 ) self._tif = tif @@ -314,18 +326,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/futures_liquidate.py b/gate_api/models/futures_liquidate.py index c292851..cadea9a 100644 --- a/gate_api/models/futures_liquidate.py +++ b/gate_api/models/futures_liquidate.py @@ -44,7 +44,7 @@ class FuturesLiquidate(object): 'order_id': 'int', 'order_price': 'str', 'fill_price': 'str', - 'left': 'int' + 'left': 'int', } attribute_map = { @@ -59,10 +59,26 @@ class FuturesLiquidate(object): 'order_id': 'order_id', 'order_price': 'order_price', 'fill_price': 'fill_price', - 'left': 'left' + 'left': 'left', } - def __init__(self, time=None, contract=None, leverage=None, size=None, margin=None, entry_price=None, liq_price=None, mark_price=None, order_id=None, order_price=None, fill_price=None, left=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + time=None, + contract=None, + leverage=None, + size=None, + margin=None, + entry_price=None, + liq_price=None, + mark_price=None, + order_id=None, + order_price=None, + fill_price=None, + left=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (int, str, str, int, str, str, str, str, int, str, str, int, Configuration) -> None """FuturesLiquidate - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -390,18 +406,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/futures_order.py b/gate_api/models/futures_order.py index 8953d23..1dccd96 100644 --- a/gate_api/models/futures_order.py +++ b/gate_api/models/futures_order.py @@ -54,7 +54,7 @@ class FuturesOrder(object): 'text': 'str', 'tkfr': 'str', 'mkfr': 'str', - 'refu': 'int' + 'refu': 'int', } attribute_map = { @@ -79,10 +79,36 @@ class FuturesOrder(object): 'text': 'text', 'tkfr': 'tkfr', 'mkfr': 'mkfr', - 'refu': 'refu' + 'refu': 'refu', } - def __init__(self, id=None, user=None, create_time=None, finish_time=None, finish_as=None, status=None, contract=None, size=None, iceberg=None, price=None, close=False, is_close=None, reduce_only=False, is_reduce_only=None, is_liq=None, tif='gtc', left=None, fill_price=None, text=None, tkfr=None, mkfr=None, refu=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + user=None, + create_time=None, + finish_time=None, + finish_as=None, + status=None, + contract=None, + size=None, + iceberg=None, + price=None, + close=False, + is_close=None, + reduce_only=False, + is_reduce_only=None, + is_liq=None, + tif='gtc', + left=None, + fill_price=None, + text=None, + tkfr=None, + mkfr=None, + refu=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (int, int, float, float, str, str, str, int, int, str, bool, bool, bool, bool, bool, str, int, str, str, str, str, int, Configuration) -> None """FuturesOrder - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -271,8 +297,9 @@ def finish_as(self, finish_as): allowed_values = ["filled", "cancelled", "liquidated", "ioc", "auto_deleveraged", "reduce_only"] # 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}" # noqa: E501 - .format(finish_as, allowed_values) + "Invalid value for `finish_as` ({0}), must be one of {1}".format( # noqa: E501 + finish_as, allowed_values + ) ) self._finish_as = finish_as @@ -300,8 +327,7 @@ def status(self, status): allowed_values = ["open", "finished"] # 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}" # noqa: E501 - .format(status, allowed_values) + "Invalid value for `status` ({0}), must be one of {1}".format(status, allowed_values) # noqa: E501 ) self._status = status @@ -538,8 +564,7 @@ def tif(self, tif): allowed_values = ["gtc", "ioc", "poc"] # noqa: E501 if self.local_vars_configuration.client_side_validation and tif not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `tif` ({0}), must be one of {1}" # noqa: E501 - .format(tif, allowed_values) + "Invalid value for `tif` ({0}), must be one of {1}".format(tif, allowed_values) # noqa: E501 ) self._tif = tif @@ -689,18 +714,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/futures_order_book.py b/gate_api/models/futures_order_book.py index e30fb43..ad88040 100644 --- a/gate_api/models/futures_order_book.py +++ b/gate_api/models/futures_order_book.py @@ -32,17 +32,12 @@ class FuturesOrderBook(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'asks': 'list[FuturesOrderBookItem]', - 'bids': 'list[FuturesOrderBookItem]' - } + openapi_types = {'asks': 'list[FuturesOrderBookItem]', 'bids': 'list[FuturesOrderBookItem]'} - attribute_map = { - 'asks': 'asks', - 'bids': 'bids' - } + attribute_map = {'asks': 'asks', 'bids': 'bids'} def __init__(self, asks=None, bids=None, local_vars_configuration=None): # noqa: E501 + # type: (list[FuturesOrderBookItem], list[FuturesOrderBookItem], Configuration) -> None """FuturesOrderBook - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -112,18 +107,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/futures_order_book_asks.py b/gate_api/models/futures_order_book_asks.py deleted file mode 100644 index ee466f8..0000000 --- a/gate_api/models/futures_order_book_asks.py +++ /dev/null @@ -1,143 +0,0 @@ -# coding: utf-8 - -""" - Gate API v4 - - APIv4 futures provides all sorts of 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 - - OpenAPI spec version: 1.1.0 - Contact: support@mail.gate.io - Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six - - -class FuturesOrderBookAsks(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 = { - 'p': 'str', - 's': 'int' - } - - attribute_map = { - 'p': 'p', - 's': 's' - } - - def __init__(self, p=None, s=None): # noqa: E501 - """FuturesOrderBookAsks - a model defined in OpenAPI""" # noqa: E501 - - self._p = None - self._s = None - self.discriminator = None - - if p is not None: - self.p = p - if s is not None: - self.s = s - - @property - def p(self): - """Gets the p of this FuturesOrderBookAsks. # noqa: E501 - - Price # noqa: E501 - - :return: The p of this FuturesOrderBookAsks. # noqa: E501 - :rtype: str - """ - return self._p - - @p.setter - def p(self, p): - """Sets the p of this FuturesOrderBookAsks. - - Price # noqa: E501 - - :param p: The p of this FuturesOrderBookAsks. # noqa: E501 - :type: str - """ - - self._p = p - - @property - def s(self): - """Gets the s of this FuturesOrderBookAsks. # noqa: E501 - - Size # noqa: E501 - - :return: The s of this FuturesOrderBookAsks. # noqa: E501 - :rtype: int - """ - return self._s - - @s.setter - def s(self, s): - """Sets the s of this FuturesOrderBookAsks. - - Size # noqa: E501 - - :param s: The s of this FuturesOrderBookAsks. # noqa: E501 - :type: int - """ - - self._s = s - - 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, FuturesOrderBookAsks): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/gate_api/models/futures_order_book_item.py b/gate_api/models/futures_order_book_item.py index 44c7674..e39ddab 100644 --- a/gate_api/models/futures_order_book_item.py +++ b/gate_api/models/futures_order_book_item.py @@ -32,17 +32,12 @@ class FuturesOrderBookItem(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'p': 'str', - 's': 'int' - } + openapi_types = {'p': 'str', 's': 'int'} - attribute_map = { - 'p': 'p', - 's': 's' - } + attribute_map = {'p': 'p', 's': 's'} def __init__(self, p=None, s=None, local_vars_configuration=None): # noqa: E501 + # type: (str, int, Configuration) -> None """FuturesOrderBookItem - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -110,18 +105,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/futures_price_trigger.py b/gate_api/models/futures_price_trigger.py index 74b3ec7..a9c988b 100644 --- a/gate_api/models/futures_price_trigger.py +++ b/gate_api/models/futures_price_trigger.py @@ -32,23 +32,20 @@ class FuturesPriceTrigger(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'strategy_type': 'int', - 'price_type': 'int', - 'price': 'str', - 'rule': 'int', - 'expiration': 'int' - } + openapi_types = {'strategy_type': 'int', 'price_type': 'int', 'price': 'str', 'rule': 'int', 'expiration': 'int'} attribute_map = { 'strategy_type': 'strategy_type', 'price_type': 'price_type', 'price': 'price', 'rule': 'rule', - 'expiration': 'expiration' + 'expiration': 'expiration', } - def __init__(self, strategy_type=None, price_type=None, price=None, rule=None, expiration=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, strategy_type=None, price_type=None, price=None, rule=None, expiration=None, local_vars_configuration=None + ): # noqa: E501 + # type: (int, int, str, int, int, Configuration) -> None """FuturesPriceTrigger - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -95,8 +92,9 @@ def strategy_type(self, strategy_type): allowed_values = [0, 1] # noqa: E501 if self.local_vars_configuration.client_side_validation and strategy_type not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `strategy_type` ({0}), must be one of {1}" # noqa: E501 - .format(strategy_type, allowed_values) + "Invalid value for `strategy_type` ({0}), must be one of {1}".format( # noqa: E501 + strategy_type, allowed_values + ) ) self._strategy_type = strategy_type @@ -124,8 +122,9 @@ def price_type(self, price_type): allowed_values = [0, 1, 2] # noqa: E501 if self.local_vars_configuration.client_side_validation and price_type not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `price_type` ({0}), must be one of {1}" # noqa: E501 - .format(price_type, allowed_values) + "Invalid value for `price_type` ({0}), must be one of {1}".format( # noqa: E501 + price_type, allowed_values + ) ) self._price_type = price_type @@ -176,8 +175,7 @@ def rule(self, rule): allowed_values = [1, 2] # noqa: E501 if self.local_vars_configuration.client_side_validation and rule not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `rule` ({0}), must be one of {1}" # noqa: E501 - .format(rule, allowed_values) + "Invalid value for `rule` ({0}), must be one of {1}".format(rule, allowed_values) # noqa: E501 ) self._rule = rule @@ -212,18 +210,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/futures_price_triggered_order.py b/gate_api/models/futures_price_triggered_order.py index 3e53970..dd84cef 100644 --- a/gate_api/models/futures_price_triggered_order.py +++ b/gate_api/models/futures_price_triggered_order.py @@ -42,7 +42,7 @@ class FuturesPriceTriggeredOrder(object): 'trade_id': 'int', 'status': 'str', 'finish_as': 'str', - 'reason': 'str' + 'reason': 'str', } attribute_map = { @@ -55,10 +55,24 @@ class FuturesPriceTriggeredOrder(object): 'trade_id': 'trade_id', 'status': 'status', 'finish_as': 'finish_as', - 'reason': 'reason' + 'reason': 'reason', } - def __init__(self, initial=None, trigger=None, id=None, user=None, create_time=None, finish_time=None, trade_id=None, status=None, finish_as=None, reason=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + initial=None, + trigger=None, + id=None, + user=None, + create_time=None, + finish_time=None, + trade_id=None, + status=None, + finish_as=None, + reason=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (FuturesInitialOrder, FuturesPriceTrigger, int, int, float, float, int, str, str, str, Configuration) -> None """FuturesPriceTriggeredOrder - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -279,8 +293,7 @@ def status(self, status): allowed_values = ["open", "finished"] # 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}" # noqa: E501 - .format(status, allowed_values) + "Invalid value for `status` ({0}), must be one of {1}".format(status, allowed_values) # noqa: E501 ) self._status = status @@ -308,8 +321,9 @@ def finish_as(self, finish_as): allowed_values = ["cancelled", "succeeded", "failed", "expired"] # 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}" # noqa: E501 - .format(finish_as, allowed_values) + "Invalid value for `finish_as` ({0}), must be one of {1}".format( # noqa: E501 + finish_as, allowed_values + ) ) self._finish_as = finish_as @@ -344,18 +358,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/futures_ticker.py b/gate_api/models/futures_ticker.py index d81960d..503fdb9 100644 --- a/gate_api/models/futures_ticker.py +++ b/gate_api/models/futures_ticker.py @@ -49,7 +49,7 @@ class FuturesTicker(object): 'funding_rate': 'str', 'funding_rate_indicative': 'str', 'index_price': 'str', - 'quanto_base_rate': 'str' + 'quanto_base_rate': 'str', } attribute_map = { @@ -69,10 +69,31 @@ class FuturesTicker(object): 'funding_rate': 'funding_rate', 'funding_rate_indicative': 'funding_rate_indicative', 'index_price': 'index_price', - 'quanto_base_rate': 'quanto_base_rate' + 'quanto_base_rate': 'quanto_base_rate', } - def __init__(self, contract=None, last=None, change_percentage=None, total_size=None, low_24h=None, high_24h=None, volume_24h=None, volume_24h_btc=None, volume_24h_usd=None, volume_24h_base=None, volume_24h_quote=None, volume_24h_settle=None, mark_price=None, funding_rate=None, funding_rate_indicative=None, index_price=None, quanto_base_rate=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + contract=None, + last=None, + change_percentage=None, + total_size=None, + low_24h=None, + high_24h=None, + volume_24h=None, + volume_24h_btc=None, + volume_24h_usd=None, + volume_24h_base=None, + volume_24h_quote=None, + volume_24h_settle=None, + mark_price=None, + funding_rate=None, + funding_rate_indicative=None, + index_price=None, + quanto_base_rate=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, str, str, str, str, str, str, str, str, str, str, str, str, str, str, str, str, Configuration) -> None """FuturesTicker - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -530,18 +551,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/futures_trade.py b/gate_api/models/futures_trade.py index ff9b175..1daa0fb 100644 --- a/gate_api/models/futures_trade.py +++ b/gate_api/models/futures_trade.py @@ -32,23 +32,14 @@ class FuturesTrade(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'id': 'int', - 'create_time': 'float', - 'contract': 'str', - 'size': 'int', - 'price': 'str' - } - - attribute_map = { - 'id': 'id', - 'create_time': 'create_time', - 'contract': 'contract', - 'size': 'size', - 'price': 'price' - } - - def __init__(self, id=None, create_time=None, contract=None, size=None, price=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {'id': 'int', 'create_time': 'float', 'contract': 'str', 'size': 'int', 'price': 'str'} + + attribute_map = {'id': 'id', 'create_time': 'create_time', 'contract': 'contract', 'size': 'size', 'price': 'price'} + + def __init__( + self, id=None, create_time=None, contract=None, size=None, price=None, local_vars_configuration=None + ): # noqa: E501 + # type: (int, float, str, int, str, Configuration) -> None """FuturesTrade - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -194,18 +185,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/gate_error_response.py b/gate_api/models/gate_error_response.py deleted file mode 100644 index 3c3dcde..0000000 --- a/gate_api/models/gate_error_response.py +++ /dev/null @@ -1,150 +0,0 @@ -# coding: utf-8 - -""" - Gate API v4 - - APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # 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 GateErrorResponse(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 = { - 'label': 'str', - 'message': 'str' - } - - attribute_map = { - 'label': 'label', - 'message': 'message' - } - - def __init__(self, label=None, message=None, local_vars_configuration=None): # noqa: E501 - """GateErrorResponse - 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._label = None - self._message = None - self.discriminator = None - - if label is not None: - self.label = label - if message is not None: - self.message = message - - @property - def label(self): - """Gets the label of this GateErrorResponse. # noqa: E501 - - Error label # noqa: E501 - - :return: The label of this GateErrorResponse. # noqa: E501 - :rtype: str - """ - return self._label - - @label.setter - def label(self, label): - """Sets the label of this GateErrorResponse. - - Error label # noqa: E501 - - :param label: The label of this GateErrorResponse. # noqa: E501 - :type: str - """ - - self._label = label - - @property - def message(self): - """Gets the message of this GateErrorResponse. # noqa: E501 - - Detailed error message # noqa: E501 - - :return: The message of this GateErrorResponse. # noqa: E501 - :rtype: str - """ - return self._message - - @message.setter - def message(self, message): - """Sets the message of this GateErrorResponse. - - Detailed error message # noqa: E501 - - :param message: The message of this GateErrorResponse. # noqa: E501 - :type: str - """ - - self._message = message - - 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, GateErrorResponse): - 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, GateErrorResponse): - return True - - return self.to_dict() != other.to_dict() diff --git a/gate_api/models/insurance_record.py b/gate_api/models/insurance_record.py index 3c8119d..379966d 100644 --- a/gate_api/models/insurance_record.py +++ b/gate_api/models/insurance_record.py @@ -32,17 +32,12 @@ class InsuranceRecord(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 't': 'int', - 'b': 'str' - } + openapi_types = {'t': 'int', 'b': 'str'} - attribute_map = { - 't': 't', - 'b': 'b' - } + attribute_map = {'t': 't', 'b': 'b'} def __init__(self, t=None, b=None, local_vars_configuration=None): # noqa: E501 + # type: (int, str, Configuration) -> None """InsuranceRecord - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -110,18 +105,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/insurance_record_inner.py b/gate_api/models/insurance_record_inner.py deleted file mode 100644 index 1774a68..0000000 --- a/gate_api/models/insurance_record_inner.py +++ /dev/null @@ -1,143 +0,0 @@ -# coding: utf-8 - -""" - Gate API v4 - - APIv4 合约接口提供了与合约交易相关的操作,包括公共接口查询合约市场行情,以及需要认证的私有接口, 实现基于 API 的自动交易。 API 文档按照 OpenAPI v3 标准制定 API 文档, 方便 API 使用者能够轻松生成需要的客户端代码,快速接入新的功能 # noqa: E501 - - OpenAPI spec version: 1.0.0 - Contact: support@mail.gate.io - Generated by: https://openapi-generator.tech -""" - - -import pprint -import re # noqa: F401 - -import six - - -class InsuranceRecordInner(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 = { - 't': 'int', - 'b': 'str' - } - - attribute_map = { - 't': 't', - 'b': 'b' - } - - def __init__(self, t=None, b=None): # noqa: E501 - """InsuranceRecordInner - a model defined in OpenAPI""" # noqa: E501 - - self._t = None - self._b = None - self.discriminator = None - - if t is not None: - self.t = t - if b is not None: - self.b = b - - @property - def t(self): - """Gets the t of this InsuranceRecordInner. # noqa: E501 - - 秒 s 精度的 Unix 时间戳 # noqa: E501 - - :return: The t of this InsuranceRecordInner. # noqa: E501 - :rtype: int - """ - return self._t - - @t.setter - def t(self, t): - """Sets the t of this InsuranceRecordInner. - - 秒 s 精度的 Unix 时间戳 # noqa: E501 - - :param t: The t of this InsuranceRecordInner. # noqa: E501 - :type: int - """ - - self._t = t - - @property - def b(self): - """Gets the b of this InsuranceRecordInner. # noqa: E501 - - 保险基金余额 # noqa: E501 - - :return: The b of this InsuranceRecordInner. # noqa: E501 - :rtype: str - """ - return self._b - - @b.setter - def b(self, b): - """Sets the b of this InsuranceRecordInner. - - 保险基金余额 # noqa: E501 - - :param b: The b of this InsuranceRecordInner. # noqa: E501 - :type: str - """ - - self._b = b - - 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, InsuranceRecordInner): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/gate_api/models/ledger_record.py b/gate_api/models/ledger_record.py index 852a322..a2fbdbe 100644 --- a/gate_api/models/ledger_record.py +++ b/gate_api/models/ledger_record.py @@ -40,7 +40,7 @@ class LedgerRecord(object): 'currency': 'str', 'address': 'str', 'memo': 'str', - 'status': 'str' + 'status': 'str', } attribute_map = { @@ -51,10 +51,22 @@ class LedgerRecord(object): 'currency': 'currency', 'address': 'address', 'memo': 'memo', - 'status': 'status' + 'status': 'status', } - def __init__(self, id=None, txid=None, timestamp=None, amount=None, currency=None, address=None, memo=None, status=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + txid=None, + timestamp=None, + amount=None, + currency=None, + address=None, + memo=None, + status=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, str, str, str, str, str, str, str, Configuration) -> None """LedgerRecord - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -273,8 +285,7 @@ def status(self, status): allowed_values = ["DONE", "CANCEL", "REQUEST", "MANUAL", "BCODE"] # 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}" # noqa: E501 - .format(status, allowed_values) + "Invalid value for `status` ({0}), must be one of {1}".format(status, allowed_values) # noqa: E501 ) self._status = status @@ -286,18 +297,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/loan.py b/gate_api/models/loan.py index b7395c5..02b5852 100644 --- a/gate_api/models/loan.py +++ b/gate_api/models/loan.py @@ -49,7 +49,7 @@ class Loan(object): 'paid_interest': 'str', 'unpaid_interest': 'str', 'fee_rate': 'str', - 'orig_id': 'str' + 'orig_id': 'str', } attribute_map = { @@ -69,10 +69,31 @@ class Loan(object): 'paid_interest': 'paid_interest', 'unpaid_interest': 'unpaid_interest', 'fee_rate': 'fee_rate', - 'orig_id': 'orig_id' + 'orig_id': 'orig_id', } - def __init__(self, id=None, create_time=None, expire_time=None, status=None, side=None, currency=None, rate=None, amount=None, days=None, auto_renew=False, currency_pair=None, left=None, repaid=None, paid_interest=None, unpaid_interest=None, fee_rate=None, orig_id=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + create_time=None, + expire_time=None, + status=None, + side=None, + currency=None, + rate=None, + amount=None, + days=None, + auto_renew=False, + currency_pair=None, + left=None, + repaid=None, + paid_interest=None, + unpaid_interest=None, + fee_rate=None, + orig_id=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, str, str, str, str, str, str, str, int, bool, str, str, str, str, str, str, str, Configuration) -> None """Loan - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -220,8 +241,7 @@ def status(self, status): allowed_values = ["open", "loaned", "finished", "auto_repaid"] # 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}" # noqa: E501 - .format(status, allowed_values) + "Invalid value for `status` ({0}), must be one of {1}".format(status, allowed_values) # noqa: E501 ) self._status = status @@ -251,8 +271,7 @@ def side(self, side): allowed_values = ["lend", "borrow"] # noqa: E501 if self.local_vars_configuration.client_side_validation and side not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `side` ({0}), must be one of {1}" # noqa: E501 - .format(side, allowed_values) + "Invalid value for `side` ({0}), must be one of {1}".format(side, allowed_values) # noqa: E501 ) self._side = side @@ -546,18 +565,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/loan_patch.py b/gate_api/models/loan_patch.py index d7408ba..7febc66 100644 --- a/gate_api/models/loan_patch.py +++ b/gate_api/models/loan_patch.py @@ -32,23 +32,20 @@ class LoanPatch(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'currency': 'str', - 'side': 'str', - 'auto_renew': 'bool', - 'currency_pair': 'str', - 'loan_id': 'str' - } + openapi_types = {'currency': 'str', 'side': 'str', 'auto_renew': 'bool', 'currency_pair': 'str', 'loan_id': 'str'} attribute_map = { 'currency': 'currency', 'side': 'side', 'auto_renew': 'auto_renew', 'currency_pair': 'currency_pair', - 'loan_id': 'loan_id' + 'loan_id': 'loan_id', } - def __init__(self, currency=None, side=None, auto_renew=None, currency_pair=None, loan_id=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, currency=None, side=None, auto_renew=None, currency_pair=None, loan_id=None, local_vars_configuration=None + ): # noqa: E501 + # type: (str, str, bool, str, str, Configuration) -> None """LoanPatch - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -119,8 +116,7 @@ def side(self, side): allowed_values = ["lend", "borrow"] # noqa: E501 if self.local_vars_configuration.client_side_validation and side not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `side` ({0}), must be one of {1}" # noqa: E501 - .format(side, allowed_values) + "Invalid value for `side` ({0}), must be one of {1}".format(side, allowed_values) # noqa: E501 ) self._side = side @@ -203,18 +199,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/loan_record.py b/gate_api/models/loan_record.py index b777608..913c546 100644 --- a/gate_api/models/loan_record.py +++ b/gate_api/models/loan_record.py @@ -46,7 +46,7 @@ class LoanRecord(object): 'auto_renew': 'bool', 'repaid': 'str', 'paid_interest': 'str', - 'unpaid_interest': 'str' + 'unpaid_interest': 'str', } attribute_map = { @@ -63,10 +63,28 @@ class LoanRecord(object): 'auto_renew': 'auto_renew', 'repaid': 'repaid', 'paid_interest': 'paid_interest', - 'unpaid_interest': 'unpaid_interest' + 'unpaid_interest': 'unpaid_interest', } - def __init__(self, id=None, loan_id=None, create_time=None, expire_time=None, status=None, borrow_user_id=None, currency=None, rate=None, amount=None, days=None, auto_renew=False, repaid=None, paid_interest=None, unpaid_interest=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + loan_id=None, + create_time=None, + expire_time=None, + status=None, + borrow_user_id=None, + currency=None, + rate=None, + amount=None, + days=None, + auto_renew=False, + repaid=None, + paid_interest=None, + unpaid_interest=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, str, str, str, str, str, str, str, str, int, bool, str, str, str, Configuration) -> None """LoanRecord - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -232,8 +250,7 @@ def status(self, status): allowed_values = ["loaned", "finished"] # 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}" # noqa: E501 - .format(status, allowed_values) + "Invalid value for `status` ({0}), must be one of {1}".format(status, allowed_values) # noqa: E501 ) self._status = status @@ -452,18 +469,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/margin_account.py b/gate_api/models/margin_account.py index c77df76..18cc45c 100644 --- a/gate_api/models/margin_account.py +++ b/gate_api/models/margin_account.py @@ -32,19 +32,12 @@ class MarginAccount(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'currency_pair': 'str', - 'base': 'MarginAccountCurrency', - 'quote': 'MarginAccountCurrency' - } - - attribute_map = { - 'currency_pair': 'currency_pair', - 'base': 'base', - 'quote': 'quote' - } + openapi_types = {'currency_pair': 'str', 'base': 'MarginAccountCurrency', 'quote': 'MarginAccountCurrency'} + + attribute_map = {'currency_pair': 'currency_pair', 'base': 'base', 'quote': 'quote'} def __init__(self, currency_pair=None, base=None, quote=None, local_vars_configuration=None): # noqa: E501 + # type: (str, MarginAccountCurrency, MarginAccountCurrency, Configuration) -> None """MarginAccount - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -134,18 +127,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/margin_account_book.py b/gate_api/models/margin_account_book.py index e544576..a43f3db 100644 --- a/gate_api/models/margin_account_book.py +++ b/gate_api/models/margin_account_book.py @@ -38,7 +38,7 @@ class MarginAccountBook(object): 'currency': 'str', 'currency_pair': 'str', 'change': 'str', - 'balance': 'str' + 'balance': 'str', } attribute_map = { @@ -47,10 +47,20 @@ class MarginAccountBook(object): 'currency': 'currency', 'currency_pair': 'currency_pair', 'change': 'change', - 'balance': 'balance' + 'balance': 'balance', } - def __init__(self, id=None, time=None, currency=None, currency_pair=None, change=None, balance=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + time=None, + currency=None, + currency_pair=None, + change=None, + balance=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, str, str, str, str, str, Configuration) -> None """MarginAccountBook - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -222,18 +232,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/margin_account_currency.py b/gate_api/models/margin_account_currency.py index e5be027..2b96125 100644 --- a/gate_api/models/margin_account_currency.py +++ b/gate_api/models/margin_account_currency.py @@ -32,21 +32,14 @@ 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' - } - - attribute_map = { - 'currency': 'currency', - 'available': 'available', - 'locked': 'locked', - 'borrowed': 'borrowed' - } - - def __init__(self, currency=None, available=None, locked=None, borrowed=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {'currency': 'str', 'available': 'str', 'locked': 'str', 'borrowed': 'str'} + + attribute_map = {'currency': 'currency', 'available': 'available', 'locked': 'locked', 'borrowed': 'borrowed'} + + def __init__( + self, currency=None, available=None, locked=None, borrowed=None, local_vars_configuration=None + ): # noqa: E501 + # type: (str, str, str, str, Configuration) -> None """MarginAccountCurrency - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -166,18 +159,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/margin_currency_pair.py b/gate_api/models/margin_currency_pair.py index 44670bd..50fbd36 100644 --- a/gate_api/models/margin_currency_pair.py +++ b/gate_api/models/margin_currency_pair.py @@ -39,7 +39,7 @@ class MarginCurrencyPair(object): 'leverage': 'int', 'min_base_amount': 'str', 'min_quote_amount': 'str', - 'max_quote_amount': 'str' + 'max_quote_amount': 'str', } attribute_map = { @@ -49,10 +49,21 @@ class MarginCurrencyPair(object): 'leverage': 'leverage', 'min_base_amount': 'min_base_amount', 'min_quote_amount': 'min_quote_amount', - 'max_quote_amount': 'max_quote_amount' + 'max_quote_amount': 'max_quote_amount', } - def __init__(self, id=None, base=None, quote=None, leverage=None, min_base_amount=None, min_quote_amount=None, max_quote_amount=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + base=None, + quote=None, + leverage=None, + min_base_amount=None, + min_quote_amount=None, + max_quote_amount=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, str, str, int, str, str, str, Configuration) -> None """MarginCurrencyPair - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -250,18 +261,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/my_futures_trade.py b/gate_api/models/my_futures_trade.py index 546c02e..ccd3672 100644 --- a/gate_api/models/my_futures_trade.py +++ b/gate_api/models/my_futures_trade.py @@ -39,7 +39,7 @@ class MyFuturesTrade(object): 'order_id': 'str', 'size': 'int', 'price': 'str', - 'role': 'str' + 'role': 'str', } attribute_map = { @@ -49,10 +49,21 @@ class MyFuturesTrade(object): 'order_id': 'order_id', 'size': 'size', 'price': 'price', - 'role': 'role' + 'role': 'role', } - def __init__(self, id=None, create_time=None, contract=None, order_id=None, size=None, price=None, role=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + create_time=None, + contract=None, + order_id=None, + size=None, + price=None, + role=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (int, float, str, str, int, str, str, Configuration) -> None """MyFuturesTrade - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -243,8 +254,7 @@ def role(self, role): allowed_values = ["taker", "maker"] # noqa: E501 if self.local_vars_configuration.client_side_validation and role not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `role` ({0}), must be one of {1}" # noqa: E501 - .format(role, allowed_values) + "Invalid value for `role` ({0}), must be one of {1}".format(role, allowed_values) # noqa: E501 ) self._role = role @@ -256,18 +266,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/open_orders.py b/gate_api/models/open_orders.py index 7b8a5cf..505066e 100644 --- a/gate_api/models/open_orders.py +++ b/gate_api/models/open_orders.py @@ -32,19 +32,12 @@ class OpenOrders(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'currency_pair': 'str', - 'total': 'int', - 'orders': 'list[Order]' - } - - attribute_map = { - 'currency_pair': 'currency_pair', - 'total': 'total', - 'orders': 'orders' - } + openapi_types = {'currency_pair': 'str', 'total': 'int', 'orders': 'list[Order]'} + + attribute_map = {'currency_pair': 'currency_pair', 'total': 'total', 'orders': 'orders'} def __init__(self, currency_pair=None, total=None, orders=None, local_vars_configuration=None): # noqa: E501 + # type: (str, int, list[Order], Configuration) -> None """OpenOrders - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -136,18 +129,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/order.py b/gate_api/models/order.py index 7d4d419..9298d83 100644 --- a/gate_api/models/order.py +++ b/gate_api/models/order.py @@ -55,7 +55,7 @@ class Order(object): 'gt_fee': 'str', 'gt_discount': 'bool', 'rebated_fee': 'str', - 'rebated_fee_currency': 'str' + 'rebated_fee_currency': 'str', } attribute_map = { @@ -81,10 +81,37 @@ class Order(object): 'gt_fee': 'gt_fee', 'gt_discount': 'gt_discount', 'rebated_fee': 'rebated_fee', - 'rebated_fee_currency': 'rebated_fee_currency' + 'rebated_fee_currency': 'rebated_fee_currency', } - def __init__(self, id=None, text=None, create_time=None, update_time=None, status=None, currency_pair=None, type='limit', account='spot', side=None, amount=None, price=None, time_in_force='gtc', auto_borrow=None, left=None, fill_price=None, filled_total=None, fee=None, fee_currency=None, point_fee=None, gt_fee=None, gt_discount=None, rebated_fee=None, rebated_fee_currency=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + text=None, + create_time=None, + update_time=None, + status=None, + currency_pair=None, + type='limit', + account='spot', + side=None, + amount=None, + price=None, + time_in_force='gtc', + auto_borrow=None, + left=None, + fill_price=None, + filled_total=None, + fee=None, + fee_currency=None, + point_fee=None, + gt_fee=None, + gt_discount=None, + rebated_fee=None, + rebated_fee_currency=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (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 """Order - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -273,8 +300,7 @@ def status(self, status): allowed_values = ["open", "closed", "cancelled"] # 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}" # noqa: E501 - .format(status, allowed_values) + "Invalid value for `status` ({0}), must be one of {1}".format(status, allowed_values) # noqa: E501 ) self._status = status @@ -327,8 +353,7 @@ def type(self, type): allowed_values = ["limit"] # noqa: E501 if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 - .format(type, allowed_values) + "Invalid value for `type` ({0}), must be one of {1}".format(type, allowed_values) # noqa: E501 ) self._type = type @@ -356,8 +381,7 @@ def account(self, account): allowed_values = ["spot", "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}" # noqa: E501 - .format(account, allowed_values) + "Invalid value for `account` ({0}), must be one of {1}".format(account, allowed_values) # noqa: E501 ) self._account = account @@ -387,8 +411,7 @@ def side(self, side): allowed_values = ["buy", "sell"] # noqa: E501 if self.local_vars_configuration.client_side_validation and side not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `side` ({0}), must be one of {1}" # noqa: E501 - .format(side, allowed_values) + "Invalid value for `side` ({0}), must be one of {1}".format(side, allowed_values) # noqa: E501 ) self._side = side @@ -466,8 +489,9 @@ def time_in_force(self, time_in_force): allowed_values = ["gtc", "ioc", "poc"] # noqa: E501 if self.local_vars_configuration.client_side_validation and time_in_force not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `time_in_force` ({0}), must be one of {1}" # noqa: E501 - .format(time_in_force, allowed_values) + "Invalid value for `time_in_force` ({0}), must be one of {1}".format( # noqa: E501 + time_in_force, allowed_values + ) ) self._time_in_force = time_in_force @@ -732,18 +756,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/order_book.py b/gate_api/models/order_book.py index 88b8177..4ca9aa1 100644 --- a/gate_api/models/order_book.py +++ b/gate_api/models/order_book.py @@ -32,17 +32,12 @@ class OrderBook(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'asks': 'list[list[str]]', - 'bids': 'list[list[str]]' - } + openapi_types = {'asks': 'list[list[str]]', 'bids': 'list[list[str]]'} - attribute_map = { - 'asks': 'asks', - 'bids': 'bids' - } + attribute_map = {'asks': 'asks', 'bids': 'bids'} def __init__(self, asks=None, bids=None, local_vars_configuration=None): # noqa: E501 + # type: (list[list[str]], list[list[str]], Configuration) -> None """OrderBook - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -112,18 +107,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/position.py b/gate_api/models/position.py index 74d78c1..8b174e0 100644 --- a/gate_api/models/position.py +++ b/gate_api/models/position.py @@ -53,7 +53,7 @@ class Position(object): 'history_point': 'str', 'adl_ranking': 'int', 'pending_orders': 'int', - 'close_order': 'PositionCloseOrder' + 'close_order': 'PositionCloseOrder', } attribute_map = { @@ -77,10 +77,35 @@ class Position(object): 'history_point': 'history_point', 'adl_ranking': 'adl_ranking', 'pending_orders': 'pending_orders', - 'close_order': 'close_order' + 'close_order': 'close_order', } - def __init__(self, user=None, contract=None, size=None, leverage=None, risk_limit=None, leverage_max=None, maintenance_rate=None, value=None, margin=None, entry_price=None, liq_price=None, mark_price=None, unrealised_pnl=None, realised_pnl=None, history_pnl=None, last_close_pnl=None, realised_point=None, history_point=None, adl_ranking=None, pending_orders=None, close_order=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + user=None, + contract=None, + size=None, + leverage=None, + risk_limit=None, + leverage_max=None, + maintenance_rate=None, + value=None, + margin=None, + entry_price=None, + liq_price=None, + mark_price=None, + unrealised_pnl=None, + realised_pnl=None, + history_pnl=None, + last_close_pnl=None, + realised_point=None, + history_point=None, + adl_ranking=None, + pending_orders=None, + close_order=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, Configuration) -> None """Position - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -640,18 +665,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/position_close.py b/gate_api/models/position_close.py index 101efd4..bdd4adc 100644 --- a/gate_api/models/position_close.py +++ b/gate_api/models/position_close.py @@ -32,23 +32,14 @@ class PositionClose(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'time': 'float', - 'contract': 'str', - 'side': 'str', - 'pnl': 'str', - 'text': 'str' - } - - attribute_map = { - 'time': 'time', - 'contract': 'contract', - 'side': 'side', - 'pnl': 'pnl', - 'text': 'text' - } - - def __init__(self, time=None, contract=None, side=None, pnl=None, text=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {'time': 'float', 'contract': 'str', 'side': 'str', 'pnl': 'str', 'text': 'str'} + + attribute_map = {'time': 'time', 'contract': 'contract', 'side': 'side', 'pnl': 'pnl', 'text': 'text'} + + def __init__( + self, time=None, contract=None, side=None, pnl=None, text=None, local_vars_configuration=None + ): # noqa: E501 + # type: (float, str, str, str, str, Configuration) -> None """PositionClose - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -141,8 +132,7 @@ def side(self, side): allowed_values = ["long", "short"] # noqa: E501 if self.local_vars_configuration.client_side_validation and side not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `side` ({0}), must be one of {1}" # noqa: E501 - .format(side, allowed_values) + "Invalid value for `side` ({0}), must be one of {1}".format(side, allowed_values) # noqa: E501 ) self._side = side @@ -200,18 +190,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/position_close_order.py b/gate_api/models/position_close_order.py index fb94f1f..49699de 100644 --- a/gate_api/models/position_close_order.py +++ b/gate_api/models/position_close_order.py @@ -32,19 +32,12 @@ class PositionCloseOrder(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'id': 'int', - 'price': 'str', - 'is_liq': 'bool' - } - - attribute_map = { - 'id': 'id', - 'price': 'price', - 'is_liq': 'is_liq' - } + openapi_types = {'id': 'int', 'price': 'str', 'is_liq': 'bool'} + + attribute_map = {'id': 'id', 'price': 'price', 'is_liq': 'is_liq'} def __init__(self, id=None, price=None, is_liq=None, local_vars_configuration=None): # noqa: E501 + # type: (int, str, bool, Configuration) -> None """PositionCloseOrder - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -138,18 +131,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/repay_request.py b/gate_api/models/repay_request.py index fd9f9b7..c6db770 100644 --- a/gate_api/models/repay_request.py +++ b/gate_api/models/repay_request.py @@ -32,21 +32,14 @@ class RepayRequest(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'currency_pair': 'str', - 'currency': 'str', - 'mode': 'str', - 'amount': 'str' - } - - attribute_map = { - 'currency_pair': 'currency_pair', - 'currency': 'currency', - 'mode': 'mode', - 'amount': 'amount' - } - - def __init__(self, currency_pair=None, currency=None, mode=None, amount=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {'currency_pair': 'str', 'currency': 'str', 'mode': 'str', 'amount': 'str'} + + attribute_map = {'currency_pair': 'currency_pair', 'currency': 'currency', 'mode': 'mode', 'amount': 'amount'} + + def __init__( + self, currency_pair=None, currency=None, mode=None, amount=None, local_vars_configuration=None + ): # noqa: E501 + # type: (str, str, str, str, Configuration) -> None """RepayRequest - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -139,8 +132,7 @@ def mode(self, mode): allowed_values = ["all", "partial"] # noqa: E501 if self.local_vars_configuration.client_side_validation and mode not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `mode` ({0}), must be one of {1}" # noqa: E501 - .format(mode, allowed_values) + "Invalid value for `mode` ({0}), must be one of {1}".format(mode, allowed_values) # noqa: E501 ) self._mode = mode @@ -175,18 +167,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/repayment.py b/gate_api/models/repayment.py index 99ff969..9558477 100644 --- a/gate_api/models/repayment.py +++ b/gate_api/models/repayment.py @@ -32,21 +32,14 @@ class Repayment(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'id': 'str', - 'create_time': 'str', - 'principal': 'str', - 'interest': 'str' - } - - attribute_map = { - 'id': 'id', - 'create_time': 'create_time', - 'principal': 'principal', - 'interest': 'interest' - } - - def __init__(self, id=None, create_time=None, principal=None, interest=None, local_vars_configuration=None): # noqa: E501 + openapi_types = {'id': 'str', 'create_time': 'str', 'principal': 'str', 'interest': 'str'} + + attribute_map = {'id': 'id', 'create_time': 'create_time', 'principal': 'principal', 'interest': 'interest'} + + def __init__( + self, id=None, create_time=None, principal=None, interest=None, local_vars_configuration=None + ): # noqa: E501 + # type: (str, str, str, str, Configuration) -> None """Repayment - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -166,18 +159,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/spot_account.py b/gate_api/models/spot_account.py index f27ab03..18b5ce2 100644 --- a/gate_api/models/spot_account.py +++ b/gate_api/models/spot_account.py @@ -32,19 +32,12 @@ class SpotAccount(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' - } - - attribute_map = { - 'currency': 'currency', - 'available': 'available', - 'locked': 'locked' - } + openapi_types = {'currency': 'str', 'available': 'str', 'locked': 'str'} + + attribute_map = {'currency': 'currency', 'available': 'available', 'locked': 'locked'} def __init__(self, currency=None, available=None, locked=None, local_vars_configuration=None): # noqa: E501 + # type: (str, str, str, Configuration) -> None """SpotAccount - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -138,18 +131,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/sub_account_transfer.py b/gate_api/models/sub_account_transfer.py index a75493b..78e03d0 100644 --- a/gate_api/models/sub_account_transfer.py +++ b/gate_api/models/sub_account_transfer.py @@ -39,7 +39,7 @@ class SubAccountTransfer(object): 'amount': 'str', 'uid': 'str', 'timest': 'str', - 'source': 'str' + 'source': 'str', } attribute_map = { @@ -49,10 +49,21 @@ class SubAccountTransfer(object): 'amount': 'amount', 'uid': 'uid', 'timest': 'timest', - 'source': 'source' + 'source': 'source', } - def __init__(self, currency=None, sub_account=None, direction=None, amount=None, uid=None, timest=None, source=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + currency=None, + sub_account=None, + direction=None, + amount=None, + uid=None, + timest=None, + source=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, str, str, str, str, str, str, Configuration) -> None """SubAccountTransfer - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -153,8 +164,9 @@ def direction(self, direction): allowed_values = ["to", "from"] # noqa: E501 if self.local_vars_configuration.client_side_validation and direction not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `direction` ({0}), must be one of {1}" # noqa: E501 - .format(direction, allowed_values) + "Invalid value for `direction` ({0}), must be one of {1}".format( # noqa: E501 + direction, allowed_values + ) ) self._direction = direction @@ -260,18 +272,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/ticker.py b/gate_api/models/ticker.py index 2f4febc..446d3bf 100644 --- a/gate_api/models/ticker.py +++ b/gate_api/models/ticker.py @@ -41,7 +41,7 @@ class Ticker(object): 'base_volume': 'str', 'quote_volume': 'str', 'high_24h': 'str', - 'low_24h': 'str' + 'low_24h': 'str', } attribute_map = { @@ -53,10 +53,23 @@ class Ticker(object): 'base_volume': 'base_volume', 'quote_volume': 'quote_volume', 'high_24h': 'high_24h', - 'low_24h': 'low_24h' + 'low_24h': 'low_24h', } - def __init__(self, currency_pair=None, last=None, lowest_ask=None, highest_bid=None, change_percentage=None, base_volume=None, quote_volume=None, high_24h=None, low_24h=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + currency_pair=None, + last=None, + lowest_ask=None, + highest_bid=None, + change_percentage=None, + base_volume=None, + quote_volume=None, + high_24h=None, + low_24h=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, str, str, str, str, str, str, str, str, Configuration) -> None """Ticker - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -306,18 +319,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/trade.py b/gate_api/models/trade.py index dfe4b83..d006733 100644 --- a/gate_api/models/trade.py +++ b/gate_api/models/trade.py @@ -43,7 +43,7 @@ class Trade(object): 'fee': 'str', 'fee_currency': 'str', 'point_fee': 'str', - 'gt_fee': 'str' + 'gt_fee': 'str', } attribute_map = { @@ -57,10 +57,25 @@ class Trade(object): 'fee': 'fee', 'fee_currency': 'fee_currency', 'point_fee': 'point_fee', - 'gt_fee': 'gt_fee' + 'gt_fee': 'gt_fee', } - def __init__(self, id=None, create_time=None, side=None, role=None, amount=None, price=None, order_id=None, fee=None, fee_currency=None, point_fee=None, gt_fee=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + id=None, + create_time=None, + side=None, + role=None, + amount=None, + price=None, + order_id=None, + fee=None, + fee_currency=None, + point_fee=None, + gt_fee=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, str, str, str, str, str, str, str, str, str, str, Configuration) -> None """Trade - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -171,8 +186,7 @@ def side(self, side): allowed_values = ["buy", "sell"] # noqa: E501 if self.local_vars_configuration.client_side_validation and side not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `side` ({0}), must be one of {1}" # noqa: E501 - .format(side, allowed_values) + "Invalid value for `side` ({0}), must be one of {1}".format(side, allowed_values) # noqa: E501 ) self._side = side @@ -200,8 +214,7 @@ def role(self, role): allowed_values = ["taker", "maker"] # noqa: E501 if self.local_vars_configuration.client_side_validation and role not in allowed_values: # noqa: E501 raise ValueError( - "Invalid value for `role` ({0}), must be one of {1}" # noqa: E501 - .format(role, allowed_values) + "Invalid value for `role` ({0}), must be one of {1}".format(role, allowed_values) # noqa: E501 ) self._role = role @@ -374,18 +387,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/trade_fee.py b/gate_api/models/trade_fee.py new file mode 100644 index 0000000..a9052a0 --- /dev/null +++ b/gate_api/models/trade_fee.py @@ -0,0 +1,299 @@ +# coding: utf-8 + +""" + Gate API v4 + + APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # 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 TradeFee(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', + 'taker_fee': 'str', + 'maker_fee': 'str', + 'gt_discount': 'bool', + 'gt_taker_fee': 'str', + 'gt_maker_fee': 'str', + 'loan_fee': 'str', + } + + attribute_map = { + 'user_id': 'user_id', + 'taker_fee': 'taker_fee', + 'maker_fee': 'maker_fee', + 'gt_discount': 'gt_discount', + 'gt_taker_fee': 'gt_taker_fee', + 'gt_maker_fee': 'gt_maker_fee', + 'loan_fee': 'loan_fee', + } + + def __init__( + self, + user_id=None, + taker_fee=None, + maker_fee=None, + gt_discount=None, + gt_taker_fee=None, + gt_maker_fee=None, + loan_fee=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (int, str, str, bool, str, str, str, Configuration) -> None + """TradeFee - 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._taker_fee = None + self._maker_fee = None + self._gt_discount = None + self._gt_taker_fee = None + self._gt_maker_fee = None + self._loan_fee = None + self.discriminator = None + + if user_id is not None: + self.user_id = user_id + if taker_fee is not None: + self.taker_fee = taker_fee + if maker_fee is not None: + self.maker_fee = maker_fee + if gt_discount is not None: + self.gt_discount = gt_discount + if gt_taker_fee is not None: + self.gt_taker_fee = gt_taker_fee + if gt_maker_fee is not None: + self.gt_maker_fee = gt_maker_fee + if loan_fee is not None: + self.loan_fee = loan_fee + + @property + def user_id(self): + """Gets the user_id of this TradeFee. # noqa: E501 + + User ID # noqa: E501 + + :return: The user_id of this TradeFee. # noqa: E501 + :rtype: int + """ + return self._user_id + + @user_id.setter + def user_id(self, user_id): + """Sets the user_id of this TradeFee. + + User ID # noqa: E501 + + :param user_id: The user_id of this TradeFee. # noqa: E501 + :type: int + """ + + self._user_id = user_id + + @property + def taker_fee(self): + """Gets the taker_fee of this TradeFee. # noqa: E501 + + taker fee rate # noqa: E501 + + :return: The taker_fee of this TradeFee. # noqa: E501 + :rtype: str + """ + return self._taker_fee + + @taker_fee.setter + def taker_fee(self, taker_fee): + """Sets the taker_fee of this TradeFee. + + taker fee rate # noqa: E501 + + :param taker_fee: The taker_fee of this TradeFee. # noqa: E501 + :type: str + """ + + self._taker_fee = taker_fee + + @property + def maker_fee(self): + """Gets the maker_fee of this TradeFee. # noqa: E501 + + maker fee rate # noqa: E501 + + :return: The maker_fee of this TradeFee. # noqa: E501 + :rtype: str + """ + return self._maker_fee + + @maker_fee.setter + def maker_fee(self, maker_fee): + """Sets the maker_fee of this TradeFee. + + maker fee rate # noqa: E501 + + :param maker_fee: The maker_fee of this TradeFee. # noqa: E501 + :type: str + """ + + self._maker_fee = maker_fee + + @property + def gt_discount(self): + """Gets the gt_discount of this TradeFee. # noqa: E501 + + Is GT deduction is enabled # noqa: E501 + + :return: The gt_discount of this TradeFee. # noqa: E501 + :rtype: bool + """ + return self._gt_discount + + @gt_discount.setter + def gt_discount(self, gt_discount): + """Sets the gt_discount of this TradeFee. + + Is GT deduction is enabled # noqa: E501 + + :param gt_discount: The gt_discount of this TradeFee. # noqa: E501 + :type: bool + """ + + self._gt_discount = gt_discount + + @property + def gt_taker_fee(self): + """Gets the gt_taker_fee of this TradeFee. # noqa: E501 + + Taker fee rate if using GT deduction. It will be 0 if GT deduction is disabled # noqa: E501 + + :return: The gt_taker_fee of this TradeFee. # noqa: E501 + :rtype: str + """ + return self._gt_taker_fee + + @gt_taker_fee.setter + def gt_taker_fee(self, gt_taker_fee): + """Sets the gt_taker_fee of this TradeFee. + + Taker fee rate if using GT deduction. It will be 0 if GT deduction is disabled # noqa: E501 + + :param gt_taker_fee: The gt_taker_fee of this TradeFee. # noqa: E501 + :type: str + """ + + self._gt_taker_fee = gt_taker_fee + + @property + def gt_maker_fee(self): + """Gets the gt_maker_fee of this TradeFee. # noqa: E501 + + Maker fee rate if using GT deduction. It will be 0 if GT deduction is disabled # noqa: E501 + + :return: The gt_maker_fee of this TradeFee. # noqa: E501 + :rtype: str + """ + return self._gt_maker_fee + + @gt_maker_fee.setter + def gt_maker_fee(self, gt_maker_fee): + """Sets the gt_maker_fee of this TradeFee. + + Maker fee rate if using GT deduction. It will be 0 if GT deduction is disabled # noqa: E501 + + :param gt_maker_fee: The gt_maker_fee of this TradeFee. # noqa: E501 + :type: str + """ + + self._gt_maker_fee = gt_maker_fee + + @property + def loan_fee(self): + """Gets the loan_fee of this TradeFee. # noqa: E501 + + Loan fee rate of margin lending # noqa: E501 + + :return: The loan_fee of this TradeFee. # noqa: E501 + :rtype: str + """ + return self._loan_fee + + @loan_fee.setter + def loan_fee(self, loan_fee): + """Sets the loan_fee of this TradeFee. + + Loan fee rate of margin lending # noqa: E501 + + :param loan_fee: The loan_fee of this TradeFee. # noqa: E501 + :type: str + """ + + self._loan_fee = loan_fee + + 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, TradeFee): + 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, TradeFee): + return True + + return self.to_dict() != other.to_dict() diff --git a/gate_api/models/transfer.py b/gate_api/models/transfer.py index e03289e..b22e211 100644 --- a/gate_api/models/transfer.py +++ b/gate_api/models/transfer.py @@ -33,35 +33,39 @@ class Transfer(object): and the value is json key in definition. """ openapi_types = { - 'id': 'str', - 'created_at': 'str', 'currency': 'str', '_from': 'str', 'to': 'str', 'amount': 'str', 'currency_pair': 'str', - 'settle': 'str' + 'settle': 'str', } attribute_map = { - 'id': 'id', - 'created_at': 'created_at', 'currency': 'currency', '_from': 'from', 'to': 'to', 'amount': 'amount', 'currency_pair': 'currency_pair', - 'settle': 'settle' + 'settle': 'settle', } - def __init__(self, id=None, created_at=None, currency=None, _from=None, to=None, amount=None, currency_pair=None, settle=None, local_vars_configuration=None): # noqa: E501 + def __init__( + self, + currency=None, + _from=None, + to=None, + amount=None, + currency_pair=None, + settle=None, + local_vars_configuration=None, + ): # noqa: E501 + # type: (str, str, str, str, str, str, Configuration) -> None """Transfer - 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._created_at = None self._currency = None self.__from = None self._to = None @@ -70,10 +74,6 @@ def __init__(self, id=None, created_at=None, currency=None, _from=None, to=None, self._settle = None self.discriminator = None - if id is not None: - self.id = id - if created_at is not None: - self.created_at = created_at self.currency = currency self._from = _from self.to = to @@ -83,52 +83,6 @@ def __init__(self, id=None, created_at=None, currency=None, _from=None, to=None, if settle is not None: self.settle = settle - @property - def id(self): - """Gets the id of this Transfer. # noqa: E501 - - Transfer ID # noqa: E501 - - :return: The id of this Transfer. # noqa: E501 - :rtype: str - """ - return self._id - - @id.setter - def id(self, id): - """Sets the id of this Transfer. - - Transfer ID # noqa: E501 - - :param id: The id of this Transfer. # noqa: E501 - :type: str - """ - - self._id = id - - @property - def created_at(self): - """Gets the created_at of this Transfer. # noqa: E501 - - Timestamp when the transfer occurred # noqa: E501 - - :return: The created_at of this Transfer. # noqa: E501 - :rtype: str - """ - return self._created_at - - @created_at.setter - def created_at(self, created_at): - """Sets the created_at of this Transfer. - - Timestamp when the transfer occurred # noqa: E501 - - :param created_at: The created_at of this Transfer. # noqa: E501 - :type: str - """ - - self._created_at = created_at - @property def currency(self): """Gets the currency of this Transfer. # noqa: E501 @@ -179,8 +133,7 @@ def _from(self, _from): allowed_values = ["spot", "margin", "futures", "delivery"] # 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}" # noqa: E501 - .format(_from, allowed_values) + "Invalid value for `_from` ({0}), must be one of {1}".format(_from, allowed_values) # noqa: E501 ) self.__from = _from @@ -210,8 +163,7 @@ def to(self, to): allowed_values = ["spot", "margin", "futures", "delivery"] # 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}" # noqa: E501 - .format(to, allowed_values) + "Invalid value for `to` ({0}), must be one of {1}".format(to, allowed_values) # noqa: E501 ) self._to = to @@ -294,18 +246,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/models/trigger_order_response.py b/gate_api/models/trigger_order_response.py index 0db6191..a5b4f7b 100644 --- a/gate_api/models/trigger_order_response.py +++ b/gate_api/models/trigger_order_response.py @@ -32,15 +32,12 @@ class TriggerOrderResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'id': 'int' - } + openapi_types = {'id': 'int'} - attribute_map = { - 'id': 'id' - } + attribute_map = {'id': 'id'} def __init__(self, id=None, local_vars_configuration=None): # noqa: E501 + # type: (int, Configuration) -> None """TriggerOrderResponse - a model defined in OpenAPI""" # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration() @@ -82,18 +79,16 @@ def to_dict(self): 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 - )) + 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() - )) + 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 diff --git a/gate_api/rest.py b/gate_api/rest.py index 70da07c..2c80151 100644 --- a/gate_api/rest.py +++ b/gate_api/rest.py @@ -19,6 +19,7 @@ import ssl import certifi + # python 2 and python 3 compatibility library import six from six.moves.urllib.parse import urlencode @@ -31,7 +32,6 @@ class RESTResponse(io.IOBase): - def __init__(self, resp): self.urllib3_response = resp self.status = resp.status @@ -48,7 +48,6 @@ def getheader(self, name, default=None): class RESTClientObject(object): - def __init__(self, configuration, pools_size=4, maxsize=None): # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 @@ -106,9 +105,17 @@ def __init__(self, configuration, pools_size=4, maxsize=None): **addition_pool_args ) - def request(self, method, url, query_params=None, headers=None, - body=None, post_params=None, _preload_content=True, - _request_timeout=None): + def request( + self, + method, + url, + query_params=None, + headers=None, + body=None, + post_params=None, + _preload_content=True, + _request_timeout=None, + ): """Perform requests. :param method: http request method @@ -128,25 +135,20 @@ def request(self, method, url, query_params=None, headers=None, (connection, read) timeouts. """ method = method.upper() - assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', - 'PATCH', 'OPTIONS'] + assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS'] if post_params and body: - raise ApiValueError( - "body parameter cannot be used with post_params parameter." - ) + raise ApiValueError("body parameter cannot be used with post_params parameter.") post_params = post_params or {} headers = headers or {} timeout = None if _request_timeout: - if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 + if isinstance(_request_timeout, (int,) if six.PY3 else (int, long)): # noqa: E501,F821 timeout = urllib3.Timeout(total=_request_timeout) - elif (isinstance(_request_timeout, tuple) and - len(_request_timeout) == 2): - timeout = urllib3.Timeout( - connect=_request_timeout[0], read=_request_timeout[1]) + elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2: + timeout = urllib3.Timeout(connect=_request_timeout[0], read=_request_timeout[1]) if 'Content-Type' not in headers: headers['Content-Type'] = 'application/json' @@ -161,42 +163,50 @@ def request(self, method, url, query_params=None, headers=None, if body is not None: request_body = json.dumps(body) r = self.pool_manager.request( - method, url, + method, + url, body=request_body, preload_content=_preload_content, timeout=timeout, - headers=headers) + headers=headers, + ) elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 r = self.pool_manager.request( - method, url, + method, + url, fields=post_params, encode_multipart=False, preload_content=_preload_content, timeout=timeout, - headers=headers) + headers=headers, + ) elif headers['Content-Type'] == 'multipart/form-data': # must del headers['Content-Type'], or the correct # Content-Type which generated by urllib3 will be # overwritten. del headers['Content-Type'] r = self.pool_manager.request( - method, url, + method, + url, fields=post_params, encode_multipart=True, preload_content=_preload_content, timeout=timeout, - headers=headers) + headers=headers, + ) # Pass a `string` parameter directly in the body to support # other content types than Json when `body` argument is # provided in serialized form elif isinstance(body, str) or isinstance(body, bytes): request_body = body r = self.pool_manager.request( - method, url, + method, + url, body=request_body, preload_content=_preload_content, timeout=timeout, - headers=headers) + headers=headers, + ) else: # Cannot generate the request from given parameters msg = """Cannot prepare a request message for provided @@ -205,11 +215,9 @@ def request(self, method, url, query_params=None, headers=None, raise ApiException(status=0, reason=msg) # For `GET`, `HEAD` else: - r = self.pool_manager.request(method, url, - fields=query_params, - preload_content=_preload_content, - timeout=timeout, - headers=headers) + r = self.pool_manager.request( + method, url, fields=query_params, preload_content=_preload_content, timeout=timeout, headers=headers + ) except urllib3.exceptions.SSLError as e: msg = "{0}\n{1}".format(type(e).__name__, str(e)) raise ApiException(status=0, reason=msg) @@ -225,67 +233,117 @@ def request(self, method, url, query_params=None, headers=None, return r - def GET(self, url, headers=None, query_params=None, _preload_content=True, - _request_timeout=None): - return self.request("GET", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - - def HEAD(self, url, headers=None, query_params=None, _preload_content=True, - _request_timeout=None): - return self.request("HEAD", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - - def OPTIONS(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("OPTIONS", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def DELETE(self, url, headers=None, query_params=None, body=None, - _preload_content=True, _request_timeout=None): - return self.request("DELETE", url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def POST(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("POST", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def PUT(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("PUT", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def PATCH(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("PATCH", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + def GET(self, url, headers=None, query_params=None, _preload_content=True, _request_timeout=None): + return self.request( + "GET", + url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params, + ) + + def HEAD(self, url, headers=None, query_params=None, _preload_content=True, _request_timeout=None): + return self.request( + "HEAD", + url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params, + ) + + def OPTIONS( + self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "OPTIONS", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + + def DELETE(self, url, headers=None, query_params=None, body=None, _preload_content=True, _request_timeout=None): + return self.request( + "DELETE", + url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + + def POST( + self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "POST", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + + def PUT( + self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "PUT", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) + + def PATCH( + self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): + return self.request( + "PATCH", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) diff --git a/setup.py b/setup.py index fb39965..1f641dc 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "gate-api" -VERSION = "4.15.1" +VERSION = "4.15.2" # To install the library, run the following # # python setup.py install @@ -37,5 +37,5 @@ license="Apache License 2.0", long_description="""\ 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 - """ + """, )