okx-exchange 0.0.75__py3-none-any.whl → 0.0.76__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.
okx/ccxt/__init__.py CHANGED
@@ -26,7 +26,7 @@ sys.modules['ccxt'] = ccxt_module
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
29
- __version__ = '4.4.95'
29
+ __version__ = '4.4.96'
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.95'
11
+ __version__ = '4.4.96'
12
12
 
13
13
  # -----------------------------------------------------------------------------
14
14
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.4.95'
5
+ __version__ = '4.4.96'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -231,6 +231,8 @@ class Exchange(BaseExchange):
231
231
  self.last_json_response = json_response
232
232
  if self.verbose:
233
233
  self.log("\nfetch Response:", self.id, method, url, http_status_code, "ResponseHeaders:", headers, "ResponseBody:", http_response)
234
+ if json_response and not isinstance(json_response, list) and self.returnResponseHeaders:
235
+ json_response['responseHeaders'] = headers
234
236
  self.logger.debug("%s %s, Response: %s %s %s", method, url, http_status_code, headers, http_response)
235
237
 
236
238
  except socket.gaierror as e:
@@ -1596,10 +1598,10 @@ class Exchange(BaseExchange):
1596
1598
  """
1597
1599
  raise NotSupported(self.id + ' fetchDepositsWithdrawals() is not supported yet')
1598
1600
 
1599
- async def fetch_deposits(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1601
+ async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1600
1602
  raise NotSupported(self.id + ' fetchDeposits() is not supported yet')
1601
1603
 
1602
- async def fetch_withdrawals(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1604
+ async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1603
1605
  raise NotSupported(self.id + ' fetchWithdrawals() is not supported yet')
1604
1606
 
1605
1607
  async def fetch_deposits_ws(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -1,6 +1,8 @@
1
1
  import asyncio
2
2
 
3
-
3
+ # Test by running:
4
+ # - python python/ccxt/pro/test/base/test_close.py
5
+ # - python python/ccxt/pro/test/base/test_future.py
4
6
  class Future(asyncio.Future):
5
7
 
6
8
  def resolve(self, result=None):
@@ -30,14 +32,14 @@ class Future(asyncio.Future):
30
32
  if err:
31
33
  exceptions.append(err)
32
34
  # if any exceptions return with first exception
35
+ if future.cancelled():
36
+ return
33
37
  if len(exceptions) > 0:
34
38
  future.set_exception(exceptions[0])
35
39
  # else return first result
36
40
  elif cancelled:
37
41
  future.cancel()
38
42
  else:
39
- if future.cancelled():
40
- return
41
43
  first_result = list(complete)[0].result()
42
44
  future.set_result(first_result)
43
45
  task.add_done_callback(callback)
@@ -1173,7 +1173,9 @@ class okx(Exchange, ImplicitAPI):
1173
1173
  },
1174
1174
  'createOrder': 'privatePostTradeBatchOrders', # or 'privatePostTradeOrder' or 'privatePostTradeOrderAlgo'
1175
1175
  'createMarketBuyOrderRequiresPrice': False,
1176
- 'fetchMarkets': ['spot', 'future', 'swap', 'option'], # spot, future, swap, option
1176
+ 'fetchMarkets': {
1177
+ 'types': ['spot', 'future', 'swap', 'option'], # spot, future, swap, option
1178
+ },
1177
1179
  'timeDifference': 0, # the difference between system clock and exchange server clock
1178
1180
  'adjustForTimeDifference': False, # controls the adjustment logic upon instantiation
1179
1181
  'defaultType': 'spot', # 'funding', 'spot', 'margin', 'future', 'swap', 'option'
@@ -1559,7 +1561,12 @@ class okx(Exchange, ImplicitAPI):
1559
1561
  """
1560
1562
  if self.options['adjustForTimeDifference']:
1561
1563
  await self.load_time_difference()
1562
- types = self.safe_list(self.options, 'fetchMarkets', [])
1564
+ types = ['spot', 'future', 'swap', 'option']
1565
+ fetchMarketsOption = self.safe_dict(self.options, 'fetchMarkets')
1566
+ if fetchMarketsOption is not None:
1567
+ types = self.safe_list(fetchMarketsOption, 'types', types)
1568
+ else:
1569
+ types = self.safe_list(self.options, 'fetchMarkets', types) # backward-support
1563
1570
  promises = []
