ccxt 4.4.42__py2.py3-none-any.whl → 4.4.44__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.
Files changed (91) hide show
  1. ccxt/__init__.py +3 -1
  2. ccxt/abstract/binance.py +1 -0
  3. ccxt/abstract/binancecoinm.py +1 -0
  4. ccxt/abstract/binanceus.py +1 -0
  5. ccxt/abstract/binanceusdm.py +1 -0
  6. ccxt/abstract/bingx.py +4 -0
  7. ccxt/abstract/bitstamp.py +1 -0
  8. ccxt/abstract/myokx.py +340 -0
  9. ccxt/async_support/__init__.py +3 -1
  10. ccxt/async_support/base/exchange.py +1 -1
  11. ccxt/async_support/binance.py +57 -45
  12. ccxt/async_support/bingx.py +30 -7
  13. ccxt/async_support/bitfinex.py +6 -2
  14. ccxt/async_support/bitget.py +3 -1
  15. ccxt/async_support/bitmart.py +4 -7
  16. ccxt/async_support/bitmex.py +3 -5
  17. ccxt/async_support/bitstamp.py +59 -0
  18. ccxt/async_support/bybit.py +8 -23
  19. ccxt/async_support/coinbase.py +13 -9
  20. ccxt/async_support/coinbaseinternational.py +13 -9
  21. ccxt/async_support/coincatch.py +2 -2
  22. ccxt/async_support/coinex.py +5 -5
  23. ccxt/async_support/cryptocom.py +4 -2
  24. ccxt/async_support/defx.py +2 -2
  25. ccxt/async_support/delta.py +1 -1
  26. ccxt/async_support/gate.py +9 -4
  27. ccxt/async_support/gemini.py +65 -2
  28. ccxt/async_support/hashkey.py +9 -9
  29. ccxt/async_support/htx.py +101 -3
  30. ccxt/async_support/hyperliquid.py +6 -1
  31. ccxt/async_support/kraken.py +9 -2
  32. ccxt/async_support/krakenfutures.py +5 -0
  33. ccxt/async_support/kucoin.py +9 -7
  34. ccxt/async_support/kucoinfutures.py +5 -5
  35. ccxt/async_support/mexc.py +18 -12
  36. ccxt/async_support/myokx.py +35 -0
  37. ccxt/async_support/ndax.py +1 -1
  38. ccxt/async_support/oceanex.py +1 -1
  39. ccxt/async_support/okx.py +5 -6
  40. ccxt/async_support/phemex.py +6 -4
  41. ccxt/async_support/vertex.py +63 -4
  42. ccxt/async_support/whitebit.py +4 -2
  43. ccxt/async_support/woo.py +8 -6
  44. ccxt/async_support/woofipro.py +5 -2
  45. ccxt/base/exchange.py +1 -1
  46. ccxt/binance.py +57 -45
  47. ccxt/bingx.py +30 -7
  48. ccxt/bitfinex.py +6 -2
  49. ccxt/bitget.py +3 -1
  50. ccxt/bitmart.py +4 -7
  51. ccxt/bitmex.py +3 -5
  52. ccxt/bitstamp.py +59 -0
  53. ccxt/bybit.py +8 -23
  54. ccxt/coinbase.py +13 -9
  55. ccxt/coinbaseinternational.py +13 -9
  56. ccxt/coincatch.py +2 -2
  57. ccxt/coinex.py +5 -5
  58. ccxt/cryptocom.py +4 -2
  59. ccxt/defx.py +2 -2
  60. ccxt/delta.py +1 -1
  61. ccxt/gate.py +9 -4
  62. ccxt/gemini.py +65 -2
  63. ccxt/hashkey.py +9 -9
  64. ccxt/htx.py +101 -3
  65. ccxt/hyperliquid.py +6 -1
  66. ccxt/kraken.py +9 -2
  67. ccxt/krakenfutures.py +5 -0
  68. ccxt/kucoin.py +9 -7
  69. ccxt/kucoinfutures.py +5 -5
  70. ccxt/mexc.py +18 -12
  71. ccxt/myokx.py +35 -0
  72. ccxt/ndax.py +1 -1
  73. ccxt/oceanex.py +1 -1
  74. ccxt/okx.py +5 -6
  75. ccxt/phemex.py +6 -4
  76. ccxt/pro/__init__.py +3 -1
  77. ccxt/pro/bitcoincom.py +4 -1
  78. ccxt/pro/bitopro.py +1 -1
  79. ccxt/pro/myokx.py +23 -0
  80. ccxt/vertex.py +63 -4
  81. ccxt/whitebit.py +4 -2
  82. ccxt/woo.py +8 -6
  83. ccxt/woofipro.py +5 -2
  84. {ccxt-4.4.42.dist-info → ccxt-4.4.44.dist-info}/METADATA +36 -34
  85. {ccxt-4.4.42.dist-info → ccxt-4.4.44.dist-info}/RECORD +88 -87
  86. ccxt/async_support/bitbay.py +0 -17
  87. ccxt/async_support/bitfinex2.py +0 -3625
  88. ccxt/async_support/hitbtc3.py +0 -16
  89. {ccxt-4.4.42.dist-info → ccxt-4.4.44.dist-info}/LICENSE.txt +0 -0
  90. {ccxt-4.4.42.dist-info → ccxt-4.4.44.dist-info}/WHEEL +0 -0
  91. {ccxt-4.4.42.dist-info → ccxt-4.4.44.dist-info}/top_level.txt +0 -0
