ccxt 4.1.28__py2.py3-none-any.whl → 4.1.29__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.
ccxt/__init__.py CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.1.28'
25
+ __version__ = '4.1.29'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
ccxt/abstract/bybit.py CHANGED
@@ -427,6 +427,7 @@ class ImplicitAPI:
427
427
  private_post_v5_position_trading_stop = privatePostV5PositionTradingStop = Entry('v5/position/trading-stop', 'private', 'POST', {'cost': 5})
428
428
  private_post_v5_position_set_auto_add_margin = privatePostV5PositionSetAutoAddMargin = Entry('v5/position/set-auto-add-margin', 'private', 'POST', {'cost': 2.5})
429
429
  private_post_v5_position_add_margin = privatePostV5PositionAddMargin = Entry('v5/position/add-margin', 'private', 'POST', {'cost': 2.5})
430
+ private_post_v5_position_confirm_pending_mmr = privatePostV5PositionConfirmPendingMmr = Entry('v5/position/confirm-pending-mmr', 'private', 'POST', {'cost': 2.5})
430
431
  private_post_v5_account_upgrade_to_uta = privatePostV5AccountUpgradeToUta = Entry('v5/account/upgrade-to-uta', 'private', 'POST', {'cost': 2.5})
431
432
  private_post_v5_account_set_margin_mode = privatePostV5AccountSetMarginMode = Entry('v5/account/set-margin-mode', 'private', 'POST', {'cost': 2.5})
432
433
  private_post_v5_account_mmp_modify = privatePostV5AccountMmpModify = Entry('v5/account/mmp-modify', 'private', 'POST', {'cost': 2.5})
ccxt/abstract/okex.py CHANGED
@@ -190,6 +190,7 @@ class ImplicitAPI:
190
190
  private_post_sprd_order = privatePostSprdOrder = Entry('sprd/order', 'private', 'POST', {'cost': 1})
191
191
  private_post_sprd_cancel_order = privatePostSprdCancelOrder = Entry('sprd/cancel-order', 'private', 'POST', {'cost': 1})
192
192
  private_post_sprd_mass_cancel = privatePostSprdMassCancel = Entry('sprd/mass-cancel', 'private', 'POST', {'cost': 1})
193
+ private_post_sprd_amend_order = privatePostSprdAmendOrder = Entry('sprd/amend-order', 'private', 'POST', {'cost': 1})
193
194
  private_post_trade_order = privatePostTradeOrder = Entry('trade/order', 'private', 'POST', {'cost': 0.3333333333333333})
194
195
  private_post_trade_batch_orders = privatePostTradeBatchOrders = Entry('trade/batch-orders', 'private', 'POST', {'cost': 0.06666666666666667})
195
196
  private_post_trade_cancel_order = privatePostTradeCancelOrder = Entry('trade/cancel-order', 'private', 'POST', {'cost': 0.3333333333333333})
ccxt/abstract/okex5.py CHANGED
@@ -190,6 +190,7 @@ class ImplicitAPI:
190
190
  private_post_sprd_order = privatePostSprdOrder = Entry('sprd/order', 'private', 'POST', {'cost': 1})
191
191
  private_post_sprd_cancel_order = privatePostSprdCancelOrder = Entry('sprd/cancel-order', 'private', 'POST', {'cost': 1})
192
192
  private_post_sprd_mass_cancel = privatePostSprdMassCancel = Entry('sprd/mass-cancel', 'private', 'POST', {'cost': 1})
193
+ private_post_sprd_amend_order = privatePostSprdAmendOrder = Entry('sprd/amend-order', 'private', 'POST', {'cost': 1})
193
194
  private_post_trade_order = privatePostTradeOrder = Entry('trade/order', 'private', 'POST', {'cost': 0.3333333333333333})
194
195
  private_post_trade_batch_orders = privatePostTradeBatchOrders = Entry('trade/batch-orders', 'private', 'POST', {'cost': 0.06666666666666667})
