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.
Files changed (140) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/digifinex.py +1 -0
  3. ccxt/abstract/mexc.py +1 -0
  4. ccxt/abstract/woo.py +2 -2
  5. ccxt/alpaca.py +74 -3
  6. ccxt/ascendex.py +9 -9
  7. ccxt/async_support/__init__.py +1 -1
  8. ccxt/async_support/alpaca.py +74 -3
  9. ccxt/async_support/ascendex.py +9 -9
  10. ccxt/async_support/base/exchange.py +1 -1
  11. ccxt/async_support/base/ws/aiohttp_client.py +2 -2
  12. ccxt/async_support/binance.py +13 -17
  13. ccxt/async_support/bingx.py +1 -2
  14. ccxt/async_support/bit2c.py +0 -1
  15. ccxt/async_support/bitbank.py +0 -1
  16. ccxt/async_support/bitbns.py +0 -1
  17. ccxt/async_support/bitfinex.py +15 -16
  18. ccxt/async_support/bitfinex1.py +0 -1
  19. ccxt/async_support/bitflyer.py +0 -1
  20. ccxt/async_support/bitget.py +1 -2
  21. ccxt/async_support/bithumb.py +0 -1
  22. ccxt/async_support/bitmart.py +3 -4
  23. ccxt/async_support/bitmex.py +5 -6
  24. ccxt/async_support/bitopro.py +4 -5
  25. ccxt/async_support/bitrue.py +5 -7
  26. ccxt/async_support/bitso.py +1 -2
  27. ccxt/async_support/bitstamp.py +1 -2
  28. ccxt/async_support/bitteam.py +1 -3
  29. ccxt/async_support/bitvavo.py +2 -4
  30. ccxt/async_support/blockchaincom.py +5 -5
  31. ccxt/async_support/blofin.py +10 -10
  32. ccxt/async_support/btcalpha.py +0 -1
  33. ccxt/async_support/btcbox.py +0 -1
  34. ccxt/async_support/btcmarkets.py +1 -3
  35. ccxt/async_support/bybit.py +2 -3
  36. ccxt/async_support/cex.py +1 -1
  37. ccxt/async_support/coinbase.py +77 -1
  38. ccxt/async_support/coinbaseexchange.py +1 -1
  39. ccxt/async_support/coinbaseinternational.py +62 -0
  40. ccxt/async_support/coincatch.py +1 -1
  41. ccxt/async_support/coinex.py +9 -9
  42. ccxt/async_support/coinlist.py +1 -1
  43. ccxt/async_support/coinmetro.py +1 -1
  44. ccxt/async_support/cryptocom.py +91 -2
  45. ccxt/async_support/currencycom.py +1 -1
  46. ccxt/async_support/defx.py +1 -2
  47. ccxt/async_support/delta.py +1 -1
  48. ccxt/async_support/digifinex.py +58 -19
  49. ccxt/async_support/exmo.py +2 -2
  50. ccxt/async_support/gate.py +1 -1
  51. ccxt/async_support/hashkey.py +3 -5
  52. ccxt/async_support/htx.py +155 -33
  53. ccxt/async_support/hyperliquid.py +1 -1
  54. ccxt/async_support/kraken.py +1 -1
  55. ccxt/async_support/kucoin.py +25 -24
  56. ccxt/async_support/luno.py +1 -1
  57. ccxt/async_support/mexc.py +173 -26
  58. ccxt/async_support/ndax.py +1 -1
  59. ccxt/async_support/okcoin.py +18 -18
  60. ccxt/async_support/okx.py +22 -21
  61. ccxt/async_support/phemex.py +12 -8
  62. ccxt/async_support/poloniex.py +1 -1
  63. ccxt/async_support/poloniexfutures.py +6 -6
  64. ccxt/async_support/vertex.py +11 -11
  65. ccxt/async_support/woo.py +39 -39
  66. ccxt/async_support/woofipro.py +24 -24
  67. ccxt/async_support/xt.py +26 -26
  68. ccxt/async_support/zonda.py +1 -1
  69. ccxt/base/exchange.py +32 -25
  70. ccxt/binance.py +13 -17
  71. ccxt/bingx.py +1 -2
  72. ccxt/bit2c.py +0 -1
  73. ccxt/bitbank.py +0 -1
  74. ccxt/bitbns.py +0 -1
  75. ccxt/bitfinex.py +15 -16
  76. ccxt/bitfinex1.py +0 -1
  77. ccxt/bitflyer.py +0 -1
  78. ccxt/bitget.py +1 -2
  79. ccxt/bithumb.py +0 -1
  80. ccxt/bitmart.py +3 -4
  81. ccxt/bitmex.py +5 -6
  82. ccxt/bitopro.py +4 -5
  83. ccxt/bitrue.py +5 -7
  84. ccxt/bitso.py +1 -2
  85. ccxt/bitstamp.py +1 -2
  86. ccxt/bitteam.py +1 -3
  87. ccxt/bitvavo.py +2 -4
  88. ccxt/blockchaincom.py +5 -5
  89. ccxt/blofin.py +10 -10
  90. ccxt/btcalpha.py +0 -1
  91. ccxt/btcbox.py +0 -1
  92. ccxt/btcmarkets.py +1 -3
  93. ccxt/bybit.py +2 -3
  94. ccxt/cex.py +1 -1
  95. ccxt/coinbase.py +77 -1
  96. ccxt/coinbaseexchange.py +1 -1
  97. ccxt/coinbaseinternational.py +62 -0
  98. ccxt/coincatch.py +1 -1
  99. ccxt/coinex.py +9 -9
  100. ccxt/coinlist.py +1 -1
  101. ccxt/coinmetro.py +1 -1
  102. ccxt/cryptocom.py +91 -2
  103. ccxt/currencycom.py +1 -1
  104. ccxt/defx.py +1 -2
  105. ccxt/delta.py +1 -1
  106. ccxt/digifinex.py +58 -19
  107. ccxt/exmo.py +2 -2
  108. ccxt/gate.py +1 -1
  109. ccxt/hashkey.py +3 -5
  110. ccxt/htx.py +155 -33
  111. ccxt/hyperliquid.py +1 -1
  112. ccxt/kraken.py +1 -1
  113. ccxt/kucoin.py +25 -24
  114. ccxt/luno.py +1 -1
  115. ccxt/mexc.py +173 -26
  116. ccxt/ndax.py +1 -1
  117. ccxt/okcoin.py +18 -18
  118. ccxt/okx.py +22 -21
  119. ccxt/phemex.py +12 -8
  120. ccxt/poloniex.py +1 -1
  121. ccxt/poloniexfutures.py +6 -6
  122. ccxt/pro/__init__.py +1 -1
  123. ccxt/pro/bitget.py +1 -1
  124. ccxt/pro/bybit.py +12 -1
  125. ccxt/pro/coinex.py +2 -2
  126. ccxt/pro/gate.py +6 -6
  127. ccxt/pro/kucoin.py +3 -3
  128. ccxt/pro/okx.py +11 -11
  129. ccxt/pro/upbit.py +2 -2
  130. ccxt/pro/woo.py +1 -1
  131. ccxt/vertex.py +11 -11
  132. ccxt/woo.py +39 -39
  133. ccxt/woofipro.py +24 -24
  134. ccxt/xt.py +26 -26
  135. ccxt/zonda.py +1 -1
  136. {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/METADATA +4 -4
  137. {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/RECORD +140 -140
  138. {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/LICENSE.txt +0 -0
  139. {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/WHEEL +0 -0
  140. {ccxt-4.4.38.dist-info → ccxt-4.4.40.dist-info}/top_level.txt +0 -0
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.mexc import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
- 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, TradingFees, Transaction, TransferEntry
10
+ 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
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
@@ -133,8 +133,8 @@ class mexc(Exchange, ImplicitAPI):
133
133
  'fetchTickers': True,
134
134
  'fetchTime': True,
135
135
  'fetchTrades': True,
136
- 'fetchTradingFee': None,
137
- 'fetchTradingFees': True,
136
+ 'fetchTradingFee': True,
137
+ 'fetchTradingFees': False,
138
138
  'fetchTradingLimits': None,
139
139
  'fetchTransactionFee': 'emulated',
140
140
  'fetchTransactionFees': True,
@@ -207,6 +207,7 @@ class mexc(Exchange, ImplicitAPI):
207
207
  'allOrders': 10,
208
208
  'account': 10,
209
209
  'myTrades': 10,
210
+ 'tradeFee': 10,
210
211
  'sub-account/list': 1,
211
212
  'sub-account/apiKey': 1,
212
213
  'capital/config/getall': 10,
@@ -688,6 +689,143 @@ class mexc(Exchange, ImplicitAPI):
688
689
  'maxTimeTillEnd': 90 * 86400 * 1000 - 1, # 90 days
689
690
  'broker': 'CCXT',
690
691
  },
692
+ 'features': {
693
+ 'def': {
694
+ 'sandbox': False,
695
+ 'createOrder': {
696
+ 'marginMode': True,
697
+ 'triggerPrice': False,
698
+ 'triggerDirection': False,
699
+ 'triggerPriceType': {
700
+ 'last': False,
701
+ 'mark': False,
702
+ 'index': False,
703
+ },
704
+ 'stopLossPrice': False, # todo
705
+ 'takeProfitPrice': False,
706
+ 'attachedStopLossTakeProfit': None,
707
+ 'timeInForce': {
708
+ 'IOC': True,
709
+ 'FOK': True,
710
+ 'PO': True,
711
+ 'GTD': False,
712
+ },
713
+ 'hedged': False,
714
+ # exchange-supported features
715
+ 'selfTradePrevention': False,
716
+ 'trailing': False,
717
+ 'iceberg': False,
718
+ },
719
+ 'createOrders': {
720
+ 'max': 20,
721
+ },
722
+ 'fetchMyTrades': {
723
+ 'marginMode': False,
724
+ 'limit': 100,
725
+ 'daysBack': 30,
726
+ 'untilDays': None,
727
+ },
728
+ 'fetchOrder': {
729
+ 'marginMode': False,
730
+ 'trigger': False,
731
+ 'trailing': False,
732
+ },
733
+ 'fetchOpenOrders': {
734
+ 'marginMode': True,
735
+ 'limit': None,
736
+ 'trigger': False,
737
+ 'trailing': False,
738
+ },
739
+ 'fetchOrders': {
740
+ 'marginMode': True,
741
+ 'limit': 1000,
742
+ 'daysBack': 7,
743
+ 'untilDays': 7,
744
+ 'trigger': False,
745
+ 'trailing': False,
746
+ },
747
+ 'fetchClosedOrders': {
748
+ 'marginMode': True,
749
+ 'limit': 1000,
750
+ 'daysBackClosed': 7,
751
+ 'daysBackCanceled': 7,
752
+ 'untilDays': 7,
753
+ 'trigger': False,
754
+ 'trailing': False,
755
+ },
756
+ 'fetchOHLCV': {
757
+ 'limit': 1000,
758
+ },
759
+ },
760
+ 'spot': {
761
+ 'extends': 'def',
762
+ },
763
+ 'forDerivs': {
764
+ 'extends': 'def',
765
+ 'createOrder': {
766
+ 'triggerPrice': True,
767
+ 'triggerPriceType': {
768
+ 'last': True,
769
+ 'mark': True,
770
+ 'index': True,
771
+ },
772
+ 'triggerDirection': True,
773
+ 'stopLossPrice': False, # todo
774
+ 'takeProfitPrice': False,
775
+ 'hedged': True,
776
+ },
777
+ 'createOrders': {
778
+ 'max': 50,
779
+ },
780
+ 'fetchMyTrades': {
781
+ 'marginMode': False,
782
+ 'limit': 100,
783
+ 'daysBack': 90,
784
+ 'untilDays': 90,
785
+ },
786
+ 'fetchOrder': {
787
+ 'marginMode': False,
788
+ },
789
+ 'fetchOpenOrders': {
790
+ 'marginMode': False,
791
+ 'limit': 100,
792
+ 'trigger': True,
793
+ 'trailing': False,
794
+ },
795
+ 'fetchOrders': {
796
+ 'marginMode': False,
797
+ 'limit': 100,
798
+ 'daysBack': 90,
799
+ 'untilDays': 90,
800
+ 'trigger': True,
801
+ 'trailing': False,
802
+ },
803
+ 'fetchClosedOrders': {
804
+ 'marginMode': False,
805
+ 'limit': 100,
806
+ 'daysBackClosed': 90,
807
+ 'daysBackCanceled': None,
808
+ 'untilDays': 90,
809
+ 'trigger': True,
810
+ 'trailing': False,
811
+ },
812
+ 'fetchOHLCV': {
813
+ 'limit': 2000,
814
+ },
815
+ },
816
+ 'swap': {
817
+ 'linear': {
818
+ 'extends': 'forDerivs',
819
+ },
820
+ 'inverse': {
821
+ 'extends': 'forDerivs',
822
+ },
823
+ },
824
+ 'future': {
825
+ 'linear': None,
826
+ 'inverse': None,
827
+ },
828
+ },
691
829
  'commonCurrencies': {
692
830
  'BEYONDPROTOCOL': 'BEYOND',
693
831
  'BIFI': 'BIFIF',
@@ -2160,7 +2298,6 @@ class mexc(Exchange, ImplicitAPI):
2160
2298
  :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
2161
2299
  :param str [marginMode]: only 'isolated' is supported for spot-margin trading
2162
2300
  :param dict [params]: extra parameters specific to the exchange API endpoint
2163
- :param float [params.triggerPrice]: The price at which a trigger order is triggered at
2164
2301
  :param bool [params.postOnly]: if True, the order will only be posted if it will be a maker order
2165
2302
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
2166
2303
  """
@@ -3426,34 +3563,44 @@ class mexc(Exchange, ImplicitAPI):
3426
3563
  })
3427
3564
  return result
3428
3565
 
3429
- async def fetch_trading_fees(self, params={}) -> TradingFees:
3566
+ async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
3430
3567
  """
3431
- fetch the trading fees for multiple markets
3568
+ fetch the trading fees for a market
3432
3569
 
3433
- https://mexcdevelop.github.io/apidocs/spot_v3_en/#account-information
3434
- https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-all-informations-of-user-39-s-asset
3570
+ https://mexcdevelop.github.io/apidocs/spot_v3_en/#query-mx-deduct-status
3435
3571
 
3572
+ :param str symbol: unified market symbol
3436
3573
  :param dict [params]: extra parameters specific to the exchange API endpoint
3437
- :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
3574
+ :returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
3438
3575
  """
3439
3576
  await self.load_markets()
3440
- response = await self.fetch_account_helper('spot', params)
3441
- makerFee = self.safe_string(response, 'makerCommission')
3442
- takerFee = self.safe_string(response, 'takerCommission')
3443
- makerFee = Precise.string_div(makerFee, '1000')
3444
- takerFee = Precise.string_div(takerFee, '1000')
3445
- result: dict = {}
3446
- for i in range(0, len(self.symbols)):
3447
- symbol = self.symbols[i]
3448
- result[symbol] = {
3449
- 'symbol': symbol,
3450
- 'maker': self.parse_number(makerFee),
3451
- 'taker': self.parse_number(takerFee),
3452
- 'percentage': True,
3453
- 'tierBased': False,
3454
- 'info': response,
3455
- }
3456
- return result
3577
+ market = self.market(symbol)
3578
+ if not market['spot']:
3579
+ raise BadRequest(self.id + ' fetchTradingFee() supports spot markets only')
3580
+ request: dict = {
3581
+ 'symbol': market['id'],
3582
+ }
3583
+ response = await self.spotPrivateGetTradeFee(self.extend(request, params))
3584
+ #
3585
+ # {
3586
+ # "data":{
3587
+ # "makerCommission":0.003000000000000000,
3588
+ # "takerCommission":0.003000000000000000
3589
+ # },
3590
+ # "code":0,
3591
+ # "msg":"success",
3592
+ # "timestamp":1669109672717
3593
+ # }
3594
+ #
3595
+ data = self.safe_dict(response, 'data', {})
3596
+ return {
3597
+ 'info': data,
3598
+ 'symbol': symbol,
3599
+ 'maker': self.safe_number(data, 'makerCommission'),
3600
+ 'taker': self.safe_number(data, 'takerCommission'),
3601
+ 'percentage': None,
3602
+ 'tierBased': None,
3603
+ }
3457
3604
 
3458
3605
  def custom_parse_balance(self, response, marketType) -> Balances:
3459
3606
  #
@@ -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-structure>`
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
  await self.load_markets()
@@ -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.stop]: True if cancel trigger or conditional orders
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
  await self.load_markets()
1573
- stop = self.safe_value_2(params, 'stop', 'trigger')
1573
+ trigger = self.safe_value_2(params, 'stop', 'trigger')
1574
1574
  advanced = self.safe_value(params, 'advanced')
1575
- if stop or advanced:
1575
+ if trigger or advanced:
1576
1576
  orderInner = await 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
  await self.load_markets()
1623
- stop = self.safe_value_2(params, 'stop', 'trigger')
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 stop or advanced:
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 stop:
1656
+ if trigger:
1657
1657
  response = await self.privatePostTradeCancelAlgos(request)
1658
1658
  elif advanced:
1659
1659
  response = await 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
- stop = self.safe_value_2(params, 'stop', 'trigger')
1905
- if stop:
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 stop:
1917
+ if trigger:
1918
1918
  response = await self.privateGetTradeOrderAlgo(self.extend(request, query))
1919
1919
  else:
1920
1920
  response = await 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.stop]: True if fetching trigger or conditional orders
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
- stop = self.safe_value(params, 'stop') or (self.safe_string(params, 'ordType') is not None)
1957
- if stop and (ordType is None):
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 stop:
1961
+ if trigger:
1962
1962
  response = await self.privateGetTradeOrdersAlgoPending(self.extend(request, params))
1963
1963
  else:
1964
1964
  response = await 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.stop]: True if fetching trigger or conditional orders
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
- stop = self.safe_value(params, 'stop') or (self.safe_string(params, 'ordType') is not None)
1994
- if stop and (ordType is None):
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 stop:
1998
+ if trigger:
1999
1999
  response = await 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-structure>`
2729
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
2730
2730
  """
2731
2731
  await self.load_markets()
2732
2732
  method = None
ccxt/async_support/okx.py CHANGED
@@ -2243,6 +2243,7 @@ class okx(Exchange, ImplicitAPI):
2243
2243
  :param int [since]: timestamp in ms of the earliest trade to fetch
2244
2244
  :param int [limit]: the maximum amount of trades to fetch
2245
2245
  :param dict [params]: extra parameters specific to the exchange API endpoint
2246
+ :param str [params.method]: 'publicGetMarketTrades' or 'publicGetMarketHistoryTrades' default is 'publicGetMarketTrades'
2246
2247
  :param boolean [params.paginate]: *only applies to publicGetMarketHistoryTrades* default False, when True will automatically paginate by calling self endpoint multiple times
2247
2248
  :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
2248
2249
  """
@@ -3254,9 +3255,9 @@ class okx(Exchange, ImplicitAPI):
3254
3255
  """
3255
3256
  if symbol is None:
3256
3257
  raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
3257
- stop = self.safe_value_2(params, 'stop', 'trigger')
3258
+ trigger = self.safe_value_2(params, 'stop', 'trigger')
3258
3259
  trailing = self.safe_bool(params, 'trailing', False)
3259
- if stop or trailing:
3260
+ if trigger or trailing:
3260
3261
  orderInner = await self.cancel_orders([id], symbol, params)
3261
3262
  return self.safe_value(orderInner, 0)
3262
3263
  await self.load_markets()
@@ -3314,9 +3315,9 @@ class okx(Exchange, ImplicitAPI):
3314
3315
  method = self.safe_string(params, 'method', defaultMethod)
3315
3316
  clientOrderIds = self.parse_ids(self.safe_value_2(params, 'clOrdId', 'clientOrderId'))
3316
3317
  algoIds = self.parse_ids(self.safe_value(params, 'algoId'))
3317
- stop = self.safe_value_2(params, 'stop', 'trigger')
3318
+ trigger = self.safe_value_2(params, 'stop', 'trigger')
3318
3319
  trailing = self.safe_bool(params, 'trailing', False)
3319
- if stop or trailing:
3320
+ if trigger or trailing:
3320
3321
  method = 'privatePostTradeCancelAlgos'
3321
3322
  if clientOrderIds is None:
3322
3323
  ids = self.parse_ids(ids)
@@ -3327,7 +3328,7 @@ class okx(Exchange, ImplicitAPI):
3327
3328
  'instId': market['id'],
3328
3329
  })
3329
3330
  for i in range(0, len(ids)):
3330
- if trailing or stop:
3331
+ if trailing or trigger:
3331
3332
  request.append({
3332
3333
  'algoId': ids[i],
3333
3334
  'instId': market['id'],
@@ -3398,9 +3399,9 @@ class okx(Exchange, ImplicitAPI):
3398
3399
  options = self.safe_dict(self.options, 'cancelOrders', {})
3399
3400
  defaultMethod = self.safe_string(options, 'method', 'privatePostTradeCancelBatchOrders')
3400
3401
  method = self.safe_string(params, 'method', defaultMethod)
3401
- stop = self.safe_bool_2(params, 'stop', 'trigger')
3402
+ trigger = self.safe_bool_2(params, 'stop', 'trigger')
3402
3403
  trailing = self.safe_bool(params, 'trailing', False)
3403
- isStopOrTrailing = stop or trailing
3404
+ isStopOrTrailing = trigger or trailing
3404
3405
  if isStopOrTrailing:
3405
3406
  method = 'privatePostTradeCancelAlgos'
3406
3407
  for i in range(0, len(orders)):
@@ -3723,8 +3724,8 @@ class okx(Exchange, ImplicitAPI):
3723
3724
  options = self.safe_value(self.options, 'fetchOrder', {})
3724
3725
  defaultMethod = self.safe_string(options, 'method', 'privateGetTradeOrder')
3725
3726
  method = self.safe_string(params, 'method', defaultMethod)
3726
- stop = self.safe_value_2(params, 'stop', 'trigger')
3727
- if stop:
3727
+ trigger = self.safe_value_2(params, 'stop', 'trigger')
3728
+ if trigger:
3728
3729
  method = 'privateGetTradeOrderAlgo'
3729
3730
  if clientOrderId is not None:
3730
3731
  request['algoClOrdId'] = clientOrderId
@@ -3852,7 +3853,7 @@ class okx(Exchange, ImplicitAPI):
3852
3853
  :param int [since]: the earliest time in ms to fetch open orders for
3853
3854
  :param int [limit]: the maximum number of open orders structures to retrieve
3854
3855
  :param dict [params]: extra parameters specific to the exchange API endpoint
3855
- :param bool [params.stop]: True if fetching trigger or conditional orders
3856
+ :param bool [params.trigger]: True if fetching trigger or conditional orders
3856
3857
  :param str [params.ordType]: "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
3857
3858
  :param str [params.algoId]: Algo ID "'433845797218942976'"
3858
3859
  :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)
@@ -3885,13 +3886,13 @@ class okx(Exchange, ImplicitAPI):
3885
3886
  defaultMethod = self.safe_string(options, 'method', 'privateGetTradeOrdersPending')
3886
3887
  method = self.safe_string(params, 'method', defaultMethod)
3887
3888
  ordType = self.safe_string(params, 'ordType')
3888
- stop = self.safe_value_2(params, 'stop', 'trigger')
3889
+ trigger = self.safe_value_2(params, 'stop', 'trigger')
3889
3890
  trailing = self.safe_bool(params, 'trailing', False)
3890
- if trailing or stop or (ordType in algoOrderTypes):
3891
+ if trailing or trigger or (ordType in algoOrderTypes):
3891
3892
  method = 'privateGetTradeOrdersAlgoPending'
3892
3893
  if trailing:
3893
3894
  request['ordType'] = 'move_order_stop'
3894
- elif stop and (ordType is None):
3895
+ elif trigger and (ordType is None):
3895
3896
  request['ordType'] = 'trigger'
3896
3897
  query = self.omit(params, ['method', 'stop', 'trigger', 'trailing'])
3897
3898
  response = None
@@ -4008,7 +4009,7 @@ class okx(Exchange, ImplicitAPI):
4008
4009
  :param int [since]: timestamp in ms of the earliest order, default is None
4009
4010
  :param int [limit]: max number of orders to return, default is None
4010
4011
  :param dict [params]: extra parameters specific to the exchange API endpoint
4011
- :param bool [params.stop]: True if fetching trigger or conditional orders
4012
+ :param bool [params.trigger]: True if fetching trigger or conditional orders
4012
4013
  :param str [params.ordType]: "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
4013
4014
  :param str [params.algoId]: Algo ID "'433845797218942976'"
4014
4015
  :param int [params.until]: timestamp in ms to fetch orders for
@@ -4043,18 +4044,18 @@ class okx(Exchange, ImplicitAPI):
4043
4044
  defaultMethod = self.safe_string(options, 'method', 'privateGetTradeOrdersHistory')
4044
4045
  method = self.safe_string(params, 'method', defaultMethod)
4045
4046
  ordType = self.safe_string(params, 'ordType')
4046
- stop = self.safe_value_2(params, 'stop', 'trigger')
4047
+ trigger = self.safe_value_2(params, 'stop', 'trigger')
4047
4048
  trailing = self.safe_bool(params, 'trailing', False)
4048
4049
  if trailing:
4049
4050
  method = 'privateGetTradeOrdersAlgoHistory'
4050
4051
  request['ordType'] = 'move_order_stop'
4051
- elif stop or (ordType in algoOrderTypes):
4052
+ elif trigger or (ordType in algoOrderTypes):
4052
4053
  method = 'privateGetTradeOrdersAlgoHistory'
4053
4054
  algoId = self.safe_string(params, 'algoId')
4054
4055
  if algoId is not None:
4055
4056
  request['algoId'] = algoId
4056
4057
  params = self.omit(params, 'algoId')
4057
- if stop:
4058
+ if trigger:
4058
4059
  if ordType is None:
4059
4060
  raise ArgumentsRequired(self.id + ' fetchCanceledOrders() requires an "ordType" string parameter, "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"')
4060
4061
  else:
@@ -4224,14 +4225,14 @@ class okx(Exchange, ImplicitAPI):
4224
4225
  defaultMethod = self.safe_string(options, 'method', 'privateGetTradeOrdersHistory')
4225
4226
  method = self.safe_string(params, 'method', defaultMethod)
4226
4227
  ordType = self.safe_string(params, 'ordType')
4227
- stop = self.safe_bool_2(params, 'stop', 'trigger')
4228
+ trigger = self.safe_bool_2(params, 'stop', 'trigger')
4228
4229
  trailing = self.safe_bool(params, 'trailing', False)
4229
- if trailing or stop or (ordType in algoOrderTypes):
4230
+ if trailing or trigger or (ordType in algoOrderTypes):
4230
4231
  method = 'privateGetTradeOrdersAlgoHistory'
4231
4232
  request['state'] = 'effective'
4232
4233
  if trailing:
4233
4234
  request['ordType'] = 'move_order_stop'
4234
- elif stop:
4235
+ elif trigger:
4235
4236
  if ordType is None:
4236
4237
  request['ordType'] = 'trigger'
4237
4238
  else:
@@ -4453,7 +4454,7 @@ class okx(Exchange, ImplicitAPI):
4453
4454
  :param str [params.marginMode]: 'cross' or 'isolated'
4454
4455
  :param int [params.until]: the latest time in ms to fetch entries for
4455
4456
  :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)
4456
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
4457
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
4457
4458
  """
4458
4459
  await self.load_markets()
4459
4460
  paginate = False
@@ -2804,15 +2804,15 @@ class phemex(Exchange, ImplicitAPI):
2804
2804
  raise ArgumentsRequired(self.id + ' cancelAllOrders() requires a symbol argument')
2805
2805
  await self.load_markets()
2806
2806
  market = self.market(symbol)
2807
- stop = self.safe_value_2(params, 'stop', 'trigger', False)
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 stop:
2815
- request['untriggerred'] = stop
2814
+ if trigger:
2815
+ request['untriggerred'] = trigger
2816
2816
  response = None
2817
2817
  if market['settle'] == 'USDT':
2818
2818
  response = await 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.from_ep(self.safe_string_2(contract, 'markEp', 'markPriceRp'), market),
3901
- 'indexPrice': self.from_ep(self.safe_string_2(contract, 'indexEp', 'indexPriceRp'), market),
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.from_er(self.safe_string(contract, 'fundingRateEr'), market),
3910
+ 'fundingRate': self.safe_number(contract, 'fundingRateRr', fundingRateEr),
3907
3911
  'fundingTimestamp': None,
3908
3912
  'fundingDatetime': None,
3909
- 'nextFundingRate': self.from_er(self.safe_string_2(contract, 'predFundingRateEr', 'predFundingRateRr'), market),
3913
+ 'nextFundingRate': self.safe_number(contract, 'predFundingRateRr', nextFundingRateEr),
3910
3914
  'nextFundingTimestamp': None,
3911
3915
  'nextFundingDatetime': None,
3912
3916
  'previousFundingRate': None,
@@ -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.stop]: set True to fetch trigger orders instead of regular orders
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
  await self.load_markets()
@@ -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.stop]: When True, all the trigger orders will be cancelled
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
  await self.load_markets()
1187
1187
  request: dict = {}
1188
1188
  if symbol is not None:
1189
1189
  request['symbol'] = self.market_id(symbol)
1190
- stop = self.safe_value_2(params, 'stop', 'trigger')
1190
+ trigger = self.safe_value_2(params, 'stop', 'trigger')
1191
1191
  params = self.omit(params, ['stop', 'trigger'])
1192
1192
  response = None
1193
- if stop:
1193
+ if trigger:
1194
1194
  response = await self.privateDeleteStopOrders(self.extend(request, params))
1195
1195
  else:
1196
1196
  response = await 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
  await self.load_markets()
1257
- stop = self.safe_value_2(params, 'stop', 'trigger')
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 stop:
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 stop:
1276
+ if trigger:
1277
1277
  response = await self.privateGetStopOrders(self.extend(request, params))
1278
1278
  else:
1279
1279
  response = await self.privateGetOrders(self.extend(request, params))