ccxt 4.4.90__py2.py3-none-any.whl → 4.4.92__py2.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.
- ccxt/__init__.py +1 -3
- ccxt/abstract/lbank.py +1 -0
- ccxt/async_support/__init__.py +1 -3
- ccxt/async_support/base/exchange.py +6 -3
- ccxt/async_support/base/ws/client.py +173 -64
- ccxt/async_support/base/ws/future.py +23 -50
- ccxt/async_support/binance.py +1 -1
- ccxt/async_support/bitmart.py +7 -0
- ccxt/async_support/bitmex.py +2 -1
- ccxt/async_support/bitvavo.py +7 -1
- ccxt/async_support/cex.py +61 -0
- ccxt/async_support/cryptocom.py +17 -2
- ccxt/async_support/cryptomus.py +1 -1
- ccxt/async_support/exmo.py +25 -10
- ccxt/async_support/gate.py +2 -2
- ccxt/async_support/htx.py +1 -1
- ccxt/async_support/hyperliquid.py +104 -53
- ccxt/async_support/kraken.py +26 -1
- ccxt/async_support/krakenfutures.py +1 -1
- ccxt/async_support/lbank.py +113 -33
- ccxt/async_support/mexc.py +1 -0
- ccxt/async_support/modetrade.py +2 -2
- ccxt/async_support/okx.py +2 -2
- ccxt/async_support/paradex.py +1 -1
- ccxt/base/exchange.py +22 -23
- ccxt/base/types.py +1 -0
- ccxt/binance.py +1 -1
- ccxt/bitmart.py +7 -0
- ccxt/bitmex.py +2 -1
- ccxt/bitvavo.py +7 -1
- ccxt/cex.py +61 -0
- ccxt/cryptocom.py +17 -2
- ccxt/cryptomus.py +1 -1
- ccxt/exmo.py +24 -10
- ccxt/gate.py +2 -2
- ccxt/htx.py +1 -1
- ccxt/hyperliquid.py +104 -53
- ccxt/kraken.py +26 -1
- ccxt/krakenfutures.py +1 -1
- ccxt/lbank.py +113 -33
- ccxt/mexc.py +1 -0
- ccxt/modetrade.py +2 -2
- ccxt/okx.py +2 -2
- ccxt/paradex.py +1 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitstamp.py +1 -1
- ccxt/pro/bybit.py +9 -140
- ccxt/pro/kraken.py +246 -258
- ccxt/pro/mexc.py +0 -1
- {ccxt-4.4.90.dist-info → ccxt-4.4.92.dist-info}/METADATA +6 -7
- {ccxt-4.4.90.dist-info → ccxt-4.4.92.dist-info}/RECORD +54 -71
- ccxt/abstract/coinlist.py +0 -57
- ccxt/async_support/base/ws/aiohttp_client.py +0 -147
- ccxt/async_support/bitcoincom.py +0 -18
- ccxt/async_support/bitfinex1.py +0 -1711
- ccxt/async_support/bitpanda.py +0 -17
- ccxt/async_support/coinlist.py +0 -2542
- ccxt/async_support/poloniexfutures.py +0 -1875
- ccxt/bitcoincom.py +0 -18
- ccxt/bitfinex1.py +0 -1710
- ccxt/bitpanda.py +0 -17
- ccxt/coinlist.py +0 -2542
- ccxt/poloniexfutures.py +0 -1875
- ccxt/pro/bitcoincom.py +0 -35
- ccxt/pro/bitfinex1.py +0 -635
- ccxt/pro/bitpanda.py +0 -16
- ccxt/pro/poloniexfutures.py +0 -1004
- ccxt/pro/wazirx.py +0 -766
- {ccxt-4.4.90.dist-info → ccxt-4.4.92.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.90.dist-info → ccxt-4.4.92.dist-info}/WHEEL +0 -0
- {ccxt-4.4.90.dist-info → ccxt-4.4.92.dist-info}/top_level.txt +0 -0
@@ -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)
|
ccxt/async_support/bitcoincom.py
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
4
|
-
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
5
|
-
|
6
|
-
from ccxt.async_support.fmfwio import fmfwio
|
7
|
-
from ccxt.abstract.bitcoincom import ImplicitAPI
|
8
|
-
from ccxt.base.types import Any
|
9
|
-
|
10
|
-
|
11
|
-
class bitcoincom(fmfwio, ImplicitAPI):
|
12
|
-
|
13
|
-
def describe(self) -> Any:
|
14
|
-
return self.deep_extend(super(bitcoincom, self).describe(), {
|
15
|
-
'id': 'bitcoincom',
|
16
|
-
'name': 'Bitcoin.com',
|
17
|
-
'alias': True,
|
18
|
-
})
|