ccxt 4.3.34__py2.py3-none-any.whl → 4.3.35__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.
Potentially problematic release.
This version of ccxt might be problematic. Click here for more details.
- ccxt/__init__.py +1 -1
- ccxt/alpaca.py +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/alpaca.py +1 -1
- ccxt/async_support/base/exchange.py +42 -42
- ccxt/async_support/binance.py +2 -2
- ccxt/async_support/bingx.py +2 -1
- ccxt/async_support/bitget.py +1 -1
- ccxt/async_support/bitmart.py +2 -7
- ccxt/async_support/btcmarkets.py +3 -1
- ccxt/async_support/bybit.py +1 -1
- ccxt/async_support/coinbase.py +60 -3
- ccxt/async_support/coinex.py +26 -19
- ccxt/async_support/gemini.py +1 -1
- ccxt/async_support/kraken.py +3 -1
- ccxt/base/exchange.py +85 -76
- ccxt/binance.py +2 -2
- ccxt/bingx.py +2 -1
- ccxt/bitget.py +1 -1
- ccxt/bitmart.py +2 -7
- ccxt/btcmarkets.py +3 -1
- ccxt/bybit.py +1 -1
- ccxt/coinbase.py +60 -3
- ccxt/coinex.py +26 -19
- ccxt/gemini.py +1 -1
- ccxt/kraken.py +3 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitget.py +24 -1
- ccxt/pro/bitmart.py +1 -1
- ccxt/pro/kraken.py +1 -1
- ccxt/pro/okx.py +1 -1
- ccxt/test/base/test_crypto.py +1 -1
- {ccxt-4.3.34.dist-info → ccxt-4.3.35.dist-info}/METADATA +4 -4
- {ccxt-4.3.34.dist-info → ccxt-4.3.35.dist-info}/RECORD +36 -36
- {ccxt-4.3.34.dist-info → ccxt-4.3.35.dist-info}/WHEEL +0 -0
- {ccxt-4.3.34.dist-info → ccxt-4.3.35.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/alpaca.py
CHANGED
@@ -772,7 +772,7 @@ class alpaca(Exchange, ImplicitAPI):
|
|
772
772
|
# "message": "order is not found."
|
773
773
|
# }
|
774
774
|
#
|
775
|
-
return self.
|
775
|
+
return self.parse_order(response)
|
776
776
|
|
777
777
|
def cancel_all_orders(self, symbol: Str = None, params={}):
|
778
778
|
"""
|
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/alpaca.py
CHANGED
@@ -772,7 +772,7 @@ class alpaca(Exchange, ImplicitAPI):
|
|
772
772
|
# "message": "order is not found."
|
773
773
|
# }
|
774
774
|
#
|
775
|
-
return self.
|
775
|
+
return self.parse_order(response)
|
776
776
|
|
777
777
|
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
778
778
|
"""
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# -----------------------------------------------------------------------------
|
4
4
|
|
5
|
-
__version__ = '4.3.
|
5
|
+
__version__ = '4.3.35'
|
6
6
|
|
7
7
|
# -----------------------------------------------------------------------------
|
8
8
|
|
@@ -570,7 +570,7 @@ class Exchange(BaseExchange):
|
|
570
570
|
|
571
571
|
async def watch_liquidations(self, symbol: str, since: Int = None, limit: Int = None, params={}):
|
572
572
|
if self.has['watchLiquidationsForSymbols']:
|
573
|
-
return self.
|
573
|
+
return self.watch_liquidations_for_symbols([symbol], since, limit, params)
|
574
574
|
raise NotSupported(self.id + ' watchLiquidations() is not supported yet')
|
575
575
|
|
576
576
|
async def watch_liquidations_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
|
@@ -578,7 +578,7 @@ class Exchange(BaseExchange):
|
|
578
578
|
|
579
579
|
async def watch_my_liquidations(self, symbol: str, since: Int = None, limit: Int = None, params={}):
|
580
580
|
if self.has['watchMyLiquidationsForSymbols']:
|
581
|
-
return self.
|
581
|
+
return self.watch_my_liquidations_for_symbols([symbol], since, limit, params)
|
582
582
|
raise NotSupported(self.id + ' watchMyLiquidations() is not supported yet')
|
583
583
|
|
584
584
|
async def watch_my_liquidations_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
|
@@ -610,7 +610,7 @@ class Exchange(BaseExchange):
|
|
610
610
|
|
611
611
|
async def fetch_margin_mode(self, symbol: str, params={}):
|
612
612
|
if self.has['fetchMarginModes']:
|
613
|
-
marginModes = await self.
|
613
|
+
marginModes = await self.fetch_margin_modes([symbol], params)
|
614
614
|
return self.safe_dict(marginModes, symbol)
|
615
615
|
else:
|
616
616
|
raise NotSupported(self.id + ' fetchMarginMode() is not supported yet')
|
@@ -619,7 +619,7 @@ class Exchange(BaseExchange):
|
|
619
619
|
raise NotSupported(self.id + ' fetchMarginModes() is not supported yet')
|
620
620
|
|
621
621
|
async def fetch_rest_order_book_safe(self, symbol, limit=None, params={}):
|
622
|
-
fetchSnapshotMaxRetries = self.
|
622
|
+
fetchSnapshotMaxRetries = self.handle_option('watchOrderBook', 'maxRetries', 3)
|
623
623
|
for i in range(0, fetchSnapshotMaxRetries):
|
624
624
|
try:
|
625
625
|
orderBook = await self.fetch_order_book(symbol, limit, params)
|
@@ -657,7 +657,7 @@ class Exchange(BaseExchange):
|
|
657
657
|
raise NotSupported(self.id + ' watchFundingRates() is not supported yet')
|
658
658
|
|
659
659
|
async def watch_funding_rates_for_symbols(self, symbols: List[str], params={}):
|
660
|
-
return await self.
|
660
|
+
return await self.watch_funding_rates(symbols, params)
|
661
661
|
|
662
662
|
async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}):
|
663
663
|
raise NotSupported(self.id + ' transfer() is not supported yet')
|
@@ -673,7 +673,7 @@ class Exchange(BaseExchange):
|
|
673
673
|
|
674
674
|
async def fetch_leverage(self, symbol: str, params={}):
|
675
675
|
if self.has['fetchLeverages']:
|
676
|
-
leverages = await self.
|
676
|
+
leverages = await self.fetch_leverages([symbol], params)
|
677
677
|
return self.safe_dict(leverages, symbol)
|
678
678
|
else:
|
679
679
|
raise NotSupported(self.id + ' fetchLeverage() is not supported yet')
|
@@ -852,12 +852,12 @@ class Exchange(BaseExchange):
|
|
852
852
|
return await self.edit_order(id, symbol, 'limit', side, amount, price, params)
|
853
853
|
|
854
854
|
async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
855
|
-
await self.
|
855
|
+
await self.cancel_order(id, symbol)
|
856
856
|
return await self.create_order(symbol, type, side, amount, price, params)
|
857
857
|
|
858
858
|
async def edit_order_ws(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
859
|
-
await self.
|
860
|
-
return await self.
|
859
|
+
await self.cancel_order_ws(id, symbol)
|
860
|
+
return await self.create_order_ws(symbol, type, side, amount, price, params)
|
861
861
|
|
862
862
|
async def fetch_permissions(self, params={}):
|
863
863
|
raise NotSupported(self.id + ' fetchPermissions() is not supported yet')
|
@@ -875,7 +875,7 @@ class Exchange(BaseExchange):
|
|
875
875
|
raise NotSupported(self.id + ' watchPositions() is not supported yet')
|
876
876
|
|
877
877
|
async def watch_position_for_symbols(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}):
|
878
|
-
return await self.
|
878
|
+
return await self.watch_positions(symbols, since, limit, params)
|
879
879
|
|
880
880
|
async def fetch_positions_for_symbol(self, symbol: str, params={}):
|
881
881
|
"""
|
@@ -955,14 +955,14 @@ class Exchange(BaseExchange):
|
|
955
955
|
async def fetch_deposit_withdraw_fee(self, code: str, params={}):
|
956
956
|
if not self.has['fetchDepositWithdrawFees']:
|
957
957
|
raise NotSupported(self.id + ' fetchDepositWithdrawFee() is not supported yet')
|
958
|
-
fees = await self.
|
958
|
+
fees = await self.fetch_deposit_withdraw_fees([code], params)
|
959
959
|
return self.safe_value(fees, code)
|
960
960
|
|
961
961
|
async def fetch_cross_borrow_rate(self, code: str, params={}):
|
962
962
|
await self.load_markets()
|
963
963
|
if not self.has['fetchBorrowRates']:
|
964
964
|
raise NotSupported(self.id + ' fetchCrossBorrowRate() is not supported yet')
|
965
|
-
borrowRates = await self.
|
965
|
+
borrowRates = await self.fetch_cross_borrow_rates(params)
|
966
966
|
rate = self.safe_value(borrowRates, code)
|
967
967
|
if rate is None:
|
968
968
|
raise ExchangeError(self.id + ' fetchCrossBorrowRate() could not find the borrow rate for currency code ' + code)
|
@@ -997,7 +997,7 @@ class Exchange(BaseExchange):
|
|
997
997
|
await self.load_markets()
|
998
998
|
market = self.market(symbol)
|
999
999
|
symbol = market['symbol']
|
1000
|
-
tickers = await self.
|
1000
|
+
tickers = await self.fetch_ticker_ws(symbol, params)
|
1001
1001
|
ticker = self.safe_dict(tickers, symbol)
|
1002
1002
|
if ticker is None:
|
1003
1003
|
raise NullResponse(self.id + ' fetchTickers() could not find a ticker for ' + symbol)
|
@@ -1083,7 +1083,7 @@ class Exchange(BaseExchange):
|
|
1083
1083
|
if trailingTriggerPrice is not None:
|
1084
1084
|
params['trailingTriggerPrice'] = trailingTriggerPrice
|
1085
1085
|
if self.has['createTrailingAmountOrderWs']:
|
1086
|
-
return await self.
|
1086
|
+
return await self.create_order_ws(symbol, type, side, amount, price, params)
|
1087
1087
|
raise NotSupported(self.id + ' createTrailingAmountOrderWs() is not supported yet')
|
1088
1088
|
|
1089
1089
|
async def create_trailing_percent_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingPercent=None, trailingTriggerPrice=None, params={}):
|
@@ -1127,7 +1127,7 @@ class Exchange(BaseExchange):
|
|
1127
1127
|
if trailingTriggerPrice is not None:
|
1128
1128
|
params['trailingTriggerPrice'] = trailingTriggerPrice
|
1129
1129
|
if self.has['createTrailingPercentOrderWs']:
|
1130
|
-
return await self.
|
1130
|
+
return await self.create_order_ws(symbol, type, side, amount, price, params)
|
1131
1131
|
raise NotSupported(self.id + ' createTrailingPercentOrderWs() is not supported yet')
|
1132
1132
|
|
1133
1133
|
async def create_market_order_with_cost(self, symbol: str, side: OrderSide, cost: float, params={}):
|
@@ -1177,7 +1177,7 @@ class Exchange(BaseExchange):
|
|
1177
1177
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1178
1178
|
"""
|
1179
1179
|
if self.has['createMarketOrderWithCostWs'] or (self.has['createMarketBuyOrderWithCostWs'] and self.has['createMarketSellOrderWithCostWs']):
|
1180
|
-
return await self.
|
1180
|
+
return await self.create_order_ws(symbol, 'market', side, cost, 1, params)
|
1181
1181
|
raise NotSupported(self.id + ' createMarketOrderWithCostWs() is not supported yet')
|
1182
1182
|
|
1183
1183
|
async def create_trigger_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, triggerPrice: Num = None, params={}):
|
@@ -1215,7 +1215,7 @@ class Exchange(BaseExchange):
|
|
1215
1215
|
raise ArgumentsRequired(self.id + ' createTriggerOrderWs() requires a triggerPrice argument')
|
1216
1216
|
params['triggerPrice'] = triggerPrice
|
1217
1217
|
if self.has['createTriggerOrderWs']:
|
1218
|
-
return await self.
|
1218
|
+
return await self.create_order_ws(symbol, type, side, amount, price, params)
|
1219
1219
|
raise NotSupported(self.id + ' createTriggerOrderWs() is not supported yet')
|
1220
1220
|
|
1221
1221
|
async def create_stop_loss_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, stopLossPrice: Num = None, params={}):
|
@@ -1253,7 +1253,7 @@ class Exchange(BaseExchange):
|
|
1253
1253
|
raise ArgumentsRequired(self.id + ' createStopLossOrderWs() requires a stopLossPrice argument')
|
1254
1254
|
params['stopLossPrice'] = stopLossPrice
|
1255
1255
|
if self.has['createStopLossOrderWs']:
|
1256
|
-
return await self.
|
1256
|
+
return await self.create_order_ws(symbol, type, side, amount, price, params)
|
1257
1257
|
raise NotSupported(self.id + ' createStopLossOrderWs() is not supported yet')
|
1258
1258
|
|
1259
1259
|
async def create_take_profit_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, takeProfitPrice: Num = None, params={}):
|
@@ -1291,7 +1291,7 @@ class Exchange(BaseExchange):
|
|
1291
1291
|
raise ArgumentsRequired(self.id + ' createTakeProfitOrderWs() requires a takeProfitPrice argument')
|
1292
1292
|
params['takeProfitPrice'] = takeProfitPrice
|
1293
1293
|
if self.has['createTakeProfitOrderWs']:
|
1294
|
-
return await self.
|
1294
|
+
return await self.create_order_ws(symbol, type, side, amount, price, params)
|
1295
1295
|
raise NotSupported(self.id + ' createTakeProfitOrderWs() is not supported yet')
|
1296
1296
|
|
1297
1297
|
async def create_order_with_take_profit_and_stop_loss(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, takeProfit: Num = None, stopLoss: Num = None, params={}):
|
@@ -1343,7 +1343,7 @@ class Exchange(BaseExchange):
|
|
1343
1343
|
"""
|
1344
1344
|
params = self.set_take_profit_and_stop_loss_params(symbol, type, side, amount, price, takeProfit, stopLoss, params)
|
1345
1345
|
if self.has['createOrderWithTakeProfitAndStopLossWs']:
|
1346
|
-
return await self.
|
1346
|
+
return await self.create_order_ws(symbol, type, side, amount, price, params)
|
1347
1347
|
raise NotSupported(self.id + ' createOrderWithTakeProfitAndStopLossWs() is not supported yet')
|
1348
1348
|
|
1349
1349
|
async def create_orders(self, orders: List[OrderRequest], params={}):
|
@@ -1374,7 +1374,7 @@ class Exchange(BaseExchange):
|
|
1374
1374
|
raise NotSupported(self.id + ' cancelAllOrdersWs() is not supported yet')
|
1375
1375
|
|
1376
1376
|
async def cancel_unified_order(self, order, params={}):
|
1377
|
-
return self.
|
1377
|
+
return self.cancel_order(self.safe_string(order, 'id'), self.safe_string(order, 'symbol'), params)
|
1378
1378
|
|
1379
1379
|
async def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1380
1380
|
if self.has['fetchOpenOrders'] and self.has['fetchClosedOrders']:
|
@@ -1398,7 +1398,7 @@ class Exchange(BaseExchange):
|
|
1398
1398
|
|
1399
1399
|
async def fetch_open_orders_ws(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1400
1400
|
if self.has['fetchOrdersWs']:
|
1401
|
-
orders = await self.
|
1401
|
+
orders = await self.fetch_orders_ws(symbol, since, limit, params)
|
1402
1402
|
return self.filter_by(orders, 'status', 'open')
|
1403
1403
|
raise NotSupported(self.id + ' fetchOpenOrdersWs() is not supported yet')
|
1404
1404
|
|
@@ -1413,7 +1413,7 @@ class Exchange(BaseExchange):
|
|
1413
1413
|
|
1414
1414
|
async def fetch_closed_orders_ws(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1415
1415
|
if self.has['fetchOrdersWs']:
|
1416
|
-
orders = await self.
|
1416
|
+
orders = await self.fetch_orders_ws(symbol, since, limit, params)
|
1417
1417
|
return self.filter_by(orders, 'status', 'closed')
|
1418
1418
|
raise NotSupported(self.id + ' fetchClosedOrdersWs() is not supported yet')
|
1419
1419
|
|
@@ -1484,7 +1484,7 @@ class Exchange(BaseExchange):
|
|
1484
1484
|
|
1485
1485
|
async def fetch_deposit_address(self, code: str, params={}):
|
1486
1486
|
if self.has['fetchDepositAddresses']:
|
1487
|
-
depositAddresses = await self.
|
1487
|
+
depositAddresses = await self.fetch_deposit_addresses([code], params)
|
1488
1488
|
depositAddress = self.safe_value(depositAddresses, code)
|
1489
1489
|
if depositAddress is None:
|
1490
1490
|
raise InvalidAddress(self.id + ' fetchDepositAddress() could not find a deposit address for ' + code + ', make sure you have created a corresponding deposit address in your wallet on the exchange website')
|
@@ -1493,7 +1493,7 @@ class Exchange(BaseExchange):
|
|
1493
1493
|
elif self.has['fetchDepositAddressesByNetwork']:
|
1494
1494
|
network = self.safe_string(params, 'network')
|
1495
1495
|
params = self.omit(params, 'network')
|
1496
|
-
addressStructures = await self.
|
1496
|
+
addressStructures = await self.fetch_deposit_addresses_by_network(code, params)
|
1497
1497
|
if network is not None:
|
1498
1498
|
return self.safe_dict(addressStructures, network)
|
1499
1499
|
else:
|
@@ -1507,37 +1507,37 @@ class Exchange(BaseExchange):
|
|
1507
1507
|
return await self.create_order(symbol, 'limit', side, amount, price, params)
|
1508
1508
|
|
1509
1509
|
async def create_limit_order_ws(self, symbol: str, side: OrderSide, amount: float, price: float, params={}):
|
1510
|
-
return await self.
|
1510
|
+
return await self.create_order_ws(symbol, 'limit', side, amount, price, params)
|
1511
1511
|
|
1512
1512
|
async def create_market_order(self, symbol: str, side: OrderSide, amount: float, price: Num = None, params={}):
|
1513
1513
|
return await self.create_order(symbol, 'market', side, amount, price, params)
|
1514
1514
|
|
1515
1515
|
async def create_market_order_ws(self, symbol: str, side: OrderSide, amount: float, price: Num = None, params={}):
|
1516
|
-
return await self.
|
1516
|
+
return await self.create_order_ws(symbol, 'market', side, amount, price, params)
|
1517
1517
|
|
1518
1518
|
async def create_limit_buy_order(self, symbol: str, amount: float, price: float, params={}):
|
1519
1519
|
return await self.create_order(symbol, 'limit', 'buy', amount, price, params)
|
1520
1520
|
|
1521
1521
|
async def create_limit_buy_order_ws(self, symbol: str, amount: float, price: float, params={}):
|
1522
|
-
return await self.
|
1522
|
+
return await self.create_order_ws(symbol, 'limit', 'buy', amount, price, params)
|
1523
1523
|
|
1524
1524
|
async def create_limit_sell_order(self, symbol: str, amount: float, price: float, params={}):
|
1525
1525
|
return await self.create_order(symbol, 'limit', 'sell', amount, price, params)
|
1526
1526
|
|
1527
1527
|
async def create_limit_sell_order_ws(self, symbol: str, amount: float, price: float, params={}):
|
1528
|
-
return await self.
|
1528
|
+
return await self.create_order_ws(symbol, 'limit', 'sell', amount, price, params)
|
1529
1529
|
|
1530
1530
|
async def create_market_buy_order(self, symbol: str, amount: float, params={}):
|
1531
1531
|
return await self.create_order(symbol, 'market', 'buy', amount, None, params)
|
1532
1532
|
|
1533
1533
|
async def create_market_buy_order_ws(self, symbol: str, amount: float, params={}):
|
1534
|
-
return await self.
|
1534
|
+
return await self.create_order_ws(symbol, 'market', 'buy', amount, None, params)
|
1535
1535
|
|
1536
1536
|
async def create_market_sell_order(self, symbol: str, amount: float, params={}):
|
1537
1537
|
return await self.create_order(symbol, 'market', 'sell', amount, None, params)
|
1538
1538
|
|
1539
1539
|
async def create_market_sell_order_ws(self, symbol: str, amount: float, params={}):
|
1540
|
-
return await self.
|
1540
|
+
return await self.create_order_ws(symbol, 'market', 'sell', amount, None, params)
|
1541
1541
|
|
1542
1542
|
async def load_time_difference(self, params={}):
|
1543
1543
|
serverTime = await self.fetch_time(params)
|
@@ -1565,7 +1565,7 @@ class Exchange(BaseExchange):
|
|
1565
1565
|
if not self.has['createPostOnlyOrderWs']:
|
1566
1566
|
raise NotSupported(self.id + 'createPostOnlyOrderWs() is not supported yet')
|
1567
1567
|
query = self.extend(params, {'postOnly': True})
|
1568
|
-
return await self.
|
1568
|
+
return await self.create_order_ws(symbol, type, side, amount, price, query)
|
1569
1569
|
|
1570
1570
|
async def create_reduce_only_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
1571
1571
|
if not self.has['createReduceOnlyOrder']:
|
@@ -1577,7 +1577,7 @@ class Exchange(BaseExchange):
|
|
1577
1577
|
if not self.has['createReduceOnlyOrderWs']:
|
1578
1578
|
raise NotSupported(self.id + 'createReduceOnlyOrderWs() is not supported yet')
|
1579
1579
|
query = self.extend(params, {'reduceOnly': True})
|
1580
|
-
return await self.
|
1580
|
+
return await self.create_order_ws(symbol, type, side, amount, price, query)
|
1581
1581
|
|
1582
1582
|
async def create_stop_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, stopPrice: Num = None, params={}):
|
1583
1583
|
if not self.has['createStopOrder']:
|
@@ -1593,7 +1593,7 @@ class Exchange(BaseExchange):
|
|
1593
1593
|
if stopPrice is None:
|
1594
1594
|
raise ArgumentsRequired(self.id + ' createStopOrderWs() requires a stopPrice argument')
|
1595
1595
|
query = self.extend(params, {'stopPrice': stopPrice})
|
1596
|
-
return await self.
|
1596
|
+
return await self.create_order_ws(symbol, type, side, amount, price, query)
|
1597
1597
|
|
1598
1598
|
async def create_stop_limit_order(self, symbol: str, side: OrderSide, amount: float, price: float, stopPrice: float, params={}):
|
1599
1599
|
if not self.has['createStopLimitOrder']:
|
@@ -1605,7 +1605,7 @@ class Exchange(BaseExchange):
|
|
1605
1605
|
if not self.has['createStopLimitOrderWs']:
|
1606
1606
|
raise NotSupported(self.id + ' createStopLimitOrderWs() is not supported yet')
|
1607
1607
|
query = self.extend(params, {'stopPrice': stopPrice})
|
1608
|
-
return await self.
|
1608
|
+
return await self.create_order_ws(symbol, 'limit', side, amount, price, query)
|
1609
1609
|
|
1610
1610
|
async def create_stop_market_order(self, symbol: str, side: OrderSide, amount: float, stopPrice: float, params={}):
|
1611
1611
|
if not self.has['createStopMarketOrder']:
|
@@ -1617,7 +1617,7 @@ class Exchange(BaseExchange):
|
|
1617
1617
|
if not self.has['createStopMarketOrderWs']:
|
1618
1618
|
raise NotSupported(self.id + ' createStopMarketOrderWs() is not supported yet')
|
1619
1619
|
query = self.extend(params, {'stopPrice': stopPrice})
|
1620
|
-
return await self.
|
1620
|
+
return await self.create_order_ws(symbol, 'market', side, amount, None, query)
|
1621
1621
|
|
1622
1622
|
async def fetch_last_prices(self, symbols: Strings = None, params={}):
|
1623
1623
|
raise NotSupported(self.id + ' fetchLastPrices() is not supported yet')
|
@@ -1644,7 +1644,7 @@ class Exchange(BaseExchange):
|
|
1644
1644
|
symbol = market['symbol']
|
1645
1645
|
if not market['contract']:
|
1646
1646
|
raise BadSymbol(self.id + ' fetchFundingRate() supports contract markets only')
|
1647
|
-
rates = await self.
|
1647
|
+
rates = await self.fetch_funding_rates([symbol], params)
|
1648
1648
|
rate = self.safe_value(rates, symbol)
|
1649
1649
|
if rate is None:
|
1650
1650
|
raise NullResponse(self.id + ' fetchFundingRate() returned no data for ' + symbol)
|
@@ -1718,7 +1718,7 @@ class Exchange(BaseExchange):
|
|
1718
1718
|
:returns dict: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
1719
1719
|
"""
|
1720
1720
|
if self.has['fetchDepositsWithdrawals']:
|
1721
|
-
return await self.
|
1721
|
+
return await self.fetch_deposits_withdrawals(code, since, limit, params)
|
1722
1722
|
else:
|
1723
1723
|
raise NotSupported(self.id + ' fetchTransactions() is not supported yet')
|
1724
1724
|
|
@@ -1852,7 +1852,7 @@ class Exchange(BaseExchange):
|
|
1852
1852
|
try:
|
1853
1853
|
if cursorValue is not None:
|
1854
1854
|
if cursorIncrement is not None:
|
1855
|
-
cursorValue = self.
|
1855
|
+
cursorValue = self.parse_to_int(cursorValue) + cursorIncrement
|
1856
1856
|
params[cursorSent] = cursorValue
|
1857
1857
|
response = None
|
1858
1858
|
if method == 'fetchAccounts':
|
@@ -1883,7 +1883,7 @@ class Exchange(BaseExchange):
|
|
1883
1883
|
if errors > maxRetries:
|
1884
1884
|
raise e
|
1885
1885
|
i += 1
|
1886
|
-
sorted = self.
|
1886
|
+
sorted = self.sort_cursor_paginated_result(result)
|
1887
1887
|
key = 0 if (method == 'fetchOHLCV') else 'timestamp'
|
1888
1888
|
return self.filter_by_since_limit(sorted, since, limit, key)
|
1889
1889
|
|
@@ -1914,7 +1914,7 @@ class Exchange(BaseExchange):
|
|
1914
1914
|
if errors > maxRetries:
|
1915
1915
|
raise e
|
1916
1916
|
i += 1
|
1917
|
-
sorted = self.
|
1917
|
+
sorted = self.sort_cursor_paginated_result(result)
|
1918
1918
|
key = 0 if (method == 'fetchOHLCV') else 'timestamp'
|
1919
1919
|
return self.filter_by_since_limit(sorted, since, limit, key)
|
1920
1920
|
|
ccxt/async_support/binance.py
CHANGED
@@ -4751,7 +4751,7 @@ class binance(Exchange, ImplicitAPI):
|
|
4751
4751
|
cancelId = self.safe_string_2(params, 'cancelNewClientOrderId', 'cancelOrigClientOrderId')
|
4752
4752
|
if cancelId is None:
|
4753
4753
|
request['cancelOrderId'] = id # user can provide either cancelOrderId, cancelOrigClientOrderId or cancelOrigClientOrderId
|
4754
|
-
# remove timeInForce from params because PO is only used by self.
|
4754
|
+
# remove timeInForce from params because PO is only used by self.is_post_only and it's not a valid value for Binance
|
4755
4755
|
if self.safe_string(params, 'timeInForce') == 'PO':
|
4756
4756
|
params = self.omit(params, ['timeInForce'])
|
4757
4757
|
params = self.omit(params, ['quoteOrderQty', 'cost', 'stopPrice', 'newClientOrderId', 'clientOrderId', 'postOnly'])
|
@@ -5811,7 +5811,7 @@ class binance(Exchange, ImplicitAPI):
|
|
5811
5811
|
request['timeInForce'] = self.options['defaultTimeInForce'] # 'GTC' = Good To Cancel(default), 'IOC' = Immediate Or Cancel
|
5812
5812
|
if not isPortfolioMargin and market['contract'] and postOnly:
|
5813
5813
|
request['timeInForce'] = 'GTX'
|
5814
|
-
# remove timeInForce from params because PO is only used by self.
|
5814
|
+
# remove timeInForce from params because PO is only used by self.is_post_only and it's not a valid value for Binance
|
5815
5815
|
if self.safe_string(params, 'timeInForce') == 'PO':
|
5816
5816
|
params = self.omit(params, 'timeInForce')
|
5817
5817
|
requestParams = self.omit(params, ['type', 'newClientOrderId', 'clientOrderId', 'postOnly', 'stopLossPrice', 'takeProfitPrice', 'stopPrice', 'triggerPrice', 'trailingTriggerPrice', 'trailingPercent', 'quoteOrderQty', 'cost', 'test'])
|
ccxt/async_support/bingx.py
CHANGED
@@ -1986,7 +1986,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
1986
1986
|
#
|
1987
1987
|
if isinstance(response, str):
|
1988
1988
|
# broken api engine : order-ids are too long numbers(i.e. 1742930526912864656)
|
1989
|
-
# and json.loadscan not handle them in JS, so we have to use .
|
1989
|
+
# and json.loadscan not handle them in JS, so we have to use .parseJson
|
1990
|
+
# however, when order has an attached SL/TP, their value types need extra parsing
|
1990
1991
|
response = self.fix_stringified_json_members(response)
|
1991
1992
|
response = self.parse_json(response)
|
1992
1993
|
data = self.safe_value(response, 'data', {})
|
ccxt/async_support/bitget.py
CHANGED
@@ -2724,7 +2724,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
2724
2724
|
request: dict = {}
|
2725
2725
|
type = None
|
2726
2726
|
type, params = self.handle_market_type_and_params('fetchTickers', market, params)
|
2727
|
-
# Calls like `.
|
2727
|
+
# Calls like `.fetchTickers(None, {subType:'inverse'})` should be supported for self exchange, so
|
2728
2728
|
# as "options.defaultSubType" is also set in exchange options, we should consider `params.subType`
|
2729
2729
|
# with higher priority and only default to spot, if `subType` is not set in params
|
2730
2730
|
passedSubType = self.safe_string(params, 'subType')
|
ccxt/async_support/bitmart.py
CHANGED
@@ -1180,14 +1180,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1180
1180
|
market = self.safe_market(marketId, market)
|
1181
1181
|
symbol = market['symbol']
|
1182
1182
|
last = self.safe_string_2(ticker, 'close_24h', 'last_price')
|
1183
|
-
percentage = self.safe_string(ticker, 'price_change_percent_24h')
|
1183
|
+
percentage = Precise.string_abs(self.safe_string(ticker, 'price_change_percent_24h'))
|
1184
1184
|
if percentage is None:
|
1185
|
-
|
1186
|
-
if (percentageRaw is not None) and (percentageRaw != '0'): # a few tickers show strictly '0' in fluctuation field
|
1187
|
-
direction = percentageRaw[0]
|
1188
|
-
percentage = direction + Precise.string_mul(percentageRaw.replace(direction, ''), '100')
|
1189
|
-
elif percentageRaw == '0':
|
1190
|
-
percentage = '0'
|
1185
|
+
percentage = Precise.string_abs(Precise.string_mul(self.safe_string(ticker, 'fluctuation'), '100'))
|
1191
1186
|
baseVolume = self.safe_string(ticker, 'base_volume_24h')
|
1192
1187
|
quoteVolume = self.safe_string(ticker, 'quote_volume_24h')
|
1193
1188
|
if quoteVolume is None:
|
ccxt/async_support/btcmarkets.py
CHANGED
@@ -876,7 +876,9 @@ class btcmarkets(Exchange, ImplicitAPI):
|
|
876
876
|
"""
|
877
877
|
calculates the presumptive fee that would be charged for an order
|
878
878
|
:param str symbol: unified market symbol
|
879
|
-
:param str type: not used by btcmarkets.
|
879
|
+
:param str type: not used by btcmarkets.calculateFee
|
880
|
+
:param str side: not used by btcmarkets.calculateFee
|
881
|
+
:param float amount: how much you want to trade, in units of the base currency on most exchanges, or number of contracts
|
880
882
|
:param float price: the price for the order to be filled at, in units of the quote currency
|
881
883
|
:param str takerOrMaker: 'taker' or 'maker'
|
882
884
|
:param dict params:
|
ccxt/async_support/bybit.py
CHANGED
@@ -2080,7 +2080,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
2080
2080
|
}
|
2081
2081
|
type = None
|
2082
2082
|
type, params = self.handle_market_type_and_params('fetchTickers', market, params)
|
2083
|
-
# Calls like `.
|
2083
|
+
# Calls like `.fetchTickers(None, {subType:'inverse'})` should be supported for self exchange, so
|
2084
2084
|
# as "options.defaultSubType" is also set in exchange options, we should consider `params.subType`
|
2085
2085
|
# with higher priority and only default to spot, if `subType` is not set in params
|
2086
2086
|
passedSubType = self.safe_string(params, 'subType')
|
ccxt/async_support/coinbase.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.coinbase import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Account, Balances, Conversion, Currencies, Currency, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
10
|
+
from ccxt.base.types import Account, Balances, Conversion, Currencies, Currency, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -122,8 +122,8 @@ class coinbase(Exchange, ImplicitAPI):
|
|
122
122
|
'fetchTickers': True,
|
123
123
|
'fetchTime': True,
|
124
124
|
'fetchTrades': True,
|
125
|
-
'fetchTradingFee':
|
126
|
-
'fetchTradingFees':
|
125
|
+
'fetchTradingFee': 'emulated',
|
126
|
+
'fetchTradingFees': True,
|
127
127
|
'fetchWithdrawals': True,
|
128
128
|
'reduceMargin': False,
|
129
129
|
'setLeverage': False,
|
@@ -4273,6 +4273,63 @@ class coinbase(Exchange, ImplicitAPI):
|
|
4273
4273
|
'takeProfitPrice': None,
|
4274
4274
|
})
|
4275
4275
|
|
4276
|
+
async def fetch_trading_fees(self, params={}) -> TradingFees:
|
4277
|
+
"""
|
4278
|
+
:see: https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_gettransactionsummary/
|
4279
|
+
fetch the trading fees for multiple markets
|
4280
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4281
|
+
:param str [params.type]: 'spot' or 'swap'
|
4282
|
+
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
|
4283
|
+
"""
|
4284
|
+
await self.load_markets()
|
4285
|
+
type = None
|
4286
|
+
type, params = self.handle_market_type_and_params('fetchTradingFees', None, params)
|
4287
|
+
isSpot = (type == 'spot')
|
4288
|
+
productType = 'SPOT' if isSpot else 'FUTURE'
|
4289
|
+
request: dict = {
|
4290
|
+
'product_type': productType,
|
4291
|
+
}
|
4292
|
+
response = await self.v3PrivateGetBrokerageTransactionSummary(self.extend(request, params))
|
4293
|
+
#
|
4294
|
+
# {
|
4295
|
+
# total_volume: '0',
|
4296
|
+
# total_fees: '0',
|
4297
|
+
# fee_tier: {
|
4298
|
+
# pricing_tier: 'Advanced 1',
|
4299
|
+
# usd_from: '0',
|
4300
|
+
# usd_to: '1000',
|
4301
|
+
# taker_fee_rate: '0.008',
|
4302
|
+
# maker_fee_rate: '0.006',
|
4303
|
+
# aop_from: '',
|
4304
|
+
# aop_to: ''
|
4305
|
+
# },
|
4306
|
+
# margin_rate: null,
|
4307
|
+
# goods_and_services_tax: null,
|
4308
|
+
# advanced_trade_only_volume: '0',
|
4309
|
+
# advanced_trade_only_fees: '0',
|
4310
|
+
# coinbase_pro_volume: '0',
|
4311
|
+
# coinbase_pro_fees: '0',
|
4312
|
+
# total_balance: '',
|
4313
|
+
# has_promo_fee: False
|
4314
|
+
# }
|
4315
|
+
#
|
4316
|
+
data = self.safe_dict(response, 'fee_tier', {})
|
4317
|
+
taker_fee = self.safe_number(data, 'taker_fee_rate')
|
4318
|
+
marker_fee = self.safe_number(data, 'maker_fee_rate')
|
4319
|
+
result: dict = {}
|
4320
|
+
for i in range(0, len(self.symbols)):
|
4321
|
+
symbol = self.symbols[i]
|
4322
|
+
market = self.market(symbol)
|
4323
|
+
if (isSpot and market['spot']) or (not isSpot and not market['spot']):
|
4324
|
+
result[symbol] = {
|
4325
|
+
'info': response,
|
4326
|
+
'symbol': symbol,
|
4327
|
+
'maker': taker_fee,
|
4328
|
+
'taker': marker_fee,
|
4329
|
+
'percentage': True,
|
4330
|
+
}
|
4331
|
+
return result
|
4332
|
+
|
4276
4333
|
def create_auth_token(self, seconds: Int, method: Str = None, url: Str = None):
|
4277
4334
|
# it may not work for v2
|
4278
4335
|
uri = None
|
ccxt/async_support/coinex.py
CHANGED
@@ -4375,7 +4375,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4375
4375
|
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
4376
4376
|
"""
|
4377
4377
|
make a withdrawal
|
4378
|
-
:see: https://
|
4378
|
+
:see: https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/withdrawal
|
4379
4379
|
:param str code: unified currency code
|
4380
4380
|
:param float amount: the amount to withdraw
|
4381
4381
|
:param str address: the address to withdraw to
|
@@ -4388,35 +4388,42 @@ class coinex(Exchange, ImplicitAPI):
|
|
4388
4388
|
self.check_address(address)
|
4389
4389
|
await self.load_markets()
|
4390
4390
|
currency = self.currency(code)
|
4391
|
-
networkCode = self.
|
4391
|
+
networkCode = self.safe_string_upper_2(params, 'network', 'chain')
|
4392
4392
|
params = self.omit(params, 'network')
|
4393
4393
|
if tag:
|
4394
4394
|
address = address + ':' + tag
|
4395
4395
|
request: dict = {
|
4396
|
-
'
|
4397
|
-
'
|
4398
|
-
'
|
4399
|
-
'transfer_method': 'onchain', # onchain, local
|
4396
|
+
'ccy': currency['id'],
|
4397
|
+
'to_address': address, # must be authorized, inter-user transfer by a registered mobile phone number or an email address is supported
|
4398
|
+
'amount': self.number_to_string(amount), # the actual amount without fees, https://www.coinex.com/fees
|
4400
4399
|
}
|
4401
4400
|
if networkCode is not None:
|
4402
|
-
request['
|
4403
|
-
response = await self.
|
4401
|
+
request['chain'] = self.network_code_to_id(networkCode) # required for on-chain, not required for inter-user transfer
|
4402
|
+
response = await self.v2PrivatePostAssetsWithdraw(self.extend(request, params))
|
4404
4403
|
#
|
4405
4404
|
# {
|
4406
4405
|
# "code": 0,
|
4407
4406
|
# "data": {
|
4408
|
-
# "
|
4409
|
-
# "
|
4410
|
-
# "
|
4411
|
-
# "
|
4412
|
-
# "
|
4407
|
+
# "withdraw_id": 31193755,
|
4408
|
+
# "created_at": 1716874165038,
|
4409
|
+
# "withdraw_method": "ON_CHAIN",
|
4410
|
+
# "ccy": "USDT",
|
4411
|
+
# "amount": "17.3",
|
4412
|
+
# "actual_amount": "15",
|
4413
|
+
# "chain": "TRC20",
|
4414
|
+
# "tx_fee": "2.3",
|
4415
|
+
# "fee_asset": "USDT",
|
4416
|
+
# "fee_amount": "2.3",
|
4417
|
+
# "to_address": "TY5vq3MT6b5cQVAHWHtpGyPg1ERcQgi3UN",
|
4418
|
+
# "memo": "",
|
4419
|
+
# "tx_id": "",
|
4413
4420
|
# "confirmations": 0,
|
4414
|
-
# "
|
4415
|
-
# "
|
4416
|
-
# "
|
4417
|
-
# "
|
4421
|
+
# "explorer_address_url": "https://tronscan.org/#/address/TY5vq3MT6b5cQVAHWHtpGyPg1ERcQgi3UN",
|
4422
|
+
# "explorer_tx_url": "https://tronscan.org/#/transaction/",
|
4423
|
+
# "remark": "",
|
4424
|
+
# "status": "audit_required"
|
4418
4425
|
# },
|
4419
|
-
# "message": "
|
4426
|
+
# "message": "OK"
|
4420
4427
|
# }
|
4421
4428
|
#
|
4422
4429
|
transaction = self.safe_dict(response, 'data', {})
|
@@ -4520,7 +4527,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4520
4527
|
# "remark": ""
|
4521
4528
|
# }
|
4522
4529
|
#
|
4523
|
-
# fetchWithdrawals
|
4530
|
+
# fetchWithdrawals and withdraw
|
4524
4531
|
#
|
4525
4532
|
# {
|
4526
4533
|
# "withdraw_id": 259364,
|