ccxt/myokx.py ADDED
@@ -0,0 +1,35 @@
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.okx import okx
7
+ from ccxt.abstract.myokx import ImplicitAPI
8
+
9
+
10
+ class myokx(okx, ImplicitAPI):
11
+
12
+ def describe(self):
13
+ return self.deep_extend(super(myokx, self).describe(), {
14
+ 'id': 'myokx',
15
+ 'name': 'MyOKX(EEA)',
16
+ 'certified': False,
17
+ 'pro': True,
18
+ 'hostname': 'eea.okx.com',
19
+ 'urls': {
20
+ 'logo': 'https://user-images.githubusercontent.com/1294454/152485636-38b19e4a-bece-4dec-979a-5982859ffc04.jpg',
21
+ 'api': {
22
+ 'rest': 'https://{hostname}',
23
+ },
24
+ 'www': 'https://my.okx.com',
25
+ 'doc': 'https://my.okx.com/docs-v5/en/#overview',
26
+ 'fees': 'https://my.okx.com/pages/products/fees.html',
27
+ 'referral': {
28
+ 'url': 'https://www.my.okx.com/join/CCXT2023',
29
+ 'discount': 0.2,
30
+ },
31
+ 'test': {
32
+ 'rest': 'https://{hostname}',
33
+ },
34
+ },
35
+ })
ccxt/ndax.py CHANGED
@@ -355,7 +355,7 @@ class ndax(Exchange, ImplicitAPI):
355
355
  #
356
356
  # {
357
357
  # "Authenticated": True,
358
- # "UserId":57765,
358
+ # "UserId":57764,
359
359
  # "SessionToken":"4a2a5857-c4e5-4fac-b09e-2c4c30b591a0"
360
360
  # }
361
361
  #
ccxt/oceanex.py CHANGED
@@ -497,7 +497,7 @@ class oceanex(Exchange, ImplicitAPI):
497
497
  # "funds":"6.0732952",
498
498
  # "market":"ethusdt",
499
499
  # "created_at":"2022-04-19T19:03:15Z",
500
- # "created_on":1650394995,
500
+ # "created_on":1650394994,
501
501
  # "side":"bid"
502
502
  # },
503
503
  # ]
ccxt/okx.py CHANGED
@@ -1206,7 +1206,6 @@ class okx(Exchange, ImplicitAPI):
1206
1206
  'brokerId': 'e847386590ce4dBC',
1207
1207
  },