195
196
  private_post_trade_cancel_order = privatePostTradeCancelOrder = Entry('trade/cancel-order', 'private', 'POST', {'cost': 0.3333333333333333})
ccxt/abstract/okx.py CHANGED
@@ -190,6 +190,7 @@ class ImplicitAPI:
190
190
  private_post_sprd_order = privatePostSprdOrder = Entry('sprd/order', 'private', 'POST', {'cost': 1})
191
191
  private_post_sprd_cancel_order = privatePostSprdCancelOrder = Entry('sprd/cancel-order', 'private', 'POST', {'cost': 1})
192
192
  private_post_sprd_mass_cancel = privatePostSprdMassCancel = Entry('sprd/mass-cancel', 'private', 'POST', {'cost': 1})
193
+ private_post_sprd_amend_order = privatePostSprdAmendOrder = Entry('sprd/amend-order', 'private', 'POST', {'cost': 1})
193
194
  private_post_trade_order = privatePostTradeOrder = Entry('trade/order', 'private', 'POST', {'cost': 0.3333333333333333})
194
195
  private_post_trade_batch_orders = privatePostTradeBatchOrders = Entry('trade/batch-orders', 'private', 'POST', {'cost': 0.06666666666666667})
195
196
  private_post_trade_cancel_order = privatePostTradeCancelOrder = Entry('trade/cancel-order', 'private', 'POST', {'cost': 0.3333333333333333})
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.1.28'
7
+ __version__ = '4.1.29'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.1.28'
5
+ __version__ = '4.1.29'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -65,6 +65,7 @@ class bitget(Exchange, ImplicitAPI):
65
65
  'editOrder': True,
66
66
  'fetchAccounts': False,
67
67
  'fetchBalance': True,
68
+ 'fetchBorrowInterest': True,
68
69
  'fetchBorrowRate': True,
69
70
  'fetchBorrowRateHistories': False,
70
71
  'fetchBorrowRateHistory': False,
@@ -5955,6 +5956,138 @@ class bitget(Exchange, ImplicitAPI):
5955
5956
  'info': info,
5956
5957
  }
5957
5958
 
