ccxt 4.4.42__py2.py3-none-any.whl → 4.4.43__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.
@@ -165,6 +165,7 @@ class bitstamp(Exchange, ImplicitAPI):
165
165
  'user_transactions/': 1,
166
166
  'user_transactions/{pair}/': 1,
167
167
  'crypto-transactions/': 1,
168
+ 'open_order': 1,
168
169
  'open_orders/all/': 1,
169
170
  'open_orders/{pair}/': 1,
170
171
  'order_status/': 1,
@@ -505,6 +506,59 @@ class bitstamp(Exchange, ImplicitAPI):
505
506
  'Ensure that there are no more than': InvalidOrder, # {"status": "error", "reason": {"amount": ["Ensure that there are no more than 0 decimal places."], "__all__": [""]}}
506
507
  },
507
508
  },
509
+ 'features': {
510
+ 'spot': {
511
+ 'sandbox': False,
512
+ 'createOrder': {
513
+ 'marginMode': False,
514
+ 'triggerPrice': False,
515
+ 'triggerPriceType': None,
516
+ 'triggerDirection': False,
517
+ 'stopLossPrice': False,
518
+ 'takeProfitPrice': False,
519
+ 'attachedStopLossTakeProfit': None,
520
+ 'timeInForce': {
521
+ 'IOC': True,
522
+ 'FOK': True,
523
+ 'PO': True,
524
+ 'GTD': True,
525
+ },
526
+ 'hedged': False,
527
+ 'trailing': False,
528
+ },
529
+ 'createOrders': None,
530
+ 'fetchMyTrades': {
531
+ 'marginMode': False,
532
+ 'limit': 1000,
533
+ 'daysBack': None,
534
+ 'untilDays': 30,
535
+ },
536
+ 'fetchOrder': {
537
+ 'marginMode': False,
538
+ 'trigger': False,
539
+ 'trailing': False,
540
+ },
541
+ 'fetchOpenOrders': {
542
+ 'marginMode': False,
543
+ 'limit': None,
544
+ 'trigger': False,
545
+ 'trailing': False,
546
+ },
547
+ 'fetchOrders': None,
548
+ 'fetchClosedOrders': None,
549
+ 'fetchOHLCV': {
550
+ 'limit': 1000,
551
+ },
552
+ },
553
+ 'swap': {
554
+ 'linear': None,
555
+ 'inverse': None,
556
+ },
557
+ 'future': {
558
+ 'linear': None,
559
+ 'inverse': None,
560
+ },
561
+ },
508
562
  })
509
563
 
510
564
  async def fetch_markets(self, params={}) -> List[Market]:
@@ -311,6 +311,64 @@ class gemini(Exchange, ImplicitAPI):
311
311
  },
312
312
  },
313
313
  },
314
+ 'features': {
315
+ 'default': {
316
+ 'sandbox': True,
317
+ 'createOrder': {
318
+ 'marginMode': False,
319
+ 'triggerPrice': True,
320
+ 'triggerPriceType': None,
321
+ 'triggerDirection': False,
322
+ 'stopLossPrice': False, # todo
323
+ 'takeProfitPrice': False, # todo
324
+ 'attachedStopLossTakeProfit': None,
325
+ 'timeInForce': {
326
+ 'IOC': True,
327
+ 'FOK': True,
328
+ 'PO': True,
329
+ 'GTD': False,
330
+ },
331
+ 'hedged': False,
332
+ 'trailing': False,
333
+ },
334
+ 'createOrders': None,
335
+ 'fetchMyTrades': {
336
+ 'marginMode': False,
337
+ 'limit': 500,
338
+ 'daysBack': None,
339
+ 'untilDays': None,
340
+ },
341
+ 'fetchOrder': {
342
+ 'marginMode': False,
343
+ 'trigger': False,
344
+ 'trailing': False,
345
+ },
346
+ 'fetchOpenOrders': {
347
+ 'marginMode': False,
348
+ 'limit': None,
349
+ 'trigger': False,
350
+ 'trailing': False,
351
+ },
352
+ 'fetchOrders': None,
353
+ 'fetchClosedOrders': None, # todo: implement
354
+ 'fetchOHLCV': {
355
+ 'limit': None,
356
+ },
357
+ },
358
+ 'spot': {
359
+ 'extends': 'default',
360
+ },
361
+ 'swap': {
362
+ 'linear': {
363
+ 'extends': 'default',
364
+ },
365
+ 'inverse': None,
366
+ },
367
+ 'future': {
368
+ 'linear': None,
369
+ 'inverse': None,
370
+ },
371
+ },
314
372
  })