1208
1208
  'features': {
1209
- # https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
1210
1209
  'default': {
1211
1210
  'sandbox': True,
1212
1211
  'createOrder': {
@@ -1235,12 +1234,12 @@ class okx(Exchange, ImplicitAPI):
1235
1234
  'GTD': False,
1236
1235
  },
1237
1236
  'hedged': True,
1238
- # even though the below params not unified yet, it's useful metadata for users to know that exchange supports them
1239
- 'selfTradePrevention': True,
1240
1237
  'trailing': True,
1241
- 'twap': True,
1242
- 'iceberg': True,
1243
- 'oco': True,
1238
+ 'iceberg': True, # todo implement
1239
+ 'leverage': False,
1240
+ 'selfTradePrevention': True, # todo implement
1241
+ 'marketBuyByCost': True,
1242
+ 'marketBuyRequiresPrice': False,
1244
1243
  },
1245
1244
  'createOrders': {
1246
1245
  'max': 20,
ccxt/phemex.py CHANGED
@@ -3462,13 +3462,15 @@ class phemex(Exchange, ImplicitAPI):
3462
3462
 
3463
3463
  :param str[] [symbols]: list of unified market symbols
3464
3464
  :param dict [params]: extra parameters specific to the exchange API endpoint
3465
+ :param str [params.code]: the currency code to fetch positions for, USD, BTC or USDT, USD is the default
3465
3466
  :param str [params.method]: *USDT contracts only* 'privateGetGAccountsAccountPositions' or 'privateGetAccountsPositions' default is 'privateGetGAccountsAccountPositions'
3466
3467
  :returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
3467
3468
  """
3468
3469
  self.load_markets()
3469
3470
  symbols = self.market_symbols(symbols)
3470
3471
  subType = None
3471
- code = self.safe_string(params, 'currency')
3472
+ code = self.safe_string_2(params, 'currency', 'code', 'USD')
3473
+ params = self.omit(params, ['currency', 'code'])
3472
3474
  settle = None
3473
3475
  market = None
3474
3476
  firstSymbol = self.safe_string(symbols, 0)
@@ -3477,15 +3479,15 @@ class phemex(Exchange, ImplicitAPI):
3477
3479
  settle = market['settle']
3478
3480
  code = market['settle']
3479
3481
  else:
3480
- settle, params = self.handle_option_and_params(params, 'fetchPositions', 'settle', 'USD')
3482
+ settle, params = self.handle_option_and_params(params, 'fetchPositions', 'settle', code)
3481
3483
  subType, params = self.handle_sub_type_and_params('fetchPositions', market, params)
3482
3484
  isUSDTSettled = settle == 'USDT'
3483
3485
  if isUSDTSettled:
3484
3486
  code = 'USDT'
3487
+ elif settle == 'BTC':
3488
+ code = 'BTC'
3485
3489
  elif code is None:
3486
3490
  code = 'USD' if (subType == 'linear') else 'BTC'
3487
- else:
3488
- params = self.omit(params, 'code')
3489
3491
  currency = self.currency(code)
3490
3492
  request: dict = {
3491
3493
  'currency': currency['id'],
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.42'
7
+ __version__ = '4.4.44'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
@@ -68,6 +68,7 @@ from ccxt.pro.kucoinfutures import kucoinfutures # noqa
68
68
  from ccxt.pro.lbank import lbank # noqa: F401
69
69
  from ccxt.pro.luno import luno # noqa: F401
70
70
  from ccxt.pro.mexc import mexc # noqa: F401
71
+ from ccxt.pro.myokx import myokx # noqa: F401
71
72
  from ccxt.pro.ndax import ndax # noqa: F401
72
73
  from ccxt.pro.okcoin import okcoin # noqa: F401
73
74
  from ccxt.pro.okx import okx # noqa: F401
@@ -144,6 +145,7 @@ exchanges = [
144
145
  'lbank',
145
146
  'luno',
146
147
  'mexc',
148
+ 'myokx',
147
149
  'ndax',
148
150
  'okcoin',
149
151
  'okx',
ccxt/pro/bitcoincom.py CHANGED
@@ -22,7 +22,10 @@ class bitcoincom(hitbtc):
22
22
  'urls': {
23
23
  'logo': 'https://user-images.githubusercontent.com/1294454/97296144-514fa300-1861-11eb-952b-3d55d492200b.jpg',
24
24
  'api': {
25
- 'ws': 'wss://api.fmfw.io/api/2/ws',
25
+ 'ws': {
26
+ 'public': 'wss://api.fmfw.io/api/3/ws/public',
27
+ 'private': 'wss://api.fmfw.io/api/3/ws/trading',
28
+ },
26
29
  },
27
30
  },
28
31
  'fees': {
ccxt/pro/bitopro.py CHANGED
@@ -77,7 +77,7 @@ class bitopro(ccxt.async_support.bitopro):
77
77
  if limit is None:
78
78
  endPart = market['id']
79
79
  else:
80
- endPart = market['id'] + ':' + limit
80
+ endPart = market['id'] + ':' + self.number_to_string(limit)
81
81
  orderbook = await self.watch_public('order-books', messageHash, endPart)
82
82
  return orderbook.limit()
83
83
 
ccxt/pro/myokx.py ADDED
@@ -0,0 +1,23 @@
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.pro.okx import okx
7
+
8
+
9
+ class myokx(okx):
10
+
11
+ def describe(self):
12
+ return self.deep_extend(super(myokx, self).describe(), {
13
+ 'id': 'myokx',
14
+ 'name': 'MyOKX',
15
+ 'urls': {
16
+ 'api': {
17
+ 'ws': 'wss://wseea.okx.com:8443/ws/v5',
18
+ },
19
+ 'test': {
20
+ 'ws': 'wss://wseeapap.okx.com:8443/ws/v5',
21
+ },
22
+ },
23
+ })
ccxt/vertex.py CHANGED
@@ -93,6 +93,7 @@ class vertex(Exchange, ImplicitAPI):
93
93
  'fetchOHLCV': True,
94
94
  'fetchOpenInterest': True,
95
95
  'fetchOpenInterestHistory': False,
96
+ 'fetchOpenInterests': True,
96
97
  'fetchOpenOrders': True,
97
98
  'fetchOrder': True,
98
99
  'fetchOrderBook': True,
@@ -1329,16 +1330,74 @@ class vertex(Exchange, ImplicitAPI):
1329
1330
  # }
1330
1331
  # }
1331
1332
  #
1332
- value = self.safe_number(interest, 'open_interest_usd')
1333
+ marketId = self.safe_string(interest, 'ticker_id')
1333
1334
  return self.safe_open_interest({
1334
- 'symbol': market['symbol'],
1335
- 'openInterestAmount': None,
1336
- 'openInterestValue': value,
1335
+ 'symbol': self.safe_symbol(marketId, market),
1336
+ 'openInterestAmount': self.safe_number(interest, 'open_interest'),
1337
+ 'openInterestValue': self.safe_number(interest, 'open_interest_usd'),
1337
1338
  'timestamp': None,
1338
1339
  'datetime': None,
1339
1340
  'info': interest,
1340
1341
  }, market)
1341
1342
 
1343
+ def fetch_open_interests(self, symbols: Strings = None, params={}):
1344
+ """
1345
+ Retrieves the open interest for a list of symbols
1346
+
1347
+ https://docs.vertexprotocol.com/developer-resources/api/v2/contracts
1348
+
1349
+ :param str[] [symbols]: a list of unified CCXT market symbols
1350
+ :param dict [params]: exchange specific parameters
1351
+ :returns dict[]: a list of `open interest structures <https://docs.ccxt.com/#/?id=open-interest-structure>`
1352
+ """
1353
+ self.load_markets()
1354
+ symbols = self.market_symbols(symbols)
1355
+ response = self.v2ArchiveGetContracts(params)
1356
+ #
1357
+ # {
1358
+ # "ADA-PERP_USDC": {
1359
+ # "ticker_id": "ADA-PERP_USDC",
1360
+ # "base_currency": "ADA-PERP",
1361
+ # "quote_currency": "USDC",
1362
+ # "last_price": 0.85506,
1363
+ # "base_volume": 1241320.0,
1364
+ # "quote_volume": 1122670.9080057142,
1365
+ # "product_type": "perpetual",
1366
+ # "contract_price": 0.8558601432685385,
1367
+ # "contract_price_currency": "USD",
1368
+ # "open_interest": 104040.0,
1369
+ # "open_interest_usd": 89043.68930565874,
1370
+ # "index_price": 0.8561952606869176,
1371
+ # "mark_price": 0.856293781088936,
1372
+ # "funding_rate": 0.000116153806226841,
1373
+ # "next_funding_rate_timestamp": 1734685200,
1374
+ # "price_change_percent_24h": -12.274325340321374
1375
+ # },
1376
+ # }
1377
+ #
1378
+ parsedSymbols = []
1379
+ results = []
1380
+ markets = list(response.keys())
1381
+ if symbols is None:
1382
+ symbols = []
1383
+ for y in range(0, len(markets)):
1384
+ tickerId = markets[y]
1385
+ parsedTickerId = tickerId.split('-')
1386
+ currentSymbol = parsedTickerId[0] + '/USDC:USDC'
1387
+ if not self.in_array(currentSymbol, symbols):
1388
+ symbols.append(currentSymbol)
1389
+ for i in range(0, len(markets)):
1390
+ marketId = markets[i]
1391
+ marketInner = self.safe_market(marketId)
1392
+ openInterest = self.safe_dict(response, marketId, {})
1393
+ for j in range(0, len(symbols)):
1394
+ market = self.market(symbols[j])
1395
+ tickerId = market['base'] + '_USDC'
1396
+ if marketInner['marketId'] == tickerId:
1397
+ parsedSymbols.append(market['symbol'])
1398
+ results.append(self.parse_open_interest(openInterest, market))
1399
+ return self.filter_by_array(results, 'symbol', parsedSymbols)
1400
+
1342
1401
  def fetch_open_interest(self, symbol: str, params={}):
1343
1402
  """
1344
1403
  Retrieves the open interest of a derivative trading pair
ccxt/whitebit.py CHANGED
@@ -1217,9 +1217,11 @@ class whitebit(Exchange, ImplicitAPI):
1217
1217
  :param dict [params]: extra parameters specific to the exchange API endpoint
1218
1218
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1219
1219
  """
1220
- params['cost'] = cost
1220
+ req = {
1221
+ 'cost': cost,
1222
+ }
1221
1223
  # only buy side is supported
1222
- return self.create_order(symbol, 'market', side, 0, None, params)
1224
+ return self.create_order(symbol, 'market', side, 0, None, self.extend(req, params))
1223
1225
 
1224
1226
  def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}) -> Order:
1225
1227
  """
ccxt/woo.py CHANGED
@@ -344,9 +344,11 @@ class woo(Exchange, ImplicitAPI):
344
344
  },
345
345
  'hedged': False,
346
346
  'trailing': True,
347
- # exchange specific params:
348
- # 'iceberg': True,
349
- # 'oco': True,
347
+ 'leverage': False,
348
+ 'marketBuyByCost': True,
349
+ 'marketBuyRequiresPrice': False,
350
+ 'selfTradePrevention': False,
351
+ 'iceberg': True, # todo implement
350
352
  },
