ccxt 4.4.95__py2.py3-none-any.whl → 4.4.97__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 +3 -1
- ccxt/abstract/binance.py +3 -0
- ccxt/abstract/binancecoinm.py +3 -0
- ccxt/abstract/binanceus.py +3 -0
- ccxt/abstract/binanceusdm.py +3 -0
- ccxt/abstract/foxbit.py +26 -0
- ccxt/abstract/hyperliquid.py +1 -1
- ccxt/abstract/phemex.py +1 -0
- ccxt/apex.py +3 -3
- ccxt/ascendex.py +2 -2
- ccxt/async_support/__init__.py +3 -1
- ccxt/async_support/apex.py +3 -3
- ccxt/async_support/ascendex.py +2 -2
- ccxt/async_support/base/exchange.py +10 -5
- ccxt/async_support/base/ws/future.py +5 -3
- ccxt/async_support/binance.py +90 -34
- ccxt/async_support/binancecoinm.py +5 -1
- ccxt/async_support/binanceus.py +3 -1
- ccxt/async_support/binanceusdm.py +3 -1
- ccxt/async_support/bingx.py +1 -1
- ccxt/async_support/bitget.py +30 -143
- ccxt/async_support/bitmart.py +2 -2
- ccxt/async_support/bitrue.py +13 -8
- ccxt/async_support/bybit.py +14 -5
- ccxt/async_support/coinbaseexchange.py +4 -2
- ccxt/async_support/coinbaseinternational.py +2 -2
- ccxt/async_support/coinspot.py +36 -1
- ccxt/async_support/cryptocom.py +78 -3
- ccxt/async_support/cryptomus.py +41 -1
- ccxt/async_support/defx.py +1 -1
- ccxt/async_support/derive.py +1 -1
- ccxt/async_support/ellipx.py +40 -0
- ccxt/async_support/exmo.py +1 -1
- ccxt/async_support/foxbit.py +1935 -0
- ccxt/async_support/gate.py +1 -2
- ccxt/async_support/hashkey.py +39 -0
- ccxt/async_support/hyperliquid.py +42 -27
- ccxt/async_support/independentreserve.py +35 -0
- ccxt/async_support/indodax.py +34 -0
- ccxt/async_support/kucoin.py +3 -2
- ccxt/async_support/kucoinfutures.py +3 -2
- ccxt/async_support/latoken.py +42 -0
- ccxt/async_support/luno.py +36 -0
- ccxt/async_support/mercado.py +34 -0
- ccxt/async_support/mexc.py +31 -32
- ccxt/async_support/modetrade.py +3 -3
- ccxt/async_support/okcoin.py +1 -1
- ccxt/async_support/okx.py +10 -3
- ccxt/async_support/onetrading.py +1 -1
- ccxt/async_support/oxfun.py +2 -1
- ccxt/async_support/paradex.py +2 -2
- ccxt/async_support/phemex.py +36 -31
- ccxt/async_support/vertex.py +3 -2
- ccxt/async_support/woo.py +6 -2
- ccxt/async_support/woofipro.py +2 -2
- ccxt/base/decimal_to_precision.py +16 -10
- ccxt/base/errors.py +6 -0
- ccxt/base/exchange.py +60 -17
- ccxt/binance.py +90 -34
- ccxt/binancecoinm.py +5 -1
- ccxt/binanceus.py +3 -1
- ccxt/binanceusdm.py +3 -1
- ccxt/bingx.py +1 -1
- ccxt/bitget.py +30 -143
- ccxt/bitmart.py +2 -2
- ccxt/bitrue.py +13 -8
- ccxt/bybit.py +14 -5
- ccxt/coinbaseexchange.py +4 -2
- ccxt/coinbaseinternational.py +2 -2
- ccxt/coinspot.py +36 -1
- ccxt/cryptocom.py +78 -3
- ccxt/cryptomus.py +41 -1
- ccxt/defx.py +1 -1
- ccxt/derive.py +1 -1
- ccxt/ellipx.py +40 -0
- ccxt/exmo.py +1 -1
- ccxt/foxbit.py +1935 -0
- ccxt/gate.py +1 -2
- ccxt/hashkey.py +39 -0
- ccxt/hyperliquid.py +42 -27
- ccxt/independentreserve.py +35 -0
- ccxt/indodax.py +34 -0
- ccxt/kucoin.py +3 -2
- ccxt/kucoinfutures.py +3 -2
- ccxt/latoken.py +42 -0
- ccxt/luno.py +36 -0
- ccxt/mercado.py +34 -0
- ccxt/mexc.py +31 -32
- ccxt/modetrade.py +3 -3
- ccxt/okcoin.py +1 -1
- ccxt/okx.py +10 -3
- ccxt/onetrading.py +1 -1
- ccxt/oxfun.py +2 -1
- ccxt/paradex.py +2 -2
- ccxt/phemex.py +36 -31
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binancecoinm.py +3 -1
- ccxt/pro/binanceus.py +3 -1
- ccxt/pro/binanceusdm.py +3 -1
- ccxt/pro/bybit.py +33 -1
- ccxt/test/tests_async.py +15 -0
- ccxt/test/tests_sync.py +15 -0
- ccxt/vertex.py +3 -2
- ccxt/woo.py +6 -2
- ccxt/woofipro.py +2 -2
- {ccxt-4.4.95.dist-info → ccxt-4.4.97.dist-info}/METADATA +19 -19
- {ccxt-4.4.95.dist-info → ccxt-4.4.97.dist-info}/RECORD +110 -107
- {ccxt-4.4.95.dist-info → ccxt-4.4.97.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.95.dist-info → ccxt-4.4.97.dist-info}/WHEEL +0 -0
- {ccxt-4.4.95.dist-info → ccxt-4.4.97.dist-info}/top_level.txt +0 -0
ccxt/mercado.py
CHANGED
@@ -32,6 +32,9 @@ class mercado(Exchange, ImplicitAPI):
|
|
32
32
|
'future': False,
|
33
33
|
'option': False,
|
34
34
|
'addMargin': False,
|
35
|
+
'borrowCrossMargin': False,
|
36
|
+
'borrowIsolatedMargin': False,
|
37
|
+
'borrowMargin': False,
|
35
38
|
'cancelOrder': True,
|
36
39
|
'closeAllPositions': False,
|
37
40
|
'closePosition': False,
|
@@ -41,29 +44,54 @@ class mercado(Exchange, ImplicitAPI):
|
|
41
44
|
'createStopLimitOrder': False,
|
42
45
|
'createStopMarketOrder': False,
|
43
46
|
'createStopOrder': False,
|
47
|
+
'fetchAllGreeks': False,
|
44
48
|
'fetchBalance': True,
|
49
|
+
'fetchBorrowInterest': False,
|
50
|
+
'fetchBorrowRate': False,
|
51
|
+
'fetchBorrowRateHistories': False,
|
45
52
|
'fetchBorrowRateHistory': False,
|
53
|
+
'fetchBorrowRates': False,
|
54
|
+
'fetchBorrowRatesPerSymbol': False,
|
46
55
|
'fetchCrossBorrowRate': False,
|
47
56
|
'fetchCrossBorrowRates': False,
|
48
57
|
'fetchDepositAddress': False,
|
49
58
|
'fetchDepositAddresses': False,
|
50
59
|
'fetchDepositAddressesByNetwork': False,
|
51
60
|
'fetchFundingHistory': False,
|
61
|
+
'fetchFundingInterval': False,
|
62
|
+
'fetchFundingIntervals': False,
|
52
63
|
'fetchFundingRate': False,
|
53
64
|
'fetchFundingRateHistory': False,
|
54
65
|
'fetchFundingRates': False,
|
66
|
+
'fetchGreeks': False,
|
55
67
|
'fetchIndexOHLCV': False,
|
56
68
|
'fetchIsolatedBorrowRate': False,
|
57
69
|
'fetchIsolatedBorrowRates': False,
|
70
|
+
'fetchIsolatedPositions': False,
|
58
71
|
'fetchLeverage': False,
|
72
|
+
'fetchLeverages': False,
|
59
73
|
'fetchLeverageTiers': False,
|
74
|
+
'fetchLiquidations': False,
|
75
|
+
'fetchLongShortRatio': False,
|
76
|
+
'fetchLongShortRatioHistory': False,
|
77
|
+
'fetchMarginAdjustmentHistory': False,
|
60
78
|
'fetchMarginMode': False,
|
79
|
+
'fetchMarginModes': False,
|
80
|
+
'fetchMarketLeverageTiers': False,
|
61
81
|
'fetchMarkets': True,
|
62
82
|
'fetchMarkOHLCV': False,
|
83
|
+
'fetchMarkPrice': False,
|
84
|
+
'fetchMarkPrices': False,
|
85
|
+
'fetchMyLiquidations': False,
|
86
|
+
'fetchMySettlementHistory': False,
|
63
87
|
'fetchMyTrades': 'emulated',
|
64
88
|
'fetchOHLCV': True,
|
89
|
+
'fetchOpenInterest': False,
|
65
90
|
'fetchOpenInterestHistory': False,
|
91
|
+
'fetchOpenInterests': False,
|
66
92
|
'fetchOpenOrders': True,
|
93
|
+
'fetchOption': False,
|
94
|
+
'fetchOptionChain': False,
|
67
95
|
'fetchOrder': True,
|
68
96
|
'fetchOrderBook': True,
|
69
97
|
'fetchOrders': True,
|
@@ -75,13 +103,19 @@ class mercado(Exchange, ImplicitAPI):
|
|
75
103
|
'fetchPositionsHistory': False,
|
76
104
|
'fetchPositionsRisk': False,
|
77
105
|
'fetchPremiumIndexOHLCV': False,
|
106
|
+
'fetchSettlementHistory': False,
|
78
107
|
'fetchTicker': True,
|
79
108
|
'fetchTickers': False,
|
80
109
|
'fetchTrades': True,
|
81
110
|
'fetchTradingFee': False,
|
82
111
|
'fetchTradingFees': False,
|
112
|
+
'fetchUnderlyingAssets': False,
|
113
|
+
'fetchVolatilityHistory': False,
|
83
114
|
'reduceMargin': False,
|
115
|
+
'repayCrossMargin': False,
|
116
|
+
'repayIsolatedMargin': False,
|
84
117
|
'setLeverage': False,
|
118
|
+
'setMargin': False,
|
85
119
|
'setMarginMode': False,
|
86
120
|
'setPositionMode': False,
|
87
121
|
'withdraw': True,
|
ccxt/mexc.py
CHANGED
@@ -448,6 +448,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
448
448
|
},
|
449
449
|
},
|
450
450
|
},
|
451
|
+
'useCcxtTradeId': True,
|
451
452
|
'timeframes': {
|
452
453
|
'spot': {
|
453
454
|
'1m': '1m',
|
@@ -1694,8 +1695,8 @@ class mexc(Exchange, ImplicitAPI):
|
|
1694
1695
|
'cost': self.safe_string(trade, 'commission'),
|
1695
1696
|
'currency': self.safe_currency_code(feeAsset),
|
1696
1697
|
}
|
1697
|
-
if id is None:
|
1698
|
-
id = self.
|
1698
|
+
if id is None and self.safe_bool(self.options, 'useCcxtTradeId', True):
|
1699
|
+
id = self.create_ccxt_trade_id(timestamp, side, amountString, priceString, takerOrMaker)
|
1699
1700
|
return self.safe_trade({
|
1700
1701
|
'id': id,
|
1701
1702
|
'order': orderId,
|
@@ -1712,23 +1713,6 @@ class mexc(Exchange, ImplicitAPI):
|
|
1712
1713
|
'info': trade,
|
1713
1714
|
}, market)
|
1714
1715
|
|
1715
|
-
def synthetic_trade_id(self, market=None, timestamp=None, side=None, amount=None, price=None, orderType=None, takerOrMaker=None):
|
1716
|
-
# TODO: can be unified method? self approach is being used by multiple exchanges(mexc, woo-coinsbit, dydx, ...)
|
1717
|
-
id = ''
|
1718
|
-
if timestamp is not None:
|
1719
|
-
id = self.number_to_string(timestamp) + '-' + self.safe_string(market, 'id', '_')
|
1720
|
-
if side is not None:
|
1721
|
-
id += '-' + side
|
1722
|
-
if amount is not None:
|
1723
|
-
id += '-' + self.number_to_string(amount)
|
1724
|
-
if price is not None:
|
1725
|
-
id += '-' + self.number_to_string(price)
|
1726
|
-
if takerOrMaker is not None:
|
1727
|
-
id += '-' + takerOrMaker
|
1728
|
-
if orderType is not None:
|
1729
|
-
id += '-' + orderType
|
1730
|
-
return id
|
1731
|
-
|
1732
1716
|
def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
1733
1717
|
"""
|
1734
1718
|
|
@@ -4651,11 +4635,14 @@ class mexc(Exchange, ImplicitAPI):
|
|
4651
4635
|
# "network": "TRX",
|
4652
4636
|
# "status": "5",
|
4653
4637
|
# "address": "TSMcEDDvkqY9dz8RkFnrS86U59GwEZjfvh",
|
4654
|
-
# "txId": "51a8f49e6f03f2c056e71fe3291aa65e1032880be855b65cecd0595a1b8af95b",
|
4638
|
+
# "txId": "51a8f49e6f03f2c056e71fe3291aa65e1032880be855b65cecd0595a1b8af95b:0",
|
4655
4639
|
# "insertTime": "1664805021000",
|
4656
4640
|
# "unlockConfirm": "200",
|
4657
4641
|
# "confirmTimes": "203",
|
4658
|
-
# "memo": "xxyy1122"
|
4642
|
+
# "memo": "xxyy1122",
|
4643
|
+
# "transHash": "51a8f49e6f03f2c056e71fe3291aa65e1032880be855b65cecd0595a1b8af95b",
|
4644
|
+
# "updateTime": "1664805621000",
|
4645
|
+
# "netWork: "TRX"
|
4659
4646
|
# }
|
4660
4647
|
# ]
|
4661
4648
|
#
|
@@ -4696,7 +4683,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
4696
4683
|
# [
|
4697
4684
|
# {
|
4698
4685
|
# "id": "adcd1c8322154de691b815eedcd10c42",
|
4699
|
-
# "txId": "0xc8c918cd69b2246db493ef6225a72ffdc664f15b08da3e25c6879b271d05e9d0",
|
4686
|
+
# "txId": "0xc8c918cd69b2246db493ef6225a72ffdc664f15b08da3e25c6879b271d05e9d0:0",
|
4700
4687
|
# "coin": "USDC-MATIC",
|
4701
4688
|
# "network": "MATIC",
|
4702
4689
|
# "address": "0xeE6C7a415995312ED52c53a0f8f03e165e0A5D62",
|
@@ -4707,7 +4694,11 @@ class mexc(Exchange, ImplicitAPI):
|
|
4707
4694
|
# "confirmNo": null,
|
4708
4695
|
# "applyTime": "1664882739000",
|
4709
4696
|
# "remark": '',
|
4710
|
-
# "memo": null
|
4697
|
+
# "memo": null,
|
4698
|
+
# "explorerUrl": "https://etherscan.io/tx/0xc8c918cd69b2246db493ef6225a72ffdc664f15b08da3e25c6879b271d05e9d0",
|
4699
|
+
# "transHash": "0xc8c918cd69b2246db493ef6225a72ffdc664f15b08da3e25c6879b271d05e9d0",
|
4700
|
+
# "updateTime": "1664882799000",
|
4701
|
+
# "netWork: "MATIC"
|
4711
4702
|
# }
|
4712
4703
|
# ]
|
4713
4704
|
#
|
@@ -4723,18 +4714,21 @@ class mexc(Exchange, ImplicitAPI):
|
|
4723
4714
|
# "network": "TRX",
|
4724
4715
|
# "status": "5",
|
4725
4716
|
# "address": "TSMcEDDvkqY9dz8RkFnrS86U59GwEZjfvh",
|
4726
|
-
# "txId": "51a8f49e6f03f2c056e71fe3291aa65e1032880be855b65cecd0595a1b8af95b",
|
4717
|
+
# "txId": "51a8f49e6f03f2c056e71fe3291aa65e1032880be855b65cecd0595a1b8af95b:0",
|
4727
4718
|
# "insertTime": "1664805021000",
|
4728
4719
|
# "unlockConfirm": "200",
|
4729
4720
|
# "confirmTimes": "203",
|
4730
|
-
# "memo": "xxyy1122"
|
4721
|
+
# "memo": "xxyy1122",
|
4722
|
+
# "transHash": "51a8f49e6f03f2c056e71fe3291aa65e1032880be855b65cecd0595a1b8af95b",
|
4723
|
+
# "updateTime": "1664805621000",
|
4724
|
+
# "netWork: "TRX"
|
4731
4725
|
# }
|
4732
4726
|
#
|
4733
4727
|
# fetchWithdrawals
|
4734
4728
|
#
|
4735
4729
|
# {
|
4736
4730
|
# "id": "adcd1c8322154de691b815eedcd10c42",
|
4737
|
-
# "txId": "0xc8c918cd69b2246db493ef6225a72ffdc664f15b08da3e25c6879b271d05e9d0",
|
4731
|
+
# "txId": "0xc8c918cd69b2246db493ef6225a72ffdc664f15b08da3e25c6879b271d05e9d0:0",
|
4738
4732
|
# "coin": "USDC-MATIC",
|
4739
4733
|
# "network": "MATIC",
|
4740
4734
|
# "address": "0xeE6C7a415995312ED52c53a0f8f03e165e0A5D62",
|
@@ -4744,8 +4738,12 @@ class mexc(Exchange, ImplicitAPI):
|
|
4744
4738
|
# "transactionFee": "1",
|
4745
4739
|
# "confirmNo": null,
|
4746
4740
|
# "applyTime": "1664882739000",
|
4747
|
-
# "remark":
|
4748
|
-
# "memo": null
|
4741
|
+
# "remark": "",
|
4742
|
+
# "memo": null,
|
4743
|
+
# "explorerUrl": "https://etherscan.io/tx/0xc8c918cd69b2246db493ef6225a72ffdc664f15b08da3e25c6879b271d05e9d0",
|
4744
|
+
# "transHash": "0xc8c918cd69b2246db493ef6225a72ffdc664f15b08da3e25c6879b271d05e9d0",
|
4745
|
+
# "updateTime": "1664882799000",
|
4746
|
+
# "netWork: "MATIC"
|
4749
4747
|
# }
|
4750
4748
|
#
|
4751
4749
|
# withdraw
|
@@ -4757,6 +4755,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
4757
4755
|
id = self.safe_string(transaction, 'id')
|
4758
4756
|
type = 'deposit' if (id is None) else 'withdrawal'
|
4759
4757
|
timestamp = self.safe_integer_2(transaction, 'insertTime', 'applyTime')
|
4758
|
+
updated = self.safe_integer(transaction, 'updateTime')
|
4760
4759
|
currencyId = None
|
4761
4760
|
currencyWithNetwork = self.safe_string(transaction, 'coin')
|
4762
4761
|
if currencyWithNetwork is not None:
|
@@ -4769,7 +4768,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
4769
4768
|
status = self.parse_transaction_status_by_type(self.safe_string(transaction, 'status'), type)
|
4770
4769
|
amountString = self.safe_string(transaction, 'amount')
|
4771
4770
|
address = self.safe_string(transaction, 'address')
|
4772
|
-
txid = self.
|
4771
|
+
txid = self.safe_string_2(transaction, 'transHash', 'txId')
|
4773
4772
|
fee = None
|
4774
4773
|
feeCostString = self.safe_string(transaction, 'transactionFee')
|
4775
4774
|
if feeCostString is not None:
|
@@ -4797,8 +4796,8 @@ class mexc(Exchange, ImplicitAPI):
|
|
4797
4796
|
'amount': self.parse_number(amountString),
|
4798
4797
|
'currency': code,
|
4799
4798
|
'status': status,
|
4800
|
-
'updated':
|
4801
|
-
'comment':
|
4799
|
+
'updated': updated,
|
4800
|
+
'comment': self.safe_string(transaction, 'remark'),
|
4802
4801
|
'internal': None,
|
4803
4802
|
'fee': fee,
|
4804
4803
|
}
|
@@ -5704,7 +5703,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
5704
5703
|
#
|
5705
5704
|
# {success: True, code: '0'}
|
5706
5705
|
#
|
5707
|
-
return self.parse_leverage(response, market)
|
5706
|
+
return self.parse_leverage(response, market) # tmp revert type
|
5708
5707
|
|
5709
5708
|
def nonce(self):
|
5710
5709
|
return self.milliseconds() - self.safe_integer(self.options, 'timeDifference', 0)
|
ccxt/modetrade.py
CHANGED
@@ -29,7 +29,7 @@ class modetrade(Exchange, ImplicitAPI):
|
|
29
29
|
'countries': ['KY'], # Cayman Islands
|
30
30
|
'rateLimit': 100,
|
31
31
|
'version': 'v1',
|
32
|
-
'certified':
|
32
|
+
'certified': False,
|
33
33
|
'pro': True,
|
34
34
|
'dex': True,
|
35
35
|
'hostname': 'trade.mode.network',
|
@@ -1750,9 +1750,9 @@ class modetrade(Exchange, ImplicitAPI):
|
|
1750
1750
|
# }
|
1751
1751
|
#
|
1752
1752
|
return [
|
1753
|
-
{
|
1753
|
+
self.safe_order({
|
1754
1754
|
'info': response,
|
1755
|
-
},
|
1755
|
+
}),
|
1756
1756
|
]
|
1757
1757
|
|
1758
1758
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
ccxt/okcoin.py
CHANGED
@@ -1650,7 +1650,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1650
1650
|
advanced = self.safe_value(params, 'advanced')
|
1651
1651
|
if trigger or advanced:
|
1652
1652
|
orderInner = self.cancel_orders([id], symbol, params)
|
1653
|
-
return self.
|
1653
|
+
return self.safe_dict(orderInner, 0)
|
1654
1654
|
market = self.market(symbol)
|
1655
1655
|
request: dict = {
|
1656
1656
|
'instId': market['id'],
|
ccxt/okx.py
CHANGED
@@ -1172,7 +1172,9 @@ class okx(Exchange, ImplicitAPI):
|
|
1172
1172
|
},
|
1173
1173
|
'createOrder': 'privatePostTradeBatchOrders', # or 'privatePostTradeOrder' or 'privatePostTradeOrderAlgo'
|
1174
1174
|
'createMarketBuyOrderRequiresPrice': False,
|
1175
|
-
'fetchMarkets':
|
1175
|
+
'fetchMarkets': {
|
1176
|
+
'types': ['spot', 'future', 'swap', 'option'], # spot, future, swap, option
|
1177
|
+
},
|
1176
1178
|
'timeDifference': 0, # the difference between system clock and exchange server clock
|
1177
1179
|
'adjustForTimeDifference': False, # controls the adjustment logic upon instantiation
|
1178
1180
|
'defaultType': 'spot', # 'funding', 'spot', 'margin', 'future', 'swap', 'option'
|
@@ -1558,7 +1560,12 @@ class okx(Exchange, ImplicitAPI):
|
|
1558
1560
|
"""
|
1559
1561
|
if self.options['adjustForTimeDifference']:
|
1560
1562
|
self.load_time_difference()
|
1561
|
-
types =
|
1563
|
+
types = ['spot', 'future', 'swap', 'option']
|
1564
|
+
fetchMarketsOption = self.safe_dict(self.options, 'fetchMarkets')
|
1565
|
+
if fetchMarketsOption is not None:
|
1566
|
+
types = self.safe_list(fetchMarketsOption, 'types', types)
|
1567
|
+
else:
|
1568
|
+
types = self.safe_list(self.options, 'fetchMarkets', types) # backward-support
|
1562
1569
|
promises = []
|
1563
1570
|
result = []
|
1564
1571
|
for i in range(0, len(types)):
|
@@ -3324,7 +3331,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3324
3331
|
trailing = self.safe_bool(params, 'trailing', False)
|
3325
3332
|
if trigger or trailing:
|
3326
3333
|
orderInner = self.cancel_orders([id], symbol, params)
|
3327
|
-
return self.
|
3334
|
+
return self.safe_dict(orderInner, 0)
|
3328
3335
|
self.load_markets()
|
3329
3336
|
market = self.market(symbol)
|
3330
3337
|
request: dict = {
|
ccxt/onetrading.py
CHANGED
@@ -1321,7 +1321,7 @@ class onetrading(Exchange, ImplicitAPI):
|
|
1321
1321
|
# "a10e9bd1-8f72-4cfe-9f1b-7f1c8a9bd8ee"
|
1322
1322
|
# ]
|
1323
1323
|
#
|
1324
|
-
return response
|
1324
|
+
return [self.safe_order({'info': response})]
|
1325
1325
|
|
1326
1326
|
def cancel_orders(self, ids, symbol: Str = None, params={}):
|
1327
1327
|
"""
|
ccxt/oxfun.py
CHANGED
@@ -2584,7 +2584,8 @@ class oxfun(Exchange, ImplicitAPI):
|
|
2584
2584
|
# "data": {"notice": "No working orders found"}
|
2585
2585
|
# }
|
2586
2586
|
#
|
2587
|
-
|
2587
|
+
response = self.privateDeleteV3OrdersCancelAll(self.extend(request, params))
|
2588
|
+
return [self.safe_order({'info': response})]
|
2588
2589
|
|
2589
2590
|
def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
|
2590
2591
|
"""
|
ccxt/paradex.py
CHANGED
@@ -1249,7 +1249,7 @@ class paradex(Exchange, ImplicitAPI):
|
|
1249
1249
|
cancelReason = self.safe_string(order, 'cancel_reason')
|
1250
1250
|
status = self.safe_string(order, 'status')
|
1251
1251
|
if cancelReason is not None:
|
1252
|
-
if cancelReason == 'NOT_ENOUGH_MARGIN':
|
1252
|
+
if cancelReason == 'NOT_ENOUGH_MARGIN' or cancelReason == 'ORDER_EXCEEDS_POSITION_LIMIT':
|
1253
1253
|
status = 'rejected'
|
1254
1254
|
else:
|
1255
1255
|
status = 'canceled'
|
@@ -1527,7 +1527,7 @@ class paradex(Exchange, ImplicitAPI):
|
|
1527
1527
|
#
|
1528
1528
|
# if success, no response...
|
1529
1529
|
#
|
1530
|
-
return response
|
1530
|
+
return [self.safe_order({'info': response})]
|
1531
1531
|
|
1532
1532
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
1533
1533
|
"""
|
ccxt/phemex.py
CHANGED
@@ -281,6 +281,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
281
281
|
# swap
|
282
282
|
'orders/replace': 1, # ?symbol=<symbol>&orderID=<orderID>&origClOrdID=<origClOrdID>&clOrdID=<clOrdID>&price=<price>&priceEp=<priceEp>&orderQty=<orderQty>&stopPx=<stopPx>&stopPxEp=<stopPxEp>&takeProfit=<takeProfit>&takeProfitEp=<takeProfitEp>&stopLoss=<stopLoss>&stopLossEp=<stopLossEp>&pegOffsetValueEp=<pegOffsetValueEp>&pegPriceType=<pegPriceType>
|
283
283
|
'g-orders/replace': 1, # ?symbol=<symbol>&orderID=<orderID>&origClOrdID=<origClOrdID>&clOrdID=<clOrdID>&price=<price>&priceEp=<priceEp>&orderQty=<orderQty>&stopPx=<stopPx>&stopPxEp=<stopPxEp>&takeProfit=<takeProfit>&takeProfitEp=<takeProfitEp>&stopLoss=<stopLoss>&stopLossEp=<stopLossEp>&pegOffsetValueEp=<pegOffsetValueEp>&pegPriceType=<pegPriceType>
|
284
|
+
'g-orders/create': 1,
|
284
285
|
'positions/leverage': 5, # ?symbol=<symbol>&leverage=<leverage>&leverageEr=<leverageEr>
|
285
286
|
'g-positions/leverage': 5, # ?symbol=<symbol>&leverage=<leverage>&leverageEr=<leverageEr>
|
286
287
|
'g-positions/switch-pos-mode-sync': 5, # ?symbol=<symbol>&targetPosMode=<targetPosMode>
|
@@ -1218,7 +1219,8 @@ class phemex(Exchange, ImplicitAPI):
|
|
1218
1219
|
# 'id': 123456789, # optional request id
|
1219
1220
|
}
|
1220
1221
|
response = None
|
1221
|
-
|
1222
|
+
isStableSettled = (market['settle'] == 'USDT') or (market['settle'] == 'USDC')
|
1223
|
+
if market['linear'] and isStableSettled:
|
1222
1224
|
response = self.v2GetMdV2Orderbook(self.extend(request, params))
|
1223
1225
|
else:
|
1224
1226
|
if (limit is not None) and (limit <= 30):
|
@@ -1350,7 +1352,8 @@ class phemex(Exchange, ImplicitAPI):
|
|
1350
1352
|
}
|
1351
1353
|
until = self.safe_integer_2(params, 'until', 'to')
|
1352
1354
|
params = self.omit(params, ['until'])
|
1353
|
-
|
1355
|
+
isStableSettled = (market['settle'] == 'USDT') or (market['settle'] == 'USDC')
|
1356
|
+
usesSpecialFromToEndpoint = ((market['linear'] or isStableSettled)) and ((since is not None) or (until is not None))
|
1354
1357
|
maxLimit = 1000
|
1355
1358
|
if usesSpecialFromToEndpoint:
|
1356
1359
|
maxLimit = 2000
|
@@ -1358,7 +1361,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
1358
1361
|
limit = maxLimit
|
1359
1362
|
request['limit'] = min(limit, maxLimit)
|
1360
1363
|
response = None
|
1361
|
-
if market['linear'] or
|
1364
|
+
if market['linear'] or isStableSettled:
|
1362
1365
|
if (until is not None) or (since is not None):
|
1363
1366
|
candleDuration = self.parse_timeframe(timeframe)
|
1364
1367
|
if since is not None:
|
@@ -1614,7 +1617,8 @@ class phemex(Exchange, ImplicitAPI):
|
|
1614
1617
|
# 'id': 123456789, # optional request id
|
1615
1618
|
}
|
1616
1619
|
response = None
|
1617
|
-
|
1620
|
+
isStableSettled = (market['settle'] == 'USDT') or (market['settle'] == 'USDC')
|
1621
|
+
if market['linear'] and isStableSettled:
|
1618
1622
|
response = self.v2GetMdV2Trade(self.extend(request, params))
|
1619
1623
|
else:
|
1620
1624
|
response = self.v1GetMdTrade(self.extend(request, params))
|
@@ -1853,7 +1857,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
1853
1857
|
timestamp = self.safe_integer(trade, 'createdAt')
|
1854
1858
|
id = self.safe_string_2(trade, 'execId', 'execID')
|
1855
1859
|
orderId = self.safe_string(trade, 'orderID')
|
1856
|
-
if market['settle'] == 'USDT':
|
1860
|
+
if market['settle'] == 'USDT' or market['settle'] == 'USDC':
|
1857
1861
|
sideId = self.safe_string_lower(trade, 'side')
|
1858
1862
|
if (sideId == 'buy') or (sideId == 'sell'):
|
1859
1863
|
side = sideId
|
@@ -2589,6 +2593,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
2589
2593
|
stopLossDefined = (stopLoss is not None)
|
2590
2594
|
takeProfit = self.safe_value(params, 'takeProfit')
|
2591
2595
|
takeProfitDefined = (takeProfit is not None)
|
2596
|
+
isStableSettled = (market['settle'] == 'USDT') or (market['settle'] == 'USDC')
|
2592
2597
|
if clientOrderId is None:
|
2593
2598
|
brokerId = self.safe_string(self.options, 'brokerId', 'CCXT123456')
|
2594
2599
|
if brokerId is not None:
|
@@ -2598,7 +2603,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
2598
2603
|
params = self.omit(params, ['clOrdID', 'clientOrderId'])
|
2599
2604
|
triggerPrice = self.safe_string_n(params, ['stopPx', 'stopPrice', 'triggerPrice'])
|
2600
2605
|
if triggerPrice is not None:
|
2601
|
-
if
|
2606
|
+
if isStableSettled:
|
2602
2607
|
request['stopPxRp'] = self.price_to_precision(symbol, triggerPrice)
|
2603
2608
|
else:
|
2604
2609
|
request['stopPxEp'] = self.to_ep(triggerPrice, market)
|
@@ -2647,7 +2652,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
2647
2652
|
posSide = 'Merged'
|
2648
2653
|
posSide = self.capitalize(posSide)
|
2649
2654
|
request['posSide'] = posSide
|
2650
|
-
if
|
2655
|
+
if isStableSettled:
|
2651
2656
|
request['orderQtyRq'] = amount
|
2652
2657
|
else:
|
2653
2658
|
request['orderQty'] = self.parse_to_int(amount)
|
@@ -2675,7 +2680,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
2675
2680
|
stopLossTriggerPrice = self.safe_value_2(stopLoss, 'triggerPrice', 'stopPrice')
|
2676
2681
|
if stopLossTriggerPrice is None:
|
2677
2682
|
raise InvalidOrder(self.id + ' createOrder() requires a trigger price in params["stopLoss"]["triggerPrice"] for a stop loss order')
|
2678
|
-
if
|
2683
|
+
if isStableSettled:
|
2679
2684
|
request['stopLossRp'] = self.price_to_precision(symbol, stopLossTriggerPrice)
|
2680
2685
|
else:
|
2681
2686
|
request['stopLossEp'] = self.to_ep(stopLossTriggerPrice, market)
|
@@ -2689,7 +2694,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
2689
2694
|
takeProfitTriggerPrice = self.safe_value_2(takeProfit, 'triggerPrice', 'stopPrice')
|
2690
2695
|
if takeProfitTriggerPrice is None:
|
2691
2696
|
raise InvalidOrder(self.id + ' createOrder() requires a trigger price in params["takeProfit"]["triggerPrice"] for a take profit order')
|
2692
|
-
if
|
2697
|
+
if isStableSettled:
|
2693
2698
|
request['takeProfitRp'] = self.price_to_precision(symbol, takeProfitTriggerPrice)
|
2694
2699
|
else:
|
2695
2700
|
request['takeProfitEp'] = self.to_ep(takeProfitTriggerPrice, market)
|
@@ -2700,27 +2705,27 @@ class phemex(Exchange, ImplicitAPI):
|
|
2700
2705
|
if tpLimitPrice is not None:
|
2701
2706
|
request['tpPxRp'] = self.price_to_precision(symbol, tpLimitPrice)
|
2702
2707
|
if (type == 'Limit') or (type == 'StopLimit') or (type == 'LimitIfTouched'):
|
2703
|
-
if
|
2708
|
+
if isStableSettled:
|
2704
2709
|
request['priceRp'] = self.price_to_precision(symbol, price)
|
2705
2710
|
else:
|
2706
2711
|
priceString = self.number_to_string(price)
|
2707
2712
|
request['priceEp'] = self.to_ep(priceString, market)
|
2708
2713
|
takeProfitPrice = self.safe_string(params, 'takeProfitPrice')
|
2709
2714
|
if takeProfitPrice is not None:
|
2710
|
-
if
|
2715
|
+
if isStableSettled:
|
2711
2716
|
request['takeProfitRp'] = self.price_to_precision(symbol, takeProfitPrice)
|
2712
2717
|
else:
|
2713
2718
|
request['takeProfitEp'] = self.to_ep(takeProfitPrice, market)
|
2714
2719
|
params = self.omit(params, 'takeProfitPrice')
|
2715
2720
|
stopLossPrice = self.safe_string(params, 'stopLossPrice')
|
2716
2721
|
if stopLossPrice is not None:
|
2717
|
-
if
|
2722
|
+
if isStableSettled:
|
2718
2723
|
request['stopLossRp'] = self.price_to_precision(symbol, stopLossPrice)
|
2719
2724
|
else:
|
2720
2725
|
request['stopLossEp'] = self.to_ep(stopLossPrice, market)
|
2721
2726
|
params = self.omit(params, 'stopLossPrice')
|
2722
2727
|
response = None
|
2723
|
-
if
|
2728
|
+
if isStableSettled:
|
2724
2729
|
response = self.privatePostGOrders(self.extend(request, params))
|
2725
2730
|
elif market['contract']:
|
2726
2731
|
response = self.privatePostOrders(self.extend(request, params))
|
@@ -2828,13 +2833,13 @@ class phemex(Exchange, ImplicitAPI):
|
|
2828
2833
|
}
|
2829
2834
|
clientOrderId = self.safe_string_2(params, 'clientOrderId', 'clOrdID')
|
2830
2835
|
params = self.omit(params, ['clientOrderId', 'clOrdID'])
|
2831
|
-
|
2836
|
+
isStableSettled = (market['settle'] == 'USDT') or (market['settle'] == 'USDC')
|
2832
2837
|
if clientOrderId is not None:
|
2833
2838
|
request['clOrdID'] = clientOrderId
|
2834
2839
|
else:
|
2835
2840
|
request['orderID'] = id
|
2836
2841
|
if price is not None:
|
2837
|
-
if
|
2842
|
+
if isStableSettled:
|
2838
2843
|
request['priceRp'] = self.price_to_precision(market['symbol'], price)
|
2839
2844
|
else:
|
2840
2845
|
request['priceEp'] = self.to_ep(price, market)
|
@@ -2844,19 +2849,19 @@ class phemex(Exchange, ImplicitAPI):
|
|
2844
2849
|
if finalQty is not None:
|
2845
2850
|
request['baseQtyEV'] = finalQty
|
2846
2851
|
elif amount is not None:
|
2847
|
-
if
|
2852
|
+
if isStableSettled:
|
2848
2853
|
request['orderQtyRq'] = self.amount_to_precision(market['symbol'], amount)
|
2849
2854
|
else:
|
2850
2855
|
request['baseQtyEV'] = self.to_ev(amount, market)
|
2851
2856
|
triggerPrice = self.safe_string_n(params, ['triggerPrice', 'stopPx', 'stopPrice'])
|
2852
2857
|
if triggerPrice is not None:
|
2853
|
-
if
|
2858
|
+
if isStableSettled:
|
2854
2859
|
request['stopPxRp'] = self.price_to_precision(symbol, triggerPrice)
|
2855
2860
|
else:
|
2856
2861
|
request['stopPxEp'] = self.to_ep(triggerPrice, market)
|
2857
2862
|
params = self.omit(params, ['triggerPrice', 'stopPx', 'stopPrice'])
|
2858
2863
|
response = None
|
2859
|
-
if
|
2864
|
+
if isStableSettled:
|
2860
2865
|
posSide = self.safe_string(params, 'posSide')
|
2861
2866
|
if posSide is None:
|
2862
2867
|
request['posSide'] = 'Merged'
|
@@ -2894,7 +2899,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
2894
2899
|
else:
|
2895
2900
|
request['orderID'] = id
|
2896
2901
|
response = None
|
2897
|
-
if market['settle'] == 'USDT':
|
2902
|
+
if market['settle'] == 'USDT' or market['settle'] == 'USDC':
|
2898
2903
|
posSide = self.safe_string(params, 'posSide')
|
2899
2904
|
if posSide is None:
|
2900
2905
|
request['posSide'] = 'Merged'
|
@@ -2930,7 +2935,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
2930
2935
|
if trigger:
|
2931
2936
|
request['untriggerred'] = trigger
|
2932
2937
|
response = None
|
2933
|
-
if market['settle'] == 'USDT':
|
2938
|
+
if market['settle'] == 'USDT' or market['settle'] == 'USDC':
|
2934
2939
|
response = self.privateDeleteGOrdersAll(self.extend(request, params))
|
2935
2940
|
#
|
2936
2941
|
# {
|
@@ -2990,7 +2995,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
2990
2995
|
else:
|
2991
2996
|
request['orderID'] = id
|
2992
2997
|
response = None
|
2993
|
-
if market['settle'] == 'USDT':
|
2998
|
+
if market['settle'] == 'USDT' or market['settle'] == 'USDC':
|
2994
2999
|
response = self.privateGetApiDataGFuturesOrdersByOrderId(self.extend(request, params))
|
2995
3000
|
elif market['spot']:
|
2996
3001
|
response = self.privateGetApiDataSpotsOrdersByOrderId(self.extend(request, params))
|
@@ -3035,7 +3040,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
3035
3040
|
if limit is not None:
|
3036
3041
|
request['limit'] = limit
|
3037
3042
|
response = None
|
3038
|
-
if market['settle'] == 'USDT':
|
3043
|
+
if market['settle'] == 'USDT' or market['settle'] == 'USDC':
|
3039
3044
|
request['currency'] = market['settle']
|
3040
3045
|
response = self.privateGetExchangeOrderV2OrderList(self.extend(request, params))
|
3041
3046
|
elif market['swap']:
|
@@ -3070,7 +3075,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
3070
3075
|
}
|
3071
3076
|
response = None
|
3072
3077
|
try:
|
3073
|
-
if market['settle'] == 'USDT':
|
3078
|
+
if market['settle'] == 'USDT' or market['settle'] == 'USDC':
|
3074
3079
|
response = self.privateGetGOrdersActiveList(self.extend(request, params))
|
3075
3080
|
elif market['swap']:
|
3076
3081
|
response = self.privateGetOrdersActiveList(self.extend(request, params))
|
@@ -3875,8 +3880,8 @@ class phemex(Exchange, ImplicitAPI):
|
|
3875
3880
|
raise BadRequest(self.id + ' fetchFundingHistory() limit argument cannot exceed 200')
|
3876
3881
|
request['limit'] = limit
|
3877
3882
|
response = None
|
3878
|
-
|
3879
|
-
if
|
3883
|
+
isStableSettled = market['settle'] == 'USDT' or market['settle'] == 'USDC'
|
3884
|
+
if isStableSettled:
|
3880
3885
|
response = self.privateGetApiDataGFuturesFundingFees(self.extend(request, params))
|
3881
3886
|
else:
|
3882
3887
|
response = self.privateGetApiDataFuturesFundingFees(self.extend(request, params))
|
@@ -3925,8 +3930,8 @@ class phemex(Exchange, ImplicitAPI):
|
|
3925
3930
|
if value is None or currencyCode is None:
|
3926
3931
|
return value
|
3927
3932
|
# it was confirmed by phemex support, that USDT contracts use direct amounts in funding fees, while USD & INVERSE needs 'valueScale'
|
3928
|
-
|
3929
|
-
if not
|
3933
|
+
isStableSettled = market['settle'] == 'USDT' or market['settle'] == 'USDC'
|
3934
|
+
if not isStableSettled:
|
3930
3935
|
currency = self.safe_currency(currencyCode)
|
3931
3936
|
scale = self.safe_string(currency['info'], 'valueScale')
|
3932
3937
|
tickPrecision = self.parse_precision(scale)
|
@@ -4118,8 +4123,8 @@ class phemex(Exchange, ImplicitAPI):
|
|
4118
4123
|
raise ArgumentsRequired(self.id + ' setMarginMode() requires a symbol argument')
|
4119
4124
|
self.load_markets()
|
4120
4125
|
market = self.market(symbol)
|
4121
|
-
if not market['swap'] or market['settle'] == 'USDT':
|
4122
|
-
raise BadSymbol(self.id + ' setMarginMode() supports swap(non USDT based) contracts only')
|
4126
|
+
if not market['swap'] or market['settle'] == 'USDT' or market['settle'] == 'USDC':
|
4127
|
+
raise BadSymbol(self.id + ' setMarginMode() supports swap(non USDT/USDC based) contracts only')
|
4123
4128
|
marginMode = marginMode.lower()
|
4124
4129
|
if marginMode != 'isolated' and marginMode != 'cross':
|
4125
4130
|
raise BadRequest(self.id + ' setMarginMode() marginMode argument should be isolated or cross')
|
@@ -4355,7 +4360,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
4355
4360
|
'symbol': market['id'],
|
4356
4361
|
}
|
4357
4362
|
response = None
|
4358
|
-
if market['settle'] == 'USDT':
|
4363
|
+
if market['settle'] == 'USDT' or market['settle'] == 'USDC':
|
4359
4364
|
if not isHedged and longLeverageRr is None and shortLeverageRr is None:
|
4360
4365
|
request['leverageRr'] = leverage
|
4361
4366
|
else:
|
@@ -4578,7 +4583,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
4578
4583
|
raise ArgumentsRequired(self.id + ' fetchFundingRateHistory() requires a symbol argument')
|
4579
4584
|
self.load_markets()
|
4580
4585
|
market = self.market(symbol)
|
4581
|
-
isUsdtSettled = market['settle'] == 'USDT'
|
4586
|
+
isUsdtSettled = market['settle'] == 'USDT' or market['settle'] == 'USDC'
|
4582
4587
|
if not market['swap']:
|
4583
4588
|
raise BadRequest(self.id + ' fetchFundingRateHistory() supports swap contracts only')
|
4584
4589
|
paginate = False
|
ccxt/pro/__init__.py
CHANGED
ccxt/pro/binancecoinm.py
CHANGED