ccxt 4.3.29__py2.py3-none-any.whl → 4.3.30__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.

Potentially problematic release.


This version of ccxt might be problematic. Click here for more details.

ccxt/__init__.py CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.3.29'
25
+ __version__ = '4.3.30'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.29'
7
+ __version__ = '4.3.30'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.3.29'
5
+ __version__ = '4.3.30'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -101,6 +101,7 @@ class AiohttpClient(Client):
101
101
  else:
102
102
  future.reject(ExchangeClosedByUser('Connection closed by the user'))
103
103
 
104
+
104
105
  async def ping_loop(self):
105
106
  if self.verbose:
106
107
  self.log(iso8601(milliseconds()), 'ping loop')
@@ -1,7 +1,6 @@
1
1
  import asyncio
2
2
  from ccxt import ExchangeClosedByUser
3
3
 
4
-
5
4
  class Future(asyncio.Future):
6
5
 
7
6
  is_race_future = False
@@ -23,38 +22,37 @@ class Future(asyncio.Future):
23
22
  task = asyncio.create_task(coro)
24
23
 
25
24
  def callback(done):
26
- exception = done.exception()
27
- if exception is None:
28
- complete, _ = done.result()
25
+ try:
26
+ complete, pending = done.result()
29
27
  # check for exceptions
30
- exceptions = []
31
- for f in complete:
32
- if f._state == 'CANCELLED':
33
- continue # was canceled internally
34
- err = f.exception()
35
- if err:
36
- exceptions.append(err)
37
- # if any exceptions return with first exception
38
- if len (exceptions) > 0:
39
- future.set_exception(exceptions[0])
40
- return
41
- # else return first result
42
- else:
43
- futures_list = list(complete)
44
- are_all_canceled = all(f._state == 'CANCELLED' for f in futures_list)
45
- if are_all_canceled and future._state == 'PENDING':
46
- future.set_exception(ExchangeClosedByUser('Connection closed by the user'))
28
+ for i, f in enumerate(complete):
29
+ try:
30
+ f.result()
31
+ except ExchangeClosedByUser as e:
32
+ if len(pending) == 0 and i == len(complete) - 1:
33
+ future.reject(e)
34
+ # wait for all the sub promises to be reject before rejecting future
35
+ continue
36
+ except asyncio.CancelledError as e:
37
+ continue
38
+ except Exception as e:
39
+ future.reject(e)
47
40
  return
41
+ # no exceptions return first result
42
+ futures_list = list(complete)
48
43
 
49
- # handle wait_for scenario
50
- if are_all_canceled and future._state == 'CANCELLED':
51
- return
44
+ are_all_canceled = all([f.cancelled() for f in futures_list])
45
+ if are_all_canceled:
46
+ future.reject(ExchangeClosedByUser('Connection closed by the user'))
47
+ return
52
48
 
53
- first = futures_list[0]
49
+ first = futures_list[0]
54
50
 
55
- first_result = first.result()
56
- future.set_result(first_result)
57
- else:
58
- future.set_exception(exception)
51
+ first_result = first.result()
52
+ future.resolve(first_result)
53
+ except asyncio.CancelledError as e:
54
+ future.reject(e)
55
+ except Exception as e:
56
+ future.reject(e)
59
57
  task.add_done_callback(callback)
60
58
  return future
@@ -2390,7 +2390,7 @@ class bingx(Exchange, ImplicitAPI):
2390
2390
  'stopLossPrice': stopLossPrice,
2391
2391
  'takeProfitPrice': takeProfitPrice,
2392
2392
  'average': self.safe_string_2(order, 'avgPrice', 'ap'),
2393
- 'cost': None,
2393
+ 'cost': self.safe_string(order, 'cummulativeQuoteQty'),
2394
2394
  'amount': self.safe_string_n(order, ['origQty', 'q', 'quantity']),
2395
2395
  'filled': self.safe_string_2(order, 'executedQty', 'z'),
2396
2396
  'remaining': None,