1564
1571
  result = []
1565
1572
  for i in range(0, len(types)):
@@ -3325,7 +3332,7 @@ class okx(Exchange, ImplicitAPI):
3325
3332
  trailing = self.safe_bool(params, 'trailing', False)
3326
3333
  if trigger or trailing:
3327
3334
  orderInner = await self.cancel_orders([id], symbol, params)
3328
- return self.safe_value(orderInner, 0)
3335
+ return self.safe_dict(orderInner, 0)
3329
3336
  await self.load_markets()
3330
3337
  market = self.market(symbol)
3331
3338
  request: dict = {
okx/ccxt/base/errors.py CHANGED
@@ -1,3 +1,9 @@
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
+
1
7
  error_hierarchy = {
2
8
  'BaseError': {
3
9
  'ExchangeError': {
okx/ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.95'
7
+ __version__ = '4.4.96'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -229,6 +229,7 @@ class Exchange(object):
229
229
  'chrome100': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36',
230
230
  }
231
231
  headers = None
232
+ returnResponseHeaders = False
232
233
  origin = '*' # CORS origin
233
234
  MAX_VALUE = float('inf')
234
235
  #
@@ -579,6 +580,8 @@ class Exchange(object):
579
580
  if self.verbose:
580
581
  self.log("\nfetch Response:", self.id, method, url, http_status_code, "ResponseHeaders:", headers, "ResponseBody:", http_response)
581
582
  self.logger.debug("%s %s, Response: %s %s %s", method, url, http_status_code, headers, http_response)
583
+ if json_response and not isinstance(json_response, list) and self.returnResponseHeaders:
584
+ json_response['responseHeaders'] = headers
582
585
  response.raise_for_status()
583
586
 
584
587
  except Timeout as e:
@@ -5495,10 +5498,10 @@ class Exchange(object):
5495
5498
  """
5496
5499
  raise NotSupported(self.id + ' fetchDepositsWithdrawals() is not supported yet')
5497
5500
 
5498
- def fetch_deposits(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
5501
+ def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
5499
5502
  raise NotSupported(self.id + ' fetchDeposits() is not supported yet')
5500
5503
 
5501
- def fetch_withdrawals(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
5504
+ def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
5502
5505
  raise NotSupported(self.id + ' fetchWithdrawals() is not supported yet')
5503
5506
 
5504
5507
  def fetch_deposits_ws(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
okx/ccxt/okx.py CHANGED
@@ -1172,7 +1172,9 @@ class okx(Exchange, ImplicitAPI):
1172
1172
  },
1173
1173
  'createOrder': 'privatePostTradeBatchOrders', # or 'privatePostTradeOrder' or 'privatePostTradeOrderAlgo'
1174
1174
  'createMarketBuyOrderRequiresPrice': False,
1175
- 'fetchMarkets': ['spot', 'future', 'swap', 'option'], # spot, future, swap, option
1175
+ 'fetchMarkets': {
1176
+ 'types': ['spot', 'future', 'swap', 'option'], # spot, future, swap, option
1177
+ },
1176
1178
  'timeDifference': 0, # the difference between system clock and exchange server clock
1177
1179
  'adjustForTimeDifference': False, # controls the adjustment logic upon instantiation
1178
1180
  'defaultType': 'spot', # 'funding', 'spot', 'margin', 'future', 'swap', 'option'
@@ -1558,7 +1560,12 @@ class okx(Exchange, ImplicitAPI):
1558
1560
  """
1559
1561
  if self.options['adjustForTimeDifference']:
1560
1562
  self.load_time_difference()
1561
- types = self.safe_list(self.options, 'fetchMarkets', [])
1563
+ types = ['spot', 'future', 'swap', 'option']
1564
+ fetchMarketsOption = self.safe_dict(self.options, 'fetchMarkets')
1565
+ if fetchMarketsOption is not None:
1566
+ types = self.safe_list(fetchMarketsOption, 'types', types)
1567
+ else:
1568
+ types = self.safe_list(self.options, 'fetchMarkets', types) # backward-support
1562
1569
  promises = []
1563
1570
  result = []
1564
1571
  for i in range(0, len(types)):
@@ -3324,7 +3331,7 @@ class okx(Exchange, ImplicitAPI):
3324
3331
  trailing = self.safe_bool(params, 'trailing', False)
3325
3332
  if trigger or trailing:
3326
3333
  orderInner = self.cancel_orders([id], symbol, params)
3327
- return self.safe_value(orderInner, 0)
3334
+ return self.safe_dict(orderInner, 0)
3328
3335
  self.load_markets()
3329
3336
  market = self.market(symbol)
3330
3337
  request: dict = {
okx/ccxt/pro/__init__.py CHANGED
@@ -8,7 +8,7 @@ sys.modules['ccxt'] = ccxt_module
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
11
- __version__ = '4.4.95'
11
+ __version__ = '4.4.96'
12
12
 
13
13
  # ----------------------------------------------------------------------------
14
14
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: okx-exchange
3
- Version: 0.0.75
3
+ Version: 0.0.76
4
4
  Summary: okx 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
  okx/__init__.py,sha256=SLqs4d-SexaSbdW86VEbgXzMVyX9dwVlxXtQ8_Zm0T0,210
2
- okx/ccxt/__init__.py,sha256=bs2x3XE5kJ9YHzWORxMOQzZ3DhbP0PrVk9k81ojOQ5o,6042
3
- okx/ccxt/okx.py,sha256=DXA_ggfu2f_AVlRzwr9scSh2Ov7NP2XnWDcx5bovxI8,406900
2
+ okx/ccxt/__init__.py,sha256=DS14haKJiK06wH_yMmuT7KGQlg-xfwq2OAJS5L6HOYs,6042
3
+ okx/ccxt/okx.py,sha256=UeKjKRrzwXzNFJEFDn52toigVhd5JimDKbdw0CCvKhI,407231
4
4
  okx/ccxt/abstract/okx.py,sha256=vf8yrYRfX1K30qzmLmTUDCRoDObSMbYX437FPKfBCXY,52434
5
- okx/ccxt/async_support/__init__.py,sha256=CQgejmC0hbG21ZzhCMiBi3m0PvAyAvrhAe-pZja0mag,4775
6
- okx/ccxt/async_support/okx.py,sha256=Q1SrTpdM1o3uYhcCqd_tGg4pYrEKaTlNM2SH_JDPzfM,408619
5
+ okx/ccxt/async_support/__init__.py,sha256=5lXzgs7oo_UDINsZQ1NZqkGkcE3OBQ0kei-Gnb6cxfA,4775
6
+ okx/ccxt/async_support/okx.py,sha256=qIIWRHVN1Osnrq3kCsMS0XqBgY4sT5zyghMN5IvbVP0,408950
7
7
  okx/ccxt/async_support/base/__init__.py,sha256=aVYSsFi--b4InRs9zDN_wtCpj8odosAB726JdUHavrk,67
8
- okx/ccxt/async_support/base/exchange.py,sha256=rlXug7vYV2ke2rjNRzkakqbw4H7gzN3oUoeSldxBheY,119440
8
+ okx/ccxt/async_support/base/exchange.py,sha256=Ov3ySIOFH_PGlKGNFfPqF_RywDiSLp9Je64KanBTMDY,119604
9
9
  okx/ccxt/async_support/base/throttler.py,sha256=tvDVcdRUVYi8fZRlEcnqtgzcgB_KMUMRs5Pu8tuU-tU,1847
10
10
  okx/ccxt/async_support/base/ws/__init__.py,sha256=uockzpLuwntKGZbs5EOWFe-Zg-k6Cj7GhNJLc_RX0so,1791
11
11
  okx/ccxt/async_support/base/ws/cache.py,sha256=xf2VOtfUwloxSlIQ39M1RGZHWQzyS9IGhB5NX6cDcAc,8370
12
12
  okx/ccxt/async_support/base/ws/client.py,sha256=ekIN5HNgeQgMG3tLZMsE889Aoxs960DLwQnwkTGhdi8,13624
13
13
  okx/ccxt/async_support/base/ws/functions.py,sha256=qwvEnjtINWL5ZU-dbbeIunjyBxzFqbGWHfVhxqAcKug,1499
14
- okx/ccxt/async_support/base/ws/future.py,sha256=2zrEB7Xinq14N05jaewNtbR_2ZiE5GQZNQV4CBW7qTA,1337
14
+ okx/ccxt/async_support/base/ws/future.py,sha256=hjdQ42zkfju5nar0GpTLJ4zXQBtgBU8DzYM5uPFcjsE,1450
15
15
  okx/ccxt/async_support/base/ws/order_book.py,sha256=uBUaIHhzMRykpmo4BCsdJ-t_HozS6VxhEs8x-Kbj-NI,2894
16
16
  okx/ccxt/async_support/base/ws/order_book_side.py,sha256=GhnGUt78pJ-AYL_Dq9produGjmBJLCI5FHIRdMz1O-g,6551
17
17
  okx/ccxt/base/__init__.py,sha256=eTx1OE3HJjspFUQjGm6LBhaQiMKJnXjkdP-JUXknyQ0,1320
18
18
  okx/ccxt/base/decimal_to_precision.py,sha256=fgWRBzRTtsf3r2INyS4f7WHlzgjB5YM1ekiwqD21aac,6634
19
- okx/ccxt/base/errors.py,sha256=Pad-6ugvGUwhoYuKUliX-N7FTrcnKCQGFjsaq2tMn0I,4610
20
- okx/ccxt/base/exchange.py,sha256=1Hb7swmJX38Qzt6t7TayO0U-jw0cQ5AbACLZoYoM-9I,331665
19
+ okx/ccxt/base/errors.py,sha256=MvCrL_sAM3de616T6RE0PSxiF2xV6Qqz5b1y1ghidbk,4888
20
+ okx/ccxt/base/exchange.py,sha256=uJ-9MHGpRUufv0rcn7X9QmQSnSKuWj8OjA5poA_qc_s,331855
21
21
  okx/ccxt/base/precise.py,sha256=koce64Yrp6vFbGijJtUt-QQ6XhJgeGTCksZ871FPp_A,8886
22
22
  okx/ccxt/base/types.py,sha256=vMQfFDVntED4YHrRJt0Q98YaM7OtGhK-DkbkqXFTYHc,11485
23
- okx/ccxt/pro/__init__.py,sha256=iicMTsqj0gJpNh4X4ThuVXNYi0-hemU0QmV-Ynuv9Ak,4089
23
+ okx/ccxt/pro/__init__.py,sha256=jg8Z0Y_GYW1wC9WDJ_OLIXZ1FEEPkb3hnS2bBi1vcho,4089
24
24
  okx/ccxt/pro/okx.py,sha256=DHQ6muxmyFV7KBUoARBHg5cr03QqUAg2etYnqsplhCM,104672
25
25
  okx/ccxt/static_dependencies/README.md,sha256=3TCvhhn09_Cqf9BDDpao1V7EfKHDpQ6k9oWRsLFixpU,18
26
26
  okx/ccxt/static_dependencies/__init__.py,sha256=tzFje8cloqmiIE6kola3EaYC0SnD1izWnri69hzHsSw,168
@@ -281,6 +281,6 @@ okx/ccxt/static_dependencies/toolz/curried/exceptions.py,sha256=gKFOHDIayAWnX2uC
281
281
  okx/ccxt/static_dependencies/toolz/curried/operator.py,sha256=ML92mknkAwzBl2NCm-4werSUmJEtSHNY9NSzhseNM9s,525
282
282
  okx/ccxt/static_dependencies/typing_inspect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
283
283
  okx/ccxt/static_dependencies/typing_inspect/typing_inspect.py,sha256=5gIWomLPfuDpgd3gX1GlnX0MuXM3VorR4j2W2qXORiQ,28269
284
- okx_exchange-0.0.75.dist-info/METADATA,sha256=FrPnNVYnIRXb6lOKvccOIAbsTbld24mmGbJAeO2Sehc,30563
285
- okx_exchange-0.0.75.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
286
- okx_exchange-0.0.75.dist-info/RECORD,,
284
+ okx_exchange-0.0.76.dist-info/METADATA,sha256=eMPEzUBRTUGg4r4slriQeJjC3PRVpqCmI3u_kNpAonM,30563
285
+ okx_exchange-0.0.76.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
286
+ okx_exchange-0.0.76.dist-info/RECORD,,