ccxt 4.4.33__py2.py3-none-any.whl → 4.4.35__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. ccxt/__init__.py +3 -1
  2. ccxt/abstract/bingx.py +17 -0
  3. ccxt/abstract/bitbank.py +5 -0
  4. ccxt/abstract/bitfinex2.py +1 -0
  5. ccxt/abstract/bitpanda.py +0 -12
  6. ccxt/abstract/bitrue.py +3 -3
  7. ccxt/abstract/ellipx.py +25 -0
  8. ccxt/abstract/okx.py +1 -0
  9. ccxt/abstract/onetrading.py +0 -12
  10. ccxt/abstract/xt.py +5 -5
  11. ccxt/alpaca.py +2 -0
  12. ccxt/async_support/__init__.py +3 -1
  13. ccxt/async_support/alpaca.py +2 -0
  14. ccxt/async_support/base/exchange.py +1 -1
  15. ccxt/async_support/binance.py +19 -15
  16. ccxt/async_support/bingx.py +479 -146
  17. ccxt/async_support/bitbank.py +5 -0
  18. ccxt/async_support/bitbns.py +2 -0
  19. ccxt/async_support/bitfinex2.py +1 -0
  20. ccxt/async_support/bitget.py +174 -40
  21. ccxt/async_support/bitmex.py +3 -1
  22. ccxt/async_support/bitopro.py +3 -0
  23. ccxt/async_support/bitrue.py +3 -2
  24. ccxt/async_support/btcmarkets.py +5 -3
  25. ccxt/async_support/btcturk.py +19 -19
  26. ccxt/async_support/bybit.py +13 -10
  27. ccxt/async_support/cex.py +13 -4
  28. ccxt/async_support/coinbase.py +3 -2
  29. ccxt/async_support/coinex.py +1 -0
  30. ccxt/async_support/coinone.py +7 -7
  31. ccxt/async_support/coinsph.py +7 -7
  32. ccxt/async_support/coinspot.py +39 -39
  33. ccxt/async_support/cryptocom.py +36 -34
  34. ccxt/async_support/ellipx.py +1828 -0
  35. ccxt/async_support/gate.py +143 -39
  36. ccxt/async_support/hyperliquid.py +70 -11
  37. ccxt/async_support/idex.py +3 -4
  38. ccxt/async_support/kraken.py +58 -49
  39. ccxt/async_support/krakenfutures.py +3 -1
  40. ccxt/async_support/kucoin.py +1 -1
  41. ccxt/async_support/okcoin.py +2 -0
  42. ccxt/async_support/okx.py +15 -10
  43. ccxt/async_support/onetrading.py +67 -370
  44. ccxt/async_support/paradex.py +2 -0
  45. ccxt/async_support/phemex.py +16 -0
  46. ccxt/async_support/poloniex.py +3 -1
  47. ccxt/async_support/poloniexfutures.py +3 -1
  48. ccxt/async_support/vertex.py +2 -0
  49. ccxt/async_support/woo.py +69 -69
  50. ccxt/async_support/xt.py +10 -10
  51. ccxt/base/exchange.py +28 -7
  52. ccxt/binance.py +19 -15
  53. ccxt/bingx.py +479 -146
  54. ccxt/bitbank.py +5 -0
  55. ccxt/bitbns.py +2 -0
  56. ccxt/bitfinex2.py +1 -0
  57. ccxt/bitget.py +174 -40
  58. ccxt/bitmex.py +3 -1
  59. ccxt/bitopro.py +3 -0
  60. ccxt/bitrue.py +3 -2
  61. ccxt/btcmarkets.py +5 -3
  62. ccxt/btcturk.py +19 -19
  63. ccxt/bybit.py +13 -10
  64. ccxt/cex.py +13 -4
  65. ccxt/coinbase.py +3 -2
  66. ccxt/coinex.py +1 -0
  67. ccxt/coinone.py +7 -7
  68. ccxt/coinsph.py +7 -7
  69. ccxt/coinspot.py +39 -39
  70. ccxt/cryptocom.py +36 -34
  71. ccxt/ellipx.py +1828 -0
  72. ccxt/gate.py +143 -39
  73. ccxt/hyperliquid.py +70 -11
  74. ccxt/idex.py +3 -4
  75. ccxt/kraken.py +58 -49
  76. ccxt/krakenfutures.py +3 -1
  77. ccxt/kucoin.py +1 -1
  78. ccxt/okcoin.py +2 -0
  79. ccxt/okx.py +15 -10
  80. ccxt/onetrading.py +67 -370
  81. ccxt/paradex.py +2 -0
  82. ccxt/phemex.py +16 -0
  83. ccxt/poloniex.py +3 -1
  84. ccxt/poloniexfutures.py +3 -1
  85. ccxt/pro/__init__.py +1 -1
  86. ccxt/pro/bitrue.py +13 -11
  87. ccxt/pro/idex.py +15 -0
  88. ccxt/pro/probit.py +58 -68
  89. ccxt/pro/woo.py +15 -15
  90. ccxt/test/tests_async.py +29 -2
  91. ccxt/test/tests_helpers.py +0 -2
  92. ccxt/test/tests_sync.py +29 -2
  93. ccxt/vertex.py +2 -0
  94. ccxt/woo.py +69 -69
  95. ccxt/xt.py +10 -10
  96. {ccxt-4.4.33.dist-info → ccxt-4.4.35.dist-info}/METADATA +9 -8
  97. {ccxt-4.4.33.dist-info → ccxt-4.4.35.dist-info}/RECORD +100 -97
  98. {ccxt-4.4.33.dist-info → ccxt-4.4.35.dist-info}/LICENSE.txt +0 -0
  99. {ccxt-4.4.33.dist-info → ccxt-4.4.35.dist-info}/WHEEL +0 -0
  100. {ccxt-4.4.33.dist-info → ccxt-4.4.35.dist-info}/top_level.txt +0 -0