315
373
 
316
374
  async def fetch_currencies(self, params={}) -> Currencies:
@@ -1431,8 +1489,8 @@ class gemini(Exchange, ImplicitAPI):
1431
1489
  }
1432
1490
  type = self.safe_string(params, 'type', type)
1433
1491
  params = self.omit(params, 'type')
1434
- triggerPrice = self.safe_string_n(params, ['stop_price', 'stopPrice'])
1435
- params = self.omit(params, ['stop_price', 'stopPrice', 'type'])
1492
+ triggerPrice = self.safe_string_n(params, ['triggerPrice', 'stop_price', 'stopPrice'])
1493
+ params = self.omit(params, ['triggerPrice', 'stop_price', 'stopPrice', 'type'])
1436
1494
  if type == 'stopLimit':
1437
1495
  raise ArgumentsRequired(self.id + ' createOrder() requires a triggerPrice parameter or a stop_price parameter for ' + type + ' orders')
1438
1496
  if triggerPrice is not None:
@@ -32,7 +32,7 @@ class hyperliquid(Exchange, ImplicitAPI):
32
32
  'countries': [],
33
33
  'version': 'v1',
34
34
  'rateLimit': 50, # 1200 requests per minute, 20 request per second
35
- 'certified': False,
35
+ 'certified': True,
36
36
  'pro': True,
37
37
  'dex': True,
38
38
  'has': {
@@ -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.async_support.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
+ })
@@ -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
  await 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'],
@@ -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
+ async 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
+ await self.load_markets()
1354
+ symbols = self.market_symbols(symbols)
1355
+ response = await 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
  async def fetch_open_interest(self, symbol: str, params={}):
