ccxt 4.4.31__py2.py3-none-any.whl → 4.4.32__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 (52) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/async_support/__init__.py +1 -1
  3. ccxt/async_support/base/exchange.py +1 -1
  4. ccxt/async_support/base/ws/aiohttp_client.py +25 -3
  5. ccxt/async_support/bitvavo.py +0 -3
  6. ccxt/async_support/cex.py +1 -1
  7. ccxt/async_support/coinex.py +1 -1
  8. ccxt/async_support/deribit.py +2 -2
  9. ccxt/async_support/gate.py +15 -2
  10. ccxt/async_support/hitbtc.py +3 -3
  11. ccxt/async_support/htx.py +1 -1
  12. ccxt/async_support/indodax.py +1 -1
  13. ccxt/async_support/kraken.py +2 -2
  14. ccxt/async_support/kucoin.py +5 -3
  15. ccxt/async_support/kucoinfutures.py +93 -25
  16. ccxt/async_support/okx.py +2 -2
  17. ccxt/async_support/phemex.py +17 -15
  18. ccxt/async_support/wavesexchange.py +3 -0
  19. ccxt/async_support/woofipro.py +2 -2
  20. ccxt/base/exchange.py +14 -2
  21. ccxt/bitvavo.py +0 -3
  22. ccxt/cex.py +1 -1
  23. ccxt/coinex.py +1 -1
  24. ccxt/deribit.py +2 -2
  25. ccxt/gate.py +15 -2
  26. ccxt/hitbtc.py +3 -3
  27. ccxt/htx.py +1 -1
  28. ccxt/indodax.py +1 -1
  29. ccxt/kraken.py +2 -2
  30. ccxt/kucoin.py +5 -3
  31. ccxt/kucoinfutures.py +93 -25
  32. ccxt/okx.py +2 -2
  33. ccxt/phemex.py +17 -15
  34. ccxt/pro/__init__.py +1 -1
  35. ccxt/pro/binance.py +8 -8
  36. ccxt/pro/bitget.py +4 -4
  37. ccxt/pro/bitmart.py +2 -2
  38. ccxt/pro/bitmex.py +2 -2
  39. ccxt/pro/bitvavo.py +46 -45
  40. ccxt/pro/blofin.py +2 -2
  41. ccxt/pro/bybit.py +2 -2
  42. ccxt/pro/cryptocom.py +4 -4
  43. ccxt/pro/gate.py +4 -4
  44. ccxt/pro/hashkey.py +3 -3
  45. ccxt/pro/mexc.py +1 -2
  46. ccxt/wavesexchange.py +3 -0
  47. ccxt/woofipro.py +2 -2
  48. {ccxt-4.4.31.dist-info → ccxt-4.4.32.dist-info}/METADATA +10 -4
  49. {ccxt-4.4.31.dist-info → ccxt-4.4.32.dist-info}/RECORD +52 -52
  50. {ccxt-4.4.31.dist-info → ccxt-4.4.32.dist-info}/LICENSE.txt +0 -0
  51. {ccxt-4.4.31.dist-info → ccxt-4.4.32.dist-info}/WHEEL +0 -0
  52. {ccxt-4.4.31.dist-info → ccxt-4.4.32.dist-info}/top_level.txt +0 -0
ccxt/gate.py CHANGED
@@ -3022,18 +3022,31 @@ class gate(Exchange, ImplicitAPI):
3022
3022
  :param int [since]: timestamp in ms of the earliest funding rate to fetch
3023
3023
  :param int [limit]: the maximum amount of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>` to fetch
3024
3024
  :param dict [params]: extra parameters specific to the exchange API endpoint
3025
+ :param int [params.until]: timestamp in ms of the latest funding rate to fetch
3026
+ :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
3025
3027
  :returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>`