351
353
  'createOrders': None,
352
354
  'fetchMyTrades': {
@@ -1051,7 +1053,7 @@ class woo(Exchange, ImplicitAPI):
1051
1053
  marginMode, params = self.handle_margin_mode_and_params('createOrder', params)
1052
1054
  if marginMode is not None:
1053
1055
  request['margin_mode'] = self.encode_margin_mode(marginMode)
1054
- triggerPrice = self.safe_number_2(params, 'triggerPrice', 'stopPrice')
1056
+ triggerPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
1055
1057
  stopLoss = self.safe_value(params, 'stopLoss')
1056
1058
  takeProfit = self.safe_value(params, 'takeProfit')
1057
1059
  algoType = self.safe_string(params, 'algoType')
@@ -1128,7 +1130,7 @@ class woo(Exchange, ImplicitAPI):
1128
1130
  }
1129
1131
  closeSide = 'SELL' if (orderSide == 'BUY') else 'BUY'
1130
1132
  if stopLoss is not None:
1131
- stopLossPrice = self.safe_number_2(stopLoss, 'triggerPrice', 'price', stopLoss)
1133
+ stopLossPrice = self.safe_string(stopLoss, 'triggerPrice', stopLoss)
1132
1134
  stopLossOrder: dict = {
1133
1135
  'side': closeSide,
1134
1136
  'algoType': 'STOP_LOSS',
@@ -1138,7 +1140,7 @@ class woo(Exchange, ImplicitAPI):
1138
1140
  }
1139
1141
  outterOrder['childOrders'].append(stopLossOrder)
1140
1142
  if takeProfit is not None:
1141
- takeProfitPrice = self.safe_number_2(takeProfit, 'triggerPrice', 'price', takeProfit)
1143
+ takeProfitPrice = self.safe_string(takeProfit, 'triggerPrice', takeProfit)
1142
1144
  takeProfitOrder: dict = {
1143
1145
  'side': closeSide,
1144
1146
  'algoType': 'TAKE_PROFIT',
ccxt/woofipro.py CHANGED
@@ -327,8 +327,11 @@ class woofipro(Exchange, ImplicitAPI):
327
327
  },
328
328
  'hedged': False,
329
329
  'trailing': True,
330
- # exchange specific
331
- # 'iceberg': True,
330
+ 'leverage': True, # todo implement
331
+ 'marketBuyByCost': False,
332
+ 'marketBuyRequiresPrice': False,
333
+ 'selfTradePrevention': False,
334
+ 'iceberg': True, # todo implement
332
335
  },
333
336
  'createOrders': {
334
337
  'max': 10,