ccxt 4.4.38__py2.py3-none-any.whl → 4.4.40__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ccxt/__init__.py +1 -1
- ccxt/abstract/digifinex.py +1 -0
- ccxt/abstract/mexc.py +1 -0
- ccxt/abstract/woo.py +2 -2
- ccxt/alpaca.py +74 -3
- ccxt/ascendex.py +9 -9
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/alpaca.py +74 -3
- ccxt/async_support/ascendex.py +9 -9
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/base/ws/aiohttp_client.py +2 -2
- ccxt/async_support/binance.py +13 -17
- ccxt/async_support/bingx.py +1 -2
- ccxt/async_support/bit2c.py +0 -1
- ccxt/async_support/bitbank.py +0 -1
- ccxt/async_support/bitbns.py +0 -1
- ccxt/async_support/bitfinex.py +15 -16
- ccxt/async_support/bitfinex1.py +0 -1
- ccxt/async_support/bitflyer.py +0 -1
- ccxt/async_support/bitget.py +1 -2
- ccxt/async_support/bithumb.py +0 -1
- ccxt/async_support/bitmart.py +3 -4
- ccxt/async_support/bitmex.py +5 -6
- ccxt/async_support/bitopro.py +4 -5
- ccxt/async_support/bitrue.py +5 -7
- ccxt/async_support/bitso.py +1 -2
- ccxt/async_support/bitstamp.py +1 -2
- ccxt/async_support/bitteam.py +1 -3
- ccxt/async_support/bitvavo.py +2 -4
- ccxt/async_support/blockchaincom.py +5 -5
- ccxt/async_support/blofin.py +10 -10
- ccxt/async_support/btcalpha.py +0 -1
- ccxt/async_support/btcbox.py +0 -1
- ccxt/async_support/btcmarkets.py +1 -3
- ccxt/async_support/bybit.py +2 -3
- ccxt/async_support/cex.py +1 -1
- ccxt/async_support/coinbase.py +77 -1
- ccxt/async_support/coinbaseexchange.py +1 -1
- ccxt/async_support/coinbaseinternational.py +62 -0
- ccxt/async_support/coincatch.py +1 -1
- ccxt/async_support/coinex.py +9 -9
- ccxt/async_support/coinlist.py +1 -1
- ccxt/async_support/coinmetro.py +1 -1
- ccxt/async_support/cryptocom.py +91 -2
- ccxt/async_support/currencycom.py +1 -1
- ccxt/async_support/defx.py +1 -2
- ccxt/async_support/delta.py +1 -1
- ccxt/async_support/digifinex.py +58 -19
- ccxt/async_support/exmo.py +2 -2
- ccxt/async_support/gate.py +1 -1
- ccxt/async_support/hashkey.py +3 -5
- ccxt/async_support/htx.py +155 -33
- ccxt/async_support/hyperliquid.py +1 -1
- ccxt/async_support/kraken.py +1 -1
- ccxt/async_support/kucoin.py +25 -24
- ccxt/async_support/luno.py +1 -1
- ccxt/async_support/mexc.py +173 -26
- ccxt/async_support/ndax.py +1 -1
- ccxt/async_support/okcoin.py +18 -18
- ccxt/async_support/okx.py +22 -21
- ccxt/async_support/phemex.py +12 -8
- ccxt/async_support/poloniex.py +1 -1
- ccxt/async_support/poloniexfutures.py +6 -6
- ccxt/async_support/vertex.py +11 -11
- ccxt/async_support/woo.py +39 -39
- ccxt/async_support/woofipro.py +24 -24
- ccxt/async_support/xt.py +26 -26
- ccxt/async_support/zonda.py +1 -1
- ccxt/base/exchange.py +32 -25
- ccxt/binance.py +13 -17
- ccxt/bingx.py +1 -2
- ccxt/bit2c.py +0 -1
- ccxt/bitbank.py +0 -1
- ccxt/bitbns.py +0 -1
- ccxt/bitfinex.py +15 -16
- ccxt/bitfinex1.py +0 -1
- ccxt/bitflyer.py +0 -1
- ccxt/bitget.py +1 -2
- ccxt/bithumb.py +0 -1
- ccxt/bitmart.py +3 -4
- ccxt/bitmex.py +5 -6
- ccxt/bitopro.py +4 -5
- ccxt/bitrue.py +5 -7
- ccxt/bitso.py +1 -2
- ccxt/bitstamp.py +1 -2
- ccxt/bitteam.py +1 -3
- ccxt/bitvavo.py +2 -4
- ccxt/blockchaincom.py +5 -5
- ccxt/blofin.py +10 -10
- ccxt/btcalpha.py +0 -1
- ccxt/btcbox.py +0 -1
- ccxt/btcmarkets.py +1 -3
- ccxt/bybit.py +2 -3
- ccxt/cex.py +1 -1
- ccxt/coinbase.py +77 -1
- ccxt/coinbaseexchange.py +1 -1
- ccxt/coinbaseinternational.py +62 -0
- ccxt/coincatch.py +1 -1
- ccxt/coinex.py +9 -9
- ccxt/coinlist.py +1 -1
- ccxt/coinmetro.py +1 -1
- ccxt/cryptocom.py +91 -2
- ccxt/currencycom.py +1 -1
- ccxt/defx.py +1 -2
- ccxt/delta.py +1 -1
- ccxt/digifinex.py +58 -19
- ccxt/exmo.py +2 -2
- ccxt/gate.py +1 -1
- ccxt/hashkey.py +3 -5
- ccxt/htx.py +155 -33
- ccxt/hyperliquid.py +1 -1
- ccxt/kraken.py +1 -1
- ccxt/kucoin.py +25 -24
- ccxt/luno.py +1 -1
- ccxt/mexc.py +173 -26
- ccxt/ndax.py +1 -1
- ccxt/okcoin.py +18 -18
- ccxt/okx.py +22 -21
- ccxt/phemex.py +12 -8
- ccxt/poloniex.py +1 -1
- ccxt/poloniexfutures.py +6 -6
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitget.py +1 -1
- ccxt/pro/bybit.py +12 -1
- ccxt/pro/coinex.py +2 -2
- ccxt/pro/gate.py +6 -6
- ccxt/pro/kucoin.py +3 -3
- ccxt/pro/okx.py +11 -11
- ccxt/pro/upbit.py +2 -2
- ccxt/pro/woo.py +1 -1
- ccxt/vertex.py +11 -11
- ccxt/woo.py +39 -39
- ccxt/woofipro.py +24 -24
- ccxt/xt.py +26 -26
- ccxt/zonda.py +1 -1
- {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/METADATA +4 -4
- {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/RECORD +140 -140
- {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/WHEEL +0 -0
- {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/top_level.txt +0 -0
ccxt/mexc.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.mexc import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Account, Balances, Currencies, Currency, DepositAddress, IndexType, Int, Leverage, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade,
|
9
|
+
from ccxt.base.types import Account, Balances, Currencies, Currency, DepositAddress, IndexType, Int, Leverage, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -132,8 +132,8 @@ class mexc(Exchange, ImplicitAPI):
|
|
132
132
|
'fetchTickers': True,
|
133
133
|
'fetchTime': True,
|
134
134
|
'fetchTrades': True,
|
135
|
-
'fetchTradingFee':
|
136
|
-
'fetchTradingFees':
|
135
|
+
'fetchTradingFee': True,
|
136
|
+
'fetchTradingFees': False,
|
137
137
|
'fetchTradingLimits': None,
|
138
138
|
'fetchTransactionFee': 'emulated',
|
139
139
|
'fetchTransactionFees': True,
|
@@ -206,6 +206,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
206
206
|
'allOrders': 10,
|
207
207
|
'account': 10,
|
208
208
|
'myTrades': 10,
|
209
|
+
'tradeFee': 10,
|
209
210
|
'sub-account/list': 1,
|
210
211
|
'sub-account/apiKey': 1,
|
211
212
|
'capital/config/getall': 10,
|
@@ -687,6 +688,143 @@ class mexc(Exchange, ImplicitAPI):
|
|
687
688
|
'maxTimeTillEnd': 90 * 86400 * 1000 - 1, # 90 days
|
688
689
|
'broker': 'CCXT',
|
689
690
|
},
|
691
|
+
'features': {
|
692
|
+
'def': {
|
693
|
+
'sandbox': False,
|
694
|
+
'createOrder': {
|
695
|
+
'marginMode': True,
|
696
|
+
'triggerPrice': False,
|
697
|
+
'triggerDirection': False,
|
698
|
+
'triggerPriceType': {
|
699
|
+
'last': False,
|
700
|
+
'mark': False,
|
701
|
+
'index': False,
|
702
|
+
},
|
703
|
+
'stopLossPrice': False, # todo
|
704
|
+
'takeProfitPrice': False,
|
705
|
+
'attachedStopLossTakeProfit': None,
|
706
|
+
'timeInForce': {
|
707
|
+
'IOC': True,
|
708
|
+
'FOK': True,
|
709
|
+
'PO': True,
|
710
|
+
'GTD': False,
|
711
|
+
},
|
712
|
+
'hedged': False,
|
713
|
+
# exchange-supported features
|
714
|
+
'selfTradePrevention': False,
|
715
|
+
'trailing': False,
|
716
|
+
'iceberg': False,
|
717
|
+
},
|
718
|
+
'createOrders': {
|
719
|
+
'max': 20,
|
720
|
+
},
|
721
|
+
'fetchMyTrades': {
|
722
|
+
'marginMode': False,
|
723
|
+
'limit': 100,
|
724
|
+
'daysBack': 30,
|
725
|
+
'untilDays': None,
|
726
|
+
},
|
727
|
+
'fetchOrder': {
|
728
|
+
'marginMode': False,
|
729
|
+
'trigger': False,
|
730
|
+
'trailing': False,
|
731
|
+
},
|
732
|
+
'fetchOpenOrders': {
|
733
|
+
'marginMode': True,
|
734
|
+
'limit': None,
|
735
|
+
'trigger': False,
|
736
|
+
'trailing': False,
|
737
|
+
},
|
738
|
+
'fetchOrders': {
|
739
|
+
'marginMode': True,
|
740
|
+
'limit': 1000,
|
741
|
+
'daysBack': 7,
|
742
|
+
'untilDays': 7,
|
743
|
+
'trigger': False,
|
744
|
+
'trailing': False,
|
745
|
+
},
|
746
|
+
'fetchClosedOrders': {
|
747
|
+
'marginMode': True,
|
748
|
+
'limit': 1000,
|
749
|
+
'daysBackClosed': 7,
|
750
|
+
'daysBackCanceled': 7,
|
751
|
+
'untilDays': 7,
|
752
|
+
'trigger': False,
|
753
|
+
'trailing': False,
|
754
|
+
},
|
755
|
+
'fetchOHLCV': {
|
756
|
+
'limit': 1000,
|
757
|
+
},
|
758
|
+
},
|
759
|
+
'spot': {
|
760
|
+
'extends': 'def',
|
761
|
+
},
|
762
|
+
'forDerivs': {
|
763
|
+
'extends': 'def',
|
764
|
+
'createOrder': {
|
765
|
+
'triggerPrice': True,
|
766
|
+
'triggerPriceType': {
|
767
|
+
'last': True,
|
768
|
+
'mark': True,
|
769
|
+
'index': True,
|
770
|
+
},
|
771
|
+
'triggerDirection': True,
|
772
|
+
'stopLossPrice': False, # todo
|
773
|
+
'takeProfitPrice': False,
|
774
|
+
'hedged': True,
|
775
|
+
},
|
776
|
+
'createOrders': {
|
777
|
+
'max': 50,
|
778
|
+
},
|
779
|
+
'fetchMyTrades': {
|
780
|
+
'marginMode': False,
|
781
|
+
'limit': 100,
|
782
|
+
'daysBack': 90,
|
783
|
+
'untilDays': 90,
|
784
|
+
},
|
785
|
+
'fetchOrder': {
|
786
|
+
'marginMode': False,
|
787
|
+
},
|
788
|
+
'fetchOpenOrders': {
|
789
|
+
'marginMode': False,
|
790
|
+
'limit': 100,
|
791
|
+
'trigger': True,
|
792
|
+
'trailing': False,
|
793
|
+
},
|
794
|
+
'fetchOrders': {
|
795
|
+
'marginMode': False,
|
796
|
+
'limit': 100,
|
797
|
+
'daysBack': 90,
|
798
|
+
'untilDays': 90,
|
799
|
+
'trigger': True,
|
800
|
+
'trailing': False,
|
801
|
+
},
|
802
|
+
'fetchClosedOrders': {
|
803
|
+
'marginMode': False,
|
804
|
+
'limit': 100,
|
805
|
+
'daysBackClosed': 90,
|
806
|
+
'daysBackCanceled': None,
|
807
|
+
'untilDays': 90,
|
808
|
+
'trigger': True,
|
809
|
+
'trailing': False,
|
810
|
+
},
|
811
|
+
'fetchOHLCV': {
|
812
|
+
'limit': 2000,
|
813
|
+
},
|
814
|
+
},
|
815
|
+
'swap': {
|
816
|
+
'linear': {
|
817
|
+
'extends': 'forDerivs',
|
818
|
+
},
|
819
|
+
'inverse': {
|
820
|
+
'extends': 'forDerivs',
|
821
|
+
},
|
822
|
+
},
|
823
|
+
'future': {
|
824
|
+
'linear': None,
|
825
|
+
'inverse': None,
|
826
|
+
},
|
827
|
+
},
|
690
828
|
'commonCurrencies': {
|
691
829
|
'BEYONDPROTOCOL': 'BEYOND',
|
692
830
|
'BIFI': 'BIFIF',
|
@@ -2159,7 +2297,6 @@ class mexc(Exchange, ImplicitAPI):
|
|
2159
2297
|
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
2160
2298
|
:param str [marginMode]: only 'isolated' is supported for spot-margin trading
|
2161
2299
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2162
|
-
:param float [params.triggerPrice]: The price at which a trigger order is triggered at
|
2163
2300
|
:param bool [params.postOnly]: if True, the order will only be posted if it will be a maker order
|
2164
2301
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2165
2302
|
"""
|
@@ -3425,34 +3562,44 @@ class mexc(Exchange, ImplicitAPI):
|
|
3425
3562
|
})
|
3426
3563
|
return result
|
3427
3564
|
|
3428
|
-
def
|
3565
|
+
def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
|
3429
3566
|
"""
|
3430
|
-
fetch the trading fees for
|
3567
|
+
fetch the trading fees for a market
|
3431
3568
|
|
3432
|
-
https://mexcdevelop.github.io/apidocs/spot_v3_en/#
|
3433
|
-
https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-all-informations-of-user-39-s-asset
|
3569
|
+
https://mexcdevelop.github.io/apidocs/spot_v3_en/#query-mx-deduct-status
|
3434
3570
|
|
3571
|
+
:param str symbol: unified market symbol
|
3435
3572
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3436
|
-
:returns dict: a
|
3573
|
+
:returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
|
3437
3574
|
"""
|
3438
3575
|
self.load_markets()
|
3439
|
-
|
3440
|
-
|
3441
|
-
|
3442
|
-
|
3443
|
-
|
3444
|
-
|
3445
|
-
|
3446
|
-
|
3447
|
-
|
3448
|
-
|
3449
|
-
|
3450
|
-
|
3451
|
-
|
3452
|
-
|
3453
|
-
|
3454
|
-
|
3455
|
-
|
3576
|
+
market = self.market(symbol)
|
3577
|
+
if not market['spot']:
|
3578
|
+
raise BadRequest(self.id + ' fetchTradingFee() supports spot markets only')
|
3579
|
+
request: dict = {
|
3580
|
+
'symbol': market['id'],
|
3581
|
+
}
|
3582
|
+
response = self.spotPrivateGetTradeFee(self.extend(request, params))
|
3583
|
+
#
|
3584
|
+
# {
|
3585
|
+
# "data":{
|
3586
|
+
# "makerCommission":0.003000000000000000,
|
3587
|
+
# "takerCommission":0.003000000000000000
|
3588
|
+
# },
|
3589
|
+
# "code":0,
|
3590
|
+
# "msg":"success",
|
3591
|
+
# "timestamp":1669109672717
|
3592
|
+
# }
|
3593
|
+
#
|
3594
|
+
data = self.safe_dict(response, 'data', {})
|
3595
|
+
return {
|
3596
|
+
'info': data,
|
3597
|
+
'symbol': symbol,
|
3598
|
+
'maker': self.safe_number(data, 'makerCommission'),
|
3599
|
+
'taker': self.safe_number(data, 'takerCommission'),
|
3600
|
+
'percentage': None,
|
3601
|
+
'tierBased': None,
|
3602
|
+
}
|
3456
3603
|
|
3457
3604
|
def custom_parse_balance(self, response, marketType) -> Balances:
|
3458
3605
|
#
|
ccxt/ndax.py
CHANGED
@@ -1194,7 +1194,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
1194
1194
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
1195
1195
|
:param int [limit]: max number of ledger entries to return, default is None
|
1196
1196
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1197
|
-
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger
|
1197
|
+
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
|
1198
1198
|
"""
|
1199
1199
|
omsId = self.safe_integer(self.options, 'omsId', 1)
|
1200
1200
|
self.load_markets()
|
ccxt/okcoin.py
CHANGED
@@ -1563,16 +1563,16 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1563
1563
|
:param str id: order id
|
1564
1564
|
:param str symbol: unified symbol of the market the order was made in
|
1565
1565
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1566
|
-
:param bool [params.
|
1566
|
+
:param bool [params.trigger]: True if cancel trigger or conditional orders
|
1567
1567
|
:param bool [params.advanced]: True if canceling advanced orders only
|
1568
1568
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1569
1569
|
"""
|
1570
1570
|
if symbol is None:
|
1571
1571
|
raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
|
1572
1572
|
self.load_markets()
|
1573
|
-
|
1573
|
+
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
1574
1574
|
advanced = self.safe_value(params, 'advanced')
|
1575
|
-
if
|
1575
|
+
if trigger or advanced:
|
1576
1576
|
orderInner = self.cancel_orders([id], symbol, params)
|
1577
1577
|
return self.safe_value(orderInner, 0)
|
1578
1578
|
market = self.market(symbol)
|
@@ -1620,7 +1620,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1620
1620
|
if symbol is None:
|
1621
1621
|
raise ArgumentsRequired(self.id + ' cancelOrders() requires a symbol argument')
|
1622
1622
|
self.load_markets()
|
1623
|
-
|
1623
|
+
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
1624
1624
|
advanced = self.safe_value(params, 'advanced')
|
1625
1625
|
params = self.omit(params, ['stop', 'trigger', 'advanced'])
|
1626
1626
|
market = self.market(symbol)
|
@@ -1636,7 +1636,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1636
1636
|
'instId': market['id'],
|
1637
1637
|
})
|
1638
1638
|
for i in range(0, len(ids)):
|
1639
|
-
if
|
1639
|
+
if trigger or advanced:
|
1640
1640
|
request.append({
|
1641
1641
|
'algoId': ids[i],
|
1642
1642
|
'instId': market['id'],
|
@@ -1653,7 +1653,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1653
1653
|
'clOrdId': clientOrderIds[i],
|
1654
1654
|
})
|
1655
1655
|
response = None
|
1656
|
-
if
|
1656
|
+
if trigger:
|
1657
1657
|
response = self.privatePostTradeCancelAlgos(request)
|
1658
1658
|
elif advanced:
|
1659
1659
|
response = self.privatePostTradeCancelAdvanceAlgos(request)
|
@@ -1901,8 +1901,8 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1901
1901
|
# 'ordId': id,
|
1902
1902
|
}
|
1903
1903
|
clientOrderId = self.safe_string_2(params, 'clOrdId', 'clientOrderId')
|
1904
|
-
|
1905
|
-
if
|
1904
|
+
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
1905
|
+
if trigger:
|
1906
1906
|
if clientOrderId is not None:
|
1907
1907
|
request['algoClOrdId'] = clientOrderId
|
1908
1908
|
else:
|
@@ -1914,7 +1914,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1914
1914
|
request['ordId'] = id
|
1915
1915
|
query = self.omit(params, ['clientOrderId', 'stop', 'trigger'])
|
1916
1916
|
response = None
|
1917
|
-
if
|
1917
|
+
if trigger:
|
1918
1918
|
response = self.privateGetTradeOrderAlgo(self.extend(request, query))
|
1919
1919
|
else:
|
1920
1920
|
response = self.privateGetTradeOrder(self.extend(request, query))
|
@@ -1933,7 +1933,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1933
1933
|
:param int [since]: the earliest time in ms to fetch open orders for
|
1934
1934
|
:param int [limit]: the maximum number of open orders structures to retrieve
|
1935
1935
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1936
|
-
:param bool [params.
|
1936
|
+
:param bool [params.trigger]: True if fetching trigger or conditional orders
|
1937
1937
|
:param str [params.ordType]: "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
1938
1938
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
1939
1939
|
"""
|
@@ -1953,12 +1953,12 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1953
1953
|
if limit is not None:
|
1954
1954
|
request['limit'] = limit # default 100, max 100
|
1955
1955
|
ordType = self.safe_string(params, 'ordType')
|
1956
|
-
|
1957
|
-
if
|
1956
|
+
trigger = self.safe_value(params, 'stop') or (self.safe_string(params, 'ordType') is not None)
|
1957
|
+
if trigger and (ordType is None):
|
1958
1958
|
request['ordType'] = 'trigger' # default to trigger
|
1959
1959
|
params = self.omit(params, ['stop'])
|
1960
1960
|
response = None
|
1961
|
-
if
|
1961
|
+
if trigger:
|
1962
1962
|
response = self.privateGetTradeOrdersAlgoPending(self.extend(request, params))
|
1963
1963
|
else:
|
1964
1964
|
response = self.privateGetTradeOrdersPending(self.extend(request, params))
|
@@ -1977,7 +1977,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1977
1977
|
:param int [since]: the earliest time in ms to fetch orders for
|
1978
1978
|
:param int [limit]: the maximum number of order structures to retrieve
|
1979
1979
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1980
|
-
:param bool [params.
|
1980
|
+
:param bool [params.trigger]: True if fetching trigger or conditional orders
|
1981
1981
|
:param str [params.ordType]: "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
1982
1982
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
1983
1983
|
"""
|
@@ -1990,12 +1990,12 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1990
1990
|
market = self.market(symbol)
|
1991
1991
|
request['instId'] = market['id']
|
1992
1992
|
ordType = self.safe_string(params, 'ordType')
|
1993
|
-
|
1994
|
-
if
|
1993
|
+
trigger = self.safe_value(params, 'stop') or (self.safe_string(params, 'ordType') is not None)
|
1994
|
+
if trigger and (ordType is None):
|
1995
1995
|
request['ordType'] = 'trigger' # default to trigger
|
1996
1996
|
params = self.omit(params, ['stop'])
|
1997
1997
|
response = None
|
1998
|
-
if
|
1998
|
+
if trigger:
|
1999
1999
|
response = self.privateGetTradeOrdersAlgoHistory(self.extend(request, params))
|
2000
2000
|
else:
|
2001
2001
|
method = None
|
@@ -2726,7 +2726,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2726
2726
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
2727
2727
|
:param int [limit]: max number of ledger entries to return, default is None
|
2728
2728
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2729
|
-
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger
|
2729
|
+
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
|
2730
2730
|
"""
|
2731
2731
|
self.load_markets()
|
2732
2732
|
method = None
|
ccxt/okx.py
CHANGED
@@ -2242,6 +2242,7 @@ class okx(Exchange, ImplicitAPI):
|
|
2242
2242
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
2243
2243
|
:param int [limit]: the maximum amount of trades to fetch
|
2244
2244
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2245
|
+
:param str [params.method]: 'publicGetMarketTrades' or 'publicGetMarketHistoryTrades' default is 'publicGetMarketTrades'
|
2245
2246
|
:param boolean [params.paginate]: *only applies to publicGetMarketHistoryTrades* default False, when True will automatically paginate by calling self endpoint multiple times
|
2246
2247
|
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
|
2247
2248
|
"""
|
@@ -3253,9 +3254,9 @@ class okx(Exchange, ImplicitAPI):
|
|
3253
3254
|
"""
|
3254
3255
|
if symbol is None:
|
3255
3256
|
raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
|
3256
|
-
|
3257
|
+
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
3257
3258
|
trailing = self.safe_bool(params, 'trailing', False)
|
3258
|
-
if
|
3259
|
+
if trigger or trailing:
|
3259
3260
|
orderInner = self.cancel_orders([id], symbol, params)
|
3260
3261
|
return self.safe_value(orderInner, 0)
|
3261
3262
|
self.load_markets()
|
@@ -3313,9 +3314,9 @@ class okx(Exchange, ImplicitAPI):
|
|
3313
3314
|
method = self.safe_string(params, 'method', defaultMethod)
|
3314
3315
|
clientOrderIds = self.parse_ids(self.safe_value_2(params, 'clOrdId', 'clientOrderId'))
|
3315
3316
|
algoIds = self.parse_ids(self.safe_value(params, 'algoId'))
|
3316
|
-
|
3317
|
+
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
3317
3318
|
trailing = self.safe_bool(params, 'trailing', False)
|
3318
|
-
if
|
3319
|
+
if trigger or trailing:
|
3319
3320
|
method = 'privatePostTradeCancelAlgos'
|
3320
3321
|
if clientOrderIds is None:
|
3321
3322
|
ids = self.parse_ids(ids)
|
@@ -3326,7 +3327,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3326
3327
|
'instId': market['id'],
|
3327
3328
|
})
|
3328
3329
|
for i in range(0, len(ids)):
|
3329
|
-
if trailing or
|
3330
|
+
if trailing or trigger:
|
3330
3331
|
request.append({
|
3331
3332
|
'algoId': ids[i],
|
3332
3333
|
'instId': market['id'],
|
@@ -3397,9 +3398,9 @@ class okx(Exchange, ImplicitAPI):
|
|
3397
3398
|
options = self.safe_dict(self.options, 'cancelOrders', {})
|
3398
3399
|
defaultMethod = self.safe_string(options, 'method', 'privatePostTradeCancelBatchOrders')
|
3399
3400
|
method = self.safe_string(params, 'method', defaultMethod)
|
3400
|
-
|
3401
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
3401
3402
|
trailing = self.safe_bool(params, 'trailing', False)
|
3402
|
-
isStopOrTrailing =
|
3403
|
+
isStopOrTrailing = trigger or trailing
|
3403
3404
|
if isStopOrTrailing:
|
3404
3405
|
method = 'privatePostTradeCancelAlgos'
|
3405
3406
|
for i in range(0, len(orders)):
|
@@ -3722,8 +3723,8 @@ class okx(Exchange, ImplicitAPI):
|
|
3722
3723
|
options = self.safe_value(self.options, 'fetchOrder', {})
|
3723
3724
|
defaultMethod = self.safe_string(options, 'method', 'privateGetTradeOrder')
|
3724
3725
|
method = self.safe_string(params, 'method', defaultMethod)
|
3725
|
-
|
3726
|
-
if
|
3726
|
+
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
3727
|
+
if trigger:
|
3727
3728
|
method = 'privateGetTradeOrderAlgo'
|
3728
3729
|
if clientOrderId is not None:
|
3729
3730
|
request['algoClOrdId'] = clientOrderId
|
@@ -3851,7 +3852,7 @@ class okx(Exchange, ImplicitAPI):
|
|
3851
3852
|
:param int [since]: the earliest time in ms to fetch open orders for
|
3852
3853
|
:param int [limit]: the maximum number of open orders structures to retrieve
|
3853
3854
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3854
|
-
:param bool [params.
|
3855
|
+
:param bool [params.trigger]: True if fetching trigger or conditional orders
|
3855
3856
|
:param str [params.ordType]: "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
3856
3857
|
:param str [params.algoId]: Algo ID "'433845797218942976'"
|
3857
3858
|
: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)
|
@@ -3884,13 +3885,13 @@ class okx(Exchange, ImplicitAPI):
|
|
3884
3885
|
defaultMethod = self.safe_string(options, 'method', 'privateGetTradeOrdersPending')
|
3885
3886
|
method = self.safe_string(params, 'method', defaultMethod)
|
3886
3887
|
ordType = self.safe_string(params, 'ordType')
|
3887
|
-
|
3888
|
+
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
3888
3889
|
trailing = self.safe_bool(params, 'trailing', False)
|
3889
|
-
if trailing or
|
3890
|
+
if trailing or trigger or (ordType in algoOrderTypes):
|
3890
3891
|
method = 'privateGetTradeOrdersAlgoPending'
|
3891
3892
|
if trailing:
|
3892
3893
|
request['ordType'] = 'move_order_stop'
|
3893
|
-
elif
|
3894
|
+
elif trigger and (ordType is None):
|
3894
3895
|
request['ordType'] = 'trigger'
|
3895
3896
|
query = self.omit(params, ['method', 'stop', 'trigger', 'trailing'])
|
3896
3897
|
response = None
|
@@ -4007,7 +4008,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4007
4008
|
:param int [since]: timestamp in ms of the earliest order, default is None
|
4008
4009
|
:param int [limit]: max number of orders to return, default is None
|
4009
4010
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4010
|
-
:param bool [params.
|
4011
|
+
:param bool [params.trigger]: True if fetching trigger or conditional orders
|
4011
4012
|
:param str [params.ordType]: "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
4012
4013
|
:param str [params.algoId]: Algo ID "'433845797218942976'"
|
4013
4014
|
:param int [params.until]: timestamp in ms to fetch orders for
|
@@ -4042,18 +4043,18 @@ class okx(Exchange, ImplicitAPI):
|
|
4042
4043
|
defaultMethod = self.safe_string(options, 'method', 'privateGetTradeOrdersHistory')
|
4043
4044
|
method = self.safe_string(params, 'method', defaultMethod)
|
4044
4045
|
ordType = self.safe_string(params, 'ordType')
|
4045
|
-
|
4046
|
+
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
4046
4047
|
trailing = self.safe_bool(params, 'trailing', False)
|
4047
4048
|
if trailing:
|
4048
4049
|
method = 'privateGetTradeOrdersAlgoHistory'
|
4049
4050
|
request['ordType'] = 'move_order_stop'
|
4050
|
-
elif
|
4051
|
+
elif trigger or (ordType in algoOrderTypes):
|
4051
4052
|
method = 'privateGetTradeOrdersAlgoHistory'
|
4052
4053
|
algoId = self.safe_string(params, 'algoId')
|
4053
4054
|
if algoId is not None:
|
4054
4055
|
request['algoId'] = algoId
|
4055
4056
|
params = self.omit(params, 'algoId')
|
4056
|
-
if
|
4057
|
+
if trigger:
|
4057
4058
|
if ordType is None:
|
4058
4059
|
raise ArgumentsRequired(self.id + ' fetchCanceledOrders() requires an "ordType" string parameter, "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"')
|
4059
4060
|
else:
|
@@ -4223,14 +4224,14 @@ class okx(Exchange, ImplicitAPI):
|
|
4223
4224
|
defaultMethod = self.safe_string(options, 'method', 'privateGetTradeOrdersHistory')
|
4224
4225
|
method = self.safe_string(params, 'method', defaultMethod)
|
4225
4226
|
ordType = self.safe_string(params, 'ordType')
|
4226
|
-
|
4227
|
+
trigger = self.safe_bool_2(params, 'stop', 'trigger')
|
4227
4228
|
trailing = self.safe_bool(params, 'trailing', False)
|
4228
|
-
if trailing or
|
4229
|
+
if trailing or trigger or (ordType in algoOrderTypes):
|
4229
4230
|
method = 'privateGetTradeOrdersAlgoHistory'
|
4230
4231
|
request['state'] = 'effective'
|
4231
4232
|
if trailing:
|
4232
4233
|
request['ordType'] = 'move_order_stop'
|
4233
|
-
elif
|
4234
|
+
elif trigger:
|
4234
4235
|
if ordType is None:
|
4235
4236
|
request['ordType'] = 'trigger'
|
4236
4237
|
else:
|
@@ -4452,7 +4453,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4452
4453
|
:param str [params.marginMode]: 'cross' or 'isolated'
|
4453
4454
|
:param int [params.until]: the latest time in ms to fetch entries for
|
4454
4455
|
: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)
|
4455
|
-
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger
|
4456
|
+
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
|
4456
4457
|
"""
|
4457
4458
|
self.load_markets()
|
4458
4459
|
paginate = False
|
ccxt/phemex.py
CHANGED
@@ -2804,15 +2804,15 @@ class phemex(Exchange, ImplicitAPI):
|
|
2804
2804
|
raise ArgumentsRequired(self.id + ' cancelAllOrders() requires a symbol argument')
|
2805
2805
|
self.load_markets()
|
2806
2806
|
market = self.market(symbol)
|
2807
|
-
|
2808
|
-
params = self.omit(params, 'stop', 'trigger')
|
2807
|
+
trigger = self.safe_value_2(params, 'stop', 'trigger', False)
|
2808
|
+
params = self.omit(params, ['stop', 'trigger'])
|
2809
2809
|
request: dict = {
|
2810
2810
|
'symbol': market['id'],
|
2811
2811
|
# 'untriggerred': False, # False to cancel non-conditional orders, True to cancel conditional orders
|
2812
2812
|
# 'text': 'up to 40 characters max',
|
2813
2813
|
}
|
2814
|
-
if
|
2815
|
-
request['untriggerred'] =
|
2814
|
+
if trigger:
|
2815
|
+
request['untriggerred'] = trigger
|
2816
2816
|
response = None
|
2817
2817
|
if market['settle'] == 'USDT':
|
2818
2818
|
response = self.privateDeleteGOrdersAll(self.extend(request, params))
|
@@ -3894,19 +3894,23 @@ class phemex(Exchange, ImplicitAPI):
|
|
3894
3894
|
marketId = self.safe_string(contract, 'symbol')
|
3895
3895
|
symbol = self.safe_symbol(marketId, market)
|
3896
3896
|
timestamp = self.safe_integer_product(contract, 'timestamp', 0.000001)
|
3897
|
+
markEp = self.from_ep(self.safe_string(contract, 'markEp'), market)
|
3898
|
+
indexEp = self.from_ep(self.safe_string(contract, 'indexEp'), market)
|
3899
|
+
fundingRateEr = self.from_er(self.safe_string(contract, 'fundingRateEr'), market)
|
3900
|
+
nextFundingRateEr = self.from_er(self.safe_string(contract, 'predFundingRateEr'), market)
|
3897
3901
|
return {
|
3898
3902
|
'info': contract,
|
3899
3903
|
'symbol': symbol,
|
3900
|
-
'markPrice': self.
|
3901
|
-
'indexPrice': self.
|
3904
|
+
'markPrice': self.safe_number(contract, 'markPriceRp', markEp),
|
3905
|
+
'indexPrice': self.safe_number(contract, 'indexPriceRp', indexEp),
|
3902
3906
|
'interestRate': None,
|
3903
3907
|
'estimatedSettlePrice': None,
|
3904
3908
|
'timestamp': timestamp,
|
3905
3909
|
'datetime': self.iso8601(timestamp),
|
3906
|
-
'fundingRate': self.
|
3910
|
+
'fundingRate': self.safe_number(contract, 'fundingRateRr', fundingRateEr),
|
3907
3911
|
'fundingTimestamp': None,
|
3908
3912
|
'fundingDatetime': None,
|
3909
|
-
'nextFundingRate': self.
|
3913
|
+
'nextFundingRate': self.safe_number(contract, 'predFundingRateRr', nextFundingRateEr),
|
3910
3914
|
'nextFundingTimestamp': None,
|
3911
3915
|
'nextFundingDatetime': None,
|
3912
3916
|
'previousFundingRate': None,
|
ccxt/poloniex.py
CHANGED
@@ -1201,7 +1201,7 @@ class poloniex(Exchange, ImplicitAPI):
|
|
1201
1201
|
:param int [since]: the earliest time in ms to fetch open orders for
|
1202
1202
|
:param int [limit]: the maximum number of open orders structures to retrieve
|
1203
1203
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1204
|
-
:param boolean [params.
|
1204
|
+
:param boolean [params.trigger]: set True to fetch trigger orders instead of regular orders
|
1205
1205
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
1206
1206
|
"""
|
1207
1207
|
self.load_markets()
|
ccxt/poloniexfutures.py
CHANGED
@@ -1180,17 +1180,17 @@ class poloniexfutures(Exchange, ImplicitAPI):
|
|
1180
1180
|
cancel all open orders
|
1181
1181
|
:param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
1182
1182
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1183
|
-
:param dict [params.
|
1183
|
+
:param dict [params.trigger]: When True, all the trigger orders will be cancelled
|
1184
1184
|
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
1185
1185
|
"""
|
1186
1186
|
self.load_markets()
|
1187
1187
|
request: dict = {}
|
1188
1188
|
if symbol is not None:
|
1189
1189
|
request['symbol'] = self.market_id(symbol)
|
1190
|
-
|
1190
|
+
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
1191
1191
|
params = self.omit(params, ['stop', 'trigger'])
|
1192
1192
|
response = None
|
1193
|
-
if
|
1193
|
+
if trigger:
|
1194
1194
|
response = self.privateDeleteStopOrders(self.extend(request, params))
|
1195
1195
|
else:
|
1196
1196
|
response = self.privateDeleteOrders(self.extend(request, params))
|
@@ -1254,13 +1254,13 @@ class poloniexfutures(Exchange, ImplicitAPI):
|
|
1254
1254
|
:returns: An `array of order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
1255
1255
|
"""
|
1256
1256
|
self.load_markets()
|
1257
|
-
|
1257
|
+
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
1258
1258
|
until = self.safe_integer(params, 'until')
|
1259
1259
|
params = self.omit(params, ['trigger', 'stop', 'until'])
|
1260
1260
|
if status == 'closed':
|
1261
1261
|
status = 'done'
|
1262
1262
|
request: dict = {}
|
1263
|
-
if not
|
1263
|
+
if not trigger:
|
1264
1264
|
request['status'] = 'active' if (status == 'open') else 'done'
|
1265
1265
|
elif status != 'open':
|
1266
1266
|
raise BadRequest(self.id + ' fetchOrdersByStatus() can only fetch untriggered stop orders')
|
@@ -1273,7 +1273,7 @@ class poloniexfutures(Exchange, ImplicitAPI):
|
|
1273
1273
|
if until is not None:
|
1274
1274
|
request['endAt'] = until
|
1275
1275
|
response = None
|
1276
|
-
if
|
1276
|
+
if trigger:
|
1277
1277
|
response = self.privateGetStopOrders(self.extend(request, params))
|
1278
1278
|
else:
|
1279
1279
|
response = self.privateGetOrders(self.extend(request, params))
|