ccxt/onetrading.py CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.onetrading import ImplicitAPI
8
- from ccxt.base.types import Balances, Currencies, Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction
8
+ from ccxt.base.types import Balances, Currencies, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees
9
9
  from typing import List
10
10
  from ccxt.base.errors import ExchangeError
11
11
  from ccxt.base.errors import AuthenticationError
@@ -16,6 +16,7 @@ from ccxt.base.errors import InsufficientFunds
16
16
  from ccxt.base.errors import InvalidAddress
17
17
  from ccxt.base.errors import InvalidOrder
18
18
  from ccxt.base.errors import OrderNotFound
19
+ from ccxt.base.errors import NotSupported
19
20
  from ccxt.base.errors import DDoSProtection
20
21
  from ccxt.base.errors import ExchangeNotAvailable
21
22
  from ccxt.base.decimal_to_precision import TICK_SIZE
@@ -46,7 +47,7 @@ class onetrading(Exchange, ImplicitAPI):
46
47
  'cancelOrders': True,
47
48
  'closeAllPositions': False,
48
49
  'closePosition': False,
49
- 'createDepositAddress': True,
50
+ 'createDepositAddress': False,
50
51
  'createOrder': True,
51
52
  'createReduceOnlyOrder': False,
52
53
  'createStopLimitOrder': True,
@@ -61,10 +62,10 @@ class onetrading(Exchange, ImplicitAPI):
61
62
  'fetchCrossBorrowRates': False,
62
63
  'fetchCurrencies': True,
63
64
  'fetchDeposit': False,
64
- 'fetchDepositAddress': True,
65
+ 'fetchDepositAddress': False,
65
66
  'fetchDepositAddresses': False,
66
67
  'fetchDepositAddressesByNetwork': False,
67
- 'fetchDeposits': True,
68
+ 'fetchDeposits': False,
68
69
  'fetchDepositsWithdrawals': False,
69
70
  'fetchFundingHistory': False,
70
71
  'fetchFundingRate': False,
@@ -97,7 +98,7 @@ class onetrading(Exchange, ImplicitAPI):
97
98
  'fetchTicker': True,
98
99
  'fetchTickers': True,
99
100
  'fetchTime': True,
100
- 'fetchTrades': True,
101
+ 'fetchTrades': False,
101
102
  'fetchTradingFee': False,
102
103
  'fetchTradingFees': True,
103
104
  'fetchTransactionFee': False,
@@ -106,14 +107,14 @@ class onetrading(Exchange, ImplicitAPI):
106
107
  'fetchTransfer': False,
107
108
  'fetchTransfers': False,
108
109
  'fetchWithdrawal': False,
109
- 'fetchWithdrawals': True,
110
+ 'fetchWithdrawals': False,
110
111
  'reduceMargin': False,
111
112
  'setLeverage': False,
112
113
  'setMargin': False,
113
114
  'setMarginMode': False,
114
115
  'setPositionMode': False,
115
116
  'transfer': False,
116
- 'withdraw': True,
117
+ 'withdraw': False,
117
118
  },
118
119
  'timeframes': {
119
120
  '1m': '1/MINUTES',
@@ -148,32 +149,20 @@ class onetrading(Exchange, ImplicitAPI):
148
149
  'order-book/{instrument_code}',
149
150
  'market-ticker',
150
151
  'market-ticker/{instrument_code}',
151
- 'price-ticks/{instrument_code}',
152
152
  'time',
153
153
  ],
154
154
  },
