@ -0,0 +1,174 @@ | |||
# coding: utf-8 | |||
# flake8: noqa | |||
""" | |||
Gate API v4 | |||
Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # noqa: E501 | |||
Contact: support@mail.gate.io | |||
Generated by: https://openapi-generator.tech | |||
""" | |||
from __future__ import absolute_import | |||
__version__ = "4.42.0" | |||
# import apis into sdk package | |||
from gate_api.api.earn_uni_api import EarnUniApi | |||
from gate_api.api.margin_uni_api import MarginUniApi | |||
from gate_api.api.sub_account_api import SubAccountApi | |||
from gate_api.api.delivery_api import DeliveryApi | |||
from gate_api.api.flash_swap_api import FlashSwapApi | |||
from gate_api.api.futures_api import FuturesApi | |||
from gate_api.api.margin_api import MarginApi | |||
from gate_api.api.options_api import OptionsApi | |||
from gate_api.api.rebate_api import RebateApi | |||
from gate_api.api.spot_api import SpotApi | |||
from gate_api.api.wallet_api import WalletApi | |||
from gate_api.api.withdrawal_api import WithdrawalApi | |||
# 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.account_balance import AccountBalance | |||
from gate_api.models.agency_commission import AgencyCommission | |||
from gate_api.models.agency_commission_history import AgencyCommissionHistory | |||
from gate_api.models.agency_transaction import AgencyTransaction | |||
from gate_api.models.agency_transaction_history import AgencyTransactionHistory | |||
from gate_api.models.api_v4_key_perm import ApiV4KeyPerm | |||
from gate_api.models.auto_repay_setting import AutoRepaySetting | |||
from gate_api.models.batch_futures_order import BatchFuturesOrder | |||
from gate_api.models.batch_order import BatchOrder | |||
from gate_api.models.cancel_order import CancelOrder | |||
from gate_api.models.cancel_order_result import CancelOrderResult | |||
from gate_api.models.contract import Contract | |||
from gate_api.models.contract_stat import ContractStat | |||
from gate_api.models.countdown_cancel_all_futures_task import CountdownCancelAllFuturesTask | |||
from gate_api.models.countdown_cancel_all_spot_task import CountdownCancelAllSpotTask | |||
from gate_api.models.create_uni_lend import CreateUniLend | |||
from gate_api.models.create_uni_loan import CreateUniLoan | |||
from gate_api.models.cross_margin_account import CrossMarginAccount | |||
from gate_api.models.cross_margin_account_book import CrossMarginAccountBook | |||
from gate_api.models.cross_margin_balance import CrossMarginBalance | |||
from gate_api.models.cross_margin_balance1 import CrossMarginBalance1 | |||
from gate_api.models.cross_margin_borrowable import CrossMarginBorrowable | |||
from gate_api.models.cross_margin_currency import CrossMarginCurrency | |||
from gate_api.models.cross_margin_loan import CrossMarginLoan | |||
from gate_api.models.cross_margin_repay_request import CrossMarginRepayRequest | |||
from gate_api.models.cross_margin_repayment import CrossMarginRepayment | |||
from gate_api.models.cross_margin_transferable import CrossMarginTransferable | |||
from gate_api.models.currency import Currency | |||
from gate_api.models.currency_chain import CurrencyChain | |||
from gate_api.models.currency_pair import CurrencyPair | |||
from gate_api.models.delivery_contract import DeliveryContract | |||
from gate_api.models.delivery_settlement import DeliverySettlement | |||
from gate_api.models.deposit_address import DepositAddress | |||
from gate_api.models.flash_swap_currency import FlashSwapCurrency | |||
from gate_api.models.flash_swap_order import FlashSwapOrder | |||
from gate_api.models.flash_swap_order_preview import FlashSwapOrderPreview | |||
from gate_api.models.flash_swap_order_request import FlashSwapOrderRequest | |||
from gate_api.models.funding_account import FundingAccount | |||
from gate_api.models.funding_book_item import FundingBookItem | |||
from gate_api.models.funding_rate_record import FundingRateRecord | |||
from gate_api.models.futures_account import FuturesAccount | |||
from gate_api.models.futures_account_book import FuturesAccountBook | |||
from gate_api.models.futures_account_history import FuturesAccountHistory | |||
from gate_api.models.futures_auto_deleverage import FuturesAutoDeleverage | |||
from gate_api.models.futures_candlestick import FuturesCandlestick | |||
from gate_api.models.futures_index_constituents import FuturesIndexConstituents | |||
from gate_api.models.futures_initial_order import FuturesInitialOrder | |||
from gate_api.models.futures_liquidate import FuturesLiquidate | |||
from gate_api.models.futures_order import FuturesOrder | |||
from gate_api.models.futures_order_amendment import FuturesOrderAmendment | |||
from gate_api.models.futures_order_book import FuturesOrderBook | |||
from gate_api.models.futures_order_book_item import FuturesOrderBookItem | |||
from gate_api.models.futures_premium_index import FuturesPremiumIndex | |||
from gate_api.models.futures_price_trigger import FuturesPriceTrigger | |||
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.index_constituent import IndexConstituent | |||
from gate_api.models.insurance_record import InsuranceRecord | |||
from gate_api.models.ledger_record import LedgerRecord | |||
from gate_api.models.liquidate_order import LiquidateOrder | |||
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_borrowable import MarginBorrowable | |||
from gate_api.models.margin_currency_pair import MarginCurrencyPair | |||
from gate_api.models.margin_transferable import MarginTransferable | |||
from gate_api.models.max_uni_borrowable import MaxUniBorrowable | |||
from gate_api.models.multi_chain_address_item import MultiChainAddressItem | |||
from gate_api.models.my_futures_trade import MyFuturesTrade | |||
from gate_api.models.my_futures_trade_time_range import MyFuturesTradeTimeRange | |||
from gate_api.models.open_orders import OpenOrders | |||
from gate_api.models.options_account import OptionsAccount | |||
from gate_api.models.options_account_book import OptionsAccountBook | |||
from gate_api.models.options_candlestick import OptionsCandlestick | |||
from gate_api.models.options_contract import OptionsContract | |||
from gate_api.models.options_my_settlements import OptionsMySettlements | |||
from gate_api.models.options_my_trade import OptionsMyTrade | |||
from gate_api.models.options_order import OptionsOrder | |||
from gate_api.models.options_position import OptionsPosition | |||
from gate_api.models.options_position_close import OptionsPositionClose | |||
from gate_api.models.options_position_close_order import OptionsPositionCloseOrder | |||
from gate_api.models.options_settlement import OptionsSettlement | |||
from gate_api.models.options_ticker import OptionsTicker | |||
from gate_api.models.options_underlying import OptionsUnderlying | |||
from gate_api.models.options_underlying_ticker import OptionsUnderlyingTicker | |||
from gate_api.models.order import Order | |||
from gate_api.models.order_book import OrderBook | |||
from gate_api.models.order_patch import OrderPatch | |||
from gate_api.models.patch_uni_lend import PatchUniLend | |||
from gate_api.models.position import Position | |||
from gate_api.models.position_close import PositionClose | |||
from gate_api.models.position_close_order import PositionCloseOrder | |||
from gate_api.models.repay_request import RepayRequest | |||
from gate_api.models.repayment import Repayment | |||
from gate_api.models.saved_address import SavedAddress | |||
from gate_api.models.spot_account import SpotAccount | |||
from gate_api.models.spot_fee import SpotFee | |||
from gate_api.models.spot_price_put_order import SpotPricePutOrder | |||
from gate_api.models.spot_price_trigger import SpotPriceTrigger | |||
from gate_api.models.spot_price_triggered_order import SpotPriceTriggeredOrder | |||
from gate_api.models.sub_account import SubAccount | |||
from gate_api.models.sub_account_balance import SubAccountBalance | |||
from gate_api.models.sub_account_cross_margin_balance import SubAccountCrossMarginBalance | |||
from gate_api.models.sub_account_futures_balance import SubAccountFuturesBalance | |||
from gate_api.models.sub_account_key import SubAccountKey | |||
from gate_api.models.sub_account_margin_balance import SubAccountMarginBalance | |||
from gate_api.models.sub_account_to_sub_account import SubAccountToSubAccount | |||
from gate_api.models.sub_account_transfer import SubAccountTransfer | |||
from gate_api.models.sub_cross_margin_account import SubCrossMarginAccount | |||
from gate_api.models.system_time import SystemTime | |||
from gate_api.models.ticker import Ticker | |||
from gate_api.models.total_balance import TotalBalance | |||
from gate_api.models.trade import Trade | |||
from gate_api.models.trade_fee import TradeFee | |||
from gate_api.models.transaction_id import TransactionID | |||
from gate_api.models.transfer import Transfer | |||
from gate_api.models.trigger_order_response import TriggerOrderResponse | |||
from gate_api.models.trigger_time import TriggerTime | |||
from gate_api.models.uni_currency import UniCurrency | |||
from gate_api.models.uni_currency_pair import UniCurrencyPair | |||
from gate_api.models.uni_interest_record import UniInterestRecord | |||
from gate_api.models.uni_lend import UniLend | |||
from gate_api.models.uni_lend_interest import UniLendInterest | |||
from gate_api.models.uni_lend_record import UniLendRecord | |||
from gate_api.models.uni_loan import UniLoan | |||
from gate_api.models.uni_loan_interest_record import UniLoanInterestRecord | |||
from gate_api.models.uni_loan_record import UniLoanRecord | |||
from gate_api.models.withdraw_status import WithdrawStatus |
@ -0,0 +1,17 @@ | |||
from __future__ import absolute_import | |||
# flake8: noqa | |||
# import apis into api package | |||
from gate_api.api.earn_uni_api import EarnUniApi | |||
from gate_api.api.margin_uni_api import MarginUniApi | |||
from gate_api.api.sub_account_api import SubAccountApi | |||
from gate_api.api.delivery_api import DeliveryApi | |||
from gate_api.api.flash_swap_api import FlashSwapApi | |||
from gate_api.api.futures_api import FuturesApi | |||
from gate_api.api.margin_api import MarginApi | |||
from gate_api.api.options_api import OptionsApi | |||
from gate_api.api.rebate_api import RebateApi | |||
from gate_api.api.spot_api import SpotApi | |||
from gate_api.api.wallet_api import WalletApi | |||
from gate_api.api.withdrawal_api import WithdrawalApi |
@ -0,0 +1,924 @@ | |||
# coding: utf-8 | |||
""" | |||
Gate API v4 | |||
Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # noqa: E501 | |||
Contact: support@mail.gate.io | |||
Generated by: https://openapi-generator.tech | |||
""" | |||
from __future__ import absolute_import | |||
import re # noqa: F401 | |||
# python 2 and python 3 compatibility library | |||
import six | |||
from gate_api.api_client import ApiClient | |||
from gate_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 | |||
class EarnUniApi(object): | |||
"""NOTE: This class is auto generated by OpenAPI Generator | |||
Ref: https://openapi-generator.tech | |||
Do not edit the class manually. | |||
""" | |||
def __init__(self, api_client=None): | |||
if api_client is None: | |||
api_client = ApiClient() | |||
self.api_client = api_client | |||
def list_uni_currencies(self, **kwargs): # noqa: E501 | |||
"""List currencies for lending # 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_uni_currencies(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: list[gate_api.UniCurrency] | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.list_uni_currencies_with_http_info(**kwargs) # noqa: E501 | |||
def list_uni_currencies_with_http_info(self, **kwargs): # noqa: E501 | |||
"""List currencies for lending # 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_uni_currencies_with_http_info(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(list[gate_api.UniCurrency], status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = [] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_uni_currencies" % k) | |||
local_var_params[k] = v | |||
del local_var_params['kwargs'] | |||
collection_formats = {} | |||
path_params = {} | |||
query_params = [] | |||
header_params = {} | |||
form_params = [] | |||
local_var_files = {} | |||
body_params = None | |||
# HTTP header `Accept` | |||
header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501 | |||
# Authentication setting | |||
auth_settings = [] # noqa: E501 | |||
return self.api_client.call_api( | |||
'/earn/uni/currencies', | |||
'GET', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='list[UniCurrency]', # noqa: E501 | |||
auth_settings=auth_settings, | |||
async_req=local_var_params.get('async_req'), | |||
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 | |||
_preload_content=local_var_params.get('_preload_content', True), | |||
_request_timeout=local_var_params.get('_request_timeout'), | |||
collection_formats=collection_formats, | |||
) | |||
def get_uni_currency(self, currency, **kwargs): # noqa: E501 | |||
"""Get currency detail for lending # 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_uni_currency(currency, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency: 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. | |||
:rtype: gate_api.UniCurrency | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.get_uni_currency_with_http_info(currency, **kwargs) # noqa: E501 | |||
def get_uni_currency_with_http_info(self, currency, **kwargs): # noqa: E501 | |||
"""Get currency detail for lending # 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_uni_currency_with_http_info(currency, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency: Currency (required) | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(gate_api.UniCurrency, status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['currency'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_uni_currency" % k) | |||
local_var_params[k] = v | |||
del local_var_params['kwargs'] | |||
# verify the required parameter 'currency' is set | |||
if self.api_client.client_side_validation and ( | |||
'currency' not in local_var_params or local_var_params['currency'] is None # noqa: E501 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Missing the required parameter `currency` when calling `get_uni_currency`" | |||
) # noqa: E501 | |||
collection_formats = {} | |||
path_params = {} | |||
if 'currency' in local_var_params: | |||
path_params['currency'] = local_var_params['currency'] # noqa: E501 | |||
query_params = [] | |||
header_params = {} | |||
form_params = [] | |||
local_var_files = {} | |||
body_params = None | |||
# HTTP header `Accept` | |||
header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501 | |||
# Authentication setting | |||
auth_settings = [] # noqa: E501 | |||
return self.api_client.call_api( | |||
'/earn/uni/currencies/{currency}', | |||
'GET', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='UniCurrency', # 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_user_uni_lends(self, **kwargs): # noqa: E501 | |||
"""List user's lending 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_user_uni_lends(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency: Retrieve data of the specified currency | |||
:param int page: Page number | |||
:param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100 | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: list[gate_api.UniLend] | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.list_user_uni_lends_with_http_info(**kwargs) # noqa: E501 | |||
def list_user_uni_lends_with_http_info(self, **kwargs): # noqa: E501 | |||
"""List user's lending 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_user_uni_lends_with_http_info(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency: Retrieve data of the specified currency | |||
:param int page: Page number | |||
:param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100 | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(list[gate_api.UniLend], status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['currency', 'page', 'limit'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_user_uni_lends" % k) | |||
local_var_params[k] = v | |||
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_user_uni_lends`, 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_user_uni_lends`, 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_user_uni_lends`, 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 | |||
query_params.append(('currency', local_var_params['currency'])) # 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 = {} | |||
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( | |||
'/earn/uni/lends', | |||
'GET', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='list[UniLend]', # noqa: E501 | |||
auth_settings=auth_settings, | |||
async_req=local_var_params.get('async_req'), | |||
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 | |||
_preload_content=local_var_params.get('_preload_content', True), | |||
_request_timeout=local_var_params.get('_request_timeout'), | |||
collection_formats=collection_formats, | |||
) | |||
def create_uni_lend(self, create_uni_lend, **kwargs): # noqa: E501 | |||
"""Lend or redeem # noqa: E501 | |||
`Lending`: The minimum interest rate is required in lending. The lending result is updated hourly and the interest profit is paid on the next hour. A high interest rate might lead to unsuccessful lending and no profit will be gained for that hour. If the funds are redeemed before the hourly settlement, no interest can be obtained for that hour. About priority: the orders created or amended first under the same interest rate will be lent out first `Redemption`: Funds that failed to be lent can be redeemed immediately. For the successfully lent funds, enjoy the hourly income, and the redemption will arrive at the next hour `Note`: Two minutes before and after the hour is the settlement time, lending and redemption are prohibited. # 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_uni_lend(create_uni_lend, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param CreateUniLend create_uni_lend: (required) | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: None | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.create_uni_lend_with_http_info(create_uni_lend, **kwargs) # noqa: E501 | |||
def create_uni_lend_with_http_info(self, create_uni_lend, **kwargs): # noqa: E501 | |||
"""Lend or redeem # noqa: E501 | |||
`Lending`: The minimum interest rate is required in lending. The lending result is updated hourly and the interest profit is paid on the next hour. A high interest rate might lead to unsuccessful lending and no profit will be gained for that hour. If the funds are redeemed before the hourly settlement, no interest can be obtained for that hour. About priority: the orders created or amended first under the same interest rate will be lent out first `Redemption`: Funds that failed to be lent can be redeemed immediately. For the successfully lent funds, enjoy the hourly income, and the redemption will arrive at the next hour `Note`: Two minutes before and after the hour is the settlement time, lending and redemption are prohibited. # 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_uni_lend_with_http_info(create_uni_lend, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param CreateUniLend create_uni_lend: (required) | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: None | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['create_uni_lend'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_uni_lend" % k) | |||
local_var_params[k] = v | |||
del local_var_params['kwargs'] | |||
# verify the required parameter 'create_uni_lend' is set | |||
if self.api_client.client_side_validation and ( | |||
'create_uni_lend' not in local_var_params or local_var_params['create_uni_lend'] is None # noqa: E501 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Missing the required parameter `create_uni_lend` when calling `create_uni_lend`" | |||
) # noqa: E501 | |||
collection_formats = {} | |||
path_params = {} | |||
query_params = [] | |||
header_params = {} | |||
form_params = [] | |||
local_var_files = {} | |||
body_params = None | |||
if 'create_uni_lend' in local_var_params: | |||
body_params = local_var_params['create_uni_lend'] | |||
# 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( | |||
'/earn/uni/lends', | |||
'POST', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
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 | |||
_preload_content=local_var_params.get('_preload_content', True), | |||
_request_timeout=local_var_params.get('_request_timeout'), | |||
collection_formats=collection_formats, | |||
) | |||
def change_uni_lend(self, patch_uni_lend, **kwargs): # noqa: E501 | |||
"""Amend lending order # noqa: E501 | |||
Currently only supports amending the minimum interest rate (hour) # noqa: E501 | |||
This method makes a synchronous HTTP request by default. To make an | |||
asynchronous HTTP request, please pass async_req=True | |||
>>> thread = api.change_uni_lend(patch_uni_lend, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param PatchUniLend patch_uni_lend: (required) | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: None | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.change_uni_lend_with_http_info(patch_uni_lend, **kwargs) # noqa: E501 | |||
def change_uni_lend_with_http_info(self, patch_uni_lend, **kwargs): # noqa: E501 | |||
"""Amend lending order # noqa: E501 | |||
Currently only supports amending the minimum interest rate (hour) # noqa: E501 | |||
This method makes a synchronous HTTP request by default. To make an | |||
asynchronous HTTP request, please pass async_req=True | |||
>>> thread = api.change_uni_lend_with_http_info(patch_uni_lend, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param PatchUniLend patch_uni_lend: (required) | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: None | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['patch_uni_lend'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method change_uni_lend" % k) | |||
local_var_params[k] = v | |||
del local_var_params['kwargs'] | |||
# verify the required parameter 'patch_uni_lend' is set | |||
if self.api_client.client_side_validation and ( | |||
'patch_uni_lend' not in local_var_params or local_var_params['patch_uni_lend'] is None # noqa: E501 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Missing the required parameter `patch_uni_lend` when calling `change_uni_lend`" | |||
) # noqa: E501 | |||
collection_formats = {} | |||
path_params = {} | |||
query_params = [] | |||
header_params = {} | |||
form_params = [] | |||
local_var_files = {} | |||
body_params = None | |||
if 'patch_uni_lend' in local_var_params: | |||
body_params = local_var_params['patch_uni_lend'] | |||
# 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( | |||
'/earn/uni/lends', | |||
'PATCH', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
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 | |||
_preload_content=local_var_params.get('_preload_content', True), | |||
_request_timeout=local_var_params.get('_request_timeout'), | |||
collection_formats=collection_formats, | |||
) | |||
def list_uni_lend_records(self, **kwargs): # noqa: E501 | |||
"""List records of lending # 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_uni_lend_records(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency: Retrieve data of the specified currency | |||
:param int page: Page number | |||
:param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100 | |||
:param str type: type: lend - lend, redeem - redeem | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: list[gate_api.UniLendRecord] | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.list_uni_lend_records_with_http_info(**kwargs) # noqa: E501 | |||
def list_uni_lend_records_with_http_info(self, **kwargs): # noqa: E501 | |||
"""List records of lending # 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_uni_lend_records_with_http_info(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency: Retrieve data of the specified currency | |||
:param int page: Page number | |||
:param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100 | |||
:param str type: type: lend - lend, redeem - redeem | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(list[gate_api.UniLendRecord], status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['currency', 'page', 'limit', 'type'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_uni_lend_records" % k) | |||
local_var_params[k] = v | |||
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_uni_lend_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'] > 100 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Invalid value for parameter `limit` when calling `list_uni_lend_records`, 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_uni_lend_records`, 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 | |||
query_params.append(('currency', local_var_params['currency'])) # 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 | |||
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 = {} | |||
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( | |||
'/earn/uni/lend_records', | |||
'GET', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='list[UniLendRecord]', # noqa: E501 | |||
auth_settings=auth_settings, | |||
async_req=local_var_params.get('async_req'), | |||
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 | |||
_preload_content=local_var_params.get('_preload_content', True), | |||
_request_timeout=local_var_params.get('_request_timeout'), | |||
collection_formats=collection_formats, | |||
) | |||
def get_uni_interest(self, currency, **kwargs): # noqa: E501 | |||
"""Get the user's total interest income of specified currency # 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_uni_interest(currency, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency: 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. | |||
:rtype: gate_api.UniLendInterest | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.get_uni_interest_with_http_info(currency, **kwargs) # noqa: E501 | |||
def get_uni_interest_with_http_info(self, currency, **kwargs): # noqa: E501 | |||
"""Get the user's total interest income of specified currency # 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_uni_interest_with_http_info(currency, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency: Currency (required) | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(gate_api.UniLendInterest, status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['currency'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_uni_interest" % k) | |||
local_var_params[k] = v | |||
del local_var_params['kwargs'] | |||
# verify the required parameter 'currency' is set | |||
if self.api_client.client_side_validation and ( | |||
'currency' not in local_var_params or local_var_params['currency'] is None # noqa: E501 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Missing the required parameter `currency` when calling `get_uni_interest`" | |||
) # noqa: E501 | |||
collection_formats = {} | |||
path_params = {} | |||
if 'currency' in local_var_params: | |||
path_params['currency'] = local_var_params['currency'] # noqa: E501 | |||
query_params = [] | |||
header_params = {} | |||
form_params = [] | |||
local_var_files = {} | |||
body_params = None | |||
# HTTP header `Accept` | |||
header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501 | |||
# Authentication setting | |||
auth_settings = ['apiv4'] # noqa: E501 | |||
return self.api_client.call_api( | |||
'/earn/uni/interests/{currency}', | |||
'GET', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='UniLendInterest', # 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_uni_interest_records(self, **kwargs): # noqa: E501 | |||
"""List interest 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_uni_interest_records(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency: Retrieve data of the specified currency | |||
:param int page: Page number | |||
:param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100 | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: list[gate_api.UniInterestRecord] | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.list_uni_interest_records_with_http_info(**kwargs) # noqa: E501 | |||
def list_uni_interest_records_with_http_info(self, **kwargs): # noqa: E501 | |||
"""List interest 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_uni_interest_records_with_http_info(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency: Retrieve data of the specified currency | |||
:param int page: Page number | |||
:param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100 | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(list[gate_api.UniInterestRecord], status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['currency', 'page', 'limit'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_uni_interest_records" % k) | |||
local_var_params[k] = v | |||
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_uni_interest_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'] > 100 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Invalid value for parameter `limit` when calling `list_uni_interest_records`, 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_uni_interest_records`, 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 | |||
query_params.append(('currency', local_var_params['currency'])) # 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 = {} | |||
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( | |||
'/earn/uni/interest_records', | |||
'GET', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='list[UniInterestRecord]', # 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, | |||
) |
@ -0,0 +1,590 @@ | |||
# coding: utf-8 | |||
""" | |||
Gate API v4 | |||
Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # noqa: E501 | |||
Contact: support@mail.gate.io | |||
Generated by: https://openapi-generator.tech | |||
""" | |||
from __future__ import absolute_import | |||
import re # noqa: F401 | |||
# python 2 and python 3 compatibility library | |||
import six | |||
from gate_api.api_client import ApiClient | |||
from gate_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 | |||
class FlashSwapApi(object): | |||
"""NOTE: This class is auto generated by OpenAPI Generator | |||
Ref: https://openapi-generator.tech | |||
Do not edit the class manually. | |||
""" | |||
def __init__(self, api_client=None): | |||
if api_client is None: | |||
api_client = ApiClient() | |||
self.api_client = api_client | |||
def list_flash_swap_currencies(self, **kwargs): # noqa: E501 | |||
"""List all supported currencies in flash swap # 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_flash_swap_currencies(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: list[gate_api.FlashSwapCurrency] | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.list_flash_swap_currencies_with_http_info(**kwargs) # noqa: E501 | |||
def list_flash_swap_currencies_with_http_info(self, **kwargs): # noqa: E501 | |||
"""List all supported currencies in flash swap # 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_flash_swap_currencies_with_http_info(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(list[gate_api.FlashSwapCurrency], status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = [] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError( | |||
"Got an unexpected keyword argument '%s'" " to method list_flash_swap_currencies" % k | |||
) | |||
local_var_params[k] = v | |||
del local_var_params['kwargs'] | |||
collection_formats = {} | |||
path_params = {} | |||
query_params = [] | |||
header_params = {} | |||
form_params = [] | |||
local_var_files = {} | |||
body_params = None | |||
# HTTP header `Accept` | |||
header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501 | |||
# Authentication setting | |||
auth_settings = [] # noqa: E501 | |||
return self.api_client.call_api( | |||
'/flash_swap/currencies', | |||
'GET', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='list[FlashSwapCurrency]', # 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_flash_swap_orders(self, **kwargs): # noqa: E501 | |||
"""List all flash swap 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_flash_swap_orders(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param int status: Flash swap order status `1` - success `2` - failure | |||
:param str sell_currency: Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies` | |||
:param str buy_currency: Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies` | |||
:param bool reverse: If results are sorted by id in reverse order. Default to `true` - `true`: sort by id in descending order(recent first) - `false`: sort by id in ascending order(oldest first) | |||
:param int limit: Maximum number of records to be returned in a single list | |||
:param int page: Page number | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: list[gate_api.FlashSwapOrder] | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.list_flash_swap_orders_with_http_info(**kwargs) # noqa: E501 | |||
def list_flash_swap_orders_with_http_info(self, **kwargs): # noqa: E501 | |||
"""List all flash swap 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_flash_swap_orders_with_http_info(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param int status: Flash swap order status `1` - success `2` - failure | |||
:param str sell_currency: Currency to sell which can be retrieved from supported currency list API `GET /flash_swap/currencies` | |||
:param str buy_currency: Currency to buy which can be retrieved from supported currency list API `GET /flash_swap/currencies` | |||
:param bool reverse: If results are sorted by id in reverse order. Default to `true` - `true`: sort by id in descending order(recent first) - `false`: sort by id in ascending order(oldest first) | |||
:param int limit: Maximum number of records to be returned in a single list | |||
:param int page: Page number | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(list[gate_api.FlashSwapOrder], status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['status', 'sell_currency', 'buy_currency', 'reverse', 'limit', 'page'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_flash_swap_orders" % k) | |||
local_var_params[k] = v | |||
del local_var_params['kwargs'] | |||
if ( | |||
self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Invalid value for parameter `limit` when calling `list_flash_swap_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_flash_swap_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_flash_swap_orders`, must be a value greater than or equal to `1`" | |||
) # noqa: E501 | |||
collection_formats = {} | |||
path_params = {} | |||
query_params = [] | |||
if 'status' in local_var_params and local_var_params['status'] is not None: # noqa: E501 | |||
query_params.append(('status', local_var_params['status'])) # noqa: E501 | |||
if 'sell_currency' in local_var_params and local_var_params['sell_currency'] is not None: # noqa: E501 | |||
query_params.append(('sell_currency', local_var_params['sell_currency'])) # noqa: E501 | |||
if 'buy_currency' in local_var_params and local_var_params['buy_currency'] is not None: # noqa: E501 | |||
query_params.append(('buy_currency', local_var_params['buy_currency'])) # noqa: E501 | |||
if 'reverse' in local_var_params and local_var_params['reverse'] is not None: # noqa: E501 | |||
query_params.append(('reverse', local_var_params['reverse'])) # noqa: E501 | |||
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 and local_var_params['page'] is not None: # noqa: E501 | |||
query_params.append(('page', local_var_params['page'])) # 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( | |||
'/flash_swap/orders', | |||
'GET', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='list[FlashSwapOrder]', # noqa: E501 | |||
auth_settings=auth_settings, | |||
async_req=local_var_params.get('async_req'), | |||
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 | |||
_preload_content=local_var_params.get('_preload_content', True), | |||
_request_timeout=local_var_params.get('_request_timeout'), | |||
collection_formats=collection_formats, | |||
) | |||
def create_flash_swap_order(self, flash_swap_order_request, **kwargs): # noqa: E501 | |||
"""Create a flash swap order # noqa: E501 | |||
Initiate a flash swap preview in advance because order creation requires a preview result # 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_flash_swap_order(flash_swap_order_request, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param FlashSwapOrderRequest flash_swap_order_request: (required) | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: gate_api.FlashSwapOrder | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.create_flash_swap_order_with_http_info(flash_swap_order_request, **kwargs) # noqa: E501 | |||
def create_flash_swap_order_with_http_info(self, flash_swap_order_request, **kwargs): # noqa: E501 | |||
"""Create a flash swap order # noqa: E501 | |||
Initiate a flash swap preview in advance because order creation requires a preview result # 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_flash_swap_order_with_http_info(flash_swap_order_request, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param FlashSwapOrderRequest flash_swap_order_request: (required) | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(gate_api.FlashSwapOrder, status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['flash_swap_order_request'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_flash_swap_order" % k) | |||
local_var_params[k] = v | |||
del local_var_params['kwargs'] | |||
# verify the required parameter 'flash_swap_order_request' is set | |||
if self.api_client.client_side_validation and ( | |||
'flash_swap_order_request' not in local_var_params | |||
or local_var_params['flash_swap_order_request'] is None # noqa: E501 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Missing the required parameter `flash_swap_order_request` when calling `create_flash_swap_order`" | |||
) # noqa: E501 | |||
collection_formats = {} | |||
path_params = {} | |||
query_params = [] | |||
header_params = {} | |||
form_params = [] | |||
local_var_files = {} | |||
body_params = None | |||
if 'flash_swap_order_request' in local_var_params: | |||
body_params = local_var_params['flash_swap_order_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( | |||
'/flash_swap/orders', | |||
'POST', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='FlashSwapOrder', # noqa: E501 | |||
auth_settings=auth_settings, | |||
async_req=local_var_params.get('async_req'), | |||
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 | |||
_preload_content=local_var_params.get('_preload_content', True), | |||
_request_timeout=local_var_params.get('_request_timeout'), | |||
collection_formats=collection_formats, | |||
) | |||
def get_flash_swap_order(self, order_id, **kwargs): # noqa: E501 | |||
"""Get a single flash swap order's detail # noqa: E501 | |||
This method makes a synchronous HTTP request by default. To make an | |||
asynchronous HTTP request, please pass async_req=True | |||
>>> thread = api.get_flash_swap_order(order_id, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param int order_id: Flash swap order ID (required) | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: gate_api.FlashSwapOrder | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.get_flash_swap_order_with_http_info(order_id, **kwargs) # noqa: E501 | |||
def get_flash_swap_order_with_http_info(self, order_id, **kwargs): # noqa: E501 | |||
"""Get a single flash swap order's detail # noqa: E501 | |||
This method makes a synchronous HTTP request by default. To make an | |||
asynchronous HTTP request, please pass async_req=True | |||
>>> thread = api.get_flash_swap_order_with_http_info(order_id, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param int order_id: Flash swap order ID (required) | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(gate_api.FlashSwapOrder, status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['order_id'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_flash_swap_order" % k) | |||
local_var_params[k] = v | |||
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 local_var_params['order_id'] is None # noqa: E501 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Missing the required parameter `order_id` when calling `get_flash_swap_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 = [] | |||
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( | |||
'/flash_swap/orders/{order_id}', | |||
'GET', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='FlashSwapOrder', # 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 preview_flash_swap_order(self, flash_swap_order_request, **kwargs): # noqa: E501 | |||
"""Initiate a flash swap order preview # noqa: E501 | |||
This method makes a synchronous HTTP request by default. To make an | |||
asynchronous HTTP request, please pass async_req=True | |||
>>> thread = api.preview_flash_swap_order(flash_swap_order_request, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param FlashSwapOrderRequest flash_swap_order_request: (required) | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: gate_api.FlashSwapOrderPreview | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.preview_flash_swap_order_with_http_info(flash_swap_order_request, **kwargs) # noqa: E501 | |||
def preview_flash_swap_order_with_http_info(self, flash_swap_order_request, **kwargs): # noqa: E501 | |||
"""Initiate a flash swap order preview # noqa: E501 | |||
This method makes a synchronous HTTP request by default. To make an | |||
asynchronous HTTP request, please pass async_req=True | |||
>>> thread = api.preview_flash_swap_order_with_http_info(flash_swap_order_request, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param FlashSwapOrderRequest flash_swap_order_request: (required) | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(gate_api.FlashSwapOrderPreview, status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['flash_swap_order_request'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method preview_flash_swap_order" % k) | |||
local_var_params[k] = v | |||
del local_var_params['kwargs'] | |||
# verify the required parameter 'flash_swap_order_request' is set | |||
if self.api_client.client_side_validation and ( | |||
'flash_swap_order_request' not in local_var_params | |||
or local_var_params['flash_swap_order_request'] is None # noqa: E501 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Missing the required parameter `flash_swap_order_request` when calling `preview_flash_swap_order`" | |||
) # noqa: E501 | |||
collection_formats = {} | |||
path_params = {} | |||
query_params = [] | |||
header_params = {} | |||
form_params = [] | |||
local_var_files = {} | |||
body_params = None | |||
if 'flash_swap_order_request' in local_var_params: | |||
body_params = local_var_params['flash_swap_order_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( | |||
'/flash_swap/orders/preview', | |||
'POST', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='FlashSwapOrderPreview', # 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, | |||
) |
@ -0,0 +1,839 @@ | |||
# coding: utf-8 | |||
""" | |||
Gate API v4 | |||
Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # noqa: E501 | |||
Contact: support@mail.gate.io | |||
Generated by: https://openapi-generator.tech | |||
""" | |||
from __future__ import absolute_import | |||
import re # noqa: F401 | |||
# python 2 and python 3 compatibility library | |||
import six | |||
from gate_api.api_client import ApiClient | |||
from gate_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 | |||
class MarginUniApi(object): | |||
"""NOTE: This class is auto generated by OpenAPI Generator | |||
Ref: https://openapi-generator.tech | |||
Do not edit the class manually. | |||
""" | |||
def __init__(self, api_client=None): | |||
if api_client is None: | |||
api_client = ApiClient() | |||
self.api_client = api_client | |||
def list_uni_currency_pairs(self, **kwargs): # noqa: E501 | |||
"""List lending markets # 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_uni_currency_pairs(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: list[gate_api.UniCurrencyPair] | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.list_uni_currency_pairs_with_http_info(**kwargs) # noqa: E501 | |||
def list_uni_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 | |||
"""List lending markets # 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_uni_currency_pairs_with_http_info(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(list[gate_api.UniCurrencyPair], status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = [] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_uni_currency_pairs" % k) | |||
local_var_params[k] = v | |||
del local_var_params['kwargs'] | |||
collection_formats = {} | |||
path_params = {} | |||
query_params = [] | |||
header_params = {} | |||
form_params = [] | |||
local_var_files = {} | |||
body_params = None | |||
# HTTP header `Accept` | |||
header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501 | |||
# Authentication setting | |||
auth_settings = [] # noqa: E501 | |||
return self.api_client.call_api( | |||
'/margin/uni/currency_pairs', | |||
'GET', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='list[UniCurrencyPair]', # noqa: E501 | |||
auth_settings=auth_settings, | |||
async_req=local_var_params.get('async_req'), | |||
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 | |||
_preload_content=local_var_params.get('_preload_content', True), | |||
_request_timeout=local_var_params.get('_request_timeout'), | |||
collection_formats=collection_formats, | |||
) | |||
def get_uni_currency_pair(self, currency_pair, **kwargs): # noqa: E501 | |||
"""Get detail of lending market # 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_uni_currency_pair(currency_pair, async_req=True) | |||
>>> result = thread.get() | |||
: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. | |||
:rtype: gate_api.UniCurrencyPair | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.get_uni_currency_pair_with_http_info(currency_pair, **kwargs) # noqa: E501 | |||
def get_uni_currency_pair_with_http_info(self, currency_pair, **kwargs): # noqa: E501 | |||
"""Get detail of lending market # 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_uni_currency_pair_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 _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.UniCurrencyPair, 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 k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_uni_currency_pair" % k) | |||
local_var_params[k] = v | |||
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 local_var_params['currency_pair'] is None # noqa: E501 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Missing the required parameter `currency_pair` when calling `get_uni_currency_pair`" | |||
) # 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 = [] | |||
header_params = {} | |||
form_params = [] | |||
local_var_files = {} | |||
body_params = None | |||
# HTTP header `Accept` | |||
header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501 | |||
# Authentication setting | |||
auth_settings = [] # noqa: E501 | |||
return self.api_client.call_api( | |||
'/margin/uni/currency_pairs/{currency_pair}', | |||
'GET', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='UniCurrencyPair', # 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_uni_loans(self, **kwargs): # noqa: E501 | |||
"""List 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_uni_loans(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency_pair: Currency pair | |||
:param str currency: Retrieve data of the specified currency | |||
:param int page: Page number | |||
:param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100 | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: list[gate_api.UniLoan] | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.list_uni_loans_with_http_info(**kwargs) # noqa: E501 | |||
def list_uni_loans_with_http_info(self, **kwargs): # noqa: E501 | |||
"""List 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_uni_loans_with_http_info(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency_pair: Currency pair | |||
:param str currency: Retrieve data of the specified currency | |||
:param int page: Page number | |||
:param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100 | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(list[gate_api.UniLoan], status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['currency_pair', 'currency', 'page', 'limit'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_uni_loans" % k) | |||
local_var_params[k] = v | |||
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_uni_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'] > 100 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Invalid value for parameter `limit` when calling `list_uni_loans`, 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_uni_loans`, 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 '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 '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 = {} | |||
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/uni/loans', | |||
'GET', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='list[UniLoan]', # noqa: E501 | |||
auth_settings=auth_settings, | |||
async_req=local_var_params.get('async_req'), | |||
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 | |||
_preload_content=local_var_params.get('_preload_content', True), | |||
_request_timeout=local_var_params.get('_request_timeout'), | |||
collection_formats=collection_formats, | |||
) | |||
def create_uni_loan(self, create_uni_loan, **kwargs): # noqa: E501 | |||
"""Borrow or repay # 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_uni_loan(create_uni_loan, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param CreateUniLoan create_uni_loan: (required) | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: None | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.create_uni_loan_with_http_info(create_uni_loan, **kwargs) # noqa: E501 | |||
def create_uni_loan_with_http_info(self, create_uni_loan, **kwargs): # noqa: E501 | |||
"""Borrow or repay # 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_uni_loan_with_http_info(create_uni_loan, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param CreateUniLoan create_uni_loan: (required) | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: None | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['create_uni_loan'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_uni_loan" % k) | |||
local_var_params[k] = v | |||
del local_var_params['kwargs'] | |||
# verify the required parameter 'create_uni_loan' is set | |||
if self.api_client.client_side_validation and ( | |||
'create_uni_loan' not in local_var_params or local_var_params['create_uni_loan'] is None # noqa: E501 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Missing the required parameter `create_uni_loan` when calling `create_uni_loan`" | |||
) # noqa: E501 | |||
collection_formats = {} | |||
path_params = {} | |||
query_params = [] | |||
header_params = {} | |||
form_params = [] | |||
local_var_files = {} | |||
body_params = None | |||
if 'create_uni_loan' in local_var_params: | |||
body_params = local_var_params['create_uni_loan'] | |||
# 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/uni/loans', | |||
'POST', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
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 | |||
_preload_content=local_var_params.get('_preload_content', True), | |||
_request_timeout=local_var_params.get('_request_timeout'), | |||
collection_formats=collection_formats, | |||
) | |||
def list_uni_loan_records(self, **kwargs): # noqa: E501 | |||
"""Get load 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_uni_loan_records(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str type: type: borrow - borrow, repay - repay | |||
:param str currency: Retrieve data of the specified currency | |||
:param str currency_pair: Currency pair | |||
:param int page: Page number | |||
:param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100 | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: list[gate_api.UniLoanRecord] | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.list_uni_loan_records_with_http_info(**kwargs) # noqa: E501 | |||
def list_uni_loan_records_with_http_info(self, **kwargs): # noqa: E501 | |||
"""Get load 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_uni_loan_records_with_http_info(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str type: type: borrow - borrow, repay - repay | |||
:param str currency: Retrieve data of the specified currency | |||
:param str currency_pair: Currency pair | |||
:param int page: Page number | |||
:param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100 | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(list[gate_api.UniLoanRecord], status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['type', 'currency', 'currency_pair', 'page', 'limit'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_uni_loan_records" % k) | |||
local_var_params[k] = v | |||
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_uni_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'] > 100 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Invalid value for parameter `limit` when calling `list_uni_loan_records`, 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_uni_loan_records`, must be a value greater than or equal to `1`" | |||
) # noqa: E501 | |||
collection_formats = {} | |||
path_params = {} | |||
query_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 | |||
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 '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 = {} | |||
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/uni/loan_records', | |||
'GET', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='list[UniLoanRecord]', # 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_uni_loan_interest_records(self, **kwargs): # noqa: E501 | |||
"""List interest 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_uni_loan_interest_records(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency_pair: Currency pair | |||
:param str currency: Retrieve data of the specified currency | |||
:param int page: Page number | |||
:param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100 | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: list[gate_api.UniLoanInterestRecord] | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.list_uni_loan_interest_records_with_http_info(**kwargs) # noqa: E501 | |||
def list_uni_loan_interest_records_with_http_info(self, **kwargs): # noqa: E501 | |||
"""List interest 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_uni_loan_interest_records_with_http_info(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency_pair: Currency pair | |||
:param str currency: Retrieve data of the specified currency | |||
:param int page: Page number | |||
:param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100 | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(list[gate_api.UniLoanInterestRecord], status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['currency_pair', 'currency', 'page', 'limit'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError( | |||
"Got an unexpected keyword argument '%s'" " to method list_uni_loan_interest_records" % k | |||
) | |||
local_var_params[k] = v | |||
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_uni_loan_interest_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'] > 100 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Invalid value for parameter `limit` when calling `list_uni_loan_interest_records`, 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_uni_loan_interest_records`, 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 '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 '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 = {} | |||
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/uni/interest_records', | |||
'GET', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='list[UniLoanInterestRecord]', # noqa: E501 | |||
auth_settings=auth_settings, | |||
async_req=local_var_params.get('async_req'), | |||
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 | |||
_preload_content=local_var_params.get('_preload_content', True), | |||
_request_timeout=local_var_params.get('_request_timeout'), | |||
collection_formats=collection_formats, | |||
) | |||
def get_uni_borrowable(self, currency, currency_pair, **kwargs): # noqa: E501 | |||
"""Get maximum borrowable # 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_uni_borrowable(currency, currency_pair, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency: Retrieve data of the specified currency (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. | |||
:rtype: gate_api.MaxUniBorrowable | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.get_uni_borrowable_with_http_info(currency, currency_pair, **kwargs) # noqa: E501 | |||
def get_uni_borrowable_with_http_info(self, currency, currency_pair, **kwargs): # noqa: E501 | |||
"""Get maximum borrowable # 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_uni_borrowable_with_http_info(currency, currency_pair, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency: Retrieve data of the specified currency (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 | |||
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.MaxUniBorrowable, 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'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_uni_borrowable" % k) | |||
local_var_params[k] = v | |||
del local_var_params['kwargs'] | |||
# verify the required parameter 'currency' is set | |||
if self.api_client.client_side_validation and ( | |||
'currency' not in local_var_params or local_var_params['currency'] is None # noqa: E501 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Missing the required parameter `currency` when calling `get_uni_borrowable`" | |||
) # 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 local_var_params['currency_pair'] is None # noqa: E501 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Missing the required parameter `currency_pair` when calling `get_uni_borrowable`" | |||
) # 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 '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( | |||
'/margin/uni/borrowable', | |||
'GET', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='MaxUniBorrowable', # 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, | |||
) |
@ -0,0 +1,312 @@ | |||
# coding: utf-8 | |||
""" | |||
Gate API v4 | |||
Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # noqa: E501 | |||
Contact: support@mail.gate.io | |||
Generated by: https://openapi-generator.tech | |||
""" | |||
from __future__ import absolute_import | |||
import re # noqa: F401 | |||
# python 2 and python 3 compatibility library | |||
import six | |||
from gate_api.api_client import ApiClient | |||
from gate_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 | |||
class RebateApi(object): | |||
"""NOTE: This class is auto generated by OpenAPI Generator | |||
Ref: https://openapi-generator.tech | |||
Do not edit the class manually. | |||
""" | |||
def __init__(self, api_client=None): | |||
if api_client is None: | |||
api_client = ApiClient() | |||
self.api_client = api_client | |||
def agency_transaction_history(self, **kwargs): # noqa: E501 | |||
"""The broker obtains the transaction history of the recommended user # 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.agency_transaction_history(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency_pair: Specify the currency pair, if not specified, return all currency pairs | |||
:param str user_id: User ID. If not specified, all user records will be returned | |||
: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 to be returned in a single 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. | |||
:rtype: list[gate_api.AgencyTransactionHistory] | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.agency_transaction_history_with_http_info(**kwargs) # noqa: E501 | |||
def agency_transaction_history_with_http_info(self, **kwargs): # noqa: E501 | |||
"""The broker obtains the transaction history of the recommended user # 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.agency_transaction_history_with_http_info(async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str currency_pair: Specify the currency pair, if not specified, return all currency pairs | |||
:param str user_id: User ID. If not specified, all user records will be returned | |||
: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 to be returned in a single 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 | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(list[gate_api.AgencyTransactionHistory], status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['currency_pair', 'user_id', '_from', 'to', 'limit', 'offset'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError( | |||
"Got an unexpected keyword argument '%s'" " to method agency_transaction_history" % k | |||
) | |||
local_var_params[k] = v | |||
del local_var_params['kwargs'] | |||
if ( | |||
self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Invalid value for parameter `limit` when calling `agency_transaction_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 `agency_transaction_history`, 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 `agency_transaction_history`, must be a value greater than or equal to `0`" | |||
) # 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 'user_id' in local_var_params and local_var_params['user_id'] is not None: # noqa: E501 | |||
query_params.append(('user_id', local_var_params['user_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 '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 = {} | |||
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( | |||
'/rebate/agency/transaction_history', | |||
'GET', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='list[AgencyTransactionHistory]', # 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 agency_commissions_history(self, **kwargs): # noqa: E501 | |||
"""The broker obtains the commission history of the recommended user # 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.agency_commissions_history(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 str user_id: User ID. If not specified, all user records will be returned | |||
: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 to be returned in a single 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. | |||
:rtype: list[gate_api.AgencyCommissionHistory] | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.agency_commissions_history_with_http_info(**kwargs) # noqa: E501 | |||
def agency_commissions_history_with_http_info(self, **kwargs): # noqa: E501 | |||
"""The broker obtains the commission history of the recommended user # 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.agency_commissions_history_with_http_info(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 str user_id: User ID. If not specified, all user records will be returned | |||
: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 to be returned in a single 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 | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(list[gate_api.AgencyCommissionHistory], status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['currency', 'user_id', '_from', 'to', 'limit', 'offset'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError( | |||
"Got an unexpected keyword argument '%s'" " to method agency_commissions_history" % k | |||
) | |||
local_var_params[k] = v | |||
del local_var_params['kwargs'] | |||
if ( | |||
self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Invalid value for parameter `limit` when calling `agency_commissions_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 `agency_commissions_history`, 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 `agency_commissions_history`, 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 'user_id' in local_var_params and local_var_params['user_id'] is not None: # noqa: E501 | |||
query_params.append(('user_id', local_var_params['user_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 '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 = {} | |||
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( | |||
'/rebate/agency/commission_history', | |||
'GET', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='list[AgencyCommissionHistory]', # 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, | |||
) |
@ -0,0 +1,245 @@ | |||
# coding: utf-8 | |||
""" | |||
Gate API v4 | |||
Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # noqa: E501 | |||
Contact: support@mail.gate.io | |||
Generated by: https://openapi-generator.tech | |||
""" | |||
from __future__ import absolute_import | |||
import re # noqa: F401 | |||
# python 2 and python 3 compatibility library | |||
import six | |||
from gate_api.api_client import ApiClient | |||
from gate_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 | |||
class WithdrawalApi(object): | |||
"""NOTE: This class is auto generated by OpenAPI Generator | |||
Ref: https://openapi-generator.tech | |||
Do not edit the class manually. | |||
""" | |||
def __init__(self, api_client=None): | |||
if api_client is None: | |||
api_client = ApiClient() | |||
self.api_client = api_client | |||
def withdraw(self, ledger_record, **kwargs): # noqa: E501 | |||
"""Withdraw # noqa: E501 | |||
This method makes a synchronous HTTP request by default. To make an | |||
asynchronous HTTP request, please pass async_req=True | |||
>>> thread = api.withdraw(ledger_record, async_req=True) | |||
>>> result = thread.get() | |||
: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. | |||
:rtype: gate_api.LedgerRecord | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
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 | |||
This method makes a synchronous HTTP request by default. To make an | |||
asynchronous HTTP request, please pass async_req=True | |||
>>> thread = api.withdraw_with_http_info(ledger_record, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param LedgerRecord ledger_record: (required) | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(gate_api.LedgerRecord, status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['ledger_record'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method withdraw" % k) | |||
local_var_params[k] = v | |||
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 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 = {} | |||
path_params = {} | |||
query_params = [] | |||
header_params = {} | |||
form_params = [] | |||
local_var_files = {} | |||
body_params = None | |||
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 | |||
# 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( | |||
'/withdrawals', | |||
'POST', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='LedgerRecord', # noqa: E501 | |||
auth_settings=auth_settings, | |||
async_req=local_var_params.get('async_req'), | |||
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 | |||
_preload_content=local_var_params.get('_preload_content', True), | |||
_request_timeout=local_var_params.get('_request_timeout'), | |||
collection_formats=collection_formats, | |||
) | |||
def cancel_withdrawal(self, withdrawal_id, **kwargs): # noqa: E501 | |||
"""Cancel withdrawal with specified ID # noqa: E501 | |||
This method makes a synchronous HTTP request by default. To make an | |||
asynchronous HTTP request, please pass async_req=True | |||
>>> thread = api.cancel_withdrawal(withdrawal_id, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str withdrawal_id: (required) | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: gate_api.LedgerRecord | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
kwargs['_return_http_data_only'] = True | |||
return self.cancel_withdrawal_with_http_info(withdrawal_id, **kwargs) # noqa: E501 | |||
def cancel_withdrawal_with_http_info(self, withdrawal_id, **kwargs): # noqa: E501 | |||
"""Cancel withdrawal with specified ID # noqa: E501 | |||
This method makes a synchronous HTTP request by default. To make an | |||
asynchronous HTTP request, please pass async_req=True | |||
>>> thread = api.cancel_withdrawal_with_http_info(withdrawal_id, async_req=True) | |||
>>> result = thread.get() | |||
:param bool async_req: execute request asynchronously | |||
:param str withdrawal_id: (required) | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param _preload_content: if False, the urllib3.HTTPResponse object will | |||
be returned without reading/decoding response | |||
data. Default is True. | |||
:param _request_timeout: timeout setting for this request. If one | |||
number provided, it will be total request | |||
timeout. It can also be a pair (tuple) of | |||
(connection, read) timeouts. | |||
:rtype: tuple(gate_api.LedgerRecord, status_code(int), headers(HTTPHeaderDict)) | |||
:return: If the method is called asynchronously, | |||
returns the request thread. | |||
""" | |||
local_var_params = locals() | |||
all_params = ['withdrawal_id'] | |||
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) | |||
for k, v in six.iteritems(local_var_params['kwargs']): | |||
if k not in all_params: | |||
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method cancel_withdrawal" % k) | |||
local_var_params[k] = v | |||
del local_var_params['kwargs'] | |||
# verify the required parameter 'withdrawal_id' is set | |||
if self.api_client.client_side_validation and ( | |||
'withdrawal_id' not in local_var_params or local_var_params['withdrawal_id'] is None # noqa: E501 | |||
): # noqa: E501 | |||
raise ApiValueError( | |||
"Missing the required parameter `withdrawal_id` when calling `cancel_withdrawal`" | |||
) # noqa: E501 | |||
collection_formats = {} | |||
path_params = {} | |||
if 'withdrawal_id' in local_var_params: | |||
path_params['withdrawal_id'] = local_var_params['withdrawal_id'] # noqa: E501 | |||
query_params = [] | |||
header_params = {} | |||
form_params = [] | |||
local_var_files = {} | |||
body_params = None | |||
# HTTP header `Accept` | |||
header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501 | |||
# Authentication setting | |||
auth_settings = ['apiv4'] # noqa: E501 | |||
return self.api_client.call_api( | |||
'/withdrawals/{withdrawal_id}', | |||
'DELETE', | |||
path_params, | |||
query_params, | |||
header_params, | |||
body=body_params, | |||
post_params=form_params, | |||
files=local_var_files, | |||
response_type='LedgerRecord', # noqa: E501 | |||
auth_settings=auth_settings, | |||
async_req=local_var_params.get('async_req'), | |||
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 | |||
_preload_content=local_var_params.get('_preload_content', True), | |||
_request_timeout=local_var_params.get('_request_timeout'), | |||
collection_formats=collection_formats, | |||
) |
@ -0,0 +1,744 @@ | |||
# coding: utf-8 | |||
""" | |||
Gate API v4 | |||
Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # noqa: E501 | |||
Contact: support@mail.gate.io | |||
Generated by: https://openapi-generator.tech | |||
""" | |||
from __future__ import absolute_import | |||
import atexit | |||
import datetime | |||
import hashlib | |||
import hmac | |||
import time | |||
from six.moves.urllib.parse import unquote_plus, urlencode, urlparse | |||
from dateutil.parser import parse | |||
import json | |||
import mimetypes | |||
from multiprocessing.pool import ThreadPool | |||
import os | |||
import re | |||
import tempfile | |||
# python 2 and python 3 compatibility library | |||
import six | |||
from six.moves.urllib.parse import quote | |||
from gate_api.configuration import Configuration | |||
import gate_api.models | |||
from gate_api import rest | |||
from gate_api.exceptions import ApiValueError, ApiException, GateApiException | |||
class ApiClient(object): | |||
"""Generic API client for OpenAPI client library builds. | |||
OpenAPI generic API client. This client handles the client- | |||
server communication, and is invariant across implementations. Specifics of | |||
the methods and models for each application are generated from the OpenAPI | |||
templates. | |||
NOTE: This class is auto generated by OpenAPI Generator. | |||
Ref: https://openapi-generator.tech | |||
Do not edit the class manually. | |||
:param configuration: .Configuration object for this client | |||
:param header_name: a header to pass when making calls to the API. | |||
:param header_value: a header value to pass when making calls to | |||
the API. | |||
:param cookie: a cookie to include in the header when making calls | |||
to the API | |||
:param pool_threads: The number of threads to use for async requests | |||
to the API. More threads means more concurrent API requests. | |||
""" | |||
PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types | |||
NATIVE_TYPES_MAPPING = { | |||
'int': int, | |||
'long': int if six.PY3 else long, # noqa: F821 | |||
'float': float, | |||
'str': str, | |||
'bool': bool, | |||
'date': datetime.date, | |||
'datetime': datetime.datetime, | |||
'object': object, | |||
} | |||
_pool = None | |||
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 | |||
self.pool_threads = pool_threads | |||
self.rest_client = rest.RESTClientObject(configuration) | |||
self.default_headers = {} | |||
if header_name is not None: | |||
self.default_headers[header_name] = header_value | |||
self.cookie = cookie | |||
# Set default User-Agent. | |||
self.user_agent = 'OpenAPI-Generator/4.42.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 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): | |||
"""Create thread pool on first request | |||
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 | |||
@property | |||
def user_agent(self): | |||
"""User agent for this API client""" | |||
return self.default_headers['User-Agent'] | |||
@user_agent.setter | |||
def user_agent(self, value): | |||
self.default_headers['User-Agent'] = value | |||
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, | |||
): | |||
config = self.configuration | |||
# header parameters | |||
header_params = header_params or {} | |||
header_params.update(self.default_headers) | |||
if self.cookie: | |||
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)) | |||
# path parameters | |||
if path_params: | |||
path_params = self.sanitize_for_serialization(path_params) | |||
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)) | |||
# query parameters | |||
if query_params: | |||
query_params = self.sanitize_for_serialization(query_params) | |||
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.extend(self.files_parameters(files)) | |||
# body | |||
if body: | |||
body = self.sanitize_for_serialization(body) | |||
# request url | |||
if _host is None: | |||
url = self.configuration.host + resource_path | |||
else: | |||
# use server/host defined in path or operation instead | |||
url = _host + resource_path | |||
# 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 | |||
try: | |||
err = json.loads(e.body) | |||
except ValueError: | |||
raise e | |||
else: | |||
if not err.get('label'): | |||
raise e | |||
raise GateApiException(err.get('label'), err.get('message'), err.get('detail'), e) | |||
content_type = response_data.getheader('content-type') | |||
self.last_response = response_data | |||
return_data = response_data | |||
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 | |||
else: | |||
return (return_data, response_data.status, response_data.getheaders()) | |||
def sanitize_for_serialization(self, obj): | |||
"""Builds a JSON POST object. | |||
If obj is None, return None. | |||
If obj is str, int, long, float, bool, return directly. | |||
If obj is datetime.datetime, datetime.date | |||
convert to string in iso8601 format. | |||
If obj is list, sanitize each element in the list. | |||
If obj is dict, return the dict. | |||
If obj is OpenAPI model, return the properties dict. | |||
:param obj: The data to serialize. | |||
:return: The serialized form of data. | |||
""" | |||
if obj is None: | |||
return None | |||
elif isinstance(obj, self.PRIMITIVE_TYPES): | |||
return obj | |||
elif isinstance(obj, list): | |||
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) | |||
elif isinstance(obj, (datetime.datetime, datetime.date)): | |||
return obj.isoformat() | |||
if isinstance(obj, dict): | |||
obj_dict = obj | |||
else: | |||
# Convert model obj to dict except | |||
# attributes `openapi_types`, `attribute_map` | |||
# 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 | |||
} | |||
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. | |||
:param response: RESTResponse object to be deserialized. | |||
:param response_type: class literal for | |||
deserialized object, or string of class name. | |||
:return: deserialized object. | |||
""" | |||
# handle file downloading | |||
# save response body into a tmp file and return the instance | |||
if response_type == "file": | |||
return self.__deserialize_file(response) | |||
# fetch data from response object | |||
try: | |||
data = json.loads(response.data) | |||
except ValueError: | |||
data = response.data | |||
return self.__deserialize(data, response_type) | |||
def __deserialize(self, data, klass): | |||
"""Deserializes dict, list, str into an object. | |||
:param data: dict, list or str. | |||
:param klass: class literal, or string of class name. | |||
:return: object. | |||
""" | |||
if data is None: | |||
return None | |||
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] | |||
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)} | |||
# convert str to class | |||
if klass in self.NATIVE_TYPES_MAPPING: | |||
klass = self.NATIVE_TYPES_MAPPING[klass] | |||
else: | |||
klass = getattr(gate_api.models, klass) | |||
if klass in self.PRIMITIVE_TYPES: | |||
return self.__deserialize_primitive(data, klass) | |||
elif klass == object: | |||
return self.__deserialize_object(data) | |||
elif klass == datetime.date: | |||
return self.__deserialize_date(data) | |||
elif klass == datetime.datetime: | |||
return self.__deserialize_datetime(data) | |||
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, | |||
): | |||
"""Makes the HTTP request (synchronous) and returns deserialized data. | |||
To make an async_req request, set the async_req parameter. | |||
:param resource_path: Path to method endpoint. | |||
:param method: Method to call. | |||
:param path_params: Path parameters in the url. | |||
:param query_params: Query parameters in the url. | |||
:param header_params: Header parameters to be | |||
placed in the request header. | |||
:param body: Request body. | |||
: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. | |||
:param dict files: key -> filename, value -> filepath, | |||
for `multipart/form-data`. | |||
:param bool async_req: execute request asynchronously | |||
:param _return_http_data_only: response data without head status code | |||
and headers | |||
:param collection_formats: dict of collection formats for path, query, | |||
header, and post parameters. | |||
: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. | |||
:param _host: server/host defined in path or operation instead | |||
:return: | |||
If async_req parameter is True, | |||
the request will be called asynchronously. | |||
The method will return the request thread. | |||
If parameter async_req is False or missing, | |||
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, | |||
): | |||
"""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, | |||
) | |||
elif method == "HEAD": | |||
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, | |||
) | |||
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, | |||
) | |||
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, | |||
) | |||
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, | |||
) | |||
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`.") | |||
def parameters_to_tuples(self, params, collection_formats): | |||
"""Get parameters as list of tuples, formatting collections. | |||
:param params: Parameters as dict or list of two-tuples | |||
:param dict collection_formats: Parameter collection formats | |||
:return: Parameters as list of tuples, collections formatted | |||
""" | |||
new_params = [] | |||
if collection_formats is None: | |||
collection_formats = {} | |||
for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 | |||
if k in collection_formats: | |||
collection_format = collection_formats[k] | |||
if collection_format == 'multi': | |||
new_params.extend((k, value) for value in v) | |||
else: | |||
if collection_format == 'ssv': | |||
delimiter = ' ' | |||
elif collection_format == 'tsv': | |||
delimiter = '\t' | |||
elif collection_format == 'pipes': | |||
delimiter = '|' | |||
else: # csv is the default | |||
delimiter = ',' | |||
new_params.append((k, delimiter.join(str(value) for value in v))) | |||
else: | |||
new_params.append((k, v)) | |||
return new_params | |||
def files_parameters(self, files=None): | |||
"""Builds form parameters. | |||
:param files: File parameters. | |||
:return: Form parameters with files. | |||
""" | |||
params = [] | |||
if files: | |||
for k, v in six.iteritems(files): | |||
if not v: | |||
continue | |||
file_names = v if type(v) is list else [v] | |||
for n in file_names: | |||
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])])) | |||
return params | |||
def select_header_accept(self, accepts): | |||
"""Returns `Accept` based on an array of accepts provided. | |||
:param accepts: List of headers. | |||
:return: Accept (e.g. application/json). | |||
""" | |||
if not accepts: | |||
return | |||
accepts = [x.lower() for x in accepts] | |||
if 'application/json' in accepts: | |||
return 'application/json' | |||
else: | |||
return ', '.join(accepts) | |||
def select_header_content_type(self, content_types): | |||
"""Returns `Content-Type` based on an array of content_types provided. | |||
:param content_types: List of content-types. | |||
:return: Content-Type (e.g. application/json). | |||
""" | |||
if not content_types: | |||
return 'application/json' | |||
content_types = [x.lower() for x in content_types] | |||
if 'application/json' in content_types or '*/*' in content_types: | |||
return 'application/json' | |||
else: | |||
return content_types[0] | |||
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: | |||
return | |||
for auth in auth_settings: | |||
auth_setting = self.configuration.auth_settings().get(auth) | |||
if auth_setting: | |||
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 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 | |||
Saves response body into a file in a temporary folder, | |||
using the filename from the `Content-Disposition` header if provided. | |||
:param response: RESTResponse. | |||
:return: file path. | |||
""" | |||
fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) | |||
os.close(fd) | |||
os.remove(path) | |||
content_disposition = response.getheader("Content-Disposition") | |||
if content_disposition: | |||
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: | |||
f.write(response.data) | |||
return path | |||
def __deserialize_primitive(self, data, klass): | |||
"""Deserializes string to primitive type. | |||
:param data: str. | |||
:param klass: class literal. | |||
:return: int, long, float, str, bool. | |||
""" | |||
try: | |||
return klass(data) | |||
except UnicodeEncodeError: | |||
return six.text_type(data) | |||
except TypeError: | |||
return data | |||
def __deserialize_object(self, value): | |||
"""Return an original value. | |||
:return: object. | |||
""" | |||
return value | |||
def __deserialize_date(self, string): | |||
"""Deserializes string to date. | |||
:param string: str. | |||
:return: date. | |||
""" | |||
try: | |||
return parse(string).date() | |||
except ImportError: | |||
return string | |||
except ValueError: | |||
raise rest.ApiException(status=0, reason="Failed to parse `{0}` as date object".format(string)) | |||
def __deserialize_datetime(self, string): | |||
"""Deserializes string to datetime. | |||
The string should be in iso8601 datetime format. | |||
:param string: str. | |||
:return: datetime. | |||
""" | |||
try: | |||
return parse(string) | |||
except ImportError: | |||
return string | |||
except ValueError: | |||
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. | |||
:param data: dict, list. | |||
: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 has_discriminator is False: | |||
return data | |||
kwargs = {} | |||
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]] | |||
kwargs[attr] = self.__deserialize(value, attr_type) | |||
instance = klass(**kwargs) | |||
if has_discriminator: | |||
klass_name = instance.get_real_child_model(data) | |||
if klass_name: | |||
instance = self.__deserialize(data, klass_name) | |||
return instance |
@ -0,0 +1,369 @@ | |||
# coding: utf-8 | |||
""" | |||
Gate API v4 | |||
Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # noqa: E501 | |||
Contact: support@mail.gate.io | |||
Generated by: https://openapi-generator.tech | |||
""" | |||
from __future__ import absolute_import | |||
import copy | |||
import logging | |||
import multiprocessing | |||
import sys | |||
import urllib3 | |||
import six | |||
from six.moves import http_client as httplib | |||
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 | |||
""" | |||
_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 | |||
# 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") | |||
self.logger_format = '%(asctime)s %(levelname)s %(message)s' | |||
"""Log format | |||
""" | |||
self.logger_stream_handler = None | |||
"""Log stream handler | |||
""" | |||
self.logger_file_handler = None | |||
"""Log file handler | |||
""" | |||
self.logger_file = None | |||
"""Debug file location | |||
""" | |||
self.debug = False | |||
"""Debug switch | |||
""" | |||
self.verify_ssl = True | |||
"""SSL/TLS verification | |||
Set this to false to skip verifying SSL certificate when calling API | |||
from https server. | |||
""" | |||
self.ssl_ca_cert = None | |||
"""Set this to customize the certificate file to verify the peer. | |||
""" | |||
self.cert_file = None | |||
"""client certificate file | |||
""" | |||
self.key_file = None | |||
"""client key file | |||
""" | |||
self.assert_hostname = None | |||
"""Set this to True/False to enable/disable SSL hostname verification. | |||
""" | |||
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. | |||
""" | |||
self.proxy = None | |||
"""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. | |||
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): | |||
"""The logger file. | |||
If the logger_file is None, then add stream handler and remove file | |||
handler. Otherwise, add file handler and remove stream handler. | |||
:return: The logger_file path. | |||
""" | |||
return self.__logger_file | |||
@logger_file.setter | |||
def logger_file(self, value): | |||
"""The logger file. | |||
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 | |||
""" | |||
self.__logger_file = value | |||
if self.__logger_file: | |||
# If set logging file, | |||
# then add file handler and remove stream handler. | |||
self.logger_file_handler = logging.FileHandler(self.__logger_file) | |||
self.logger_file_handler.setFormatter(self.logger_formatter) | |||
for _, logger in six.iteritems(self.logger): | |||
logger.addHandler(self.logger_file_handler) | |||
@property | |||
def debug(self): | |||
"""Debug status | |||
:return: The debug status, True or False. | |||
""" | |||
return self.__debug | |||
@debug.setter | |||
def debug(self, value): | |||
"""Debug status | |||
:param value: The debug status, True or False. | |||
:type: bool | |||
""" | |||
self.__debug = value | |||
if self.__debug: | |||
# if debug status is True, turn on debug logging | |||
for _, logger in six.iteritems(self.logger): | |||
logger.setLevel(logging.DEBUG) | |||
# turn on httplib debug | |||
httplib.HTTPConnection.debuglevel = 1 | |||
else: | |||
# if debug status is False, turn off debug logging, | |||
# setting log level to default `logging.WARNING` | |||
for _, logger in six.iteritems(self.logger): | |||
logger.setLevel(logging.WARNING) | |||
# turn off httplib debug | |||
httplib.HTTPConnection.debuglevel = 0 | |||
@property | |||
def logger_format(self): | |||
"""The logger format. | |||
The logger_formatter will be updated when sets logger_format. | |||
:return: The format string. | |||
""" | |||
return self.__logger_format | |||
@logger_format.setter | |||
def logger_format(self, value): | |||
"""The logger format. | |||
The logger_formatter will be updated when sets logger_format. | |||
:param value: The format string. | |||
:type: str | |||
""" | |||
self.__logger_format = value | |||
self.logger_formatter = logging.Formatter(self.__logger_format) | |||
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=username + ':' + password).get('authorization') | |||
def auth_settings(self): | |||
"""Gets Auth Settings dict for api client. | |||
:return: The Auth Settings information dict. | |||
""" | |||
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. | |||
:return: The report for debugging. | |||
""" | |||
return ( | |||
"Python SDK Debug Report:\n" | |||
"OS: {env}\n" | |||
"Python Version: {pyversion}\n" | |||
"Version of the API: 4.42.0\n" | |||
"SDK Package Version: 4.42.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 |
@ -0,0 +1,133 @@ | |||
# coding: utf-8 | |||
""" | |||
Gate API v4 | |||
Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # noqa: E501 | |||
Contact: support@mail.gate.io | |||
Generated by: https://openapi-generator.tech | |||
""" | |||
import 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 | |||
class GateApiException(ApiException): | |||
def __init__(self, label=None, message=None, detail=None, exp=None): | |||
"""Init GateApiException from ApiException | |||
:param str label: error label parsed | |||
:param str message: error message parsed | |||
:param str detail: possible error message parsed | |||
:param ApiException exp: parent exception | |||
""" | |||
self.label = label | |||
self.message = detail if detail else message | |||
self.status = exp.status | |||
self.reason = exp.reason | |||
self.body = exp.body | |||
self.headers = exp.headers | |||
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 |
@ -0,0 +1,148 @@ | |||
# coding: utf-8 | |||
# flake8: noqa | |||
""" | |||
Gate API v4 | |||
Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # noqa: E501 | |||
Contact: support@mail.gate.io | |||
Generated by: https://openapi-generator.tech | |||
""" | |||
from __future__ import absolute_import | |||
# import models into model package | |||
from gate_api.models.account_balance import AccountBalance | |||
from gate_api.models.agency_commission import AgencyCommission | |||
from gate_api.models.agency_commission_history import AgencyCommissionHistory | |||
from gate_api.models.agency_transaction import AgencyTransaction | |||
from gate_api.models.agency_transaction_history import AgencyTransactionHistory | |||
from gate_api.models.api_v4_key_perm import ApiV4KeyPerm | |||
from gate_api.models.auto_repay_setting import AutoRepaySetting | |||
from gate_api.models.batch_futures_order import BatchFuturesOrder | |||
from gate_api.models.batch_order import BatchOrder | |||
from gate_api.models.cancel_order import CancelOrder | |||
from gate_api.models.cancel_order_result import CancelOrderResult | |||
from gate_api.models.contract import Contract | |||
from gate_api.models.contract_stat import ContractStat | |||
from gate_api.models.countdown_cancel_all_futures_task import CountdownCancelAllFuturesTask | |||
from gate_api.models.countdown_cancel_all_spot_task import CountdownCancelAllSpotTask | |||
from gate_api.models.create_uni_lend import CreateUniLend | |||
from gate_api.models.create_uni_loan import CreateUniLoan | |||
from gate_api.models.cross_margin_account import CrossMarginAccount | |||
from gate_api.models.cross_margin_account_book import CrossMarginAccountBook | |||
from gate_api.models.cross_margin_balance import CrossMarginBalance | |||
from gate_api.models.cross_margin_balance1 import CrossMarginBalance1 | |||
from gate_api.models.cross_margin_borrowable import CrossMarginBorrowable | |||
from gate_api.models.cross_margin_currency import CrossMarginCurrency | |||
from gate_api.models.cross_margin_loan import CrossMarginLoan | |||
from gate_api.models.cross_margin_repay_request import CrossMarginRepayRequest | |||
from gate_api.models.cross_margin_repayment import CrossMarginRepayment | |||
from gate_api.models.cross_margin_transferable import CrossMarginTransferable | |||
from gate_api.models.currency import Currency | |||
from gate_api.models.currency_chain import CurrencyChain | |||
from gate_api.models.currency_pair import CurrencyPair | |||
from gate_api.models.delivery_contract import DeliveryContract | |||
from gate_api.models.delivery_settlement import DeliverySettlement | |||
from gate_api.models.deposit_address import DepositAddress | |||
from gate_api.models.flash_swap_currency import FlashSwapCurrency | |||
from gate_api.models.flash_swap_order import FlashSwapOrder | |||
from gate_api.models.flash_swap_order_preview import FlashSwapOrderPreview | |||
from gate_api.models.flash_swap_order_request import FlashSwapOrderRequest | |||
from gate_api.models.funding_account import FundingAccount | |||
from gate_api.models.funding_book_item import FundingBookItem | |||
from gate_api.models.funding_rate_record import FundingRateRecord | |||
from gate_api.models.futures_account import FuturesAccount | |||
from gate_api.models.futures_account_book import FuturesAccountBook | |||
from gate_api.models.futures_account_history import FuturesAccountHistory | |||
from gate_api.models.futures_auto_deleverage import FuturesAutoDeleverage | |||
from gate_api.models.futures_candlestick import FuturesCandlestick | |||
from gate_api.models.futures_index_constituents import FuturesIndexConstituents | |||
from gate_api.models.futures_initial_order import FuturesInitialOrder | |||
from gate_api.models.futures_liquidate import FuturesLiquidate | |||
from gate_api.models.futures_order import FuturesOrder | |||
from gate_api.models.futures_order_amendment import FuturesOrderAmendment | |||
from gate_api.models.futures_order_book import FuturesOrderBook | |||
from gate_api.models.futures_order_book_item import FuturesOrderBookItem | |||
from gate_api.models.futures_premium_index import FuturesPremiumIndex | |||
from gate_api.models.futures_price_trigger import FuturesPriceTrigger | |||
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.index_constituent import IndexConstituent | |||
from gate_api.models.insurance_record import InsuranceRecord | |||
from gate_api.models.ledger_record import LedgerRecord | |||
from gate_api.models.liquidate_order import LiquidateOrder | |||
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_borrowable import MarginBorrowable | |||
from gate_api.models.margin_currency_pair import MarginCurrencyPair | |||
from gate_api.models.margin_transferable import MarginTransferable | |||
from gate_api.models.max_uni_borrowable import MaxUniBorrowable | |||
from gate_api.models.multi_chain_address_item import MultiChainAddressItem | |||
from gate_api.models.my_futures_trade import MyFuturesTrade | |||
from gate_api.models.my_futures_trade_time_range import MyFuturesTradeTimeRange | |||
from gate_api.models.open_orders import OpenOrders | |||
from gate_api.models.options_account import OptionsAccount | |||
from gate_api.models.options_account_book import OptionsAccountBook | |||
from gate_api.models.options_candlestick import OptionsCandlestick | |||
from gate_api.models.options_contract import OptionsContract | |||
from gate_api.models.options_my_settlements import OptionsMySettlements | |||
from gate_api.models.options_my_trade import OptionsMyTrade | |||
from gate_api.models.options_order import OptionsOrder | |||
from gate_api.models.options_position import OptionsPosition | |||
from gate_api.models.options_position_close import OptionsPositionClose | |||
from gate_api.models.options_position_close_order import OptionsPositionCloseOrder | |||
from gate_api.models.options_settlement import OptionsSettlement | |||
from gate_api.models.options_ticker import OptionsTicker | |||
from gate_api.models.options_underlying import OptionsUnderlying | |||
from gate_api.models.options_underlying_ticker import OptionsUnderlyingTicker | |||
from gate_api.models.order import Order | |||
from gate_api.models.order_book import OrderBook | |||
from gate_api.models.order_patch import OrderPatch | |||
from gate_api.models.patch_uni_lend import PatchUniLend | |||
from gate_api.models.position import Position | |||
from gate_api.models.position_close import PositionClose | |||
from gate_api.models.position_close_order import PositionCloseOrder | |||
from gate_api.models.repay_request import RepayRequest | |||
from gate_api.models.repayment import Repayment | |||
from gate_api.models.saved_address import SavedAddress | |||
from gate_api.models.spot_account import SpotAccount | |||
from gate_api.models.spot_fee import SpotFee | |||
from gate_api.models.spot_price_put_order import SpotPricePutOrder | |||
from gate_api.models.spot_price_trigger import SpotPriceTrigger | |||
from gate_api.models.spot_price_triggered_order import SpotPriceTriggeredOrder | |||
from gate_api.models.sub_account import SubAccount | |||
from gate_api.models.sub_account_balance import SubAccountBalance | |||
from gate_api.models.sub_account_cross_margin_balance import SubAccountCrossMarginBalance | |||
from gate_api.models.sub_account_futures_balance import SubAccountFuturesBalance | |||
from gate_api.models.sub_account_key import SubAccountKey | |||
from gate_api.models.sub_account_margin_balance import SubAccountMarginBalance | |||
from gate_api.models.sub_account_to_sub_account import SubAccountToSubAccount | |||
from gate_api.models.sub_account_transfer import SubAccountTransfer | |||
from gate_api.models.sub_cross_margin_account import SubCrossMarginAccount | |||
from gate_api.models.system_time import SystemTime | |||
from gate_api.models.ticker import Ticker | |||
from gate_api.models.total_balance import TotalBalance | |||
from gate_api.models.trade import Trade | |||
from gate_api.models.trade_fee import TradeFee | |||
from gate_api.models.transaction_id import TransactionID | |||
from gate_api.models.transfer import Transfer | |||
from gate_api.models.trigger_order_response import TriggerOrderResponse | |||
from gate_api.models.trigger_time import TriggerTime | |||
from gate_api.models.uni_currency import UniCurrency | |||
from gate_api.models.uni_currency_pair import UniCurrencyPair | |||
from gate_api.models.uni_interest_record import UniInterestRecord | |||
from gate_api.models.uni_lend import UniLend | |||
from gate_api.models.uni_lend_interest import UniLendInterest | |||
from gate_api.models.uni_lend_record import UniLendRecord | |||
from gate_api.models.uni_loan import UniLoan | |||
from gate_api.models.uni_loan_interest_record import UniLoanInterestRecord | |||
from gate_api.models.uni_loan_record import UniLoanRecord | |||
from gate_api.models.withdraw_status import WithdrawStatus |