3026
3028
  """
3027
3029
  if symbol is None:
3028
3030
  raise ArgumentsRequired(self.id + ' fetchFundingRateHistory() requires a symbol argument')
3029
3031
  self.load_markets()
3032
+ paginate = False
3033
+ paginate, params = self.handle_option_and_params(params, 'fetchFundingRateHistory', 'paginate')
3034
+ if paginate:
3035
+ return self.fetch_paginated_call_deterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params)
3030
3036
  market = self.market(symbol)
3031
3037
  if not market['swap']:
3032
3038
  raise BadSymbol(self.id + ' fetchFundingRateHistory() supports swap contracts only')
3033
- request, query = self.prepare_request(market, None, params)
3039
+ request: dict = {}
3040
+ request, params = self.prepare_request(market, None, params)
3034
3041
  if limit is not None:
3035
3042
  request['limit'] = limit
3036
- response = self.publicFuturesGetSettleFundingRate(self.extend(request, query))
3043
+ if since is not None:
3044
+ request['from'] = self.parse_to_int(since / 1000)
3045
+ until = self.safe_integer(params, 'until')
3046
+ if until is not None:
3047
+ params = self.omit(params, 'until')
3048
+ request['to'] = self.parse_to_int(until / 1000)
3049
+ response = self.publicFuturesGetSettleFundingRate(self.extend(request, params))
3037
3050
  #
3038
3051
  # {
3039
3052
  # "r": "0.00063521",
ccxt/hitbtc.py CHANGED
@@ -1530,7 +1530,7 @@ class hitbtc(Exchange, ImplicitAPI):
1530
1530
 
1531
1531
  https://api.hitbtc.com/#order-books
1532
1532
 
1533
- :param str[]|None symbols: list of unified market symbols, all symbols fetched if None, default is None
1533
+ :param str[] [symbols]: list of unified market symbols, all symbols fetched if None, default is None
1534
1534
  :param int [limit]: max number of entries per orderbook to return, default is None
1535
1535
  :param dict [params]: extra parameters specific to the exchange API endpoint
1536
1536
  :returns dict: a dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbol
@@ -3396,8 +3396,8 @@ class hitbtc(Exchange, ImplicitAPI):
3396
3396
 
3397
3397
  https://api.hitbtc.com/#close-all-futures-margin-positions
3398
3398
 
3399
- @param symbol
3400
- @param side
3399
+ :param str symbol: unified ccxt market symbol
3400
+ :param str side: 'buy' or 'sell'
3401
3401
  :param dict [params]: extra parameters specific to the okx api endpoint
3402
3402
  :param str [params.symbol]: *required* unified market symbol
3403
3403
  :param str [params.marginMode]: 'cross' or 'isolated', default is 'cross'
ccxt/htx.py CHANGED
@@ -3070,7 +3070,7 @@ class htx(Exchange, ImplicitAPI):
3070
3070
 
3071
3071
  :param str type: 'spot', 'swap' or 'future
3072
3072
  :param str [marginMode]: 'cross' or 'isolated'
3073
- @param symbol
3073
+ :param str [symbol]: unified ccxt market symbol
3074
3074
  :param dict [params]: extra parameters specific to the exchange API endpoint
3075
3075
  :returns dict: a dictionary of `account structures <https://docs.ccxt.com/#/?id=account-structure>` indexed by the account type
3076
3076
  """
ccxt/indodax.py CHANGED
@@ -29,7 +29,7 @@ class indodax(Exchange, ImplicitAPI):
29
29
  'countries': ['ID'], # Indonesia
30
30
  # 10 requests per second for making trades => 1000ms / 10 = 100ms
31
31
  # 180 requests per minute(public endpoints) = 2 requests per second => cost = (1000ms / rateLimit) / 2 = 5
