gate-io-api 0.0.65__py3-none-any.whl → 0.0.100__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of gate-io-api might be problematic. Click here for more details.
- gate/ccxt/__init__.py +2 -1
- gate/ccxt/abstract/gate.py +62 -18
- gate/ccxt/async_support/__init__.py +2 -1
- gate/ccxt/async_support/base/exchange.py +165 -27
- gate/ccxt/async_support/base/throttler.py +1 -1
- gate/ccxt/async_support/base/ws/client.py +194 -64
- gate/ccxt/async_support/base/ws/future.py +27 -50
- gate/ccxt/async_support/gate.py +356 -253
- gate/ccxt/base/decimal_to_precision.py +14 -10
- gate/ccxt/base/errors.py +6 -0
- gate/ccxt/base/exchange.py +606 -119
- gate/ccxt/base/types.py +4 -0
- gate/ccxt/gate.py +356 -253
- gate/ccxt/pro/__init__.py +2 -89
- gate/ccxt/pro/gate.py +14 -7
- {gate_io_api-0.0.65.dist-info → gate_io_api-0.0.100.dist-info}/METADATA +70 -25
- {gate_io_api-0.0.65.dist-info → gate_io_api-0.0.100.dist-info}/RECORD +18 -19
- gate/ccxt/async_support/base/ws/aiohttp_client.py +0 -147
- {gate_io_api-0.0.65.dist-info → gate_io_api-0.0.100.dist-info}/WHEEL +0 -0
gate/ccxt/pro/__init__.py
CHANGED
|
@@ -8,7 +8,7 @@ sys.modules['ccxt'] = ccxt_module
|
|
|
8
8
|
|
|
9
9
|
# ----------------------------------------------------------------------------
|
|
10
10
|
|
|
11
|
-
__version__ = '4.
|
|
11
|
+
__version__ = '4.5.15'
|
|
12
12
|
|
|
13
13
|
# ----------------------------------------------------------------------------
|
|
14
14
|
|
|
@@ -31,6 +31,7 @@ from ccxt.base.errors import NoChange # noqa: F4
|
|
|
31
31
|
from ccxt.base.errors import MarginModeAlreadySet # noqa: F401
|
|
32
32
|
from ccxt.base.errors import MarketClosed # noqa: F401
|
|
33
33
|
from ccxt.base.errors import ManualInteractionNeeded # noqa: F401
|
|
34
|
+
from ccxt.base.errors import RestrictedLocation # noqa: F401
|
|
34
35
|
from ccxt.base.errors import InsufficientFunds # noqa: F401
|
|
35
36
|
from ccxt.base.errors import InvalidAddress # noqa: F401
|
|
36
37
|
from ccxt.base.errors import AddressPending # noqa: F401
|
|
@@ -60,94 +61,6 @@ from ccxt.base.errors import UnsubscribeError # noqa: F4
|
|
|
60
61
|
from ccxt.base.errors import error_hierarchy # noqa: F401
|
|
61
62
|
# DO_NOT_REMOVE__ERROR_IMPORTS_END
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
64
|
from ccxt.pro.gate import gate # noqa: F401
|
|
152
65
|
|
|
153
66
|
exchanges = [ 'gate',]
|
gate/ccxt/pro/gate.py
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import ccxt.async_support
|
|
7
7
|
from ccxt.async_support.base.ws.cache import ArrayCache, ArrayCacheBySymbolById, ArrayCacheBySymbolBySide, ArrayCacheByTimestamp
|
|
8
8
|
import hashlib
|
|
9
|
-
from ccxt.base.types import Any, Balances, Int, Liquidation, Market, MarketType, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade
|
|
9
|
+
from ccxt.base.types import Any, Balances, Bool, Int, Liquidation, Market, MarketType, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade
|
|
10
10
|
from ccxt.async_support.base.ws.client import Client
|
|
11
11
|
from typing import List
|
|
12
12
|
from ccxt.base.errors import ExchangeError
|
|
@@ -333,7 +333,7 @@ class gate(gateAsync):
|
|
|
333
333
|
"""
|
|
334
334
|
return await self.fetch_orders_by_status_ws('finished', symbol, since, limit, params)
|
|
335
335
|
|
|
336
|
-
async def fetch_orders_by_status_ws(self, status: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
|
336
|
+
async def fetch_orders_by_status_ws(self, status: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
|
337
337
|
"""
|
|
338
338
|
|
|
339
339
|
https://www.gate.io/docs/developers/futures/ws/en/#order-list
|
|
@@ -368,6 +368,13 @@ class gate(gateAsync):
|
|
|
368
368
|
async def watch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
|
369
369
|
"""
|
|
370
370
|
watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
|
371
|
+
|
|
372
|
+
https://www.gate.com/docs/developers/apiv4/ws/en/#order-book-channel
|
|
373
|
+
https://www.gate.com/docs/developers/apiv4/ws/en/#order-book-v2-api
|
|
374
|
+
https://www.gate.com/docs/developers/futures/ws/en/#order-book-api
|
|
375
|
+
https://www.gate.com/docs/developers/futures/ws/en/#order-book-v2-api
|
|
376
|
+
https://www.gate.com/docs/developers/delivery/ws/en/#order-book-api
|
|
377
|
+
|
|
371
378
|
:param str symbol: unified symbol of the market to fetch the order book for
|
|
372
379
|
:param int [limit]: the maximum amount of order book entries to return
|
|
373
380
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -384,7 +391,7 @@ class gate(gateAsync):
|
|
|
384
391
|
url = self.get_url_by_market(market)
|
|
385
392
|
payload = [marketId, interval]
|
|
386
393
|
if limit is None:
|
|
387
|
-
limit = 100
|
|
394
|
+
limit = 100 # max 100 atm
|
|
388
395
|
if market['contract']:
|
|
389
396
|
stringLimit = str(limit)
|
|
390
397
|
payload.append(stringLimit)
|
|
@@ -790,7 +797,7 @@ class gate(gateAsync):
|
|
|
790
797
|
hash = 'trades:' + symbol
|
|
791
798
|
client.resolve(cachedTrades, hash)
|
|
792
799
|
|
|
793
|
-
async def watch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
|
800
|
+
async def watch_ohlcv(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
|
794
801
|
"""
|
|
795
802
|
watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
796
803
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
|
@@ -1335,7 +1342,7 @@ class gate(gateAsync):
|
|
|
1335
1342
|
"""
|
|
1336
1343
|
return self.watch_my_liquidations_for_symbols([symbol], since, limit, params)
|
|
1337
1344
|
|
|
1338
|
-
async def watch_my_liquidations_for_symbols(self, symbols: List[str]
|
|
1345
|
+
async def watch_my_liquidations_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}) -> List[Liquidation]:
|
|
1339
1346
|
"""
|
|
1340
1347
|
watch the private liquidations of a trading pair
|
|
1341
1348
|
|
|
@@ -1489,7 +1496,7 @@ class gate(gateAsync):
|
|
|
1489
1496
|
'datetime': self.iso8601(timestamp),
|
|
1490
1497
|
})
|
|
1491
1498
|
|
|
1492
|
-
def handle_error_message(self, client: Client, message):
|
|
1499
|
+
def handle_error_message(self, client: Client, message) -> Bool:
|
|
1493
1500
|
#
|
|
1494
1501
|
# {
|
|
1495
1502
|
# "time": 1647274664,
|
|
@@ -1888,7 +1895,7 @@ class gate(gateAsync):
|
|
|
1888
1895
|
channel = messageType + '.login'
|
|
1889
1896
|
client = self.client(url)
|
|
1890
1897
|
messageHash = 'authenticated'
|
|
1891
|
-
future = client.
|
|
1898
|
+
future = client.reusableFuture(messageHash)
|
|
1892
1899
|
authenticated = self.safe_value(client.subscriptions, messageHash)
|
|
1893
1900
|
if authenticated is None:
|
|
1894
1901
|
return await self.request_private(url, {}, channel, messageHash)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gate-io-api
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.100
|
|
4
4
|
Summary: gate crypto exchange api client
|
|
5
5
|
Project-URL: Homepage, https://github.com/ccxt/ccxt
|
|
6
6
|
Project-URL: Issues, https://github.com/ccxt/ccxt
|
|
@@ -135,7 +135,6 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
135
135
|
- `fetch_balance(self, params={})`
|
|
136
136
|
- `fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
|
|
137
137
|
- `fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
|
|
138
|
-
- `fetch_contract_markets(self, params={})`
|
|
139
138
|
- `fetch_currencies(self, params={})`
|
|
140
139
|
- `fetch_deposit_address(self, code: str, params={})`
|
|
141
140
|
- `fetch_deposit_addresses_by_network(self, code: str, params={})`
|
|
@@ -145,6 +144,7 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
145
144
|
- `fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
|
|
146
145
|
- `fetch_funding_rate(self, symbol: str, params={})`
|
|
147
146
|
- `fetch_funding_rates(self, symbols: Strings = None, params={})`
|
|
147
|
+
- `fetch_future_markets(self, params={})`
|
|
148
148
|
- `fetch_greeks(self, symbol: str, params={})`
|
|
149
149
|
- `fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={})`
|
|
150
150
|
- `fetch_leverage_tiers(self, symbols: Strings = None, params={})`
|
|
@@ -157,7 +157,7 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
157
157
|
- `fetch_my_settlement_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
|
|
158
158
|
- `fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
|
|
159
159
|
- `fetch_network_deposit_address(self, code: str, params={})`
|
|
160
|
-
- `fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={})`
|
|
160
|
+
- `fetch_ohlcv(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={})`
|
|
161
161
|
- `fetch_open_interest_history(self, symbol: str, timeframe='5m', since: Int = None, limit: Int = None, params={})`
|
|
162
162
|
- `fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
|
|
163
163
|
- `fetch_option_chain(self, code: str, params={})`
|
|
@@ -175,6 +175,7 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
175
175
|
- `fetch_positions(self, symbols: Strings = None, params={})`
|
|
176
176
|
- `fetch_settlement_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
|
|
177
177
|
- `fetch_spot_markets(self, params={})`
|
|
178
|
+
- `fetch_swap_markets(self, params={})`
|
|
178
179
|
- `fetch_ticker(self, symbol: str, params={})`
|
|
179
180
|
- `fetch_tickers(self, symbols: Strings = None, params={})`
|
|
180
181
|
- `fetch_time(self, params={})`
|
|
@@ -206,17 +207,19 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
206
207
|
- `repay_cross_margin(self, code: str, amount, params={})`
|
|
207
208
|
- `repay_isolated_margin(self, symbol: str, code: str, amount, params={})`
|
|
208
209
|
- `safe_market(self, marketId: Str = None, market: Market = None, delimiter: Str = None, marketType: Str = None)`
|
|
209
|
-
- `set_leverage(self, leverage:
|
|
210
|
+
- `set_leverage(self, leverage: int, symbol: Str = None, params={})`
|
|
210
211
|
- `set_position_mode(self, hedged: bool, symbol: Str = None, params={})`
|
|
211
212
|
- `set_sandbox_mode(self, enable: bool)`
|
|
212
213
|
- `spot_order_prepare_request(self, market=None, trigger=False, params={})`
|
|
213
214
|
- `transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={})`
|
|
214
215
|
- `upgrade_unified_trade_account(self, params={})`
|
|
215
|
-
- `withdraw(self, code: str, amount: float, address: str, tag=None, params={})`
|
|
216
|
+
- `withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={})`
|
|
216
217
|
|
|
217
218
|
### REST Raw
|
|
218
219
|
|
|
219
220
|
- `public_wallet_get_currency_chains(request)`
|
|
221
|
+
- `public_unified_get_currencies(request)`
|
|
222
|
+
- `public_unified_get_history_loan_rate(request)`
|
|
220
223
|
- `public_spot_get_currencies(request)`
|
|
221
224
|
- `public_spot_get_currencies_currency(request)`
|
|
222
225
|
- `public_spot_get_currency_pairs(request)`
|
|
@@ -226,13 +229,16 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
226
229
|
- `public_spot_get_trades(request)`
|
|
227
230
|
- `public_spot_get_candlesticks(request)`
|
|
228
231
|
- `public_spot_get_time(request)`
|
|
232
|
+
- `public_spot_get_insurance_history(request)`
|
|
233
|
+
- `public_margin_get_uni_currency_pairs(request)`
|
|
234
|
+
- `public_margin_get_uni_currency_pairs_currency_pair(request)`
|
|
235
|
+
- `public_margin_get_loan_margin_tiers(request)`
|
|
229
236
|
- `public_margin_get_currency_pairs(request)`
|
|
230
237
|
- `public_margin_get_currency_pairs_currency_pair(request)`
|
|
231
238
|
- `public_margin_get_funding_book(request)`
|
|
232
239
|
- `public_margin_get_cross_currencies(request)`
|
|
233
240
|
- `public_margin_get_cross_currencies_currency(request)`
|
|
234
|
-
- `
|
|
235
|
-
- `public_margin_get_uni_currency_pairs_currency_pair(request)`
|
|
241
|
+
- `public_flash_swap_get_currency_pairs(request)`
|
|
236
242
|
- `public_flash_swap_get_currencies(request)`
|
|
237
243
|
- `public_futures_get_settle_contracts(request)`
|
|
238
244
|
- `public_futures_get_settle_contracts_contract(request)`
|
|
@@ -254,6 +260,7 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
254
260
|
- `public_delivery_get_settle_candlesticks(request)`
|
|
255
261
|
- `public_delivery_get_settle_tickers(request)`
|
|
256
262
|
- `public_delivery_get_settle_insurance(request)`
|
|
263
|
+
- `public_delivery_get_settle_risk_limit_tiers(request)`
|
|
257
264
|
- `public_options_get_underlyings(request)`
|
|
258
265
|
- `public_options_get_expirations(request)`
|
|
259
266
|
- `public_options_get_contracts(request)`
|
|
@@ -268,6 +275,13 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
268
275
|
- `public_options_get_trades(request)`
|
|
269
276
|
- `public_earn_get_uni_currencies(request)`
|
|
270
277
|
- `public_earn_get_uni_currencies_currency(request)`
|
|
278
|
+
- `public_earn_get_dual_investment_plan(request)`
|
|
279
|
+
- `public_earn_get_structured_products(request)`
|
|
280
|
+
- `public_loan_get_collateral_currencies(request)`
|
|
281
|
+
- `public_loan_get_multi_collateral_currencies(request)`
|
|
282
|
+
- `public_loan_get_multi_collateral_ltv(request)`
|
|
283
|
+
- `public_loan_get_multi_collateral_fixed_rate(request)`
|
|
284
|
+
- `public_loan_get_multi_collateral_current_rate(request)`
|
|
271
285
|
- `private_withdrawals_post_withdrawals(request)`
|
|
272
286
|
- `private_withdrawals_post_push(request)`
|
|
273
287
|
- `private_withdrawals_delete_withdrawals_withdrawal_id(request)`
|
|
@@ -302,23 +316,26 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
302
316
|
- `private_subaccounts_put_sub_accounts_user_id_keys_key(request)`
|
|
303
317
|
- `private_subaccounts_delete_sub_accounts_user_id_keys_key(request)`
|
|
304
318
|
- `private_unified_get_accounts(request)`
|
|
305
|
-
- `private_unified_get_account_mode(request)`
|
|
306
319
|
- `private_unified_get_borrowable(request)`
|
|
307
320
|
- `private_unified_get_transferable(request)`
|
|
321
|
+
- `private_unified_get_transferables(request)`
|
|
322
|
+
- `private_unified_get_batch_borrowable(request)`
|
|
308
323
|
- `private_unified_get_loans(request)`
|
|
309
324
|
- `private_unified_get_loan_records(request)`
|
|
310
325
|
- `private_unified_get_interest_records(request)`
|
|
311
|
-
- `private_unified_get_estimate_rate(request)`
|
|
312
|
-
- `private_unified_get_currency_discount_tiers(request)`
|
|
313
326
|
- `private_unified_get_risk_units(request)`
|
|
314
327
|
- `private_unified_get_unified_mode(request)`
|
|
328
|
+
- `private_unified_get_estimate_rate(request)`
|
|
329
|
+
- `private_unified_get_currency_discount_tiers(request)`
|
|
315
330
|
- `private_unified_get_loan_margin_tiers(request)`
|
|
316
331
|
- `private_unified_get_leverage_user_currency_config(request)`
|
|
317
332
|
- `private_unified_get_leverage_user_currency_setting(request)`
|
|
318
|
-
- `
|
|
333
|
+
- `private_unified_get_account_mode(request)`
|
|
319
334
|
- `private_unified_post_loans(request)`
|
|
320
335
|
- `private_unified_post_portfolio_calculator(request)`
|
|
321
336
|
- `private_unified_post_leverage_user_currency_setting(request)`
|
|
337
|
+
- `private_unified_post_collateral_currencies(request)`
|
|
338
|
+
- `private_unified_post_account_mode(request)`
|
|
322
339
|
- `private_unified_put_unified_mode(request)`
|
|
323
340
|
- `private_spot_get_fee(request)`
|
|
324
341
|
- `private_spot_get_batch_fee(request)`
|
|
@@ -347,6 +364,13 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
347
364
|
- `private_margin_get_funding_accounts(request)`
|
|
348
365
|
- `private_margin_get_auto_repay(request)`
|
|
349
366
|
- `private_margin_get_transferable(request)`
|
|
367
|
+
- `private_margin_get_uni_estimate_rate(request)`
|
|
368
|
+
- `private_margin_get_uni_loans(request)`
|
|
369
|
+
- `private_margin_get_uni_loan_records(request)`
|
|
370
|
+
- `private_margin_get_uni_interest_records(request)`
|
|
371
|
+
- `private_margin_get_uni_borrowable(request)`
|
|
372
|
+
- `private_margin_get_user_loan_margin_tiers(request)`
|
|
373
|
+
- `private_margin_get_user_account(request)`
|
|
350
374
|
- `private_margin_get_loans(request)`
|
|
351
375
|
- `private_margin_get_loans_loan_id(request)`
|
|
352
376
|
- `private_margin_get_loans_loan_id_repayment(request)`
|
|
@@ -362,23 +386,17 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
362
386
|
- `private_margin_get_cross_transferable(request)`
|
|
363
387
|
- `private_margin_get_cross_estimate_rate(request)`
|
|
364
388
|
- `private_margin_get_cross_borrowable(request)`
|
|
365
|
-
- `private_margin_get_uni_estimate_rate(request)`
|
|
366
|
-
- `private_margin_get_uni_loans(request)`
|
|
367
|
-
- `private_margin_get_uni_loan_records(request)`
|
|
368
|
-
- `private_margin_get_uni_interest_records(request)`
|
|
369
|
-
- `private_margin_get_uni_borrowable(request)`
|
|
370
389
|
- `private_margin_post_auto_repay(request)`
|
|
390
|
+
- `private_margin_post_uni_loans(request)`
|
|
391
|
+
- `private_margin_post_leverage_user_market_setting(request)`
|
|
371
392
|
- `private_margin_post_loans(request)`
|
|
372
393
|
- `private_margin_post_merged_loans(request)`
|
|
373
394
|
- `private_margin_post_loans_loan_id_repayment(request)`
|
|
374
395
|
- `private_margin_post_cross_loans(request)`
|
|
375
396
|
- `private_margin_post_cross_repayments(request)`
|
|
376
|
-
- `private_margin_post_uni_loans(request)`
|
|
377
397
|
- `private_margin_patch_loans_loan_id(request)`
|
|
378
398
|
- `private_margin_patch_loan_records_loan_record_id(request)`
|
|
379
399
|
- `private_margin_delete_loans_loan_id(request)`
|
|
380
|
-
- `private_flash_swap_get_currencies(request)`
|
|
381
|
-
- `private_flash_swap_get_currency_pairs(request)`
|
|
382
400
|
- `private_flash_swap_get_orders(request)`
|
|
383
401
|
- `private_flash_swap_get_orders_order_id(request)`
|
|
384
402
|
- `private_flash_swap_post_orders(request)`
|
|
@@ -397,12 +415,14 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
397
415
|
- `private_futures_get_settle_liquidates(request)`
|
|
398
416
|
- `private_futures_get_settle_auto_deleverages(request)`
|
|
399
417
|
- `private_futures_get_settle_fee(request)`
|
|
400
|
-
- `
|
|
418
|
+
- `private_futures_get_settle_risk_limit_table(request)`
|
|
401
419
|
- `private_futures_get_settle_price_orders(request)`
|
|
402
420
|
- `private_futures_get_settle_price_orders_order_id(request)`
|
|
403
421
|
- `private_futures_post_settle_positions_contract_margin(request)`
|
|
404
422
|
- `private_futures_post_settle_positions_contract_leverage(request)`
|
|
405
423
|
- `private_futures_post_settle_positions_contract_risk_limit(request)`
|
|
424
|
+
- `private_futures_post_settle_positions_cross_mode(request)`
|
|
425
|
+
- `private_futures_post_settle_dual_comp_positions_cross_mode(request)`
|
|
406
426
|
- `private_futures_post_settle_dual_mode(request)`
|
|
407
427
|
- `private_futures_post_settle_dual_comp_positions_contract_margin(request)`
|
|
408
428
|
- `private_futures_post_settle_dual_comp_positions_contract_leverage(request)`
|
|
@@ -411,6 +431,8 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
411
431
|
- `private_futures_post_settle_batch_orders(request)`
|
|
412
432
|
- `private_futures_post_settle_countdown_cancel_all(request)`
|
|
413
433
|
- `private_futures_post_settle_batch_cancel_orders(request)`
|
|
434
|
+
- `private_futures_post_settle_batch_amend_orders(request)`
|
|
435
|
+
- `private_futures_post_settle_bbo_orders(request)`
|
|
414
436
|
- `private_futures_post_settle_price_orders(request)`
|
|
415
437
|
- `private_futures_put_settle_orders_order_id(request)`
|
|
416
438
|
- `private_futures_delete_settle_orders(request)`
|
|
@@ -454,14 +476,27 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
454
476
|
- `private_options_post_mmp_reset(request)`
|
|
455
477
|
- `private_options_delete_orders(request)`
|
|
456
478
|
- `private_options_delete_orders_order_id(request)`
|
|
457
|
-
- `private_earn_get_uni_currencies(request)`
|
|
458
|
-
- `private_earn_get_uni_currencies_currency(request)`
|
|
459
479
|
- `private_earn_get_uni_lends(request)`
|
|
460
480
|
- `private_earn_get_uni_lend_records(request)`
|
|
461
481
|
- `private_earn_get_uni_interests_currency(request)`
|
|
462
482
|
- `private_earn_get_uni_interest_records(request)`
|
|
463
483
|
- `private_earn_get_uni_interest_status_currency(request)`
|
|
484
|
+
- `private_earn_get_uni_chart(request)`
|
|
485
|
+
- `private_earn_get_uni_rate(request)`
|
|
486
|
+
- `private_earn_get_staking_eth2_rate_records(request)`
|
|
487
|
+
- `private_earn_get_dual_orders(request)`
|
|
488
|
+
- `private_earn_get_structured_orders(request)`
|
|
489
|
+
- `private_earn_get_staking_coins(request)`
|
|
490
|
+
- `private_earn_get_staking_order_list(request)`
|
|
491
|
+
- `private_earn_get_staking_award_list(request)`
|
|
492
|
+
- `private_earn_get_staking_assets(request)`
|
|
493
|
+
- `private_earn_get_uni_currencies(request)`
|
|
494
|
+
- `private_earn_get_uni_currencies_currency(request)`
|
|
464
495
|
- `private_earn_post_uni_lends(request)`
|
|
496
|
+
- `private_earn_post_staking_eth2_swap(request)`
|
|
497
|
+
- `private_earn_post_dual_orders(request)`
|
|
498
|
+
- `private_earn_post_structured_orders(request)`
|
|
499
|
+
- `private_earn_post_staking_swap(request)`
|
|
465
500
|
- `private_earn_put_uni_interest_reinvest(request)`
|
|
466
501
|
- `private_earn_patch_uni_lends(request)`
|
|
467
502
|
- `private_loan_get_collateral_orders(request)`
|
|
@@ -470,12 +505,12 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
470
505
|
- `private_loan_get_collateral_collaterals(request)`
|
|
471
506
|
- `private_loan_get_collateral_total_amount(request)`
|
|
472
507
|
- `private_loan_get_collateral_ltv(request)`
|
|
473
|
-
- `private_loan_get_collateral_currencies(request)`
|
|
474
508
|
- `private_loan_get_multi_collateral_orders(request)`
|
|
475
509
|
- `private_loan_get_multi_collateral_orders_order_id(request)`
|
|
476
510
|
- `private_loan_get_multi_collateral_repay(request)`
|
|
477
511
|
- `private_loan_get_multi_collateral_mortgage(request)`
|
|
478
512
|
- `private_loan_get_multi_collateral_currency_quota(request)`
|
|
513
|
+
- `private_loan_get_collateral_currencies(request)`
|
|
479
514
|
- `private_loan_get_multi_collateral_currencies(request)`
|
|
480
515
|
- `private_loan_get_multi_collateral_ltv(request)`
|
|
481
516
|
- `private_loan_get_multi_collateral_fixed_rate(request)`
|
|
@@ -487,15 +522,25 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
487
522
|
- `private_loan_post_multi_collateral_repay(request)`
|
|
488
523
|
- `private_loan_post_multi_collateral_mortgage(request)`
|
|
489
524
|
- `private_account_get_detail(request)`
|
|
525
|
+
- `private_account_get_main_keys(request)`
|
|
490
526
|
- `private_account_get_rate_limit(request)`
|
|
491
527
|
- `private_account_get_stp_groups(request)`
|
|
492
528
|
- `private_account_get_stp_groups_stp_id_users(request)`
|
|
493
529
|
- `private_account_get_stp_groups_debit_fee(request)`
|
|
530
|
+
- `private_account_get_debit_fee(request)`
|
|
494
531
|
- `private_account_post_stp_groups(request)`
|
|
495
532
|
- `private_account_post_stp_groups_stp_id_users(request)`
|
|
533
|
+
- `private_account_post_debit_fee(request)`
|
|
496
534
|
- `private_account_delete_stp_groups_stp_id_users(request)`
|
|
497
535
|
- `private_rebate_get_agency_transaction_history(request)`
|
|
498
536
|
- `private_rebate_get_agency_commission_history(request)`
|
|
537
|
+
- `private_rebate_get_partner_transaction_history(request)`
|
|
538
|
+
- `private_rebate_get_partner_commission_history(request)`
|
|
539
|
+
- `private_rebate_get_partner_sub_list(request)`
|
|
540
|
+
- `private_rebate_get_broker_commission_history(request)`
|
|
541
|
+
- `private_rebate_get_broker_transaction_history(request)`
|
|
542
|
+
- `private_rebate_get_user_info(request)`
|
|
543
|
+
- `private_rebate_get_user_sub_relation(request)`
|
|
499
544
|
|
|
500
545
|
### WS Unified
|
|
501
546
|
|
|
@@ -520,7 +565,7 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
520
565
|
- `watch_trades_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={})`
|
|
521
566
|
- `un_watch_trades_for_symbols(self, symbols: List[str], params={})`
|
|
522
567
|
- `un_watch_trades(self, symbol: str, params={})`
|
|
523
|
-
- `watch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={})`
|
|
568
|
+
- `watch_ohlcv(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={})`
|
|
524
569
|
- `watch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
|
|
525
570
|
- `watch_balance(self, params={})`
|
|
526
571
|
- `watch_positions(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={})`
|
|
@@ -528,7 +573,7 @@ You can also construct custom requests to available "implicit" endpoints
|
|
|
528
573
|
- `load_positions_snapshot(self, client, messageHash, type)`
|
|
529
574
|
- `watch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
|
|
530
575
|
- `watch_my_liquidations(self, symbol: str, since: Int = None, limit: Int = None, params={})`
|
|
531
|
-
- `watch_my_liquidations_for_symbols(self, symbols: List[str]
|
|
576
|
+
- `watch_my_liquidations_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={})`
|
|
532
577
|
- `clean_cache(self, subscription: dict)`
|
|
533
578
|
- `get_url_by_market(self, market)`
|
|
534
579
|
- `get_type_by_market(self, market: Market)`
|
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
gate/__init__.py,sha256=rmRavmagjlyk7Z5zGWWJiY8tfYIPsk04hRzC4SYJOzA,222
|
|
2
|
-
gate/ccxt/__init__.py,sha256=
|
|
3
|
-
gate/ccxt/gate.py,sha256=
|
|
4
|
-
gate/ccxt/abstract/gate.py,sha256=
|
|
5
|
-
gate/ccxt/async_support/__init__.py,sha256=
|
|
6
|
-
gate/ccxt/async_support/gate.py,sha256
|
|
2
|
+
gate/ccxt/__init__.py,sha256=_8rN5BRGYOobzHosSeHwOLSGTBlAS0sr6CqQmQa4dzo,6127
|
|
3
|
+
gate/ccxt/gate.py,sha256=7g2Jtaata6h3GR8mqpVvUxVl64dUQnNSnuQdafmhUzk,357833
|
|
4
|
+
gate/ccxt/abstract/gate.py,sha256=BqKAEgATjdn7tcjVr2WkCZ9vitp1a4g7Y5I678_v2KU,52137
|
|
5
|
+
gate/ccxt/async_support/__init__.py,sha256=uWJPmK_MFP_RawbTbhViLwRMwuzPSpfQfg5xtx5TthI,4860
|
|
6
|
+
gate/ccxt/async_support/gate.py,sha256=-ceJqNgdLa5ux6OfXfVnzui_G7q464hUbgUM6T4PGRM,359798
|
|
7
7
|
gate/ccxt/async_support/base/__init__.py,sha256=aVYSsFi--b4InRs9zDN_wtCpj8odosAB726JdUHavrk,67
|
|
8
|
-
gate/ccxt/async_support/base/exchange.py,sha256=
|
|
9
|
-
gate/ccxt/async_support/base/throttler.py,sha256=
|
|
8
|
+
gate/ccxt/async_support/base/exchange.py,sha256=khpXAI5qS2W1nYREz5GlLLZYMS86W5l2tTNXz0puDfU,126383
|
|
9
|
+
gate/ccxt/async_support/base/throttler.py,sha256=SR1JdHbXgkkRps_YBP7QxVREHsBN1Gbpm5gx_YuMa5g,1841
|
|
10
10
|
gate/ccxt/async_support/base/ws/__init__.py,sha256=uockzpLuwntKGZbs5EOWFe-Zg-k6Cj7GhNJLc_RX0so,1791
|
|
11
|
-
gate/ccxt/async_support/base/ws/aiohttp_client.py,sha256=Y5HxAVXyyYduj6b6SbbUZETlq3GrVMzrkW1r-TMgpb8,6329
|
|
12
11
|
gate/ccxt/async_support/base/ws/cache.py,sha256=xf2VOtfUwloxSlIQ39M1RGZHWQzyS9IGhB5NX6cDcAc,8370
|
|
13
|
-
gate/ccxt/async_support/base/ws/client.py,sha256=
|
|
12
|
+
gate/ccxt/async_support/base/ws/client.py,sha256=mrHV3_L_0cd5612gbfnB9F659nX3PrwDkhAmDwh_LWg,14410
|
|
14
13
|
gate/ccxt/async_support/base/ws/functions.py,sha256=qwvEnjtINWL5ZU-dbbeIunjyBxzFqbGWHfVhxqAcKug,1499
|
|
15
|
-
gate/ccxt/async_support/base/ws/future.py,sha256=
|
|
14
|
+
gate/ccxt/async_support/base/ws/future.py,sha256=hjdQ42zkfju5nar0GpTLJ4zXQBtgBU8DzYM5uPFcjsE,1450
|
|
16
15
|
gate/ccxt/async_support/base/ws/order_book.py,sha256=uBUaIHhzMRykpmo4BCsdJ-t_HozS6VxhEs8x-Kbj-NI,2894
|
|
17
16
|
gate/ccxt/async_support/base/ws/order_book_side.py,sha256=GhnGUt78pJ-AYL_Dq9produGjmBJLCI5FHIRdMz1O-g,6551
|
|
18
17
|
gate/ccxt/base/__init__.py,sha256=eTx1OE3HJjspFUQjGm6LBhaQiMKJnXjkdP-JUXknyQ0,1320
|
|
19
|
-
gate/ccxt/base/decimal_to_precision.py,sha256=
|
|
20
|
-
gate/ccxt/base/errors.py,sha256=
|
|
21
|
-
gate/ccxt/base/exchange.py,sha256=
|
|
18
|
+
gate/ccxt/base/decimal_to_precision.py,sha256=3XI30u9YudHbTA438397u5rkdlXa3atxwZEfUus3C4k,6803
|
|
19
|
+
gate/ccxt/base/errors.py,sha256=OGhWNvNtRlJOzFx-n1x3ZjTnaPpfWH0Vc0xACS-MeDw,5012
|
|
20
|
+
gate/ccxt/base/exchange.py,sha256=7msTYhpfOTLb3FU89STj-nk5uo7zdfVUbO968sq26Sg,353374
|
|
22
21
|
gate/ccxt/base/precise.py,sha256=koce64Yrp6vFbGijJtUt-QQ6XhJgeGTCksZ871FPp_A,8886
|
|
23
|
-
gate/ccxt/base/types.py,sha256=
|
|
24
|
-
gate/ccxt/pro/__init__.py,sha256=
|
|
25
|
-
gate/ccxt/pro/gate.py,sha256=
|
|
22
|
+
gate/ccxt/base/types.py,sha256=5XQX4lNnUaHumeNtgaY-QEaFABQd3RMMmREglZ3H_fA,11546
|
|
23
|
+
gate/ccxt/pro/__init__.py,sha256=lTTqO-IwJZgyieVFM_bW80xJWtMMVIgXKvzLJbtd6uU,4174
|
|
24
|
+
gate/ccxt/pro/gate.py,sha256=fN9delh8YwosmOlTEL2swSCr7wsJUc1DYxz2JbZF_q0,89835
|
|
26
25
|
gate/ccxt/static_dependencies/README.md,sha256=3TCvhhn09_Cqf9BDDpao1V7EfKHDpQ6k9oWRsLFixpU,18
|
|
27
26
|
gate/ccxt/static_dependencies/__init__.py,sha256=tzFje8cloqmiIE6kola3EaYC0SnD1izWnri69hzHsSw,168
|
|
28
27
|
gate/ccxt/static_dependencies/ecdsa/__init__.py,sha256=Xaj0G79BLtBt2YZcOOMV8qOlQZ7fIJznNiHhiEEZfQA,594
|
|
@@ -282,6 +281,6 @@ gate/ccxt/static_dependencies/toolz/curried/exceptions.py,sha256=gKFOHDIayAWnX2u
|
|
|
282
281
|
gate/ccxt/static_dependencies/toolz/curried/operator.py,sha256=ML92mknkAwzBl2NCm-4werSUmJEtSHNY9NSzhseNM9s,525
|
|
283
282
|
gate/ccxt/static_dependencies/typing_inspect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
284
283
|
gate/ccxt/static_dependencies/typing_inspect/typing_inspect.py,sha256=5gIWomLPfuDpgd3gX1GlnX0MuXM3VorR4j2W2qXORiQ,28269
|
|
285
|
-
gate_io_api-0.0.
|
|
286
|
-
gate_io_api-0.0.
|
|
287
|
-
gate_io_api-0.0.
|
|
284
|
+
gate_io_api-0.0.100.dist-info/METADATA,sha256=UBOHtl6sKRKBgmTbduLF0VOENcE8TxchOaiWuazL56I,29078
|
|
285
|
+
gate_io_api-0.0.100.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
286
|
+
gate_io_api-0.0.100.dist-info/RECORD,,
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
orjson = None
|
|
4
|
-
try:
|
|
5
|
-
import orjson as orjson
|
|
6
|
-
except ImportError:
|
|
7
|
-
pass
|
|
8
|
-
|
|
9
|
-
import json
|
|
10
|
-
from asyncio import sleep, ensure_future
|
|
11
|
-
from aiohttp import WSMsgType
|
|
12
|
-
from .functions import milliseconds, iso8601, is_json_encoded_object
|
|
13
|
-
from ccxt.async_support.base.ws.client import Client
|
|
14
|
-
from ccxt.async_support.base.ws.functions import gunzip, inflate
|
|
15
|
-
from ccxt import NetworkError, RequestTimeout, ExchangeClosedByUser
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class AiohttpClient(Client):
|
|
19
|
-
|
|
20
|
-
proxy = None
|
|
21
|
-
|
|
22
|
-
def closed(self):
|
|
23
|
-
return (self.connection is None) or self.connection.closed
|
|
24
|
-
|
|
25
|
-
def receive(self):
|
|
26
|
-
return self.connection.receive()
|
|
27
|
-
|
|
28
|
-
# helper method for binary and text messages
|
|
29
|
-
def handle_text_or_binary_message(self, data):
|
|
30
|
-
if self.verbose:
|
|
31
|
-
self.log(iso8601(milliseconds()), 'message', data)
|
|
32
|
-
if isinstance(data, bytes):
|
|
33
|
-
data = data.decode()
|
|
34
|
-
# decoded = json.loads(data) if is_json_encoded_object(data) else data
|
|
35
|
-
decode = None
|
|
36
|
-
if is_json_encoded_object(data):
|
|
37
|
-
if orjson is None:
|
|
38
|
-
decode = json.loads(data)
|
|
39
|
-
else:
|
|
40
|
-
decode = orjson.loads(data)
|
|
41
|
-
else:
|
|
42
|
-
decode = data
|
|
43
|
-
self.on_message_callback(self, decode)
|
|
44
|
-
|
|
45
|
-
def handle_message(self, message):
|
|
46
|
-
# self.log(iso8601(milliseconds()), message)
|
|
47
|
-
if message.type == WSMsgType.TEXT:
|
|
48
|
-
self.handle_text_or_binary_message(message.data)
|
|
49
|
-
elif message.type == WSMsgType.BINARY:
|
|
50
|
-
data = message.data
|
|
51
|
-
if self.gunzip:
|
|
52
|
-
data = gunzip(data)
|
|
53
|
-
elif self.inflate:
|
|
54
|
-
data = inflate(data)
|
|
55
|
-
self.handle_text_or_binary_message(data)
|
|
56
|
-
# autoping is responsible for automatically replying with pong
|
|
57
|
-
# to a ping incoming from a server, we have to disable autoping
|
|
58
|
-
# with aiohttp's websockets and respond with pong manually
|
|
59
|
-
# otherwise aiohttp's websockets client won't trigger WSMsgType.PONG
|
|
60
|
-
elif message.type == WSMsgType.PING:
|
|
61
|
-
if self.verbose:
|
|
62
|
-
self.log(iso8601(milliseconds()), 'ping', message)
|
|
63
|
-
ensure_future(self.connection.pong(message.data), loop=self.asyncio_loop)
|
|
64
|
-
elif message.type == WSMsgType.PONG:
|
|
65
|
-
self.lastPong = milliseconds()
|
|
66
|
-
if self.verbose:
|
|
67
|
-
self.log(iso8601(milliseconds()), 'pong', message)
|
|
68
|
-
pass
|
|
69
|
-
elif message.type == WSMsgType.CLOSE:
|
|
70
|
-
if self.verbose:
|
|
71
|
-
self.log(iso8601(milliseconds()), 'close', self.closed(), message)
|
|
72
|
-
self.on_close(message.data)
|
|
73
|
-
elif message.type == WSMsgType.CLOSED:
|
|
74
|
-
if self.verbose:
|
|
75
|
-
self.log(iso8601(milliseconds()), 'closed', self.closed(), message)
|
|
76
|
-
self.on_close(1000)
|
|
77
|
-
elif message.type == WSMsgType.ERROR:
|
|
78
|
-
if self.verbose:
|
|
79
|
-
self.log(iso8601(milliseconds()), 'error', message)
|
|
80
|
-
error = NetworkError(str(message))
|
|
81
|
-
self.on_error(error)
|
|
82
|
-
|
|
83
|
-
def create_connection(self, session):
|
|
84
|
-
# autoping is responsible for automatically replying with pong
|
|
85
|
-
# to a ping incoming from a server, we have to disable autoping
|
|
86
|
-
# with aiohttp's websockets and respond with pong manually
|
|
87
|
-
# otherwise aiohttp's websockets client won't trigger WSMsgType.PONG
|
|
88
|
-
# call aenter here to simulate async with otherwise we get the error "await not called with future"
|
|
89
|
-
# if connecting to a non-existent endpoint
|
|
90
|
-
if (self.proxy):
|
|
91
|
-
return session.ws_connect(self.url, autoping=False, autoclose=False, headers=self.options.get('headers'), proxy=self.proxy, max_msg_size=10485760).__aenter__()
|
|
92
|
-
return session.ws_connect(self.url, autoping=False, autoclose=False, headers=self.options.get('headers'), max_msg_size=10485760).__aenter__()
|
|
93
|
-
|
|
94
|
-
async def send(self, message):
|
|
95
|
-
if self.verbose:
|
|
96
|
-
self.log(iso8601(milliseconds()), 'sending', message)
|
|
97
|
-
send_msg = None
|
|
98
|
-
if isinstance(message, str):
|
|
99
|
-
send_msg = message
|
|
100
|
-
else:
|
|
101
|
-
if orjson is None:
|
|
102
|
-
send_msg = json.dumps(message, separators=(',', ':'))
|
|
103
|
-
else:
|
|
104
|
-
send_msg = orjson.dumps(message).decode('utf-8')
|
|
105
|
-
return await self.connection.send_str(send_msg)
|
|
106
|
-
|
|
107
|
-
async def close(self, code=1000):
|
|
108
|
-
if self.verbose:
|
|
109
|
-
self.log(iso8601(milliseconds()), 'closing', code)
|
|
110
|
-
if not self.closed():
|
|
111
|
-
await self.connection.close()
|
|
112
|
-
# these will end automatically once self.closed() = True
|
|
113
|
-
# so we don't need to cancel them
|
|
114
|
-
if self.ping_looper:
|
|
115
|
-
self.ping_looper.cancel()
|
|
116
|
-
if self.receive_looper:
|
|
117
|
-
self.receive_looper.cancel() # cancel all pending futures stored in self.futures
|
|
118
|
-
for key in self.futures:
|
|
119
|
-
future = self.futures[key]
|
|
120
|
-
if not future.done():
|
|
121
|
-
if future.is_race_future:
|
|
122
|
-
future.cancel() # this is an "internal" future so we want to cancel it silently
|
|
123
|
-
else:
|
|
124
|
-
future.reject(ExchangeClosedByUser('Connection closed by the user'))
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
async def ping_loop(self):
|
|
128
|
-
if self.verbose:
|
|
129
|
-
self.log(iso8601(milliseconds()), 'ping loop')
|
|
130
|
-
while self.keepAlive and not self.closed():
|
|
131
|
-
now = milliseconds()
|
|
132
|
-
self.lastPong = now if self.lastPong is None else self.lastPong
|
|
133
|
-
if (self.lastPong + self.keepAlive * self.maxPingPongMisses) < now:
|
|
134
|
-
self.on_error(RequestTimeout('Connection to ' + self.url + ' timed out due to a ping-pong keepalive missing on time'))
|
|
135
|
-
# the following ping-clause is not necessary with aiohttp's built-in ws
|
|
136
|
-
# since it has a heartbeat option (see create_connection above)
|
|
137
|
-
# however some exchanges require a text-type ping message
|
|
138
|
-
# therefore we need this clause anyway
|
|
139
|
-
else:
|
|
140
|
-
if self.ping:
|
|
141
|
-
try:
|
|
142
|
-
await self.send(self.ping(self))
|
|
143
|
-
except Exception as e:
|
|
144
|
-
self.on_error(e)
|
|
145
|
-
else:
|
|
146
|
-
await self.connection.ping()
|
|
147
|
-
await sleep(self.keepAlive / 1000)
|