coinex-api 0.0.72__py3-none-any.whl → 0.0.74__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.
coinex/ccxt/__init__.py CHANGED
@@ -26,7 +26,7 @@ sys.modules['ccxt'] = ccxt_module
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
29
- __version__ = '4.4.93'
29
+ __version__ = '4.4.95'
30
30
 
31
31
  # ----------------------------------------------------------------------------
32
32
 
@@ -8,7 +8,7 @@ sys.modules['ccxt'] = ccxt_module
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
11
- __version__ = '4.4.93'
11
+ __version__ = '4.4.95'
12
12
 
13
13
  # -----------------------------------------------------------------------------
14
14
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.4.93'
5
+ __version__ = '4.4.95'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -36,6 +36,8 @@ class Future(asyncio.Future):
36
36
  elif cancelled:
37
37
  future.cancel()
38
38
  else:
39
+ if future.cancelled():
40
+ return
39
41
  first_result = list(complete)[0].result()
40
42
  future.set_result(first_result)
41
43
  task.add_done_callback(callback)
@@ -1,9 +1,3 @@
1
- # ----------------------------------------------------------------------------
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
- # EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
-
7
1
  error_hierarchy = {
8
2
  'BaseError': {
9
3
  'ExchangeError': {
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.93'
7
+ __version__ = '4.4.95'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2839,7 +2839,7 @@ class Exchange(object):
2839
2839
  # keep self in mind:
2840
2840
  # in JS: 1 == 1.0 is True; 1 == 1.0 is True
2841
2841
  # in Python: 1 == 1.0 is True
2842
- # in PHP 1 == 1.0 is True, but 1 == 1.0 is False
2842
+ # in PHP 1 == 1.0 is True, but 1 == 1.0 is False.
2843
2843
  if stringVersion.find('.') >= 0:
2844
2844
  return float(stringVersion)
2845
2845
  return int(stringVersion)
@@ -3780,7 +3780,7 @@ class Exchange(object):
3780
3780
  for i in range(0, len(fees)):
3781
3781
  fee = fees[i]
3782
3782
  code = self.safe_string(fee, 'currency')
3783
- feeCurrencyCode = code is not code if None else str(i)
3783
+ feeCurrencyCode = code if (code is not None) else str(i)
3784
3784
  if feeCurrencyCode is not None:
3785
3785
  rate = self.safe_string(fee, 'rate')
3786
3786
  cost = self.safe_string(fee, 'cost')
@@ -3808,8 +3808,7 @@ class Exchange(object):
3808
3808
 
3809
3809
  def safe_ticker(self, ticker: dict, market: Market = None):
3810
3810
  open = self.omit_zero(self.safe_string(ticker, 'open'))
3811
- close = self.omit_zero(self.safe_string(ticker, 'close'))
3812
- last = self.omit_zero(self.safe_string(ticker, 'last'))
3811
+ close = self.omit_zero(self.safe_string_2(ticker, 'close', 'last'))
3813
3812
  change = self.omit_zero(self.safe_string(ticker, 'change'))
3814
3813
  percentage = self.omit_zero(self.safe_string(ticker, 'percentage'))
3815
3814
  average = self.omit_zero(self.safe_string(ticker, 'average'))
@@ -3818,29 +3817,52 @@ class Exchange(object):
3818
3817
  quoteVolume = self.safe_string(ticker, 'quoteVolume')
3819
3818
  if vwap is None:
3820
3819
  vwap = Precise.string_div(self.omit_zero(quoteVolume), baseVolume)
3821
- if (last is not None) and (close is None):
3822
- close = last
3823
- elif (last is None) and (close is not None):
3824
- last = close
3825
- if (last is not None) and (open is not None):
3826
- if change is None:
3827
- change = Precise.string_sub(last, open)
3828
- if average is None:
3820
+ # calculate open
3821
+ if change is not None:
3822
+ if close is None and average is not None:
3823
+ close = Precise.string_add(average, Precise.string_div(change, '2'))
3824
+ if open is None and close is not None:
3825
+ open = Precise.string_sub(close, change)
3826
+ elif percentage is not None:
3827
+ if close is None and average is not None:
3828
+ openAddClose = Precise.string_mul(average, '2')
3829
+ # openAddClose = open * (1 + (100 + percentage)/100)
3830
+ denominator = Precise.string_add('2', Precise.string_div(percentage, '100'))
3831
+ calcOpen = open if (open is not None) else Precise.string_div(openAddClose, denominator)
3832
+ close = Precise.string_mul(calcOpen, Precise.string_add('1', Precise.string_div(percentage, '100')))
3833
+ if open is None and close is not None:
3834
+ open = Precise.string_div(close, Precise.string_add('1', Precise.string_div(percentage, '100')))
3835
+ # change
3836
+ if change is None:
3837
+ if close is not None and open is not None:
3838
+ change = Precise.string_sub(close, open)
3839
+ elif close is not None and percentage is not None:
3840
+ change = Precise.string_mul(Precise.string_div(percentage, '100'), Precise.string_div(close, '100'))
3841
+ elif open is not None and percentage is not None:
3842
+ change = Precise.string_mul(open, Precise.string_div(percentage, '100'))
3843
+ # calculate things according to "open"(similar can be done with "close")
3844
+ if open is not None:
3845
+ # percentage(using change)
3846
+ if percentage is None and change is not None:
3847
+ percentage = Precise.string_mul(Precise.string_div(change, open), '100')
3848
+ # close(using change)
3849
+ if close is None and change is not None:
3850
+ close = Precise.string_add(open, change)
3851
+ # close(using average)
3852
+ if close is None and average is not None:
3853
+ close = Precise.string_mul(average, '2')
3854
+ # average
3855
+ if average is None and close is not None:
3829
3856
  precision = 18
3830
3857
  if market is not None and self.is_tick_precision():
3831
3858
  marketPrecision = self.safe_dict(market, 'precision')
3832
3859
  precisionPrice = self.safe_string(marketPrecision, 'price')
3833
3860
  if precisionPrice is not None:
3834
3861
  precision = self.precision_from_string(precisionPrice)
3835
- average = Precise.string_div(Precise.string_add(last, open), '2', precision)
3836
- if (percentage is None) and (change is not None) and (open is not None) and Precise.string_gt(open, '0'):
3837
- percentage = Precise.string_mul(Precise.string_div(change, open), '100')
3838
- if (change is None) and (percentage is not None) and (open is not None):
3839
- change = Precise.string_div(Precise.string_mul(percentage, open), '100')
3840
- if (open is None) and (last is not None) and (change is not None):
3841
- open = Precise.string_sub(last, change)
3862
+ average = Precise.string_div(Precise.string_add(open, close), '2', precision)
3842
3863
  # timestamp and symbol operations don't belong in safeTicker
3843
3864
  # they should be done in the derived classes
3865
+ closeParsed = self.parse_number(self.omit_zero(close))
3844
3866
  return self.extend(ticker, {
3845
3867
  'bid': self.parse_number(self.omit_zero(self.safe_string(ticker, 'bid'))),
3846
3868
  'bidVolume': self.safe_number(ticker, 'bidVolume'),
@@ -3849,8 +3871,8 @@ class Exchange(object):
3849
3871
  'high': self.parse_number(self.omit_zero(self.safe_string(ticker, 'high'))),
3850
3872
  'low': self.parse_number(self.omit_zero(self.safe_string(ticker, 'low'))),
3851
3873
  'open': self.parse_number(self.omit_zero(open)),
3852
- 'close': self.parse_number(self.omit_zero(close)),
3853
- 'last': self.parse_number(self.omit_zero(last)),
3874
+ 'close': closeParsed,
3875
+ 'last': closeParsed,
3854
3876
  'change': self.parse_number(change),
3855
3877
  'percentage': self.parse_number(percentage),
3856
3878
  'average': self.parse_number(average),
@@ -8,7 +8,7 @@ sys.modules['ccxt'] = ccxt_module
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
11
- __version__ = '4.4.93'
11
+ __version__ = '4.4.95'
12
12
 
13
13
  # ----------------------------------------------------------------------------
14
14
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: coinex-api
3
- Version: 0.0.72
3
+ Version: 0.0.74
4
4
  Summary: coinex crypto exchange api client
5
5
  Project-URL: Homepage, https://github.com/ccxt/ccxt
6
6
  Project-URL: Issues, https://github.com/ccxt/ccxt
@@ -1,26 +1,26 @@
1
1
  coinex/__init__.py,sha256=d633U2PpNFHvpDWLb3lItS0ObcBN0E2XgS5QkOEejI8,246
2
- coinex/ccxt/__init__.py,sha256=voF6eMIFwfbzL4CcM1pq9oKVjSQwv9x98yPXIM_vTNw,6048
2
+ coinex/ccxt/__init__.py,sha256=ReItvqAxKPGo87IbVcsfNTCoD49Q-HXGQawErEnImWg,6048
3
3
  coinex/ccxt/coinex.py,sha256=2IWog856J1MkEwbFWGUBAtiLVycQJEDzk2ddXhEh964,267633
4
4
  coinex/ccxt/abstract/coinex.py,sha256=4TRXtWgONqkm3eSL55Y5T7Q4QxJrnOTuhP0ugsKHAWo,34856
5
- coinex/ccxt/async_support/__init__.py,sha256=e59U3Qh1xgnZ6WF5tzP6CBem2D6UgTeCQP8k7paf38k,4781
5
+ coinex/ccxt/async_support/__init__.py,sha256=lvRLsSCoWkEdfJ1D9WsC8NO0IcbyAe7ymn1Ooe0a-SY,4781
6
6
  coinex/ccxt/async_support/coinex.py,sha256=rKjhOk0bRSh2r-RuEf-mneByxwJVl9qHvVILtAbJuZA,268921
7
7
  coinex/ccxt/async_support/base/__init__.py,sha256=aVYSsFi--b4InRs9zDN_wtCpj8odosAB726JdUHavrk,67
8
- coinex/ccxt/async_support/base/exchange.py,sha256=WRCIHpPMqJ4UpcL4x534QQWA1Bo4RFS1xJitRjKFViw,119440
8
+ coinex/ccxt/async_support/base/exchange.py,sha256=rlXug7vYV2ke2rjNRzkakqbw4H7gzN3oUoeSldxBheY,119440
9
9
  coinex/ccxt/async_support/base/throttler.py,sha256=tvDVcdRUVYi8fZRlEcnqtgzcgB_KMUMRs5Pu8tuU-tU,1847
10
10
  coinex/ccxt/async_support/base/ws/__init__.py,sha256=uockzpLuwntKGZbs5EOWFe-Zg-k6Cj7GhNJLc_RX0so,1791
11
11
  coinex/ccxt/async_support/base/ws/cache.py,sha256=xf2VOtfUwloxSlIQ39M1RGZHWQzyS9IGhB5NX6cDcAc,8370
12
12
  coinex/ccxt/async_support/base/ws/client.py,sha256=ekIN5HNgeQgMG3tLZMsE889Aoxs960DLwQnwkTGhdi8,13624
13
13
  coinex/ccxt/async_support/base/ws/functions.py,sha256=qwvEnjtINWL5ZU-dbbeIunjyBxzFqbGWHfVhxqAcKug,1499
14
- coinex/ccxt/async_support/base/ws/future.py,sha256=9yFyxqT7cl-7ZFM6LM4b6UPXyO2FGIbAhs5uoJ3-Smo,1271
14
+ coinex/ccxt/async_support/base/ws/future.py,sha256=2zrEB7Xinq14N05jaewNtbR_2ZiE5GQZNQV4CBW7qTA,1337
15
15
  coinex/ccxt/async_support/base/ws/order_book.py,sha256=uBUaIHhzMRykpmo4BCsdJ-t_HozS6VxhEs8x-Kbj-NI,2894
16
16
  coinex/ccxt/async_support/base/ws/order_book_side.py,sha256=GhnGUt78pJ-AYL_Dq9produGjmBJLCI5FHIRdMz1O-g,6551
17
17
  coinex/ccxt/base/__init__.py,sha256=eTx1OE3HJjspFUQjGm6LBhaQiMKJnXjkdP-JUXknyQ0,1320
18
18
  coinex/ccxt/base/decimal_to_precision.py,sha256=fgWRBzRTtsf3r2INyS4f7WHlzgjB5YM1ekiwqD21aac,6634
19
- coinex/ccxt/base/errors.py,sha256=MvCrL_sAM3de616T6RE0PSxiF2xV6Qqz5b1y1ghidbk,4888
20
- coinex/ccxt/base/exchange.py,sha256=64LNTmAxXu8gUG6n4pwCNjTmVZmV0otj7ceWXRB3G6o,330373
19
+ coinex/ccxt/base/errors.py,sha256=Pad-6ugvGUwhoYuKUliX-N7FTrcnKCQGFjsaq2tMn0I,4610
20
+ coinex/ccxt/base/exchange.py,sha256=1Hb7swmJX38Qzt6t7TayO0U-jw0cQ5AbACLZoYoM-9I,331665
21
21
  coinex/ccxt/base/precise.py,sha256=koce64Yrp6vFbGijJtUt-QQ6XhJgeGTCksZ871FPp_A,8886
22
22
  coinex/ccxt/base/types.py,sha256=vMQfFDVntED4YHrRJt0Q98YaM7OtGhK-DkbkqXFTYHc,11485
23
- coinex/ccxt/pro/__init__.py,sha256=vf34De-oc2LRNfSmSQDaCkTvcEfNwTOSidT1scDmNpQ,4095
23
+ coinex/ccxt/pro/__init__.py,sha256=4ljVi9HGNuTvXgE29tGaShbM09NVE68McT8BjuetjYg,4095
24
24
  coinex/ccxt/pro/coinex.py,sha256=aQ6Xa4ML0PTCgGleDJuhjqntspAREz6XxQwX9IcD6OY,56616
25
25
  coinex/ccxt/static_dependencies/README.md,sha256=3TCvhhn09_Cqf9BDDpao1V7EfKHDpQ6k9oWRsLFixpU,18
26
26
  coinex/ccxt/static_dependencies/__init__.py,sha256=tzFje8cloqmiIE6kola3EaYC0SnD1izWnri69hzHsSw,168
@@ -281,6 +281,6 @@ coinex/ccxt/static_dependencies/toolz/curried/exceptions.py,sha256=gKFOHDIayAWnX
281
281
  coinex/ccxt/static_dependencies/toolz/curried/operator.py,sha256=ML92mknkAwzBl2NCm-4werSUmJEtSHNY9NSzhseNM9s,525
282
282
  coinex/ccxt/static_dependencies/typing_inspect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
283
283
  coinex/ccxt/static_dependencies/typing_inspect/typing_inspect.py,sha256=5gIWomLPfuDpgd3gX1GlnX0MuXM3VorR4j2W2qXORiQ,28269
284
- coinex_api-0.0.72.dist-info/METADATA,sha256=54uOfWQ_FlxMStSZ_JDGUgZzaebr6y8PlyOkZtVpztI,19969
285
- coinex_api-0.0.72.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
286
- coinex_api-0.0.72.dist-info/RECORD,,
284
+ coinex_api-0.0.74.dist-info/METADATA,sha256=j3ipWiC5ZYMvE7-RpoJWt3g-ZVjr02FAMDZfON6_13U,19969
285
+ coinex_api-0.0.74.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
286
+ coinex_api-0.0.74.dist-info/RECORD,,