32
- 'rateLimit': 100,
32
+ 'rateLimit': 50,
33
33
  'has': {
34
34
  'CORS': None,
35
35
  'spot': True,
ccxt/kraken.py CHANGED
@@ -2045,8 +2045,8 @@ class kraken(Exchange, ImplicitAPI):
2045
2045
 
2046
2046
  https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
2047
2047
 
2048
- :param str[]|None ids: list of order id
2049
- @param symbol
2048
+ :param str[] [ids]: list of order id
2049
+ :param str [symbol]: unified ccxt market symbol
2050
2050
  :param dict [params]: extra parameters specific to the kraken api endpoint
2051
2051
  :returns dict[]: a list of `order structure <https://docs.ccxt.com/#/?id=order-structure>`
2052
2052
  """
ccxt/kucoin.py CHANGED
@@ -590,6 +590,8 @@ class kucoin(Exchange, ImplicitAPI):
590
590
  '400303': PermissionDenied, # {"msg":"To enjoy the full range of our products and services, we kindly request you complete the identity verification process.","code":"400303"}
591
591
  '500000': ExchangeNotAvailable, # {"code":"500000","msg":"Internal Server Error"}
592
592
  '260220': InvalidAddress, # {"code": "260220", "msg": "deposit.address.not.exists"}
593
+ '600100': InsufficientFunds, # {"msg":"Funds below the minimum requirement.","code":"600100"}
594
+ '600101': InvalidOrder, # {"msg":"The order funds should more then 0.1 USDT.","code":"600101"}
593
595
  '900014': BadRequest, # {"code":"900014","msg":"Invalid chainId"}
594
596
  },
595
597
  'broad': {
@@ -1244,7 +1246,7 @@ class kucoin(Exchange, ImplicitAPI):
1244
1246
 
1245
1247
  def load_migration_status(self, force: bool = False):
1246
1248
  """
1247
- @param force
1249
+ :param boolean force: load account state for non hf
1248
1250
  loads the migration status for the account(hf or not)
1249
1251
 
1250
1252
  https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/get-user-type
@@ -4739,8 +4741,8 @@ class kucoin(Exchange, ImplicitAPI):
4739
4741
 
4740
4742
  https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/modify-leverage-multiplier
4741
4743
 
4742
- @param leverage
4743
- :param str symbol: unified market symbol
4744
+ :param int [leverage]: New leverage multiplier. Must be greater than 1 and up to two decimal places, and cannot be less than the user's current debt leverage or greater than the system's maximum leverage
4745
+ :param str [symbol]: unified market symbol
4744
4746
  :param dict [params]: extra parameters specific to the exchange API endpoint
4745
4747
  :returns dict: response from the exchange
4746
4748
  """
ccxt/kucoinfutures.py CHANGED
@@ -1212,8 +1212,8 @@ class kucoinfutures(kucoin, ImplicitAPI):
1212
1212
  https://www.kucoin.com/docs/rest/futures-trading/positions/get-positions-history
1213
1213
 
1214
1214
  :param str[] [symbols]: list of unified market symbols
1215
- @param since
1216
- @param limit
1215
+ :param int [since]: the earliest time in ms to fetch position history for
1216
+ :param int [limit]: the maximum number of entries to retrieve
1217
1217
  :param dict [params]: extra parameters specific to the exchange API endpoint
1218
1218
  :param int [params.until]: closing end time
1219
1219
  :param int [params.pageId]: page id
@@ -1404,7 +1404,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1404
1404
  """
1405
1405
  Create an order on the exchange
1406
1406
 
1407
- https://docs.kucoin.com/futures/#place-an-order
1407
+ https://www.kucoin.com/docs/rest/futures-trading/orders/place-order
1408
1408
  https://www.kucoin.com/docs/rest/futures-trading/orders/place-take-profit-and-stop-loss-order#http-request
1409
1409
 
1410
1410
  :param str symbol: Unified CCXT market symbol
@@ -1421,6 +1421,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
1421
1421
  :param bool [params.reduceOnly]: A mark to reduce the position size only. Set to False by default. Need to set the position size when reduceOnly is True.
1422
1422
  :param str [params.timeInForce]: GTC, GTT, IOC, or FOK, default is GTC, limit orders only
1423
1423
  :param str [params.postOnly]: Post only flag, invalid when timeInForce is IOC or FOK
1424
+ :param float [params.cost]: the cost of the order in units of USDT
1424
1425
  ----------------- Exchange Specific Parameters -----------------
1425
1426
  :param float [params.leverage]: Leverage size of the order
1426
1427
  :param str [params.clientOid]: client order id, defaults to uuid if not passed
@@ -1510,17 +1511,21 @@ class kucoinfutures(kucoin, ImplicitAPI):
1510
1511
  # required param, cannot be used twice
1511
1512
  clientOrderId = self.safe_string_2(params, 'clientOid', 'clientOrderId', self.uuid())
1512
1513
  params = self.omit(params, ['clientOid', 'clientOrderId'])
1513
- if amount < 1:
1514
- raise InvalidOrder(self.id + ' createOrder() minimum contract order amount is 1')
1515
- preciseAmount = int(self.amount_to_precision(symbol, amount))
1516
1514
  request: dict = {
1517
1515
  'clientOid': clientOrderId,
1518
1516
  'side': side,
1519
1517
  'symbol': market['id'],
1520
1518
  'type': type, # limit or market
1521
- 'size': preciseAmount,
1522
1519
  'leverage': 1,
1523
1520
  }
1521
+ cost = self.safe_string(params, 'cost')
1522
+ params = self.omit(params, 'cost')
1523
+ if cost is not None:
1524
+ request['valueQty'] = self.cost_to_precision(symbol, cost)
1525
+ else:
1526
+ if amount < 1:
1527
+ raise InvalidOrder(self.id + ' createOrder() minimum contract order amount is 1')
1528
+ request['size'] = int(self.amount_to_precision(symbol, amount))
1524
1529
  triggerPrice, stopLossPrice, takeProfitPrice = self.handle_trigger_prices(params)
1525
1530
  stopLoss = self.safe_dict(params, 'stopLoss')
1526
1531
  takeProfit = self.safe_dict(params, 'takeProfit')
@@ -2349,6 +2354,10 @@ class kucoinfutures(kucoin, ImplicitAPI):
2349
2354
  def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
2350
2355
  """
2351
2356
  transfer currency internally between wallets on the same account
2357
+
2358
+ https://www.kucoin.com/docs/rest/funding/transfer/transfer-to-main-or-trade-account
2359
+ https://www.kucoin.com/docs/rest/funding/transfer/transfer-to-futures-account
2360
+
2352
2361
  :param str code: unified currency code
2353
2362
  :param float amount: amount to transfer
2354
2363
  :param str fromAccount: account to transfer from
@@ -2356,47 +2365,99 @@ class kucoinfutures(kucoin, ImplicitAPI):
2356
2365
  :param dict [params]: extra parameters specific to the exchange API endpoint
2357
2366
  :returns dict: a `transfer structure <https://docs.ccxt.com/#/?id=transfer-structure>`
2358
2367
  """
2359
- if (toAccount != 'main' and toAccount != 'funding') or (fromAccount != 'futures' and fromAccount != 'future' and fromAccount != 'contract'):
2360
- raise BadRequest(self.id + ' transfer() only supports transfers from contract(future) account to main(funding) account')
2361
2368
  self.load_markets()
2362
2369
  currency = self.currency(code)
2363
2370
  amountToPrecision = self.currency_to_precision(code, amount)
2364
2371
  request: dict = {
2365
- 'currency': self.safe_string(currency, 'id'), # Currency,including XBT,USDT
2372
+ 'currency': self.safe_string(currency, 'id'),
2366
2373
  'amount': amountToPrecision,
2367
2374
  }
2368
- # transfer from usdm futures wallet to spot wallet
2369
- response = self.futuresPrivatePostTransferOut(self.extend(request, params))
2370
- #
2371
- # {
2372
- # "code": "200000",
2373
- # "data": {
2374
- # "applyId": "5bffb63303aa675e8bbe18f9" # Transfer-out request ID
2375
- # }
2376
- # }
2377
- #
2378
- data = self.safe_value(response, 'data')
2375
+ toAccountString = self.parse_transfer_type(toAccount)
2376
+ response = None
2377
+ if toAccountString == 'TRADE' or toAccountString == 'MAIN':
2378
+ request['recAccountType'] = toAccountString
2379
+ response = self.futuresPrivatePostTransferOut(self.extend(request, params))
2380
+ #
2381
+ # {
2382
+ # "code": "200000",
2383
+ # "data": {
2384
+ # "applyId": "6738754373ceee00011ec3f8",
2385
+ # "bizNo": "6738754373ceee00011ec3f7",
2386
+ # "payAccountType": "CONTRACT",
2387
+ # "payTag": "DEFAULT",
2388
+ # "remark": "",
2389
+ # "recAccountType": "MAIN",
2390
+ # "recTag": "DEFAULT",
2391
+ # "recRemark": "",
2392
+ # "recSystem": "KUCOIN",
2393
+ # "status": "PROCESSING",
2394
+ # "currency": "USDT",
2395
+ # "amount": "5",
2396
+ # "fee": "0",
2397
+ # "sn": 1519769124846692,
2398
+ # "reason": "",
2399
+ # "createdAt": 1731753283000,
2400
+ # "updatedAt": 1731753283000
2401
+ # }
2402
+ # }
2403
+ #
2404
+ elif toAccount == 'future' or toAccount == 'swap' or toAccount == 'contract':
2405
+ request['payAccountType'] = self.parse_transfer_type(fromAccount)
2406
+ response = self.futuresPrivatePostTransferIn(self.extend(request, params))
2407
+ #
2408
+ # {
2409
+ # "code": "200000",
2410
+ # "data": {
2411
+ # "applyId": "5bffb63303aa675e8bbe18f9" # Transfer-out request ID
2412
+ # }
2413
+ # }
2414
+ #
2415
+ else:
2416
+ raise BadRequest(self.id + ' transfer() only supports transfers between future/swap, spot and funding accounts')
2417
+ data = self.safe_dict(response, 'data', {})
2379
2418
  return self.extend(self.parse_transfer(data, currency), {
2380
2419
  'amount': self.parse_number(amountToPrecision),
2381
- 'fromAccount': 'future',
2382
- 'toAccount': 'spot',
2420
+ 'fromAccount': fromAccount,
2421
+ 'toAccount': toAccount,
2383
2422
  })
2384
2423
 
2385
2424
  def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
2386
2425
  #
2387
- # transfer
2426
+ # transfer to spot or funding account
2388
2427
  #
2389
2428
  # {
2390
2429
  # "applyId": "5bffb63303aa675e8bbe18f9" # Transfer-out request ID
2391
2430
  # }
2392
2431
  #
2432
+ # transfer to future account
2433
+ #
2434
+ # {
2435
+ # "applyId": "6738754373ceee00011ec3f8",
2436
+ # "bizNo": "6738754373ceee00011ec3f7",
2437
+ # "payAccountType": "CONTRACT",
2438
+ # "payTag": "DEFAULT",
2439
+ # "remark": "",
2440
+ # "recAccountType": "MAIN",
2441
+ # "recTag": "DEFAULT",
2442
+ # "recRemark": "",
2443
+ # "recSystem": "KUCOIN",
2444
+ # "status": "PROCESSING",
2445
+ # "currency": "USDT",
2446
+ # "amount": "5",
2447
+ # "fee": "0",
2448
+ # "sn": 1519769124846692,
2449
+ # "reason": "",
2450
+ # "createdAt": 1731753283000,
2451
+ # "updatedAt": 1731753283000
2452
+ # }
2453
+ #
2393
2454
  timestamp = self.safe_integer(transfer, 'updatedAt')
2394
2455
  return {
2395
2456
  'id': self.safe_string(transfer, 'applyId'),
2396
2457
  'timestamp': timestamp,
2397
2458
  'datetime': self.iso8601(timestamp),
2398
2459
  'currency': self.safe_currency_code(None, currency),
2399
- 'amount': None,
2460
+ 'amount': self.safe_number(transfer, 'amount'),
2400
2461
  'fromAccount': None,
2401
2462
  'toAccount': None,
2402
2463
  'status': self.safe_string(transfer, 'status'),
@@ -2409,6 +2470,13 @@ class kucoinfutures(kucoin, ImplicitAPI):
2409
2470
  }
2410
2471
  return self.safe_string(statuses, status, status)
2411
2472
 
2473
+ def parse_transfer_type(self, transferType: Str) -> Str:
2474
+ transferTypes: dict = {
2475
+ 'spot': 'TRADE',
2476
+ 'funding': 'MAIN',
2477
+ }
2478
+ return self.safe_string_upper(transferTypes, transferType, transferType)
2479
+
2412
2480
  def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
2413
2481
  """
2414
2482
 
ccxt/okx.py CHANGED
@@ -7932,8 +7932,8 @@ class okx(Exchange, ImplicitAPI):
7932
7932
 
7933
7933
  :param str [symbol]: not used by okx fetchMarginAdjustmentHistory
7934
7934
  :param str [type]: "add" or "reduce"
7935
- @param since
7936
- @param limit
7935
+ :param int [since]: the earliest time in ms to fetch margin adjustment history for
7936
+ :param int [limit]: the maximum number of entries to retrieve
7937
7937
  :param dict params: extra parameters specific to the exchange api endpoint
7938
7938
  :param boolean [params.auto]: True if fetching auto margin increases
7939
7939
  :returns dict[]: a list of `margin structures <https://docs.ccxt.com/#/?id=margin-loan-structure>`
ccxt/phemex.py CHANGED
@@ -504,6 +504,13 @@ class phemex(Exchange, ImplicitAPI):
504
504
  'transfer': {
505
505
  'fillResponseFromRequest': True,
506
506
  },
507
+ 'triggerPriceTypesMap': {
508
+ 'last': 'ByLastPrice',
509
+ 'mark': 'ByMarkPrice',
510
+ 'index': 'ByIndexPrice',
511
+ 'ask': 'ByAskPrice',
512
+ 'bid': 'ByBidPrice',
513
+ },
507
514
  },
508
515
  })
509
516
 
@@ -2070,6 +2077,7 @@ class phemex(Exchange, ImplicitAPI):
2070
2077
  'PartiallyFilled': 'open',
2071
2078
  'Filled': 'closed',
2072
2079
  'Canceled': 'canceled',
2080
+ 'Suspended': 'canceled',
2073
2081
  '1': 'open',
2074
2082
  '2': 'canceled',
2075
2083
  '3': 'closed',
@@ -2539,13 +2547,10 @@ class phemex(Exchange, ImplicitAPI):
2539
2547
  request['stopLossEp'] = self.to_ep(stopLossTriggerPrice, market)
2540
2548
  stopLossTriggerPriceType = self.safe_string_2(stopLoss, 'triggerPriceType', 'slTrigger')
2541
2549
  if stopLossTriggerPriceType is not None:
2542
- if market['settle'] == 'USDT':
2543
- if (stopLossTriggerPriceType != 'ByMarkPrice') and (stopLossTriggerPriceType != 'ByLastPrice') and (stopLossTriggerPriceType != 'ByIndexPrice') and (stopLossTriggerPriceType != 'ByAskPrice') and (stopLossTriggerPriceType != 'ByBidPrice') and (stopLossTriggerPriceType != 'ByMarkPriceLimit') and (stopLossTriggerPriceType != 'ByLastPriceLimit'):
2544
- raise InvalidOrder(self.id + ' createOrder() take profit trigger price type must be one of "ByMarkPrice", "ByIndexPrice", "ByAskPrice", "ByBidPrice", "ByMarkPriceLimit", "ByLastPriceLimit" or "ByLastPrice"')
2545
- else:
2546
- if (stopLossTriggerPriceType != 'ByMarkPrice') and (stopLossTriggerPriceType != 'ByLastPrice'):
2547
- raise InvalidOrder(self.id + ' createOrder() take profit trigger price type must be one of "ByMarkPrice", or "ByLastPrice"')
2548
- request['slTrigger'] = stopLossTriggerPriceType
2550
+ request['slTrigger'] = self.safe_string(self.options['triggerPriceTypesMap'], stopLossTriggerPriceType, stopLossTriggerPriceType)
2551
+ slLimitPrice = self.safe_string(stopLoss, 'price')
2552
+ if slLimitPrice is not None:
2553
+ request['slPxRp'] = self.price_to_precision(symbol, slLimitPrice)
2549
2554
  if takeProfitDefined:
2550
2555
  takeProfitTriggerPrice = self.safe_value_2(takeProfit, 'triggerPrice', 'stopPrice')
2551
2556
  if takeProfitTriggerPrice is None:
@@ -2554,15 +2559,12 @@ class phemex(Exchange, ImplicitAPI):
2554
2559
  request['takeProfitRp'] = self.price_to_precision(symbol, takeProfitTriggerPrice)
2555
2560
  else:
2556
2561
  request['takeProfitEp'] = self.to_ep(takeProfitTriggerPrice, market)
2557
- takeProfitTriggerPriceType = self.safe_string_2(stopLoss, 'triggerPriceType', 'tpTrigger')
2562
+ takeProfitTriggerPriceType = self.safe_string_2(takeProfit, 'triggerPriceType', 'tpTrigger')
2558
2563
  if takeProfitTriggerPriceType is not None:
2559
- if market['settle'] == 'USDT':
2560
- if (takeProfitTriggerPriceType != 'ByMarkPrice') and (takeProfitTriggerPriceType != 'ByLastPrice') and (takeProfitTriggerPriceType != 'ByIndexPrice') and (takeProfitTriggerPriceType != 'ByAskPrice') and (takeProfitTriggerPriceType != 'ByBidPrice') and (takeProfitTriggerPriceType != 'ByMarkPriceLimit') and (takeProfitTriggerPriceType != 'ByLastPriceLimit'):
2561
- raise InvalidOrder(self.id + ' createOrder() take profit trigger price type must be one of "ByMarkPrice", "ByIndexPrice", "ByAskPrice", "ByBidPrice", "ByMarkPriceLimit", "ByLastPriceLimit" or "ByLastPrice"')
2562
- else:
2563
- if (takeProfitTriggerPriceType != 'ByMarkPrice') and (takeProfitTriggerPriceType != 'ByLastPrice'):
2564
- raise InvalidOrder(self.id + ' createOrder() take profit trigger price type must be one of "ByMarkPrice", or "ByLastPrice"')
2565
- request['tpTrigger'] = takeProfitTriggerPriceType
2564
+ request['tpTrigger'] = self.safe_string(self.options['triggerPriceTypesMap'], takeProfitTriggerPriceType, takeProfitTriggerPriceType)
2565
+ tpLimitPrice = self.safe_string(takeProfit, 'price')
2566
+ if tpLimitPrice is not None:
2567
+ request['tpPxRp'] = self.price_to_precision(symbol, tpLimitPrice)
2566
2568
  if (type == 'Limit') or (type == 'StopLimit') or (type == 'LimitIfTouched'):
2567
2569
  if market['settle'] == 'USDT':
2568
2570
  request['priceRp'] = self.price_to_precision(symbol, price)
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.31'
7
+ __version__ = '4.4.32'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
ccxt/pro/binance.py CHANGED
@@ -223,7 +223,7 @@ class binance(ccxt.async_support.binance):
223
223
  https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams/All-Market-Liquidation-Order-Streams
224
224
  https://developers.binance.com/docs/derivatives/coin-margined-futures/websocket-market-streams/All-Market-Liquidation-Order-Streams
225
225
 
226
- :param str[] symbols:
226
+ :param str[] symbols: list of unified market symbols
227
227
  :param int [since]: the earliest time in ms to fetch liquidations for
228
228
  :param int [limit]: the maximum number of liquidation structures to retrieve
229
229
  :param dict [params]: exchange specific parameters for the bitmex api endpoint
@@ -436,7 +436,7 @@ class binance(ccxt.async_support.binance):
436
436
  https://developers.binance.com/docs/derivatives/usds-margined-futures/user-data-streams/Event-Order-Update
437
437
  https://developers.binance.com/docs/derivatives/coin-margined-futures/user-data-streams/Event-Order-Update
438
438
 
439
- @param symbols
439
+ :param str[] symbols: list of unified market symbols
440
440
  :param int [since]: the earliest time in ms to fetch liquidations for
441
441
  :param int [limit]: the maximum number of liquidation structures to retrieve
442
442
  :param dict [params]: exchange specific parameters for the bitmex api endpoint
@@ -2971,7 +2971,7 @@ class binance(ccxt.async_support.binance):
2971
2971
  https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Cancel-Order
2972
2972
 
2973
2973
  :param str id: order id
2974
- :param str symbol: unified market symbol, default is None
2974
+ :param str [symbol]: unified market symbol, default is None
2975
2975
  :param dict [params]: extra parameters specific to the exchange API endpoint
2976
2976
  :param str|None [params.cancelRestrictions]: Supported values: ONLY_NEW - Cancel will succeed if the order status is NEW. ONLY_PARTIALLY_FILLED - Cancel will succeed if order status is PARTIALLY_FILLED.
2977
2977
  :returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
@@ -3012,7 +3012,7 @@ class binance(ccxt.async_support.binance):
3012
3012
 
3013
3013
  https://developers.binance.com/docs/binance-spot-api-docs/web-socket-api#cancel-open-orders-trade
3014
3014
 
3015
- :param str symbol: unified market symbol of the market to cancel orders in
3015
+ :param str [symbol]: unified market symbol of the market to cancel orders in
3016
3016
  :param dict [params]: extra parameters specific to the exchange API endpoint
3017
3017
  :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
3018
3018
  """
@@ -3048,8 +3048,8 @@ class binance(ccxt.async_support.binance):
3048
3048
  https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/websocket-api/Query-Order
3049
3049
 
3050
3050
  :param str id: order id
3051
- :param str symbol: unified symbol of the market the order was made in
3052
- :param dict params: extra parameters specific to the exchange API endpoint
3051
+ :param str [symbol]: unified symbol of the market the order was made in
3052
+ :param dict [params]: extra parameters specific to the exchange API endpoint
3053
3053
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
3054
3054
  """
3055
3055
  await self.load_markets()
@@ -3474,8 +3474,8 @@ class binance(ccxt.async_support.binance):
3474
3474
  """
3475
3475
  watch all open positions
3476
3476
  :param str[]|None symbols: list of unified market symbols
3477
- @param since
3478
- @param limit
3477
+ :param number [since]: since timestamp
3478
+ :param number [limit]: limit
3479
3479
  :param dict params: extra parameters specific to the exchange API endpoint
3480
3480
  :param boolean [params.portfolioMargin]: set to True if you would like to watch positions in a portfolio margin account
3481
3481
  :returns dict[]: a list of `position structure <https://docs.ccxt.com/en/latest/manual.html#position-structure>`
ccxt/pro/bitget.py CHANGED
@@ -431,7 +431,7 @@ class bitget(ccxt.async_support.bitget):
431
431
  https://www.bitget.com/api-doc/contract/websocket/public/Candlesticks-Channel
432
432
 
433
433
  :param str symbol: unified symbol of the market to unwatch the ohlcv for
434
- :param str timeframe:
434
+ :param str [timeframe]: the period for the ratio, default is 1 minute
435
435
  :param dict [params]: extra parameters specific to the exchange API endpoint
436
436
  :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
437
437
  """
@@ -664,7 +664,7 @@ class bitget(ccxt.async_support.bitget):
664
664
  self.handle_deltas(storedOrderBook['bids'], bids)
665
665
  storedOrderBook['timestamp'] = timestamp
666
666
  storedOrderBook['datetime'] = self.iso8601(timestamp)
667
- checksum = self.safe_bool(self.options, 'checksum', True)
667
+ checksum = self.handle_option('watchOrderBook', 'checksum', True)
668
668
  isSnapshot = self.safe_string(message, 'action') == 'snapshot' # snapshot does not have a checksum
669
669
  if not isSnapshot and checksum:
670
670
  storedAsks = storedOrderBook['asks']
@@ -916,8 +916,8 @@ class bitget(ccxt.async_support.bitget):
916
916
  https://www.bitget.com/api-doc/contract/websocket/private/Positions-Channel
917
917
 
918
918
  :param str[]|None symbols: list of unified market symbols
919
- @param since
920
- @param limit
919
+ :param int [since]: the earliest time in ms to fetch positions for
920
+ :param int [limit]: the maximum number of positions to retrieve
921
921
  :param dict params: extra parameters specific to the exchange API endpoint
922
922
  :param str [params.instType]: one of 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES', default is 'USDT-FUTURES'
923
923
  :returns dict[]: a list of `position structure <https://docs.ccxt.com/en/latest/manual.html#position-structure>`
ccxt/pro/bitmart.py CHANGED
@@ -695,8 +695,8 @@ class bitmart(ccxt.async_support.bitmart):
695
695
 
696
696
  watch all open positions
697
697
  :param str[]|None symbols: list of unified market symbols
698
- @param since
699
- @param limit
698
+ :param int [since]: the earliest time in ms to fetch positions
699
+ :param int [limit]: the maximum number of positions to retrieve
700
700
  :param dict params: extra parameters specific to the exchange API endpoint
701
701
  :returns dict[]: a list of `position structure <https://docs.ccxt.com/en/latest/manual.html#position-structure>`
702
702
  """
ccxt/pro/bitmex.py CHANGED
@@ -718,8 +718,8 @@ class bitmex(ccxt.async_support.bitmex):
718
718
  https://www.bitmex.com/app/wsAPI#Subscriptions
719
719
 
720
720
  :param str[]|None symbols: list of unified market symbols
721
- @param since
722
- @param limit
721
+ :param int [since]: the earliest time in ms to watch positions for
722
+ :param int [limit]: the maximum number of positions to retrieve
723
723
  :param dict params: extra parameters specific to the exchange API endpoint
724
724
  :returns dict[]: a list of `position structure <https://docs.ccxt.com/en/latest/manual.html#position-structure>`
725
725
  """