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.
- ccxt/__init__.py +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/base/ws/aiohttp_client.py +25 -3
- ccxt/async_support/bitvavo.py +0 -3
- ccxt/async_support/cex.py +1 -1
- ccxt/async_support/coinex.py +1 -1
- ccxt/async_support/deribit.py +2 -2
- ccxt/async_support/gate.py +15 -2
- ccxt/async_support/hitbtc.py +3 -3
- ccxt/async_support/htx.py +1 -1
- ccxt/async_support/indodax.py +1 -1
- ccxt/async_support/kraken.py +2 -2
- ccxt/async_support/kucoin.py +5 -3
- ccxt/async_support/kucoinfutures.py +93 -25
- ccxt/async_support/okx.py +2 -2
- ccxt/async_support/phemex.py +17 -15
- ccxt/async_support/wavesexchange.py +3 -0
- ccxt/async_support/woofipro.py +2 -2
- ccxt/base/exchange.py +14 -2
- ccxt/bitvavo.py +0 -3
- ccxt/cex.py +1 -1
- ccxt/coinex.py +1 -1
- ccxt/deribit.py +2 -2
- ccxt/gate.py +15 -2
- ccxt/hitbtc.py +3 -3
- ccxt/htx.py +1 -1
- ccxt/indodax.py +1 -1
- ccxt/kraken.py +2 -2
- ccxt/kucoin.py +5 -3
- ccxt/kucoinfutures.py +93 -25
- ccxt/okx.py +2 -2
- ccxt/phemex.py +17 -15
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +8 -8
- ccxt/pro/bitget.py +4 -4
- ccxt/pro/bitmart.py +2 -2
- ccxt/pro/bitmex.py +2 -2
- ccxt/pro/bitvavo.py +46 -45
- ccxt/pro/blofin.py +2 -2
- ccxt/pro/bybit.py +2 -2
- ccxt/pro/cryptocom.py +4 -4
- ccxt/pro/gate.py +4 -4
- ccxt/pro/hashkey.py +3 -3
- ccxt/pro/mexc.py +1 -2
- ccxt/wavesexchange.py +3 -0
- ccxt/woofipro.py +2 -2
- {ccxt-4.4.31.dist-info → ccxt-4.4.32.dist-info}/METADATA +10 -4
- {ccxt-4.4.31.dist-info → ccxt-4.4.32.dist-info}/RECORD +52 -52
- {ccxt-4.4.31.dist-info → ccxt-4.4.32.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.31.dist-info → ccxt-4.4.32.dist-info}/WHEEL +0 -0
- {ccxt-4.4.31.dist-info → ccxt-4.4.32.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/async_support/__init__.py
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
|
+
orjson = None
|
4
|
+
try:
|
5
|
+
import orjson as orjson
|
6
|
+
except ImportError:
|
7
|
+
pass
|
8
|
+
|
3
9
|
import json
|
4
10
|
from asyncio import sleep, ensure_future
|
5
11
|
from aiohttp import WSMsgType
|
@@ -25,8 +31,16 @@ class AiohttpClient(Client):
|
|
25
31
|
self.log(iso8601(milliseconds()), 'message', data)
|
26
32
|
if isinstance(data, bytes):
|
27
33
|
data = data.decode()
|
28
|
-
decoded = json.loads(data) if is_json_encoded_object(data) else data
|
29
|
-
|
34
|
+
# decoded = json.loads(data) if is_json_encoded_object(data) else data
|
35
|
+
decode = None
|
36
|
+
if is_json_encoded_object(data):
|
37
|
+
if orjson is None:
|
38
|
+
decode = json.loads(data)
|
39
|
+
else:
|
40
|
+
decode = orjson.loads(data)
|
41
|
+
else:
|
42
|
+
decode = data
|
43
|
+
self.on_message_callback(self, decode)
|
30
44
|
|
31
45
|
def handle_message(self, message):
|
32
46
|
# self.log(iso8601(milliseconds()), message)
|
@@ -80,7 +94,15 @@ class AiohttpClient(Client):
|
|
80
94
|
async def send(self, message):
|
81
95
|
if self.verbose:
|
82
96
|
self.log(iso8601(milliseconds()), 'sending', message)
|
83
|
-
|
97
|
+
send_msg = None
|
98
|
+
if isinstance(message, str):
|
99
|
+
send_msg = message
|
100
|
+
else:
|
101
|
+
if orjson is None:
|
102
|
+
send_msg = json.dumps(message, separators=(',', ':'))
|
103
|
+
else:
|
104
|
+
send_msg = orjson.dumps(message).decode('utf-8')
|
105
|
+
return await self.connection.send_str(send_msg)
|
84
106
|
|
85
107
|
async def close(self, code=1000):
|
86
108
|
if self.verbose:
|
ccxt/async_support/bitvavo.py
CHANGED
@@ -1097,9 +1097,6 @@ class bitvavo(Exchange, ImplicitAPI):
|
|
1097
1097
|
request['timeInForce'] = timeInForce
|
1098
1098
|
if postOnly:
|
1099
1099
|
request['postOnly'] = True
|
1100
|
-
clientOrderId = self.safe_string(params, 'clientOrderId')
|
1101
|
-
if clientOrderId is None:
|
1102
|
-
request['clientOrderId'] = self.uuid22()
|
1103
1100
|
return self.extend(request, params)
|
1104
1101
|
|
1105
1102
|
async def create_order(self, symbol: Str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
ccxt/async_support/cex.py
CHANGED
@@ -848,7 +848,7 @@ class cex(Exchange, ImplicitAPI):
|
|
848
848
|
|
849
849
|
https://trade.cex.io/docs/#rest-private-api-calls-orders
|
850
850
|
|
851
|
-
|
851
|
+
:param str status: order status to fetch for
|
852
852
|
:param str symbol: unified market symbol of the market orders were made in
|
853
853
|
:param int [since]: the earliest time in ms to fetch orders for
|
854
854
|
:param int [limit]: the maximum number of order structures to retrieve
|
ccxt/async_support/coinex.py
CHANGED
@@ -3253,7 +3253,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3253
3253
|
https://docs.coinex.com/api/v2/futures/order/http/list-finished-order
|
3254
3254
|
https://docs.coinex.com/api/v2/futures/order/http/list-finished-stop-order
|
3255
3255
|
|
3256
|
-
|
3256
|
+
:param str status: order status to fetch for
|
3257
3257
|
:param str symbol: unified market symbol of the market orders were made in
|
3258
3258
|
:param int [since]: the earliest time in ms to fetch orders for
|
3259
3259
|
:param int [limit]: the maximum number of order structures to retrieve
|
ccxt/async_support/deribit.py
CHANGED
@@ -2965,8 +2965,8 @@ class deribit(Exchange, ImplicitAPI):
|
|
2965
2965
|
https://docs.deribit.com/#public-get_funding_rate_history
|
2966
2966
|
|
2967
2967
|
:param str symbol: unified market symbol
|
2968
|
-
|
2969
|
-
|
2968
|
+
:param int [since]: the earliest time in ms to fetch funding rate history for
|
2969
|
+
:param int [limit]: the maximum number of entries to retrieve
|
2970
2970
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2971
2971
|
:param int [params.end_timestamp]: fetch funding rate ending at self timestamp
|
2972
2972
|
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
ccxt/async_support/gate.py
CHANGED
@@ -3023,18 +3023,31 @@ class gate(Exchange, ImplicitAPI):
|
|
3023
3023
|
:param int [since]: timestamp in ms of the earliest funding rate to fetch
|
3024
3024
|
:param int [limit]: the maximum amount of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>` to fetch
|
3025
3025
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3026
|
+
:param int [params.until]: timestamp in ms of the latest funding rate to fetch
|
3027
|
+
: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)
|
3026
3028
|
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>`
|
3027
3029
|
"""
|
3028
3030
|
if symbol is None:
|
3029
3031
|
raise ArgumentsRequired(self.id + ' fetchFundingRateHistory() requires a symbol argument')
|
3030
3032
|
await self.load_markets()
|
3033
|
+
paginate = False
|
3034
|
+
paginate, params = self.handle_option_and_params(params, 'fetchFundingRateHistory', 'paginate')
|
3035
|
+
if paginate:
|
3036
|
+
return await self.fetch_paginated_call_deterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params)
|
3031
3037
|
market = self.market(symbol)
|
3032
3038
|
if not market['swap']:
|
3033
3039
|
raise BadSymbol(self.id + ' fetchFundingRateHistory() supports swap contracts only')
|
3034
|
-
request
|
3040
|
+
request: dict = {}
|
3041
|
+
request, params = self.prepare_request(market, None, params)
|
3035
3042
|
if limit is not None:
|
3036
3043
|
request['limit'] = limit
|
3037
|
-
|
3044
|
+
if since is not None:
|
3045
|
+
request['from'] = self.parse_to_int(since / 1000)
|
3046
|
+
until = self.safe_integer(params, 'until')
|
3047
|
+
if until is not None:
|
3048
|
+
params = self.omit(params, 'until')
|
3049
|
+
request['to'] = self.parse_to_int(until / 1000)
|
3050
|
+
response = await self.publicFuturesGetSettleFundingRate(self.extend(request, params))
|
3038
3051
|
#
|
3039
3052
|
# {
|
3040
3053
|
# "r": "0.00063521",
|
ccxt/async_support/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[]
|
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
|
-
|
3400
|
-
|
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/async_support/htx.py
CHANGED
@@ -3071,7 +3071,7 @@ class htx(Exchange, ImplicitAPI):
|
|
3071
3071
|
|
3072
3072
|
:param str type: 'spot', 'swap' or 'future
|
3073
3073
|
:param str [marginMode]: 'cross' or 'isolated'
|
3074
|
-
|
3074
|
+
:param str [symbol]: unified ccxt market symbol
|
3075
3075
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3076
3076
|
:returns dict: a dictionary of `account structures <https://docs.ccxt.com/#/?id=account-structure>` indexed by the account type
|
3077
3077
|
"""
|
ccxt/async_support/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':
|
32
|
+
'rateLimit': 50,
|
33
33
|
'has': {
|
34
34
|
'CORS': None,
|
35
35
|
'spot': True,
|
ccxt/async_support/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[]
|
2049
|
-
|
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/async_support/kucoin.py
CHANGED
@@ -591,6 +591,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
591
591
|
'400303': PermissionDenied, # {"msg":"To enjoy the full range of our products and services, we kindly request you complete the identity verification process.","code":"400303"}
|
592
592
|
'500000': ExchangeNotAvailable, # {"code":"500000","msg":"Internal Server Error"}
|
593
593
|
'260220': InvalidAddress, # {"code": "260220", "msg": "deposit.address.not.exists"}
|
594
|
+
'600100': InsufficientFunds, # {"msg":"Funds below the minimum requirement.","code":"600100"}
|
595
|
+
'600101': InvalidOrder, # {"msg":"The order funds should more then 0.1 USDT.","code":"600101"}
|
594
596
|
'900014': BadRequest, # {"code":"900014","msg":"Invalid chainId"}
|
595
597
|
},
|
596
598
|
'broad': {
|
@@ -1245,7 +1247,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1245
1247
|
|
1246
1248
|
async def load_migration_status(self, force: bool = False):
|
1247
1249
|
"""
|
1248
|
-
|
1250
|
+
:param boolean force: load account state for non hf
|
1249
1251
|
loads the migration status for the account(hf or not)
|
1250
1252
|
|
1251
1253
|
https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/get-user-type
|
@@ -4740,8 +4742,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
4740
4742
|
|
4741
4743
|
https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/modify-leverage-multiplier
|
4742
4744
|
|
4743
|
-
|
4744
|
-
:param str symbol: unified market symbol
|
4745
|
+
: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
|
4746
|
+
:param str [symbol]: unified market symbol
|
4745
4747
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4746
4748
|
:returns dict: response from the exchange
|
4747
4749
|
"""
|
@@ -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
|
-
|
1216
|
-
|
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://
|
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
|
async 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
|
await 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'),
|
2372
|
+
'currency': self.safe_string(currency, 'id'),
|
2366
2373
|
'amount': amountToPrecision,
|
2367
2374
|
}
|
2368
|
-
|
2369
|
-
response =
|
2370
|
-
|
2371
|
-
|
2372
|
-
|
2373
|
-
|
2374
|
-
|
2375
|
-
|
2376
|
-
|
2377
|
-
|
2378
|
-
|
2375
|
+
toAccountString = self.parse_transfer_type(toAccount)
|
2376
|
+
response = None
|
2377
|
+
if toAccountString == 'TRADE' or toAccountString == 'MAIN':
|
2378
|
+
request['recAccountType'] = toAccountString
|
2379
|
+
response = await 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 = await 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':
|
2382
|
-
'toAccount':
|
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':
|
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
|
async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
2413
2481
|
"""
|
2414
2482
|
|
ccxt/async_support/okx.py
CHANGED
@@ -7933,8 +7933,8 @@ class okx(Exchange, ImplicitAPI):
|
|
7933
7933
|
|
7934
7934
|
:param str [symbol]: not used by okx fetchMarginAdjustmentHistory
|
7935
7935
|
:param str [type]: "add" or "reduce"
|
7936
|
-
|
7937
|
-
|
7936
|
+
:param int [since]: the earliest time in ms to fetch margin adjustment history for
|
7937
|
+
:param int [limit]: the maximum number of entries to retrieve
|
7938
7938
|
:param dict params: extra parameters specific to the exchange api endpoint
|
7939
7939
|
:param boolean [params.auto]: True if fetching auto margin increases
|
7940
7940
|
:returns dict[]: a list of `margin structures <https://docs.ccxt.com/#/?id=margin-loan-structure>`
|
ccxt/async_support/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
|
-
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
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(
|
2562
|
+
takeProfitTriggerPriceType = self.safe_string_2(takeProfit, 'triggerPriceType', 'tpTrigger')
|
2558
2563
|
if takeProfitTriggerPriceType is not None:
|
2559
|
-
|
2560
|
-
|
2561
|
-
|
2562
|
-
|
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)
|
@@ -1890,6 +1890,9 @@ class wavesexchange(Exchange, ImplicitAPI):
|
|
1890
1890
|
async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1891
1891
|
"""
|
1892
1892
|
fetch all trades made by the user
|
1893
|
+
|
1894
|
+
https://api.wavesplatform.com/v0/docs/#/transactions/searchTxsExchange
|
1895
|
+
|
1893
1896
|
:param str symbol: unified market symbol
|
1894
1897
|
:param int [since]: the earliest time in ms to fetch trades for
|
1895
1898
|
:param int [limit]: the maximum number of trades structures to retrieve
|
ccxt/async_support/woofipro.py
CHANGED
@@ -2379,8 +2379,8 @@ class woofipro(Exchange, ImplicitAPI):
|
|
2379
2379
|
|
2380
2380
|
https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/update-leverage-setting
|
2381
2381
|
|
2382
|
-
|
2383
|
-
:param str symbol: unified market symbol
|
2382
|
+
:param int [leverage]: the rate of leverage
|
2383
|
+
:param str [symbol]: unified market symbol
|
2384
2384
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2385
2385
|
:returns dict: response from the exchange
|
2386
2386
|
"""
|
ccxt/base/exchange.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.4.
|
7
|
+
__version__ = '4.4.32'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -88,6 +88,14 @@ import gzip
|
|
88
88
|
import hashlib
|
89
89
|
import hmac
|
90
90
|
import io
|
91
|
+
|
92
|
+
# load orjson if available, otherwise default to json
|
93
|
+
orjson = None
|
94
|
+
try:
|
95
|
+
import orjson as orjson
|
96
|
+
except ImportError:
|
97
|
+
pass
|
98
|
+
|
91
99
|
import json
|
92
100
|
import math
|
93
101
|
import random
|
@@ -486,9 +494,11 @@ class Exchange(object):
|
|
486
494
|
return response_body.strip()
|
487
495
|
|
488
496
|
def on_json_response(self, response_body):
|
489
|
-
if self.quoteJsonNumbers:
|
497
|
+
if self.quoteJsonNumbers and orjson is None:
|
490
498
|
return json.loads(response_body, parse_float=str, parse_int=str)
|
491
499
|
else:
|
500
|
+
if orjson:
|
501
|
+
return orjson.loads(response_body)
|
492
502
|
return json.loads(response_body)
|
493
503
|
|
494
504
|
def fetch(self, url, method='GET', headers=None, body=None):
|
@@ -1433,6 +1443,8 @@ class Exchange(object):
|
|
1433
1443
|
|
1434
1444
|
@staticmethod
|
1435
1445
|
def json(data, params=None):
|
1446
|
+
if orjson:
|
1447
|
+
return orjson.dumps(data).decode('utf-8')
|
1436
1448
|
return json.dumps(data, separators=(',', ':'), cls=SafeJSONEncoder)
|
1437
1449
|
|
1438
1450
|
@staticmethod
|
ccxt/bitvavo.py
CHANGED
@@ -1097,9 +1097,6 @@ class bitvavo(Exchange, ImplicitAPI):
|
|
1097
1097
|
request['timeInForce'] = timeInForce
|
1098
1098
|
if postOnly:
|
1099
1099
|
request['postOnly'] = True
|
1100
|
-
clientOrderId = self.safe_string(params, 'clientOrderId')
|
1101
|
-
if clientOrderId is None:
|
1102
|
-
request['clientOrderId'] = self.uuid22()
|
1103
1100
|
return self.extend(request, params)
|
1104
1101
|
|
1105
1102
|
def create_order(self, symbol: Str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
ccxt/cex.py
CHANGED
@@ -847,7 +847,7 @@ class cex(Exchange, ImplicitAPI):
|
|
847
847
|
|
848
848
|
https://trade.cex.io/docs/#rest-private-api-calls-orders
|
849
849
|
|
850
|
-
|
850
|
+
:param str status: order status to fetch for
|
851
851
|
:param str symbol: unified market symbol of the market orders were made in
|
852
852
|
:param int [since]: the earliest time in ms to fetch orders for
|
853
853
|
:param int [limit]: the maximum number of order structures to retrieve
|
ccxt/coinex.py
CHANGED
@@ -3252,7 +3252,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3252
3252
|
https://docs.coinex.com/api/v2/futures/order/http/list-finished-order
|
3253
3253
|
https://docs.coinex.com/api/v2/futures/order/http/list-finished-stop-order
|
3254
3254
|
|
3255
|
-
|
3255
|
+
:param str status: order status to fetch for
|
3256
3256
|
:param str symbol: unified market symbol of the market orders were made in
|
3257
3257
|
:param int [since]: the earliest time in ms to fetch orders for
|
3258
3258
|
:param int [limit]: the maximum number of order structures to retrieve
|
ccxt/deribit.py
CHANGED
@@ -2965,8 +2965,8 @@ class deribit(Exchange, ImplicitAPI):
|
|
2965
2965
|
https://docs.deribit.com/#public-get_funding_rate_history
|
2966
2966
|
|
2967
2967
|
:param str symbol: unified market symbol
|
2968
|
-
|
2969
|
-
|
2968
|
+
:param int [since]: the earliest time in ms to fetch funding rate history for
|
2969
|
+
:param int [limit]: the maximum number of entries to retrieve
|
2970
2970
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2971
2971
|
:param int [params.end_timestamp]: fetch funding rate ending at self timestamp
|
2972
2972
|
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|