ccxt 4.1.27__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 +1 -1
- ccxt/abstract/bybit.py +1 -0
- ccxt/abstract/okex.py +1 -0
- ccxt/abstract/okex5.py +1 -0
- ccxt/abstract/okx.py +1 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bitget.py +133 -0
- ccxt/async_support/bybit.py +4 -0
- ccxt/async_support/cryptocom.py +29 -0
- ccxt/async_support/krakenfutures.py +47 -3
- ccxt/async_support/mexc.py +86 -4
- ccxt/async_support/okx.py +1 -0
- ccxt/async_support/woo.py +4 -1
- ccxt/base/exchange.py +1 -1
- ccxt/bitget.py +133 -0
- ccxt/bybit.py +4 -0
- ccxt/cryptocom.py +29 -0
- ccxt/krakenfutures.py +47 -3
- ccxt/mexc.py +86 -4
- ccxt/okx.py +1 -0
- ccxt/pro/__init__.py +1 -1
- ccxt/woo.py +4 -1
- {ccxt-4.1.27.dist-info → ccxt-4.1.29.dist-info}/METADATA +6 -6
- {ccxt-4.1.27.dist-info → ccxt-4.1.29.dist-info}/RECORD +27 -27
- {ccxt-4.1.27.dist-info → ccxt-4.1.29.dist-info}/WHEEL +0 -0
- {ccxt-4.1.27.dist-info → ccxt-4.1.29.dist-info}/top_level.txt +0 -0
ccxt/bitget.py
CHANGED
@@ -64,6 +64,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
64
64
|
'editOrder': True,
|
65
65
|
'fetchAccounts': False,
|
66
66
|
'fetchBalance': True,
|
67
|
+
'fetchBorrowInterest': True,
|
67
68
|
'fetchBorrowRate': True,
|
68
69
|
'fetchBorrowRateHistories': False,
|
69
70
|
'fetchBorrowRateHistory': False,
|
@@ -5954,6 +5955,138 @@ class bitget(Exchange, ImplicitAPI):
|
|
5954
5955
|
'info': info,
|
5955
5956
|
}
|
5956
5957
|
|
5958
|
+
def fetch_borrow_interest(self, code: Optional[str] = None, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
|
5959
|
+
"""
|
5960
|
+
fetch the interest owed by the user for borrowing currency for margin trading
|
5961
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-interest-records
|
5962
|
+
:see: https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-interest-records
|
5963
|
+
:param str [code]: unified currency code
|
5964
|
+
:param str [symbol]: unified market symbol when fetching interest in isolated markets
|
5965
|
+
:param int [since]: the earliest time in ms to fetch borrow interest for
|
5966
|
+
:param int [limit]: the maximum number of structures to retrieve
|
5967
|
+
:param dict [params]: extra parameters specific to the bitget api endpoint
|
5968
|
+
:returns dict[]: a list of `borrow interest structures <https://github.com/ccxt/ccxt/wiki/Manual#borrow-interest-structure>`
|
5969
|
+
"""
|
5970
|
+
self.load_markets()
|
5971
|
+
market = None
|
5972
|
+
if symbol is not None:
|
5973
|
+
market = self.market(symbol)
|
5974
|
+
request = {}
|
5975
|
+
currency = None
|
5976
|
+
if code is not None:
|
5977
|
+
currency = self.currency(code)
|
5978
|
+
request['coin'] = currency['id']
|
5979
|
+
if since is not None:
|
5980
|
+
request['startTime'] = since
|
5981
|
+
else:
|
5982
|
+
request['startTime'] = self.milliseconds() - 7776000000
|
5983
|
+
if limit is not None:
|
5984
|
+
request['pageSize'] = limit
|
5985
|
+
response = None
|
5986
|
+
marginMode = None
|
5987
|
+
marginMode, params = self.handle_margin_mode_and_params('fetchBorrowInterest', params, 'cross')
|
5988
|
+
if marginMode == 'isolated':
|
5989
|
+
self.check_required_symbol('fetchBorrowInterest', symbol)
|
5990
|
+
request['symbol'] = market['info']['symbolName']
|
5991
|
+
response = self.privateMarginGetIsolatedInterestList(self.extend(request, params))
|
5992
|
+
elif marginMode == 'cross':
|
5993
|
+
response = self.privateMarginGetCrossInterestList(self.extend(request, params))
|
5994
|
+
#
|
5995
|
+
# isolated
|
5996
|
+
#
|
5997
|
+
# {
|
5998
|
+
# "code": "00000",
|
5999
|
+
# "msg": "success",
|
6000
|
+
# "requestTime": 1698282523888,
|
6001
|
+
# "data": {
|
6002
|
+
# "resultList": [
|
6003
|
+
# {
|
6004
|
+
# "interestId": "1100560904468705284",
|
6005
|
+
# "interestCoin": "USDT",
|
6006
|
+
# "interestRate": "0.000126279",
|
6007
|
+
# "loanCoin": "USDT",
|
6008
|
+
# "amount": "0.00000298",
|
6009
|
+
# "type": "scheduled",
|
6010
|
+
# "symbol": "BTCUSDT",
|
6011
|
+
# "ctime": "1698120000000"
|
6012
|
+
# },
|
6013
|
+
# ],
|
6014
|
+
# "maxId": "1100560904468705284",
|
6015
|
+
# "minId": "1096915487398965249"
|
6016
|
+
# }
|
6017
|
+
# }
|
6018
|
+
#
|
6019
|
+
# cross
|
6020
|
+
#
|
6021
|
+
# {
|
6022
|
+
# "code": "00000",
|
6023
|
+
# "msg": "success",
|
6024
|
+
# "requestTime": 1698282552126,
|
6025
|
+
# "data": {
|
6026
|
+
# "resultList": [
|
6027
|
+
# {
|
6028
|
+
# "interestId": "1099126154352799744",
|
6029
|
+
# "interestCoin": "USDT",
|
6030
|
+
# "interestRate": "0.000126279",
|
6031
|
+
# "loanCoin": "USDT",
|
6032
|
+
# "amount": "0.00002631",
|
6033
|
+
# "type": "scheduled",
|
6034
|
+
# "ctime": "1697778000000"
|
6035
|
+
# },
|
6036
|
+
# ],
|
6037
|
+
# "maxId": "1099126154352799744",
|
6038
|
+
# "minId": "1096917004629716993"
|
6039
|
+
# }
|
6040
|
+
# }
|
6041
|
+
#
|
6042
|
+
data = self.safe_value(response, 'data', {})
|
6043
|
+
rows = self.safe_value(data, 'resultList', [])
|
6044
|
+
interest = self.parse_borrow_interests(rows, market)
|
6045
|
+
return self.filter_by_currency_since_limit(interest, code, since, limit)
|
6046
|
+
|
6047
|
+
def parse_borrow_interest(self, info, market=None):
|
6048
|
+
#
|
6049
|
+
# isolated
|
6050
|
+
#
|
6051
|
+
# {
|
6052
|
+
# "interestId": "1100560904468705284",
|
6053
|
+
# "interestCoin": "USDT",
|
6054
|
+
# "interestRate": "0.000126279",
|
6055
|
+
# "loanCoin": "USDT",
|
6056
|
+
# "amount": "0.00000298",
|
6057
|
+
# "type": "scheduled",
|
6058
|
+
# "symbol": "BTCUSDT",
|
6059
|
+
# "ctime": "1698120000000"
|
6060
|
+
# }
|
6061
|
+
#
|
6062
|
+
# cross
|
6063
|
+
#
|
6064
|
+
# {
|
6065
|
+
# "interestId": "1099126154352799744",
|
6066
|
+
# "interestCoin": "USDT",
|
6067
|
+
# "interestRate": "0.000126279",
|
6068
|
+
# "loanCoin": "USDT",
|
6069
|
+
# "amount": "0.00002631",
|
6070
|
+
# "type": "scheduled",
|
6071
|
+
# "ctime": "1697778000000"
|
6072
|
+
# }
|
6073
|
+
#
|
6074
|
+
marketId = self.safe_string(info, 'symbol')
|
6075
|
+
market = self.safe_market(marketId, market)
|
6076
|
+
marginMode = 'isolated' if (marketId is not None) else 'cross'
|
6077
|
+
timestamp = self.safe_integer(info, 'ctime')
|
6078
|
+
return {
|
6079
|
+
'symbol': self.safe_string(market, 'symbol'),
|
6080
|
+
'marginMode': marginMode,
|
6081
|
+
'currency': self.safe_currency_code(self.safe_string(info, 'interestCoin')),
|
6082
|
+
'interest': self.safe_number(info, 'amount'),
|
6083
|
+
'interestRate': self.safe_number(info, 'interestRate'),
|
6084
|
+
'amountBorrowed': None,
|
6085
|
+
'timestamp': timestamp,
|
6086
|
+
'datetime': self.iso8601(timestamp),
|
6087
|
+
'info': info,
|
6088
|
+
}
|
6089
|
+
|
5957
6090
|
def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
|
5958
6091
|
if not response:
|
5959
6092
|
return None # fallback to default error handler
|
ccxt/bybit.py
CHANGED
@@ -634,6 +634,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
634
634
|
'v5/position/trading-stop': 5, # 10/s => cost = 50 / 10 = 5
|
635
635
|
'v5/position/set-auto-add-margin': 2.5,
|
636
636
|
'v5/position/add-margin': 2.5,
|
637
|
+
'v5/position/confirm-pending-mmr': 2.5,
|
637
638
|
# account
|
638
639
|
'v5/account/upgrade-to-uta': 2.5,
|
639
640
|
'v5/account/set-margin-mode': 2.5,
|
@@ -3071,8 +3072,11 @@ class bybit(Exchange, ImplicitAPI):
|
|
3071
3072
|
# "time": 1672125441042
|
3072
3073
|
# }
|
3073
3074
|
#
|
3075
|
+
timestamp = self.safe_integer(response, 'time')
|
3074
3076
|
result = {
|
3075
3077
|
'info': response,
|
3078
|
+
'timestamp': timestamp,
|
3079
|
+
'datetime': self.iso8601(timestamp),
|
3076
3080
|
}
|
3077
3081
|
responseResult = self.safe_value(response, 'result', {})
|
3078
3082
|
currencyList = self.safe_value_n(responseResult, ['loanAccountList', 'list', 'balance'])
|
ccxt/cryptocom.py
CHANGED
@@ -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
|
+
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
|
+
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 = 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
|
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
|
ccxt/krakenfutures.py
CHANGED
@@ -413,6 +413,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
413
413
|
|
414
414
|
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
|
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
|
self.load_markets()
|
463
471
|
response = self.publicGetTickers(params)
|
464
472
|
#
|
@@ -645,6 +653,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
645
653
|
|
646
654
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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 '
|
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 = '
|
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
|
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
|
self.load_markets()
|
1753
1787
|
market = self.market(symbol)
|
@@ -1786,6 +1820,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1786
1820
|
|
1787
1821
|
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':
|
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
|
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
|
self.load_markets()
|
1880
1922
|
response = self.publicGetInstruments(params)
|
1881
1923
|
#
|
@@ -2045,6 +2087,8 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2045
2087
|
|
2046
2088
|
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
|
ccxt/mexc.py
CHANGED
@@ -7,6 +7,7 @@ from ccxt.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 self.create_swap_order(market, type, side, amount, price, marginMode, query)
|
2008
2010
|
|
2009
|
-
def
|
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
|
-
|
2047
|
+
return self.extend(request, params)
|
2048
|
+
|
2049
|
+
def create_spot_order(self, market, type, side, amount, price=None, marginMode=None, params={}):
|
2050
|
+
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 = self.spotPrivatePostMarginOrder(self.extend(request, params))
|
2055
|
+
else:
|
2056
|
+
response = 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
|
+
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
|
+
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 = 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
|
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/okx.py
CHANGED
ccxt/pro/__init__.py
CHANGED
ccxt/woo.py
CHANGED
@@ -132,7 +132,10 @@ class woo(Exchange, ImplicitAPI):
|
|
132
132
|
'fees': [
|
133
133
|
'https://support.woo.org/hc/en-001/articles/4404611795353--Trading-Fees',
|
134
134
|
],
|
135
|
-
'referral':
|
135
|
+
'referral': {
|
136
|
+
'url': 'https://x.woo.org/register?ref=YWOWC96B',
|
137
|
+
'discount': 0.35,
|
138
|
+
},
|
136
139
|
},
|
137
140
|
'api': {
|
138
141
|
'v1': {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ccxt
|
3
|
-
Version: 4.1.
|
3
|
+
Version: 4.1.29
|
4
4
|
Summary: A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 130+ exchanges
|
5
5
|
Home-page: https://ccxt.com
|
6
6
|
Author: Igor Kroitor
|
@@ -92,7 +92,7 @@ Current feature list:
|
|
92
92
|
| [](https://m.mexc.com/auth/signup?inviteCode=1FQ1G) | mexc | [MEXC Global](https://m.mexc.com/auth/signup?inviteCode=1FQ1G) | [](https://mxcdevelop.github.io/apidocs/spot_v3_en/) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) | |
|
93
93
|
| [](https://www.okx.com/activities/ccxt-trade-and-earn?channelid=CCXT2023) | okx | [OKX](https://www.okx.com/activities/ccxt-trade-and-earn?channelid=CCXT2023) | [](https://www.okx.com/docs-v5/en/) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) | [](https://www.okx.com/activities/ccxt-trade-and-earn?channelid=CCXT2023) |
|
94
94
|
| [](https://wx.network) | wavesexchange | [Waves.Exchange](https://wx.network) | [](https://docs.wx.network) | [](https://github.com/ccxt/ccxt/wiki/Certification) | | |
|
95
|
-
| [](https://
|
95
|
+
| [](https://x.woo.org/register?ref=YWOWC96B) | woo | [WOO X](https://x.woo.org/register?ref=YWOWC96B) | [](https://docs.woo.org/) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) | [](https://x.woo.org/register?ref=YWOWC96B) |
|
96
96
|
|
97
97
|
## Supported Cryptocurrency Exchange Markets
|
98
98
|
|
@@ -193,7 +193,7 @@ The CCXT library currently supports the following 97 cryptocurrency exchange mar
|
|
193
193
|
| [](https://wx.network) | wavesexchange | [Waves.Exchange](https://wx.network) | [](https://docs.wx.network) | [](https://github.com/ccxt/ccxt/wiki/Certification) | |
|
194
194
|
| [](https://wazirx.com/invite/k7rrnks5) | wazirx | [WazirX](https://wazirx.com/invite/k7rrnks5) | [](https://docs.wazirx.com/#public-rest-api-for-wazirx) | | [](https://ccxt.pro) |
|
195
195
|
| [](https://whitebit.com/referral/d9bdf40e-28f2-4b52-b2f9-cd1415d82963) | whitebit | [WhiteBit](https://whitebit.com/referral/d9bdf40e-28f2-4b52-b2f9-cd1415d82963) | [](https://github.com/whitebit-exchange/api-docs) | | [](https://ccxt.pro) |
|
196
|
-
| [](https://
|
196
|
+
| [](https://x.woo.org/register?ref=YWOWC96B) | woo | [WOO X](https://x.woo.org/register?ref=YWOWC96B) | [](https://docs.woo.org/) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
197
197
|
| [](https://www.yobit.net) | yobit | [YoBit](https://www.yobit.net) | [](https://www.yobit.net/en/api/) | | |
|
198
198
|
| [](https://zaif.jp) | zaif | [Zaif](https://zaif.jp) | [](https://techbureau-api-document.readthedocs.io/ja/latest/index.html) | | |
|
199
199
|
| [](https://auth.zondaglobal.com/ref/jHlbB4mIkdS1) | zonda | [Zonda](https://auth.zondaglobal.com/ref/jHlbB4mIkdS1) | [](https://docs.zonda.exchange/) | | |
|
@@ -254,13 +254,13 @@ console.log(version, Object.keys(exchanges));
|
|
254
254
|
|
255
255
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
256
256
|
|
257
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.
|
258
|
-
* unpkg: https://unpkg.com/ccxt@4.1.
|
257
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.29/dist/ccxt.browser.js
|
258
|
+
* unpkg: https://unpkg.com/ccxt@4.1.29/dist/ccxt.browser.js
|
259
259
|
|
260
260
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
261
261
|
|
262
262
|
```HTML
|
263
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.
|
263
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.29/dist/ccxt.browser.js"></script>
|
264
264
|
```
|
265
265
|
|
266
266
|
Creates a global `ccxt` object:
|