155
155
  'private': {
156
156
  'get': [
157
157
  'account/balances',
158
- 'account/deposit/crypto/{currency_code}',
159
- 'account/deposit/fiat/EUR',
160
- 'account/deposits',
161
- 'account/deposits/bitpanda',
162
- 'account/withdrawals',
163
- 'account/withdrawals/bitpanda',
164
158
  'account/fees',
165
159
  'account/orders',
166
160
  'account/orders/{order_id}',
167
161
  'account/orders/{order_id}/trades',
168
162
  'account/trades',
169
163
  'account/trades/{trade_id}',
170
- 'account/trading-volume',
171
164
  ],
172
165
  'post': [
173
- 'account/deposit/crypto',
174
- 'account/withdraw/crypto',
175
- 'account/withdraw/fiat',
176
- 'account/fees',
177
166
  'account/orders',
178
167
  ],
179
168
  'delete': [
@@ -317,6 +306,9 @@ class onetrading(Exchange, ImplicitAPI):
317
306
  def fetch_time(self, params={}):
318
307
  """
319
308
  fetches the current integer timestamp in milliseconds from the exchange server
309
+
310
+ https://docs.onetrading.com/#time
311
+
320
312
  :param dict [params]: extra parameters specific to the exchange API endpoint
321
313
  :returns int: the current integer timestamp in milliseconds from the exchange server
322
314
  """
@@ -332,6 +324,9 @@ class onetrading(Exchange, ImplicitAPI):
332
324
  def fetch_currencies(self, params={}) -> Currencies:
333
325
  """
334
326
  fetches all available currencies on an exchange
327
+
328
+ https://docs.onetrading.com/#currencies
329
+
335
330
  :param dict [params]: extra parameters specific to the exchange API endpoint
336
331
  :returns dict: an associative dictionary of currencies
337
332
  """
@@ -370,6 +365,9 @@ class onetrading(Exchange, ImplicitAPI):
370
365
  def fetch_markets(self, params={}) -> List[Market]:
371
366
  """
372
367
  retrieves data on all markets for onetrading
368
+
369
+ https://docs.onetrading.com/#instruments
370
+
373
371
  :param dict [params]: extra parameters specific to the exchange API endpoint
374
372
  :returns dict[]: an array of objects representing market data
375
373
  """
@@ -450,6 +448,10 @@ class onetrading(Exchange, ImplicitAPI):
450
448
  def fetch_trading_fees(self, params={}) -> TradingFees:
451
449
  """
452
450
  fetch the trading fees for multiple markets
451
+
452
+ https://docs.onetrading.com/#fee-groups
453
+ https://docs.onetrading.com/#fees
454
+
453
455
  :param dict [params]: extra parameters specific to the exchange API endpoint
454
456
  :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
455
457
  """
@@ -458,7 +460,12 @@ class onetrading(Exchange, ImplicitAPI):
458
460
  if method is None:
459
461
  options = self.safe_value(self.options, 'fetchTradingFees', {})
460
462
  method = self.safe_string(options, 'method', 'fetchPrivateTradingFees')
461
- return getattr(self, method)(params)
463
+ if method == 'fetchPrivateTradingFees':
464
+ return self.fetch_private_trading_fees(params)
465
+ elif method == 'fetchPublicTradingFees':
466
+ return self.fetch_public_trading_fees(params)
467
+ else:
468
+ raise NotSupported(self.id + ' fetchTradingFees() does not support ' + method + ', fetchPrivateTradingFees and fetchPublicTradingFees are supported')
462
469
 
463
470
  def fetch_public_trading_fees(self, params={}):
464
471
  self.load_markets()
@@ -617,6 +624,9 @@ class onetrading(Exchange, ImplicitAPI):
617
624
  def fetch_ticker(self, symbol: str, params={}) -> Ticker:
618
625
  """
619
626
  fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
627
+
628
+ https://docs.onetrading.com/#market-ticker-for-instrument
629
+
620
630
  :param str symbol: unified symbol of the market to fetch the ticker for
621
631
  :param dict [params]: extra parameters specific to the exchange API endpoint
622
632
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
@@ -650,7 +660,10 @@ class onetrading(Exchange, ImplicitAPI):
650
660
  def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
651
661
  """
652
662
  fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
653
- :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
663
+
664
+ https://docs.onetrading.com/#market-ticker
665
+
666
+ :param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
654
667
  :param dict [params]: extra parameters specific to the exchange API endpoint
655
668
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
656
669
  """
@@ -687,6 +700,9 @@ class onetrading(Exchange, ImplicitAPI):
687
700
  def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
688
701
  """
689
702
  fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
703
+
704
+ https://docs.onetrading.com/#order-book
705
+
690
706
  :param str symbol: unified symbol of the market to fetch the order book for
691
707
  :param int [limit]: the maximum amount of order book entries to return
692
708
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -809,6 +825,9 @@ class onetrading(Exchange, ImplicitAPI):
809
825
  def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
810
826
  """
811
827
  fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
828
+
829
+ https://docs.onetrading.com/#candlesticks
830
+
812
831
  :param str symbol: unified symbol of the market to fetch OHLCV data for
813
832
  :param str timeframe: the length of time each candle represents
814
833
  :param int [since]: timestamp in ms of the earliest candle to fetch
@@ -927,44 +946,6 @@ class onetrading(Exchange, ImplicitAPI):
927
946
  'info': trade,
928
947
  }, market)
929
948
 
930
- def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
931
- """
932
- get the list of most recent trades for a particular symbol
933
- :param str symbol: unified symbol of the market to fetch trades for
934
- :param int [since]: timestamp in ms of the earliest trade to fetch
935
- :param int [limit]: the maximum amount of trades to fetch
936
- :param dict [params]: extra parameters specific to the exchange API endpoint
937
- :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
938
- """
939
- self.load_markets()
940
- market = self.market(symbol)
941
- request: dict = {
942
- 'instrument_code': market['id'],
943
- # 'from': self.iso8601(since),
944
- # 'to': self.iso8601(self.milliseconds()),
945
- }
946
- if since is not None:
947
- # returns price ticks for a specific market with an interval of maximum of 4 hours
948
- # sorted by latest first
949
- request['from'] = self.iso8601(since)
950
- request['to'] = self.iso8601(self.sum(since, 14400000))
951
- response = self.publicGetPriceTicksInstrumentCode(self.extend(request, params))
952
- #
953
- # [
954
- # {
955
- # "instrument_code":"BTC_EUR",
956
- # "price":"8137.28",
957
- # "amount":"0.22269",
958
- # "taker_side":"BUY",
959
- # "volume":"1812.0908832",
960
- # "time":"2020-07-10T14:44:32.299Z",
961
- # "trade_timestamp":1594392272299,
962
- # "sequence":603047
963
- # }
964
- # ]
965
- #
966
- return self.parse_trades(response, market, since, limit)
967
-
968
949
  def parse_balance(self, response) -> Balances:
969
950
  balances = self.safe_value(response, 'balances', [])
970
951
  result: dict = {'info': response}
@@ -981,6 +962,9 @@ class onetrading(Exchange, ImplicitAPI):
981
962
  def fetch_balance(self, params={}) -> Balances:
982
963
  """
983
964
  query for balance and get the amount of funds available for trading or funds locked in orders
965
+
966
+ https://docs.onetrading.com/#balances
967
+
984
968
  :param dict [params]: extra parameters specific to the exchange API endpoint
985
969
  :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
986
970
  """
@@ -1004,317 +988,6 @@ class onetrading(Exchange, ImplicitAPI):
1004
988
  #
1005
989
  return self.parse_balance(response)
1006
990
 
1007
- def parse_deposit_address(self, depositAddress, currency: Currency = None) -> DepositAddress:
1008
- code = None
1009
- if currency is not None:
1010
- code = currency['code']
1011
- address = self.safe_string(depositAddress, 'address')
1012
- tag = self.safe_string(depositAddress, 'destination_tag')
1013
- self.check_address(address)
1014
- return {
1015
- 'info': depositAddress,
1016
- 'currency': code,
1017
- 'network': None,
1018
- 'address': address,
1019
- 'tag': tag,
1020
- }
1021
-
1022
- def create_deposit_address(self, code: str, params={}):
1023
- """
1024
- create a currency deposit address
1025
- :param str code: unified currency code of the currency for the deposit address
1026
- :param dict [params]: extra parameters specific to the exchange API endpoint
1027
- :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
1028
- """
1029
- self.load_markets()
1030
- currency = self.currency(code)
1031
- request: dict = {
1032
- 'currency': currency['id'],
1033
- }
1034
- response = self.privatePostAccountDepositCrypto(self.extend(request, params))
1035
- #
1036
- # {
1037
- # "address":"rBnNhk95FrdNisZtXcStzriFS8vEzz53DM",
1038
- # "destination_tag":"865690307",
1039
- # "enabled":true,
1040
- # "is_smart_contract":false
1041
- # }
1042
- #
1043
- return self.parse_deposit_address(response, currency)
1044
-
1045
- def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
1046
- """
1047
- fetch the deposit address for a currency associated with self account
1048
- :param str code: unified currency code
1049
- :param dict [params]: extra parameters specific to the exchange API endpoint
1050
- :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
1051
- """
1052
- self.load_markets()
1053
- currency = self.currency(code)
1054
- request: dict = {
1055
- 'currency_code': currency['id'],
1056
- }
1057
- response = self.privateGetAccountDepositCryptoCurrencyCode(self.extend(request, params))
1058
- #
1059
- # {
1060
- # "address":"rBnNhk95FrdNisZtXcStzriFS8vEzz53DM",
1061
- # "destination_tag":"865690307",
1062
- # "enabled":true,
1063
- # "is_smart_contract":false,
1064
- # "can_create_more":false
1065
- # }
1066
- #
1067
- return self.parse_deposit_address(response, currency)
1068
-
1069
- def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1070
- """
1071
- fetch all deposits made to an account
1072
- :param str code: unified currency code
1073
- :param int [since]: the earliest time in ms to fetch deposits for
1074
- :param int [limit]: the maximum number of deposits structures to retrieve
1075
- :param dict [params]: extra parameters specific to the exchange API endpoint
1076
- :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
1077
- """
1078
- self.load_markets()
1079
- request: dict = {
1080
- # 'cursor': 'string', # pointer specifying the position from which the next pages should be returned
1081
- }
1082
- currency = None
1083
- if code is not None:
1084
- currency = self.currency(code)
1085
- request['currency_code'] = currency['id']
1086
- if limit is not None:
1087
- request['max_page_size'] = limit
1088
- if since is not None:
1089
- to = self.safe_string(params, 'to')
1090
- if to is None:
1091
- raise ArgumentsRequired(self.id + ' fetchDeposits() requires a "to" iso8601 string param with the since argument is specified')
1092
- request['from'] = self.iso8601(since)
1093
- response = self.privateGetAccountDeposits(self.extend(request, params))
1094
- #
1095
- # {
1096
- # "deposit_history": [
1097
- # {
1098
- # "transaction_id": "e5342efcd-d5b7-4a56-8e12-b69ffd68c5ef",
1099
- # "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
1100
- # "amount": "100",
1101
- # "type": "CRYPTO",
1102
- # "funds_source": "INTERNAL",
1103
- # "time": "2020-04-22T09:57:47Z",
1104
- # "currency": "BTC",
1105
- # "fee_amount": "0.0",
1106
- # "fee_currency": "BTC"
1107
- # },
1108
- # {
1109
- # "transaction_id": "79793d00-2899-4a4d-95b7-73ae6b31384f",
1110
- # "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
1111
- # "time": "2020-05-05T11:22:07.925Z",
1112
- # "currency": "EUR",
1113
- # "funds_source": "EXTERNAL",
1114
- # "type": "FIAT",
1115
- # "amount": "50.0",
1116
- # "fee_amount": "0.01",
1117
- # "fee_currency": "EUR"
1118
- # }
1119
- # ],
1120
- # "max_page_size": 2,
1121
- # "cursor": "eyJhY2NvdW50X2lkIjp7InMiOiJlMzY5YWM4MC00NTc3LTExZTktYWUwOC05YmVkYzQ3OTBiODQiLCJzcyI6W10sIm5zIjpbXSwiYnMiOltdLCJtIjp7fSwibCI6W119LCJpdGVtX2tleSI6eyJzIjoiV0lUSERSQVdBTDo6MmFlMjYwY2ItOTk3MC00YmNiLTgxNmEtZGY4MDVmY2VhZTY1Iiwic3MiOltdLCJucyI6W10sImJzIjpbXSwibSI6e30sImwiOltdfSwiZ2xvYmFsX3dpdGhkcmF3YWxfaW5kZXhfaGFzaF9rZXkiOnsicyI6ImUzNjlhYzgwLTQ1NzctMTFlOS1hZTA4LTliZWRjNDc5MGI4NCIsInNzIjpbXSwibnMiOltdLCJicyI6W10sIm0iOnt9LCJsIjpbXX0sInRpbWVzdGFtcCI6eyJuIjoiMTU4ODA1ODc2Nzk0OCIsInNzIjpbXSwibnMiOltdLCJicyI6W10sIm0iOnt9LCJsIjpbXX19"
1122
- # }
1123
- #
1124
- depositHistory = self.safe_list(response, 'deposit_history', [])
1125
- return self.parse_transactions(depositHistory, currency, since, limit, {'type': 'deposit'})
1126
-
1127
- def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1128
- """
1129
- fetch all withdrawals made from an account
1130
- :param str code: unified currency code
1131
- :param int [since]: the earliest time in ms to fetch withdrawals for
1132
- :param int [limit]: the maximum number of withdrawals structures to retrieve
1133
- :param dict [params]: extra parameters specific to the exchange API endpoint
1134
- :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
1135
- """
1136
- self.load_markets()
1137
- request: dict = {
1138
- # 'cursor': 'string', # pointer specifying the position from which the next pages should be returned
1139
- }
1140
- currency = None
1141
- if code is not None:
1142
- currency = self.currency(code)
1143
- request['currency_code'] = currency['id']
1144
- if limit is not None:
1145
- request['max_page_size'] = limit
1146
- if since is not None:
1147
- to = self.safe_string(params, 'to')
1148
- if to is None:
1149
- raise ArgumentsRequired(self.id + ' fetchWithdrawals() requires a "to" iso8601 string param with the since argument is specified')
1150
- request['from'] = self.iso8601(since)
1151
- response = self.privateGetAccountWithdrawals(self.extend(request, params))
1152
- #
1153
- # {
1154
- # "withdrawal_history": [
1155
- # {
1156
- # "account_id": "e369ac80-4577-11e9-ae08-9bedc4790b84",
1157
- # "amount": "0.1",
1158
- # "currency": "BTC",
1159
- # "fee_amount": "0.00002",
1160
- # "fee_currency": "BTC",
1161
- # "funds_source": "EXTERNAL",
1162
- # "related_transaction_id": "e298341a-3855-405e-bce3-92db368a3157",
1163
- # "time": "2020-05-05T11:11:32.110Z",
1164
- # "transaction_id": "6693ff40-bb10-4dcf-ada7-3b287727c882",
1165
- # "type": "CRYPTO"
1166
- # },
1167
- # {
1168
- # "account_id": "e369ac80-4577-11e9-ae08-9bedc4790b84",
1169
- # "amount": "0.1",
1170
- # "currency": "BTC",
1171
- # "fee_amount": "0.0",
1172
- # "fee_currency": "BTC",
1173
- # "funds_source": "INTERNAL",
1174
- # "time": "2020-05-05T10:29:53.464Z",
1175
- # "transaction_id": "ec9703b1-954b-4f76-adea-faac66eabc0b",
1176
- # "type": "CRYPTO"
1177
- # }
1178
- # ],
1179
- # "cursor": "eyJhY2NvdW50X2lkIjp7InMiOiJlMzY5YWM4MC00NTc3LTExZTktYWUwOC05YmVkYzQ3OTBiODQiLCJzcyI6W10sIm5zIjpbXSwiYnMiOltdLCJtIjp7fSwibCI6W119LCJpdGVtX2tleSI6eyJzIjoiV0lUSERSQVdBTDo6ZWM5NzAzYjEtOTU0Yi00Zjc2LWFkZWEtZmFhYzY2ZWFiYzBiIiwic3MiOltdLCJucyI6W10sImJzIjpbXSwibSI6e30sImwiOltdfSwiZ2xvYmFsX3dpdGhkcmF3YWxfaW5kZXhfaGFzaF9rZXkiOnsicyI6ImUzNjlhYzgwLTQ1NzctMTFlOS1hZTA4LTliZWRjNDc5MGI4NCIsInNzIjpbXSwibnMiOltdLCJicyI6W10sIm0iOnt9LCJsIjpbXX0sInRpbWVzdGFtcCI6eyJuIjoiMTU4ODY3NDU5MzQ2NCIsInNzIjpbXSwibnMiOltdLCJicyI6W10sIm0iOnt9LCJsIjpbXX19",
1180
- # "max_page_size": 2
1181
- # }
1182
- #
1183
- withdrawalHistory = self.safe_list(response, 'withdrawal_history', [])
1184
- return self.parse_transactions(withdrawalHistory, currency, since, limit, {'type': 'withdrawal'})
1185
-
1186
- def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1187
- """
1188
- make a withdrawal
1189
- :param str code: unified currency code
1190
- :param float amount: the amount to withdraw
1191
- :param str address: the address to withdraw to
1192
- :param str tag:
1193
- :param dict [params]: extra parameters specific to the exchange API endpoint
1194
- :returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
1195
- """
1196
- tag, params = self.handle_withdraw_tag_and_params(tag, params)
1197
- self.check_address(address)
1198
- self.load_markets()
1199
- currency = self.currency(code)
1200
- request: dict = {
1201
- 'currency': code,
1202
- 'amount': self.currency_to_precision(code, amount),
1203
- # 'payout_account_id': '66756a10-3e86-48f4-9678-b634c4b135b2', # fiat only
1204
- # 'recipient': { # crypto only
1205
- # 'address': address,
1206
- # # 'destination_tag': '',
1207
- # },
1208
- }
1209
- options = self.safe_value(self.options, 'fiat', [])
1210
- isFiat = self.in_array(code, options)
1211
- method = 'privatePostAccountWithdrawFiat' if isFiat else 'privatePostAccountWithdrawCrypto'
1212
- if isFiat:
1213
- payoutAccountId = self.safe_string(params, 'payout_account_id')
1214
- if payoutAccountId is None:
1215
- raise ArgumentsRequired(self.id + ' withdraw() requires a payout_account_id param for fiat ' + code + ' withdrawals')
1216
- else:
1217
- recipient: dict = {'address': address}
1218
- if tag is not None:
1219
- recipient['destination_tag'] = tag
1220
- request['recipient'] = recipient
1221
- response = getattr(self, method)(self.extend(request, params))
1222
- #
1223
- # crypto
1224
- #
1225
- # {
1226
- # "amount": "1234.5678",
1227
- # "fee": "1234.5678",
1228
- # "recipient": "3NacQ7rzZdhfyAtfJ5a11k8jFPdcMP2Bq7",
1229
- # "destination_tag": "",
1230
- # "transaction_id": "d0f8529f-f832-4e6a-9dc5-b8d5797badb2"
1231
- # }
1232
- #
1233
- # fiat
1234
- #
1235
- # {
1236
- # "transaction_id": "54236cd0-4413-11e9-93fb-5fea7e5b5df6"
1237
- # }
1238
- #
1239
- return self.parse_transaction(response, currency)
1240
-
1241
- def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
1242
- #
1243
- # fetchDeposits, fetchWithdrawals
1244
- #
1245
- # {
1246
- # "transaction_id": "C2b42efcd-d5b7-4a56-8e12-b69ffd68c5ef",
1247
- # "type": "FIAT",
1248
- # "account_id": "c2d0076a-c20d-41f8-9e9a-1a1d028b2b58",
1249
- # "amount": "1234.5678",
1250
- # "time": "2019-08-24T14:15:22Z",
1251
- # "funds_source": "INTERNAL",
1252
- # "currency": "BTC",
1253
- # "fee_amount": "1234.5678",
1254
- # "fee_currency": "BTC",
1255
- # "blockchain_transaction_id": "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16",
1256
- # "related_transaction_id": "e298341a-3855-405e-bce3-92db368a3157"
1257
- # }
1258
- #
1259
- # withdraw
1260
- #
1261
- #
1262
- # crypto
1263
- #
1264
- # {
1265
- # "amount": "1234.5678",
1266
- # "fee": "1234.5678",
1267
- # "recipient": "3NacQ7rzZdhfyAtfJ5a11k8jFPdcMP2Bq7",
1268
- # "destination_tag": "",
1269
- # "transaction_id": "d0f8529f-f832-4e6a-9dc5-b8d5797badb2"
1270
- # }
1271
- #
1272
- # fiat
1273
- #
1274
- # {
1275
- # "transaction_id": "54236cd0-4413-11e9-93fb-5fea7e5b5df6"
1276
- # }
1277
- #
1278
- id = self.safe_string(transaction, 'transaction_id')
1279
- amount = self.safe_number(transaction, 'amount')
1280
- timestamp = self.parse8601(self.safe_string(transaction, 'time'))
1281
- currencyId = self.safe_string(transaction, 'currency')
1282
- currency = self.safe_currency(currencyId, currency)
1283
- status = 'ok' # the exchange returns cleared transactions only
1284
- feeCost = self.safe_number_2(transaction, 'fee_amount', 'fee')
1285
- fee = None
1286
- addressTo = self.safe_string(transaction, 'recipient')
1287
- tagTo = self.safe_string(transaction, 'destination_tag')
1288
- if feeCost is not None:
1289
- feeCurrencyId = self.safe_string(transaction, 'fee_currency', currencyId)
1290
- feeCurrencyCode = self.safe_currency_code(feeCurrencyId)
1291
- fee = {
1292
- 'cost': feeCost,
1293
- 'currency': feeCurrencyCode,
1294
- }
1295
- return {
1296
- 'info': transaction,
1297
- 'id': id,
1298
- 'currency': currency['code'],
1299
- 'amount': amount,
1300
- 'network': None,
1301
- 'address': addressTo,
1302
- 'addressFrom': None,
1303
- 'addressTo': addressTo,
1304
- 'tag': tagTo,
1305
- 'tagFrom': None,
1306
- 'tagTo': tagTo,
1307
- 'status': status,
1308
- 'type': None,
1309
- 'updated': None,
1310
- 'txid': self.safe_string(transaction, 'blockchain_transaction_id'),
1311
- 'comment': None,
1312
- 'internal': None,
1313
- 'timestamp': timestamp,
1314
- 'datetime': self.iso8601(timestamp),
1315
- 'fee': fee,
1316
- }
1317
-
1318
991
  def parse_order_status(self, status: Str):
1319
992
  statuses: dict = {
1320
993
  'FILLED': 'open',
@@ -1516,6 +1189,9 @@ class onetrading(Exchange, ImplicitAPI):
1516
1189
  def cancel_order(self, id: str, symbol: Str = None, params={}):
1517
1190
  """
1518
1191
  cancels an open order
1192
+
1193
+ https://docs.onetrading.com/#close-order-by-order-id
1194
+
1519
1195
  :param str id: order id
1520
1196
  :param str symbol: not used by bitmex cancelOrder()
1521
1197
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1540,6 +1216,9 @@ class onetrading(Exchange, ImplicitAPI):
1540
1216
  def cancel_all_orders(self, symbol: Str = None, params={}):
1541
1217
  """
1542
1218
  cancel all open orders
1219
+
1220
+ https://docs.onetrading.com/#close-all-orders
1221
+
1543
1222
  :param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
1544
1223
  :param dict [params]: extra parameters specific to the exchange API endpoint
1545
1224
  :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
@@ -1560,6 +1239,9 @@ class onetrading(Exchange, ImplicitAPI):
1560
1239
  def cancel_orders(self, ids, symbol: Str = None, params={}):
1561
1240
  """
1562
1241
  cancel multiple orders
1242
+
1243
+ https://docs.onetrading.com/#close-all-orders
1244
+
1563
1245
  :param str[] ids: order ids
1564
1246
  :param str symbol: unified market symbol, default is None
1565
1247
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1580,6 +1262,9 @@ class onetrading(Exchange, ImplicitAPI):
1580
1262
  def fetch_order(self, id: str, symbol: Str = None, params={}):
1581
1263
  """
1582
1264
  fetches information on an order made by the user
1265
+
1266
+ https://docs.onetrading.com/#get-order
1267
+
1583
1268
  :param str id: the order id
1584
1269
  :param str symbol: not used by onetrading fetchOrder
1585
1270
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1636,6 +1321,9 @@ class onetrading(Exchange, ImplicitAPI):
1636
1321
  def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1637
1322
  """
1638
1323
  fetch all unfilled currently open orders
1324
+
1325
+ https://docs.onetrading.com/#get-orders
1326
+
1639
1327
  :param str symbol: unified market symbol
1640
1328
  :param int [since]: the earliest time in ms to fetch open orders for
1641
1329
  :param int [limit]: the maximum number of open orders structures to retrieve
@@ -1750,6 +1438,9 @@ class onetrading(Exchange, ImplicitAPI):
1750
1438
  def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1751
1439
  """
1752
1440
  fetches information on multiple closed orders made by the user
1441
+
1442
+ https://docs.onetrading.com/#get-orders
1443
+
1753
1444
  :param str symbol: unified market symbol of the market orders were made in
1754
1445
  :param int [since]: the earliest time in ms to fetch orders for
1755
1446
  :param int [limit]: the maximum number of order structures to retrieve
@@ -1764,6 +1455,9 @@ class onetrading(Exchange, ImplicitAPI):
1764
1455
  def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1765
1456
  """
1766
1457
  fetch all the trades made from a single order
1458
+
1459
+ https://docs.onetrading.com/#trades-for-order
1460
+
1767
1461
  :param str id: order id
1768
1462
  :param str symbol: unified market symbol
1769
1463
  :param int [since]: the earliest time in ms to fetch trades for
@@ -1819,6 +1513,9 @@ class onetrading(Exchange, ImplicitAPI):
1819
1513
  def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1820
1514
  """
1821
1515
  fetch all trades made by the user
1516
+
1517
+ https://docs.onetrading.com/#all-trades
1518
+
1822
1519
  :param str symbol: unified market symbol
1823
1520
  :param int [since]: the earliest time in ms to fetch trades for
1824
1521
  :param int [limit]: the maximum number of trades structures to retrieve
ccxt/paradex.py CHANGED
@@ -53,6 +53,8 @@ class paradex(Exchange, ImplicitAPI):
53
53
  'createOrder': True,
54
54
  'createOrders': False,
55
55
  'createReduceOnlyOrder': False,
56
+ 'createStopOrder': True,
57
+ 'createTriggerOrder': True,
56
58
  'editOrder': False,
57
59
  'fetchAccounts': False,
58
60
  'fetchBalance': True,
ccxt/phemex.py CHANGED
@@ -2537,6 +2537,22 @@ class phemex(Exchange, ImplicitAPI):
2537
2537
  if triggerPrice is not None:
2538
2538
  triggerType = self.safe_string(params, 'triggerType', 'ByMarkPrice')
2539
2539
  request['triggerType'] = triggerType
2540
+ # set direction & exchange specific order type
2541
+ triggerDirection = None
2542
+ triggerDirection, params = self.handle_param_string(params, 'triggerDirection')
2543
+ if triggerDirection is None:
2544
+ raise ArgumentsRequired(self.id + " createOrder() also requires a 'triggerDirection' parameter with either 'up' or 'down' value")
2545
+ # the flow defined per https://phemex-docs.github.io/#more-order-type-examples
2546
+ if triggerDirection == 'up':
2547
+ if side == 'sell':
2548
+ request['ordType'] = 'MarketIfTouched' if (type == 'Market') else 'LimitIfTouched'
2549
+ elif side == 'buy':
2550
+ request['ordType'] = 'Stop' if (type == 'Market') else 'StopLimit'
2551
+ elif triggerDirection == 'down':
2552
+ if side == 'sell':
2553
+ request['ordType'] = 'Stop' if (type == 'Market') else 'StopLimit'
2554
+ elif side == 'buy':
2555
+ request['ordType'] = 'MarketIfTouched' if (type == 'Market') else 'LimitIfTouched'
2540
2556
  if stopLossDefined or takeProfitDefined:
2541
2557
  if stopLossDefined:
2542
2558
  stopLossTriggerPrice = self.safe_value_2(stopLoss, 'triggerPrice', 'stopPrice')