1343
1402
  """
1344
1403
  Retrieves the open interest of a derivative trading pair
ccxt/async_support/woo.py CHANGED
@@ -1051,7 +1051,7 @@ class woo(Exchange, ImplicitAPI):
1051
1051
  marginMode, params = self.handle_margin_mode_and_params('createOrder', params)
1052
1052
  if marginMode is not None:
1053
1053
  request['margin_mode'] = self.encode_margin_mode(marginMode)
1054
- triggerPrice = self.safe_number_2(params, 'triggerPrice', 'stopPrice')
1054
+ triggerPrice = self.safe_string_2(params, 'triggerPrice', 'stopPrice')
1055
1055
  stopLoss = self.safe_value(params, 'stopLoss')
1056
1056
  takeProfit = self.safe_value(params, 'takeProfit')
1057
1057
  algoType = self.safe_string(params, 'algoType')
@@ -1128,7 +1128,7 @@ class woo(Exchange, ImplicitAPI):
1128
1128
  }
1129
1129
  closeSide = 'SELL' if (orderSide == 'BUY') else 'BUY'
1130
1130
  if stopLoss is not None:
1131
- stopLossPrice = self.safe_number_2(stopLoss, 'triggerPrice', 'price', stopLoss)
1131
+ stopLossPrice = self.safe_string(stopLoss, 'triggerPrice', stopLoss)
1132
1132
  stopLossOrder: dict = {
1133
1133
  'side': closeSide,
1134
1134
  'algoType': 'STOP_LOSS',
@@ -1138,7 +1138,7 @@ class woo(Exchange, ImplicitAPI):
1138
1138
  }
1139
1139
  outterOrder['childOrders'].append(stopLossOrder)
1140
1140
  if takeProfit is not None:
1141
- takeProfitPrice = self.safe_number_2(takeProfit, 'triggerPrice', 'price', takeProfit)
1141
+ takeProfitPrice = self.safe_string(takeProfit, 'triggerPrice', takeProfit)
1142
1142
  takeProfitOrder: dict = {
1143
1143
  'side': closeSide,
1144
1144
  'algoType': 'TAKE_PROFIT',
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.42'
7
+ __version__ = '4.4.43'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
ccxt/bingx.py CHANGED
@@ -399,12 +399,26 @@ class bingx(Exchange, ImplicitAPI):
399
399
  'get': {
400
400
  'uid': 1,
401
401
  'apiKey/query': 2,
402
+ 'account/apiPermissions': 5,
402
403
  },
403
404
  'post': {
404
405
  'innerTransfer/authorizeSubAccount': 1,
405
406
  },
406
407
  },
407
408
  },
409
+ 'transfer': {
410
+ 'v1': {
411
+ 'private': {
412
+ 'get': {
413
+ 'subAccount/asset/transferHistory': 1,
414
+ },
415
+ 'post': {
416
+ 'subAccount/transferAsset/supportCoins': 1,
417
+ 'subAccount/transferAsset': 1,
418
+ },
419
+ },
420
+ },
421
+ },
408
422
  },
409
423
  'user': {
410
424
  'auth': {
@@ -6144,13 +6158,17 @@ class bingx(Exchange, ImplicitAPI):
6144
6158
  if isSandbox and (type != 'swap'):
6145
6159
  raise NotSupported(self.id + ' does not have a testnet/sandbox URL for ' + type + ' endpoints')
6146
6160
  url = self.implode_hostname(self.urls['api'][type])
6147
- if type == 'spot' and version == 'v3':
6148
- url += '/api'
6149
- else:
6150
- url += '/' + type
6151
- url += '/' + version + '/'
6152
6161
  path = self.implode_params(path, params)
6153
- url += path
6162
+ if version == 'transfer':
6163
+ type = 'account/transfer'
6164
+ version = section[2]
6165
+ access = section[3]
6166
+ if path != 'account/apiPermissions':
6167
+ if type == 'spot' and version == 'v3':
6168
+ url += '/api'
6169
+ else:
6170
+ url += '/' + type
6171
+ url += '/' + version + '/' + path
6154
6172
  params = self.omit(params, self.extract_params(path))
6155
6173
  params['timestamp'] = self.nonce()
6156
6174
  params = self.keysort(params)
@@ -6159,7 +6177,7 @@ class bingx(Exchange, ImplicitAPI):
6159
6177
  url += '?' + self.urlencode(params)
6160
6178
  elif access == 'private':
6161
6179
  self.check_required_credentials()
6162
- isJsonContentType = ((type == 'subAccount') and (method == 'POST'))
6180
+ isJsonContentType = (((type == 'subAccount') or (type == 'account/transfer')) and (method == 'POST'))
6163
6181
  parsedParams = self.parse_params(params)
6164
6182
  signature = self.hmac(self.encode(self.rawencode(parsedParams)), self.encode(self.secret), hashlib.sha256)
6165
6183
  headers = {
ccxt/bitstamp.py CHANGED
@@ -165,6 +165,7 @@ class bitstamp(Exchange, ImplicitAPI):
165
165
  'user_transactions/': 1,
166
166
  'user_transactions/{pair}/': 1,
167
167
  'crypto-transactions/': 1,
168
+ 'open_order': 1,
168
169
  'open_orders/all/': 1,
169
170
  'open_orders/{pair}/': 1,
170
171
  'order_status/': 1,
@@ -505,6 +506,59 @@ class bitstamp(Exchange, ImplicitAPI):
505
506
  'Ensure that there are no more than': InvalidOrder, # {"status": "error", "reason": {"amount": ["Ensure that there are no more than 0 decimal places."], "__all__": [""]}}
506
507
  },
507
508
  },
509
+ 'features': {
510
+ 'spot': {
511
+ 'sandbox': False,
512
+ 'createOrder': {
513
+ 'marginMode': False,
514
+ 'triggerPrice': False,
515
+ 'triggerPriceType': None,
516
+ 'triggerDirection': False,
517
+ 'stopLossPrice': False,
518
+ 'takeProfitPrice': False,
519
+ 'attachedStopLossTakeProfit': None,
520
+ 'timeInForce': {
521
+ 'IOC': True,
522
+ 'FOK': True,
523
+ 'PO': True,
524
+ 'GTD': True,
525
+ },
526
+ 'hedged': False,
527
+ 'trailing': False,
528
+ },
529
+ 'createOrders': None,
530
+ 'fetchMyTrades': {
531
+ 'marginMode': False,
532
+ 'limit': 1000,
533
+ 'daysBack': None,
534
+ 'untilDays': 30,
535
+ },
536
+ 'fetchOrder': {
537
+ 'marginMode': False,
538
+ 'trigger': False,
539
+ 'trailing': False,
540
+ },
541
+ 'fetchOpenOrders': {
542
+ 'marginMode': False,
543
+ 'limit': None,
544
+ 'trigger': False,
545
+ 'trailing': False,
546
+ },
547
+ 'fetchOrders': None,
548
+ 'fetchClosedOrders': None,
549
+ 'fetchOHLCV': {
550
+ 'limit': 1000,
551
+ },
552
+ },
553
+ 'swap': {
554
+ 'linear': None,
555
+ 'inverse': None,
556
+ },
557
+ 'future': {
558
+ 'linear': None,
559
+ 'inverse': None,
560
+ },
561
+ },
508
562
  })
509
563
 
510
564
  def fetch_markets(self, params={}) -> List[Market]:
ccxt/gemini.py CHANGED
@@ -310,6 +310,64 @@ class gemini(Exchange, ImplicitAPI):
310
310
  },
311
311
  },
312
312
  },
313
+ 'features': {
314
+ 'default': {
315
+ 'sandbox': True,
316
+ 'createOrder': {
317
+ 'marginMode': False,
318
+ 'triggerPrice': True,
319
+ 'triggerPriceType': None,
320
+ 'triggerDirection': False,
321
+ 'stopLossPrice': False, # todo
322
+ 'takeProfitPrice': False, # todo
323
+ 'attachedStopLossTakeProfit': None,
324
+ 'timeInForce': {
325
+ 'IOC': True,
326
+ 'FOK': True,
327
+ 'PO': True,
328
+ 'GTD': False,
329
+ },
330
+ 'hedged': False,
331
+ 'trailing': False,
332
+ },
333
+ 'createOrders': None,
334
+ 'fetchMyTrades': {
335
+ 'marginMode': False,
336
+ 'limit': 500,
337
+ 'daysBack': None,
338
+ 'untilDays': None,
339
+ },
340
+ 'fetchOrder': {
341
+ 'marginMode': False,
342
+ 'trigger': False,
343
+ 'trailing': False,
344
+ },
345
+ 'fetchOpenOrders': {
346
+ 'marginMode': False,
347
+ 'limit': None,
348
+ 'trigger': False,
349
+ 'trailing': False,
350
+ },
351
+ 'fetchOrders': None,
352
+ 'fetchClosedOrders': None, # todo: implement
353
+ 'fetchOHLCV': {
354
+ 'limit': None,
355
+ },
356
+ },
357
+ 'spot': {
358
+ 'extends': 'default',
359
+ },
360
+ 'swap': {
361
+ 'linear': {
362
+ 'extends': 'default',
363
+ },
364
+ 'inverse': None,
365
+ },
366
+ 'future': {
367
+ 'linear': None,
368
+ 'inverse': None,
369
+ },
370
+ },
313
371
  })
314
372
 
315
373
  def fetch_currencies(self, params={}) -> Currencies:
@@ -1430,8 +1488,8 @@ class gemini(Exchange, ImplicitAPI):
1430
1488
  }
1431
1489
  type = self.safe_string(params, 'type', type)
1432
1490
  params = self.omit(params, 'type')
1433
- triggerPrice = self.safe_string_n(params, ['stop_price', 'stopPrice'])
1434
- params = self.omit(params, ['stop_price', 'stopPrice', 'type'])
1491
+ triggerPrice = self.safe_string_n(params, ['triggerPrice', 'stop_price', 'stopPrice'])
1492
+ params = self.omit(params, ['triggerPrice', 'stop_price', 'stopPrice', 'type'])
1435
1493
  if type == 'stopLimit':
1436
1494
  raise ArgumentsRequired(self.id + ' createOrder() requires a triggerPrice parameter or a stop_price parameter for ' + type + ' orders')
1437
1495
  if triggerPrice is not None:
ccxt/hyperliquid.py CHANGED
@@ -31,7 +31,7 @@ class hyperliquid(Exchange, ImplicitAPI):
31
31
  'countries': [],
32
32
  'version': 'v1',
33
33
  'rateLimit': 50, # 1200 requests per minute, 20 request per second
34
- 'certified': False,
34
+ 'certified': True,
35
35
  'pro': True,
36
36
  'dex': True,
37
37
  'has': {
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/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.43'
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',