5959
+ async def fetch_borrow_interest(self, code: Optional[str] = None, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
5960
+ """
5961
+ fetch the interest owed by the user for borrowing currency for margin trading
5962
+ :see: https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-interest-records
5963
+ :see: https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-interest-records
5964
+ :param str [code]: unified currency code
5965
+ :param str [symbol]: unified market symbol when fetching interest in isolated markets
5966
+ :param int [since]: the earliest time in ms to fetch borrow interest for
5967
+ :param int [limit]: the maximum number of structures to retrieve
5968
+ :param dict [params]: extra parameters specific to the bitget api endpoint
5969
+ :returns dict[]: a list of `borrow interest structures <https://github.com/ccxt/ccxt/wiki/Manual#borrow-interest-structure>`
5970
+ """
5971
+ await self.load_markets()
5972
+ market = None
5973
+ if symbol is not None:
5974
+ market = self.market(symbol)
5975
+ request = {}
5976
+ currency = None
5977
+ if code is not None:
5978
+ currency = self.currency(code)
5979
+ request['coin'] = currency['id']
5980
+ if since is not None:
5981
+ request['startTime'] = since
5982
+ else:
5983
+ request['startTime'] = self.milliseconds() - 7776000000
5984
+ if limit is not None:
5985
+ request['pageSize'] = limit
5986
+ response = None
5987
+ marginMode = None
5988
+ marginMode, params = self.handle_margin_mode_and_params('fetchBorrowInterest', params, 'cross')
5989
+ if marginMode == 'isolated':
5990
+ self.check_required_symbol('fetchBorrowInterest', symbol)
5991
+ request['symbol'] = market['info']['symbolName']
5992
+ response = await self.privateMarginGetIsolatedInterestList(self.extend(request, params))
5993
+ elif marginMode == 'cross':
5994
+ response = await self.privateMarginGetCrossInterestList(self.extend(request, params))
5995
+ #
5996
+ # isolated
5997
+ #
5998
+ # {
5999
+ # "code": "00000",
6000
+ # "msg": "success",
6001
+ # "requestTime": 1698282523888,
6002
+ # "data": {
6003
+ # "resultList": [
6004
+ # {
6005
+ # "interestId": "1100560904468705284",
6006
+ # "interestCoin": "USDT",
6007
+ # "interestRate": "0.000126279",
6008
+ # "loanCoin": "USDT",
6009
+ # "amount": "0.00000298",
6010
+ # "type": "scheduled",
6011
+ # "symbol": "BTCUSDT",
6012
+ # "ctime": "1698120000000"
6013
+ # },
6014
+ # ],
6015
+ # "maxId": "1100560904468705284",
6016
+ # "minId": "1096915487398965249"
6017
+ # }
6018
+ # }
6019
+ #
6020
+ # cross
6021
+ #
6022
+ # {
6023
+ # "code": "00000",
6024
+ # "msg": "success",
6025
+ # "requestTime": 1698282552126,
6026
+ # "data": {
6027
+ # "resultList": [
6028
+ # {
6029
+ # "interestId": "1099126154352799744",
6030
+ # "interestCoin": "USDT",
6031
+ # "interestRate": "0.000126279",
6032
+ # "loanCoin": "USDT",
6033
+ # "amount": "0.00002631",
6034
+ # "type": "scheduled",
6035
+ # "ctime": "1697778000000"
6036
+ # },
6037
+ # ],
6038
+ # "maxId": "1099126154352799744",
6039
+ # "minId": "1096917004629716993"
6040
+ # }
6041
+ # }
6042
+ #
6043
+ data = self.safe_value(response, 'data', {})
6044
+ rows = self.safe_value(data, 'resultList', [])
6045
+ interest = self.parse_borrow_interests(rows, market)
6046
+ return self.filter_by_currency_since_limit(interest, code, since, limit)
6047
+
6048
+ def parse_borrow_interest(self, info, market=None):
6049
+ #
6050
+ # isolated
6051
+ #
6052
+ # {
6053
+ # "interestId": "1100560904468705284",
6054
+ # "interestCoin": "USDT",
6055
+ # "interestRate": "0.000126279",
6056
+ # "loanCoin": "USDT",
6057
+ # "amount": "0.00000298",
6058
+ # "type": "scheduled",
6059
+ # "symbol": "BTCUSDT",
6060
+ # "ctime": "1698120000000"
6061
+ # }
6062
+ #
6063
+ # cross
6064
+ #
6065
+ # {
6066
+ # "interestId": "1099126154352799744",
6067
+ # "interestCoin": "USDT",
6068
+ # "interestRate": "0.000126279",
6069
+ # "loanCoin": "USDT",
6070
+ # "amount": "0.00002631",
6071
+ # "type": "scheduled",
6072
+ # "ctime": "1697778000000"
6073
+ # }
6074
+ #
6075
+ marketId = self.safe_string(info, 'symbol')
6076
+ market = self.safe_market(marketId, market)
6077
+ marginMode = 'isolated' if (marketId is not None) else 'cross'
6078
+ timestamp = self.safe_integer(info, 'ctime')
6079
+ return {
6080
+ 'symbol': self.safe_string(market, 'symbol'),
6081
+ 'marginMode': marginMode,
6082
+ 'currency': self.safe_currency_code(self.safe_string(info, 'interestCoin')),
6083
+ 'interest': self.safe_number(info, 'amount'),
6084
+ 'interestRate': self.safe_number(info, 'interestRate'),
6085
+ 'amountBorrowed': None,
6086
+ 'timestamp': timestamp,
6087
+ 'datetime': self.iso8601(timestamp),
6088
+ 'info': info,
6089
+ }
6090
+
5958
6091
  def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
5959
6092
  if not response:
5960
6093
  return None # fallback to default error handler
@@ -635,6 +635,7 @@ class bybit(Exchange, ImplicitAPI):
635
635
  'v5/position/trading-stop': 5, # 10/s => cost = 50 / 10 = 5
636
636
  'v5/position/set-auto-add-margin': 2.5,
637
637
  'v5/position/add-margin': 2.5,
638
+ 'v5/position/confirm-pending-mmr': 2.5,
638
639
  # account
639
640
  'v5/account/upgrade-to-uta': 2.5,
640
641
  'v5/account/set-margin-mode': 2.5,
@@ -3072,8 +3073,11 @@ class bybit(Exchange, ImplicitAPI):
3072
3073
  # "time": 1672125441042
3073
3074
  # }
3074
3075
  #
3076
+ timestamp = self.safe_integer(response, 'time')
3075
3077
  result = {
3076
3078
  'info': response,
3079
+ 'timestamp': timestamp,
3080
+ 'datetime': self.iso8601(timestamp),
3077
3081
  }
3078
3082
  responseResult = self.safe_value(response, 'result', {})
3079
3083
  currencyList = self.safe_value_n(responseResult, ['loanAccountList', 'list', 'balance'])
@@ -50,6 +50,7 @@ class cryptocom(Exchange, ImplicitAPI):
50
50
  'borrowMargin': True,
51
51
  'cancelAllOrders': True,
52
52
  'cancelOrder': True,
53
+ 'cancelOrders': True,
53
54
  'createOrder': True,
54
55
  'createOrders': True,
55
56
  'fetchAccounts': True,
@@ -1323,6 +1324,34 @@ class cryptocom(Exchange, ImplicitAPI):
1323
1324
  result = self.safe_value(response, 'result', {})
1324
1325
  return self.parse_order(result, market)
1325
1326
 
1327
+ async def cancel_orders(self, ids, symbol: Optional[str] = None, params={}):
1328
+ """
1329
+ cancel multiple orders
1330
+ :see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list
1331
+ :param str[] ids: order ids
1332
+ :param str symbol: unified market symbol
1333
+ :param dict [params]: extra parameters specific to the okx api endpoint
1334
+ :returns dict: an list of `order structures <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
1335
+ """
1336
+ self.check_required_symbol('cancelOrders', symbol)
1337
+ await self.load_markets()
1338
+ market = self.market(symbol)
1339
+ orderRequests = []
1340
+ for i in range(0, len(ids)):
1341
+ id = ids[i]
1342
+ order = {
1343
+ 'instrument_name': market['id'],
1344
+ 'order_id': str(id),
1345
+ }
1346
+ orderRequests.append(order)
1347
+ request = {
1348
+ 'contingency_type': 'LIST',
1349
+ 'order_list': orderRequests,
1350
+ }
1351
+ response = await self.v1PrivatePostPrivateCancelOrderList(self.extend(request, params))
1352
+ result = self.safe_value(response, 'result', [])
1353
+ return self.parse_orders(result, market, None, None, params)
1354
+
1326
1355
  async def fetch_open_orders(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
1327
1356
  """
1328
1357
  fetch all unfilled currently open orders
@@ -413,6 +413,7 @@ class krakenfutures(Exchange, ImplicitAPI):
413
413
 
414
414
  async def fetch_order_book(self, symbol: str, limit: Optional[int] = None, params={}):
415
415
  """
416
+ :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-orderbook
416
417
  Fetches a list of open orders in a market
417
418
  :param str symbol: Unified market symbol
418
419
  :param int [limit]: Not used by krakenfutures
@@ -459,6 +460,13 @@ class krakenfutures(Exchange, ImplicitAPI):
459
460
  return self.parse_order_book(response['orderBook'], symbol, timestamp)
460
461
 
461
462
  async def fetch_tickers(self, symbols: Optional[List[str]] = None, params={}):
463
+ """
464
+ fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
465
+ :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-tickers
466
+ :param str[] symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
467
+ :param dict [params]: extra parameters specific to the krakenfutures api endpoint
468
+ :returns dict: an array of `ticker structures <https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure>`
469
+ """
462
470
  await self.load_markets()
463
471
  response = await self.publicGetTickers(params)
464
472
  #
@@ -645,6 +653,7 @@ class krakenfutures(Exchange, ImplicitAPI):
645
653
 
646
654
  async def fetch_trades(self, symbol: str, since: Optional[int] = None, limit: Optional[int] = None, params={}):
647
655
  """
656
+ :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-trade-history
648
657
  * @descriptions Fetch a history of filled trades that self account has made
649
658
  :param str symbol: Unified CCXT market symbol
650
659
  :param int [since]: Timestamp in ms of earliest trade. Not used by krakenfutures except in combination with params.until
@@ -936,6 +945,7 @@ class krakenfutures(Exchange, ImplicitAPI):
936
945
 
937
946
  async def edit_order(self, id: str, symbol, type, side, amount=None, price=None, params={}):
938
947
  """
948
+ :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-edit-order
939
949
  Edit an open order on the exchange
940
950
  :param str id: order id
941
951
  :param str symbol: Not used by Krakenfutures
@@ -963,6 +973,8 @@ class krakenfutures(Exchange, ImplicitAPI):
963
973
 
964
974
  async def cancel_order(self, id: str, symbol: Optional[str] = None, params={}):
965
975
  """
976
+ :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-cancel-order
977
+ Cancel an open order on the exchange
966
978
  :param str id: Order id
967
979
  :param str symbol: Not used by Krakenfutures
968
980
  :param dict [params]: Exchange specific params
@@ -1037,6 +1049,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1037
1049
 
1038
1050
  async def cancel_all_orders(self, symbol: Optional[str] = None, params={}):
1039
1051
  """
1052
+ :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-cancel-all-orders
1040
1053
  Cancels all orders on the exchange, including trigger orders
1041
1054
  :param str symbol: Unified market symbol
1042
1055
  :param dict [params]: Exchange specific params
@@ -1050,6 +1063,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1050
1063
 
1051
1064
  async def fetch_open_orders(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
1052
1065
  """
1066
+ :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-get-open-orders
1053
1067
  Gets all open orders, including trigger orders, for an account from the exchange api
1054
1068
  :param str symbol: Unified market symbol
1055
1069
  :param int [since]: Timestamp(ms) of earliest order.(Not used by kraken api but filtered internally by CCXT)
@@ -1429,6 +1443,16 @@ class krakenfutures(Exchange, ImplicitAPI):
1429
1443
  })
1430
1444
 
1431
1445
  async def fetch_my_trades(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
1446
+ """
1447
+ fetch all trades made by the user
1448
+ :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-historical-data-get-your-fills
1449
+ :param str symbol: unified market symbol
1450
+ :param int [since]: *not used by the api* the earliest time in ms to fetch trades for
1451
+ :param int [limit]: the maximum number of trades structures to retrieve
1452
+ :param dict [params]: extra parameters specific to the bybit api endpoint
1453
+ :param int [params.until]: the latest time in ms to fetch entries for
1454
+ :returns Trade[]: a list of `trade structures <https://github.com/ccxt/ccxt/wiki/Manual#trade-structure>`
1455
+ """
1432
1456
  await self.load_markets()
1433
1457
  market = None
1434
1458
  if symbol is not None:
@@ -1458,9 +1482,10 @@ class krakenfutures(Exchange, ImplicitAPI):
1458
1482
 
1459
1483
  async def fetch_balance(self, params={}):
1460
1484
  """
1485
+ :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-account-information-get-wallets
1461
1486
  Fetch the balance for a sub-account, all sub-account balances are inside 'info' in the response
1462
1487
  :param dict [params]: Exchange specific parameters
1463
- :param str [params.type]: The sub-account type to query the balance of, possible values include 'flex', 'cash'/'main'/'funding', or a market symbol * defaults to 'cash' *
1488
+ :param str [params.type]: The sub-account type to query the balance of, possible values include 'flex', 'cash'/'main'/'funding', or a market symbol * defaults to 'flex' *
1464
1489
  :param str [params.symbol]: A unified market symbol, when assigned the balance for a trading market that matches the symbol is returned
1465
1490
  :returns: A `balance structure <https://github.com/ccxt/ccxt/wiki/Manual#balance-structure>`
1466
1491
  """
@@ -1562,7 +1587,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1562
1587
  raise ArgumentsRequired(self.id + ' fetchBalance requires symbol argument for margin accounts')
1563
1588
  type = symbol
1564
1589
  if type is None:
1565
- type = 'cash' if (symbol is None) else symbol
1590
+ type = 'flex' if (symbol is None) else symbol
1566
1591
  accountName = self.parse_account(type)
1567
1592
  accounts = self.safe_value(response, 'accounts')
1568
1593
  account = self.safe_value(accounts, accountName)
@@ -1748,6 +1773,15 @@ class krakenfutures(Exchange, ImplicitAPI):
1748
1773
  }
1749
1774
 
1750
1775
  async def fetch_funding_rate_history(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
1776
+ """
1777
+ fetches historical funding rate prices
1778
+ :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-historical-funding-rates-historical-funding-rates
1779
+ :param str symbol: unified symbol of the market to fetch the funding rate history for
1780
+ :param int [since]: timestamp in ms of the earliest funding rate to fetch
1781
+ :param int [limit]: the maximum amount of `funding rate structures <https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure>` to fetch
1782
+ :param dict [params]: extra parameters specific to the api endpoint
1783
+ :returns dict[]: a list of `funding rate structures <https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure>`
1784
+ """
1751
1785
  self.check_required_symbol('fetchFundingRateHistory', symbol)
1752
1786
  await self.load_markets()
1753
1787
  market = self.market(symbol)
@@ -1786,6 +1820,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1786
1820
 
1787
1821
  async def fetch_positions(self, symbols: Optional[List[str]] = None, params={}):
1788
1822
  """
1823
+ :see: https://docs.futures.kraken.com/#websocket-api-private-feeds-open-positions
1789
1824
  Fetches current contract trading positions
1790
1825
  :param str[] symbols: List of unified symbols
1791
1826
  :param dict [params]: Not used by krakenfutures
@@ -1863,7 +1898,7 @@ class krakenfutures(Exchange, ImplicitAPI):
1863
1898
  'entryPrice': self.safe_number(position, 'price'),
1864
1899
  'notional': None,
1865
1900
  'leverage': leverage,
1866
- 'unrealizedPnl': self.safe_number(position, 'unrealizedFunding'),
1901
+ 'unrealizedPnl': None,
1867
1902
  'contracts': self.safe_number(position, 'size'),
1868
1903
  'contractSize': self.safe_number(market, 'contractSize'),
1869
1904
  'marginRatio': None,
@@ -1876,6 +1911,13 @@ class krakenfutures(Exchange, ImplicitAPI):
1876
1911
  }
1877
1912
 
1878
1913
  async def fetch_leverage_tiers(self, symbols: Optional[List[str]] = None, params={}):
1914
+ """
1915
+ :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-instrument-details-get-instruments
1916
+ retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
1917
+ :param str[]|None symbols: list of unified market symbols
1918
+ :param dict [params]: extra parameters specific to the krakenfutures api endpoint
1919
+ :returns dict: a dictionary of `leverage tiers structures <https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure>`, indexed by market symbols
1920
+ """
1879
1921
  await self.load_markets()
1880
1922
  response = await self.publicGetInstruments(params)
1881
1923
  #
@@ -2045,6 +2087,8 @@ class krakenfutures(Exchange, ImplicitAPI):
2045
2087
 
2046
2088
  async def transfer(self, code: str, amount, fromAccount, toAccount, params={}):
2047
2089
  """
2090
+ :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-wallet-transfer
2091
+ :see: https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-withdrawal-to-spot-wallet
2048
2092
  transfers currencies between sub-accounts
2049
2093
  :param str code: Unified currency code
2050
2094
  :param float amount: Size of the transfer
@@ -7,6 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.mexc import ImplicitAPI
8
8
  import hashlib
9
9
  from ccxt.base.types import OrderSide
10
+ from ccxt.base.types import OrderRequest
10
11
  from ccxt.base.types import OrderType
11
12
  from ccxt.base.types import IndexType
12
13
  from typing import Optional
@@ -53,6 +54,7 @@ class mexc(Exchange, ImplicitAPI):
53
54
  'cancelOrders': None,
54
55
  'createDepositAddress': True,
55
56
  'createOrder': True,
57
+ 'createOrders': True,
56
58
  'createReduceOnlyOrder': True,
57
59
  'deposit': None,
58
60
  'editOrder': None,
@@ -2006,7 +2008,7 @@ class mexc(Exchange, ImplicitAPI):
2006
2008
  else:
2007
2009
  return await self.create_swap_order(market, type, side, amount, price, marginMode, query)
2008
2010
 
2009
- async def create_spot_order(self, market, type, side, amount, price=None, marginMode=None, params={}):
2011
+ def create_spot_order_request(self, market, type, side, amount, price=None, marginMode=None, params={}):
2010
2012
  symbol = market['symbol']
2011
2013
  orderSide = 'BUY' if (side == 'buy') else 'SELL'
2012
2014
  request = {
@@ -2035,16 +2037,23 @@ class mexc(Exchange, ImplicitAPI):
2035
2037
  if clientOrderId is not None:
2036
2038
  request['newClientOrderId'] = clientOrderId
2037
2039
  params = self.omit(params, ['type', 'clientOrderId'])
2038
- method = 'spotPrivatePostOrder'
2039
2040
  if marginMode is not None:
2040
2041
  if marginMode != 'isolated':
2041
2042
  raise BadRequest(self.id + ' createOrder() does not support marginMode ' + marginMode + ' for spot-margin trading')
2042
- method = 'spotPrivatePostMarginOrder'
2043
2043
  postOnly = None
2044
2044
  postOnly, params = self.handle_post_only(type == 'market', type == 'LIMIT_MAKER', params)
2045
2045
  if postOnly:
2046
2046
  request['type'] = 'LIMIT_MAKER'
2047
- response = await getattr(self, method)(self.extend(request, params))
2047
+ return self.extend(request, params)
2048
+
2049
+ async def create_spot_order(self, market, type, side, amount, price=None, marginMode=None, params={}):
2050
+ await self.load_markets()
2051
+ request = self.create_spot_order_request(market, type, side, amount, price, marginMode, params)
2052
+ response = None
2053
+ if marginMode is not None:
2054
+ response = await self.spotPrivatePostMarginOrder(self.extend(request, params))
2055
+ else:
2056
+ response = await self.spotPrivatePostOrder(self.extend(request, params))
2048
2057
  #
2049
2058
  # spot
2050
2059
  #
@@ -2160,6 +2169,63 @@ class mexc(Exchange, ImplicitAPI):
2160
2169
  data = self.safe_string(response, 'data')
2161
2170
  return self.parse_order(data, market)
2162
2171
 
2172
+ async def create_orders(self, orders: List[OrderRequest], params={}):
2173
+ """
2174
+ *spot only* *all orders must have the same symbol* create a list of trade orders
2175
+ :see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#batch-orders
2176
+ :param array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
2177
+ :param dict [params]: extra parameters specific to api endpoint
2178
+ :returns dict: an `order structure <https://github.com/ccxt/ccxt/wiki/Manual#order-structure>`
2179
+ """
2180
+ await self.load_markets()
2181
+ ordersRequests = []
2182
+ symbol = None
2183
+ for i in range(0, len(orders)):
2184
+ rawOrder = orders[i]
2185
+ marketId = self.safe_string(rawOrder, 'symbol')
2186
+ market = self.market(marketId)
2187
+ if not market['spot']:
2188
+ raise NotSupported(self.id + ' createOrders() is only supported for spot markets')
2189
+ if symbol is None:
2190
+ symbol = marketId
2191
+ else:
2192
+ if symbol != marketId:
2193
+ raise BadRequest(self.id + ' createOrders() requires all orders to have the same symbol')
2194
+ type = self.safe_string(rawOrder, 'type')
2195
+ side = self.safe_string(rawOrder, 'side')
2196
+ amount = self.safe_value(rawOrder, 'amount')
2197
+ price = self.safe_value(rawOrder, 'price')
2198
+ orderParams = self.safe_value(rawOrder, 'params', {})
2199
+ marginMode = None
2200
+ marginMode, params = self.handle_margin_mode_and_params('createOrder', params)
2201
+ orderRequest = self.create_spot_order_request(market, type, side, amount, price, marginMode, orderParams)
2202
+ ordersRequests.append(orderRequest)
2203
+ request = {
2204
+ 'batchOrders': ordersRequests,
2205
+ }
2206
+ response = await self.spotPrivatePostBatchOrders(request)
2207
+ #
2208
+ # [
2209
+ # {
2210
+ # "symbol": "BTCUSDT",
2211
+ # "orderId": "1196315350023612316",
2212
+ # "newClientOrderId": "hio8279hbdsds",
2213
+ # "orderListId": -1
2214
+ # },
2215
+ # {
2216
+ # "newClientOrderId": "123456",
2217
+ # "msg": "The minimum transaction volume cannot be less than:0.5USDT",
2218
+ # "code": 30002
2219
+ # },
2220
+ # {
2221
+ # "symbol": "BTCUSDT",
2222
+ # "orderId": "1196315350023612318",
2223
+ # "orderListId": -1
2224
+ # }
2225
+ # ]
2226
+ #
2227
+ return self.parse_orders(response)
2228
+
2163
2229
  async def fetch_order(self, id: str, symbol: Optional[str] = None, params={}):
2164
2230
  """
2165
2231
  fetches information on an order made by the user
@@ -2955,6 +3021,22 @@ class mexc(Exchange, ImplicitAPI):
2955
3021
  # "updateTime": "1648984276000",
2956
3022
  # }
2957
3023
  #
3024
+ # createOrders error
3025
+ #
3026
+ # {
3027
+ # "newClientOrderId": "123456",
3028
+ # "msg": "The minimum transaction volume cannot be less than:0.5USDT",
3029
+ # "code": 30002
3030
+ # }
3031
+ #
3032
+ code = self.safe_integer(order, 'code')
3033
+ if code is not None:
3034
+ # error upon placing multiple orders
3035
+ return self.safe_order({
3036
+ 'info': order,
3037
+ 'status': 'rejected',
3038
+ 'clientOrderId': self.safe_string(order, 'newClientOrderId'),
3039
+ })
2958
3040
  id = None
2959
3041
  if isinstance(order, str):
2960
3042
  id = order
ccxt/async_support/okx.py CHANGED
@@ -398,6 +398,7 @@ class okx(Exchange, ImplicitAPI):
398
398
  'sprd/order': 1,
399
399
  'sprd/cancel-order': 1,
400
400
  'sprd/mass-cancel': 1,
401
+ 'sprd/amend-order': 1,
401
402
  # trade
402
403
  'trade/order': 1 / 3,
403
404
  'trade/batch-orders': 1 / 15,
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.1.28'
7
+ __version__ = '4.1.29'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10