ccxt 4.4.32__py2.py3-none-any.whl → 4.4.34__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 (95) hide show
  1. ccxt/__init__.py +3 -1
  2. ccxt/abstract/bingx.py +16 -0
  3. ccxt/abstract/bitbank.py +5 -0
  4. ccxt/abstract/bitfinex2.py +1 -0
  5. ccxt/abstract/coinbaseexchange.py +1 -0
  6. ccxt/abstract/ellipx.py +25 -0
  7. ccxt/abstract/kraken.py +1 -0
  8. ccxt/alpaca.py +2 -0
  9. ccxt/async_support/__init__.py +3 -1
  10. ccxt/async_support/alpaca.py +2 -0
  11. ccxt/async_support/base/exchange.py +1 -1
  12. ccxt/async_support/binance.py +164 -7
  13. ccxt/async_support/bingx.py +155 -8
  14. ccxt/async_support/bitbank.py +5 -0
  15. ccxt/async_support/bitbns.py +2 -0
  16. ccxt/async_support/bitfinex2.py +1 -0
  17. ccxt/async_support/bitget.py +174 -40
  18. ccxt/async_support/bitmex.py +2 -0
  19. ccxt/async_support/bitopro.py +3 -0
  20. ccxt/async_support/bitrue.py +1 -0
  21. ccxt/async_support/btcmarkets.py +2 -0
  22. ccxt/async_support/bybit.py +143 -12
  23. ccxt/async_support/cex.py +16 -5
  24. ccxt/async_support/coinbase.py +5 -24
  25. ccxt/async_support/coinbaseexchange.py +2 -1
  26. ccxt/async_support/coinex.py +2 -0
  27. ccxt/async_support/coinone.py +7 -7
  28. ccxt/async_support/coinsph.py +7 -7
  29. ccxt/async_support/coinspot.py +39 -39
  30. ccxt/async_support/cryptocom.py +36 -34
  31. ccxt/async_support/ellipx.py +1828 -0
  32. ccxt/async_support/gate.py +1 -0
  33. ccxt/async_support/hyperliquid.py +13 -2
  34. ccxt/async_support/kraken.py +1 -0
  35. ccxt/async_support/krakenfutures.py +3 -1
  36. ccxt/async_support/kucoinfutures.py +1 -1
  37. ccxt/async_support/lbank.py +1 -0
  38. ccxt/async_support/okcoin.py +2 -0
  39. ccxt/async_support/okx.py +103 -8
  40. ccxt/async_support/onetrading.py +20 -1
  41. ccxt/async_support/paradex.py +2 -0
  42. ccxt/async_support/phemex.py +33 -6
  43. ccxt/async_support/poloniex.py +3 -1
  44. ccxt/async_support/poloniexfutures.py +3 -1
  45. ccxt/async_support/vertex.py +2 -0
  46. ccxt/async_support/woo.py +69 -69
  47. ccxt/base/exchange.py +100 -2
  48. ccxt/binance.py +164 -7
  49. ccxt/bingx.py +155 -8
  50. ccxt/bitbank.py +5 -0
  51. ccxt/bitbns.py +2 -0
  52. ccxt/bitfinex2.py +1 -0
  53. ccxt/bitget.py +174 -40
  54. ccxt/bitmex.py +2 -0
  55. ccxt/bitopro.py +3 -0
  56. ccxt/bitrue.py +1 -0
  57. ccxt/btcmarkets.py +2 -0
  58. ccxt/bybit.py +143 -12
  59. ccxt/cex.py +16 -5
  60. ccxt/coinbase.py +5 -24
  61. ccxt/coinbaseexchange.py +2 -1
  62. ccxt/coinex.py +2 -0
  63. ccxt/coinone.py +7 -7
  64. ccxt/coinsph.py +7 -7
  65. ccxt/coinspot.py +39 -39
  66. ccxt/cryptocom.py +36 -34
  67. ccxt/ellipx.py +1828 -0
  68. ccxt/gate.py +1 -0
  69. ccxt/hyperliquid.py +13 -2
  70. ccxt/kraken.py +1 -0
  71. ccxt/krakenfutures.py +3 -1
  72. ccxt/kucoinfutures.py +1 -1
  73. ccxt/lbank.py +1 -0
  74. ccxt/okcoin.py +2 -0
  75. ccxt/okx.py +103 -8
  76. ccxt/onetrading.py +20 -1
  77. ccxt/paradex.py +2 -0
  78. ccxt/phemex.py +33 -6
  79. ccxt/poloniex.py +3 -1
  80. ccxt/poloniexfutures.py +3 -1
  81. ccxt/pro/__init__.py +1 -1
  82. ccxt/pro/idex.py +15 -0
  83. ccxt/pro/okx.py +8 -0
  84. ccxt/pro/probit.py +4 -2
  85. ccxt/pro/woo.py +15 -15
  86. ccxt/test/tests_async.py +3 -1
  87. ccxt/test/tests_helpers.py +1 -3
  88. ccxt/test/tests_sync.py +3 -1
  89. ccxt/vertex.py +2 -0
  90. ccxt/woo.py +69 -69
  91. {ccxt-4.4.32.dist-info → ccxt-4.4.34.dist-info}/METADATA +9 -8
  92. {ccxt-4.4.32.dist-info → ccxt-4.4.34.dist-info}/RECORD +95 -92
  93. {ccxt-4.4.32.dist-info → ccxt-4.4.34.dist-info}/LICENSE.txt +0 -0
  94. {ccxt-4.4.32.dist-info → ccxt-4.4.34.dist-info}/WHEEL +0 -0
  95. {ccxt-4.4.32.dist-info → ccxt-4.4.34.dist-info}/top_level.txt +0 -0
@@ -12,6 +12,7 @@ from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
13
  from ccxt.base.errors import AuthenticationError
14
14
  from ccxt.base.errors import PermissionDenied
15
+ from ccxt.base.errors import AccountSuspended
15
16
  from ccxt.base.errors import ArgumentsRequired
16
17
  from ccxt.base.errors import BadRequest
17
18
  from ccxt.base.errors import BadSymbol
@@ -568,7 +569,7 @@ class bybit(Exchange, ImplicitAPI):
568
569
  '10005': PermissionDenied, # permission denied for current apikey
569
570
  '10006': RateLimitExceeded, # too many requests
570
571
  '10007': AuthenticationError, # api_key not found in your request parameters
571
- '10008': AuthenticationError, # User had been banned
572
+ '10008': AccountSuspended, # User had been banned
572
573
  '10009': AuthenticationError, # IP had been banned
573
574
  '10010': PermissionDenied, # request ip mismatch
574
575
  '10014': BadRequest, # Request is duplicate
@@ -1012,7 +1013,7 @@ class bybit(Exchange, ImplicitAPI):
1012
1013
  'enableUnifiedMargin': None,
1013
1014
  'enableUnifiedAccount': None,
1014
1015
  'unifiedMarginStatus': None,
1015
- 'createMarketBuyOrderRequiresPrice': True, # only True for classic accounts
1016
+ 'createMarketBuyOrderRequiresPrice': False, # only True for classic accounts
1016
1017
  'createUnifiedMarginAccount': False,
1017
1018
  'defaultType': 'swap', # 'swap', 'future', 'option', 'spot'
1018
1019
  'defaultSubType': 'linear', # 'linear', 'inverse'
@@ -1072,6 +1073,123 @@ class bybit(Exchange, ImplicitAPI):
1072
1073
  '1d': '1d',
1073
1074
  },
1074
1075
  },
1076
+ 'features': {
1077
+ 'default': {
1078
+ 'sandbox': True,
1079
+ 'createOrder': {
1080
+ 'marginMode': False,
1081
+ 'triggerPrice': True,
1082
+ 'triggerPriceType': {
1083
+ 'last': True,
1084
+ 'mark': True,
1085
+ 'index': True,
1086
+ },
1087
+ 'triggerDirection': True,
1088
+ 'stopLossPrice': True,
1089
+ 'takeProfitPrice': True,
1090
+ 'attachedStopLossTakeProfit': {
1091
+ 'triggerPriceType': {
1092
+ 'last': True,
1093
+ 'mark': True,
1094
+ 'index': True,
1095
+ },
1096
+ 'limitPrice': True,
1097
+ },
1098
+ 'timeInForce': {
1099
+ 'GTC': True,
1100
+ 'IOC': True,
1101
+ 'FOK': True,
1102
+ 'PO': True,
1103
+ 'GTD': False,
1104
+ },
1105
+ 'hedged': True,
1106
+ # exchange-supported features
1107
+ 'selfTradePrevention': True,
1108
+ 'trailing': True,
1109
+ 'twap': False,
1110
+ 'iceberg': False,
1111
+ 'oco': False,
1112
+ },
1113
+ 'createOrders': {
1114
+ 'max': 10,
1115
+ },
1116
+ 'fetchMyTrades': {
1117
+ 'marginMode': False,
1118
+ 'limit': 100,
1119
+ 'daysBack': 365 * 2, # 2 years
1120
+ 'untilDays': 7, # days between start-end
1121
+ },
1122
+ 'fetchOrder': {
1123
+ 'marginMode': False,
1124
+ 'trigger': True,
1125
+ 'trailing': False,
1126
+ },
1127
+ 'fetchOpenOrders': {
1128
+ 'marginMode': False,
1129
+ 'limit': 50,
1130
+ 'trigger': True,
1131
+ 'trailing': False,
1132
+ },
1133
+ 'fetchOrders': None,
1134
+ 'fetchClosedOrders': {
1135
+ 'marginMode': False,
1136
+ 'limit': 50,
1137
+ 'daysBackClosed': 365 * 2, # 2 years
1138
+ 'daysBackCanceled': 1,
1139
+ 'untilDays': 7,
1140
+ 'trigger': True,
1141
+ 'trailing': False,
1142
+ },
1143
+ 'fetchOHLCV': {
1144
+ 'limit': 1000,
1145
+ },
1146
+ },
1147
+ 'spot': {
1148
+ 'extends': 'default',
1149
+ 'createOrder': {
1150
+ 'marginMode': False,
1151
+ 'triggerPrice': True,
1152
+ 'triggerPriceType': None,
1153
+ 'triggerDirection': False,
1154
+ 'stopLossPrice': True,
1155
+ 'takeProfitPrice': True,
1156
+ 'attachedStopLossTakeProfit': {
1157
+ 'triggerPriceType': None,
1158
+ 'limitPrice': True,
1159
+ },
1160
+ 'timeInForce': {
1161
+ 'GTC': True,
1162
+ 'IOC': True,
1163
+ 'FOK': True,
1164
+ 'PO': True,
1165
+ 'GTD': False,
1166
+ },
1167
+ 'hedged': True,
1168
+ # exchange-supported features
1169
+ 'selfTradePrevention': True,
1170
+ 'trailing': True,
1171
+ 'twap': False,
1172
+ 'iceberg': False,
1173
+ 'oco': False,
1174
+ },
1175
+ },
1176
+ 'swap': {
1177
+ 'linear': {
1178
+ 'extends': 'default',
1179
+ },
1180
+ 'inverse': {
1181
+ 'extends': 'default',
1182
+ },
1183
+ },
1184
+ 'future': {
1185
+ 'linear': {
1186
+ 'extends': 'default',
1187
+ },
1188
+ 'inverse': {
1189
+ 'extends': 'default',
1190
+ },
1191
+ },
1192
+ },
1075
1193
  'fees': {
1076
1194
  'trading': {
1077
1195
  'feeSide': 'get',
@@ -1112,7 +1230,7 @@ class bybit(Exchange, ImplicitAPI):
1112
1230
 
1113
1231
  def add_pagination_cursor_to_result(self, response):
1114
1232
  result = self.safe_dict(response, 'result', {})
1115
- data = self.safe_value_n(result, ['list', 'rows', 'data', 'dataList'], [])
1233
+ data = self.safe_list_n(result, ['list', 'rows', 'data', 'dataList'], [])
1116
1234
  paginationCursor = self.safe_string_2(result, 'nextPageCursor', 'cursor')
1117
1235
  dataLength = len(data)
1118
1236
  if (paginationCursor is not None) and (dataLength > 0):
@@ -1123,12 +1241,12 @@ class bybit(Exchange, ImplicitAPI):
1123
1241
 
1124
1242
  async def is_unified_enabled(self, params={}):
1125
1243
  """
1126
- :param dict [params]: extra parameters specific to the exchange API endpoint
1127
1244
 
1128
1245
  https://bybit-exchange.github.io/docs/v5/user/apikey-info#http-request
1129
1246
  https://bybit-exchange.github.io/docs/v5/account/account-info
1130
1247
 
1131
1248
  returns [enableUnifiedMargin, enableUnifiedAccount] so the user can check if unified account is enabled
1249
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1132
1250
  :returns any: [enableUnifiedMargin, enableUnifiedAccount]
1133
1251
  """
1134
1252
  # The API key of user id must own one of permissions will be allowed to call following API endpoints.
@@ -2161,6 +2279,7 @@ class bybit(Exchange, ImplicitAPI):
2161
2279
  :param str[] symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
2162
2280
  :param dict [params]: extra parameters specific to the exchange API endpoint
2163
2281
  :param str [params.subType]: *contract only* 'linear', 'inverse'
2282
+ :param str [params.baseCoin]: *option only* base coin, default is 'BTC'
2164
2283
  :returns dict: an array of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
2165
2284
  """
2166
2285
  await self.load_markets()
@@ -2202,10 +2321,11 @@ class bybit(Exchange, ImplicitAPI):
2202
2321
  # only if passedSubType is None, then use spot
2203
2322
  if type == 'spot' and passedSubType is None:
2204
2323
  request['category'] = 'spot'
2205
- elif type == 'swap' or type == 'future' or subType is not None:
2206
- request['category'] = subType
2207
2324
  elif type == 'option':
2208
2325
  request['category'] = 'option'
2326
+ request['baseCoin'] = self.safe_string(params, 'baseCoin', 'BTC')
2327
+ elif type == 'swap' or type == 'future' or subType is not None:
2328
+ request['category'] = subType
2209
2329
  response = await self.publicGetV5MarketTickers(self.extend(request, params))
2210
2330
  #
2211
2331
  # {
@@ -2992,7 +3112,7 @@ class bybit(Exchange, ImplicitAPI):
2992
3112
  'datetime': self.iso8601(timestamp),
2993
3113
  }
2994
3114
  responseResult = self.safe_dict(response, 'result', {})
2995
- currencyList = self.safe_value_n(responseResult, ['loanAccountList', 'list', 'balance'])
3115
+ currencyList = self.safe_list_n(responseResult, ['loanAccountList', 'list', 'balance'])
2996
3116
  if currencyList is None:
2997
3117
  # usdc wallet
2998
3118
  code = 'USDC'
@@ -3346,11 +3466,17 @@ class bybit(Exchange, ImplicitAPI):
3346
3466
  market = self.safe_market(marketId, market, None, marketType)
3347
3467
  symbol = market['symbol']
3348
3468
  timestamp = self.safe_integer_2(order, 'createdTime', 'createdAt')
3469
+ marketUnit = self.safe_string(order, 'marketUnit', 'baseCoin')
3349
3470
  id = self.safe_string(order, 'orderId')
3350
3471
  type = self.safe_string_lower(order, 'orderType')
3351
3472
  price = self.safe_string(order, 'price')
3352
- amount = self.safe_string(order, 'qty')
3353
- cost = self.safe_string(order, 'cumExecValue')
3473
+ amount: Str = None
3474
+ cost: Str = None
3475
+ if marketUnit == 'baseCoin':
3476
+ amount = self.safe_string(order, 'qty')
3477
+ cost = self.safe_string(order, 'cumExecValue')
3478
+ else:
3479
+ cost = self.safe_string(order, 'cumExecValue')
3354
3480
  filled = self.safe_string(order, 'cumExecQty')
3355
3481
  remaining = self.safe_string(order, 'leavesQty')
3356
3482
  lastTradeTimestamp = self.safe_integer_2(order, 'updatedTime', 'updatedAt')
@@ -3666,7 +3792,7 @@ class bybit(Exchange, ImplicitAPI):
3666
3792
  # classic accounts
3667
3793
  # for market buy it requires the amount of quote currency to spend
3668
3794
  createMarketBuyOrderRequiresPrice = True
3669
- createMarketBuyOrderRequiresPrice, params = self.handle_option_and_params(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', True)
3795
+ createMarketBuyOrderRequiresPrice, params = self.handle_option_and_params(params, 'createOrder', 'createMarketBuyOrderRequiresPrice')
3670
3796
  if createMarketBuyOrderRequiresPrice:
3671
3797
  if (price is None) and (cost is None):
3672
3798
  raise InvalidOrder(self.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend(amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to False and pass the cost to spend in the amount argument')
@@ -3675,7 +3801,12 @@ class bybit(Exchange, ImplicitAPI):
3675
3801
  costRequest = cost if (cost is not None) else quoteAmount
3676
3802
  request['qty'] = self.get_cost(symbol, costRequest)
3677
3803
  else:
3678
- request['qty'] = self.get_cost(symbol, self.number_to_string(amount))
3804
+ if cost is not None:
3805
+ request['qty'] = self.get_cost(symbol, self.number_to_string(cost))
3806
+ elif price is not None:
3807
+ request['qty'] = self.get_cost(symbol, Precise.string_mul(amountString, priceString))
3808
+ else:
3809
+ request['qty'] = self.get_cost(symbol, self.number_to_string(amount))
3679
3810
  else:
3680
3811
  if not isTrailingAmountOrder and not isAlternativeEndpoint:
3681
3812
  request['qty'] = amountString
@@ -3751,7 +3882,7 @@ class bybit(Exchange, ImplicitAPI):
3751
3882
  side = self.safe_string(rawOrder, 'side')
3752
3883
  amount = self.safe_value(rawOrder, 'amount')
3753
3884
  price = self.safe_value(rawOrder, 'price')
3754
- orderParams = self.safe_value(rawOrder, 'params', {})
3885
+ orderParams = self.safe_dict(rawOrder, 'params', {})
3755
3886
  orderRequest = self.create_order_request(marketId, type, side, amount, price, orderParams, isUta)
3756
3887
  ordersRequests.append(orderRequest)
3757
3888
  symbols = self.market_symbols(orderSymbols, None, False, True, True)
ccxt/async_support/cex.py CHANGED
@@ -10,6 +10,7 @@ import hashlib
10
10
  from ccxt.base.types import Account, Balances, Currencies, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
11
11
  from typing import List
12
12
  from ccxt.base.errors import ExchangeError
13
+ from ccxt.base.errors import AuthenticationError
13
14
  from ccxt.base.errors import PermissionDenied
14
15
  from ccxt.base.errors import ArgumentsRequired
15
16
  from ccxt.base.errors import BadRequest
@@ -26,7 +27,7 @@ class cex(Exchange, ImplicitAPI):
26
27
  'id': 'cex',
27
28
  'name': 'CEX.IO',
28
29
  'countries': ['GB', 'EU', 'CY', 'RU'],
29
- 'rateLimit': 1667, # 100 req/min
30
+ 'rateLimit': 300, # 200 req/min
30
31
  'pro': True,
31
32
  'has': {
32
33
  'CORS': None,
@@ -38,6 +39,8 @@ class cex(Exchange, ImplicitAPI):
38
39
  'cancelAllOrders': True,
39
40
  'cancelOrder': True,
40
41
  'createOrder': True,
42
+ 'createStopOrder': True,
43
+ 'createTriggerOrder': True,
41
44
  'fetchAccounts': True,
42
45
  'fetchBalance': True,
43
46
  'fetchClosedOrder': True,
@@ -127,6 +130,7 @@ class cex(Exchange, ImplicitAPI):
127
130
  'Insufficient funds': InsufficientFunds,
128
131
  'Get deposit address for main account is not allowed': PermissionDenied,
129
132
  'Market Trigger orders are not allowed': BadRequest, # for some reason, triggerPrice does not work for market orders
133
+ 'key not passed or incorrect': AuthenticationError,
130
134
  },
131
135
  },
132
136
  'timeframes': {
@@ -837,7 +841,7 @@ class cex(Exchange, ImplicitAPI):
837
841
  code = self.safe_currency_code(key)
838
842
  account: dict = {
839
843
  'used': self.safe_string(balance, 'balanceOnHold'),
840
- 'free': self.safe_string(balance, 'balance'),
844
+ 'total': self.safe_string(balance, 'balance'),
841
845
  }
842
846
  result[code] = account
843
847
  return self.safe_balance(result)
@@ -917,7 +921,7 @@ class cex(Exchange, ImplicitAPI):
917
921
  # },
918
922
  # ...
919
923
  #
920
- data = self.safe_value(response, 'data', [])
924
+ data = self.safe_list(response, 'data', [])
921
925
  return self.parse_orders(data, market, since, limit)
922
926
 
923
927
  async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
@@ -986,10 +990,16 @@ class cex(Exchange, ImplicitAPI):
986
990
 
987
991
  def parse_order_status(self, status: Str):
988
992
  statuses: dict = {
993
+ 'PENDING_NEW': 'open',
994
+ 'NEW': 'open',
995
+ 'PARTIALLY_FILLED': 'open',
989
996
  'FILLED': 'closed',
997
+ 'EXPIRED': 'expired',
998
+ 'REJECTED': 'rejected',
999
+ 'PENDING_CANCEL': 'canceling',
990
1000
  'CANCELLED': 'canceled',
991
1001
  }
992
- return self.safe_string(statuses, status, None)
1002
+ return self.safe_string(statuses, status, status)
993
1003
 
994
1004
  def parse_order(self, order: dict, market: Market = None) -> Order:
995
1005
  #
@@ -1038,7 +1048,7 @@ class cex(Exchange, ImplicitAPI):
1038
1048
  currencyId = self.safe_string(order, 'feeCurrency')
1039
1049
  feeCode = self.safe_currency_code(currencyId)
1040
1050
  fee['currency'] = feeCode
1041
- fee['fee'] = feeAmount
1051
+ fee['cost'] = feeAmount
1042
1052
  timestamp = self.safe_integer(order, 'serverCreateTimestamp')
1043
1053
  requestedBase = self.safe_number(order, 'requestedAmountCcy1')
1044
1054
  executedBase = self.safe_number(order, 'executedAmountCcy1')
@@ -1082,6 +1092,7 @@ class cex(Exchange, ImplicitAPI):
1082
1092
  :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1083
1093
  :param dict [params]: extra parameters specific to the exchange API endpoint
1084
1094
  :param str [params.accountId]: account-id to use(default is empty string)
1095
+ :param float [params.triggerPrice]: the price at which a trigger order is triggered at
1085
1096
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1086
1097
  """
1087
1098
  accountId = None
@@ -2182,7 +2182,8 @@ class coinbase(Exchange, ImplicitAPI):
2182
2182
 
2183
2183
  :param dict [params]: extra parameters specific to the exchange API endpoint
2184
2184
  :param boolean [params.v3]: default False, set True to use v3 api endpoint
2185
- :param dict [params.type]: "spot"(default) or "swap" or "future"
2185
+ :param str [params.type]: "spot"(default) or "swap" or "future"
2186
+ :param int [params.limit]: default 250, maximum number of accounts to return
2186
2187
  :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
2187
2188
  """
2188
2189
  await self.load_markets()
@@ -2199,7 +2200,7 @@ class coinbase(Exchange, ImplicitAPI):
2199
2200
  request['limit'] = 250
2200
2201
  response = await self.v3PrivateGetBrokerageAccounts(self.extend(request, params))
2201
2202
  else:
2202
- request['limit'] = 100
2203
+ request['limit'] = 250
2203
2204
  response = await self.v2PrivateGetAccounts(self.extend(request, params))
2204
2205
  #
2205
2206
  # v2PrivateGetAccounts
@@ -2311,28 +2312,8 @@ class coinbase(Exchange, ImplicitAPI):
2311
2312
  pagination = self.safe_dict(response, 'pagination', {})
2312
2313
  cursor = self.safe_string(pagination, 'next_starting_after')
2313
2314
  if (cursor is not None) and (cursor != ''):
2314
- lastFee = self.safe_dict(last, 'fee')
2315
- last['next_starting_after'] = cursor
2316
- ledger[lastIndex] = {
2317
- 'info': self.safe_dict(last, 'info'),
2318
- 'id': self.safe_string(last, 'id'),
2319
- 'timestamp': self.safe_integer(last, 'timestamp'),
2320
- 'datetime': self.safe_string(last, 'datetime'),
2321
- 'direction': self.safe_string(last, 'direction'),
2322
- 'account': self.safe_string(last, 'account'),
2323
- 'referenceId': None,
2324
- 'referenceAccount': None,
2325
- 'type': self.safe_string(last, 'type'),
2326
- 'currency': self.safe_string(last, 'currency'),
2327
- 'amount': self.safe_number(last, 'amount'),
2328
- 'before': None,
2329
- 'after': None,
2330
- 'status': self.safe_string(last, 'status'),
2331
- 'fee': {
2332
- 'cost': self.safe_number(lastFee, 'cost'),
2333
- 'currency': self.safe_string(lastFee, 'currency'),
2334
- },
2335
- }
2315
+ last['info']['next_starting_after'] = cursor
2316
+ ledger[lastIndex] = last
2336
2317
  return ledger
2337
2318
 
2338
2319
  def parse_ledger_entry_status(self, status):
@@ -127,7 +127,8 @@ class coinbaseexchange(Exchange, ImplicitAPI):
127
127
  'products/{id}/ticker',
128
128
  'products/{id}/trades',
129
129
  'time',
130
- 'products/spark-lines', # experimental
130
+ 'products/spark-lines', # experimental,
131
+ 'products/volume-summary',
131
132
  ],
132
133
  },
133
134
  'private': {
@@ -69,6 +69,7 @@ class coinex(Exchange, ImplicitAPI):
69
69
  'createOrders': True,
70
70
  'createReduceOnlyOrder': True,
71
71
  'createStopLossOrder': True,
72
+ 'createStopOrder': True,
72
73
  'createTakeProfitOrder': True,
73
74
  'createTriggerOrder': True,
74
75
  'editOrder': True,
@@ -4575,6 +4576,7 @@ class coinex(Exchange, ImplicitAPI):
4575
4576
  'not_pass': 'failed',
4576
4577
  'cancel': 'canceled',
4577
4578
  'finish': 'ok',
4579
+ 'finished': 'ok',
4578
4580
  'fail': 'failed',
4579
4581
  }
4580
4582
  return self.safe_string(statuses, status, status)
@@ -240,7 +240,7 @@ class coinone(Exchange, ImplicitAPI):
240
240
  # }
241
241
  #
242
242
  result: dict = {}
243
- currencies = self.safe_value(response, 'currencies', [])
243
+ currencies = self.safe_list(response, 'currencies', [])
244
244
  for i in range(0, len(currencies)):
245
245
  entry = currencies[i]
246
246
  id = self.safe_string(entry, 'symbol')
@@ -320,7 +320,7 @@ class coinone(Exchange, ImplicitAPI):
320
320
  # ]
321
321
  # }
322
322
  #
323
- tickers = self.safe_value(response, 'tickers', [])
323
+ tickers = self.safe_list(response, 'tickers', [])
324
324
  result = []
325
325
  for i in range(0, len(tickers)):
326
326
  entry = self.safe_value(tickers, i)
@@ -570,7 +570,7 @@ class coinone(Exchange, ImplicitAPI):
570
570
  # ]
571
571
  # }
572
572
  #
573
- data = self.safe_value(response, 'tickers', [])
573
+ data = self.safe_list(response, 'tickers', [])
574
574
  ticker = self.safe_dict(data, 0, {})
575
575
  return self.parse_ticker(ticker, market)
576
576
 
@@ -603,8 +603,8 @@ class coinone(Exchange, ImplicitAPI):
603
603
  #
604
604
  timestamp = self.safe_integer(ticker, 'timestamp')
605
605
  last = self.safe_string(ticker, 'last')
606
- asks = self.safe_value(ticker, 'best_asks')
607
- bids = self.safe_value(ticker, 'best_bids')
606
+ asks = self.safe_list(ticker, 'best_asks', [])
607
+ bids = self.safe_list(ticker, 'best_bids', [])
608
608
  baseId = self.safe_string(ticker, 'target_currency')
609
609
  quoteId = self.safe_string(ticker, 'quote_currency')
610
610
  base = self.safe_currency_code(baseId)
@@ -658,7 +658,7 @@ class coinone(Exchange, ImplicitAPI):
658
658
  #
659
659
  timestamp = self.safe_integer(trade, 'timestamp')
660
660
  market = self.safe_market(None, market)
661
- isSellerMaker = self.safe_value(trade, 'is_seller_maker')
661
+ isSellerMaker = self.safe_bool(trade, 'is_seller_maker')
662
662
  side = None
663
663
  if isSellerMaker is not None:
664
664
  side = 'sell' if isSellerMaker else 'buy'
@@ -1063,7 +1063,7 @@ class coinone(Exchange, ImplicitAPI):
1063
1063
  # }
1064
1064
  # }
1065
1065
  #
1066
- walletAddress = self.safe_value(response, 'walletAddress', {})
1066
+ walletAddress = self.safe_dict(response, 'walletAddress', {})
1067
1067
  keys = list(walletAddress.keys())
1068
1068
  result: dict = {}
1069
1069
  for i in range(0, len(keys)):
@@ -555,7 +555,7 @@ class coinsph(Exchange, ImplicitAPI):
555
555
  # ]
556
556
  # }
557
557
  #
558
- markets = self.safe_value(response, 'symbols')
558
+ markets = self.safe_list(response, 'symbols', [])
559
559
  result = []
560
560
  for i in range(0, len(markets)):
561
561
  market = markets[i]
@@ -564,7 +564,7 @@ class coinsph(Exchange, ImplicitAPI):
564
564
  quoteId = self.safe_string(market, 'quoteAsset')
565
565
  base = self.safe_currency_code(baseId)
566
566
  quote = self.safe_currency_code(quoteId)
567
- limits = self.index_by(self.safe_value(market, 'filters'), 'filterType')
567
+ limits = self.index_by(self.safe_list(market, 'filters', []), 'filterType')
568
568
  amountLimits = self.safe_value(limits, 'LOT_SIZE', {})
569
569
  priceLimits = self.safe_value(limits, 'PRICE_FILTER', {})
570
570
  costLimits = self.safe_value(limits, 'NOTIONAL', {})
@@ -644,7 +644,7 @@ class coinsph(Exchange, ImplicitAPI):
644
644
  ids.append(id)
645
645
  request['symbols'] = ids
646
646
  defaultMethod = 'publicGetOpenapiQuoteV1Ticker24hr'
647
- options = self.safe_value(self.options, 'fetchTickers', {})
647
+ options = self.safe_dict(self.options, 'fetchTickers', {})
648
648
  method = self.safe_string(options, 'method', defaultMethod)
649
649
  tickers = None
650
650
  if method == 'publicGetOpenapiQuoteV1TickerPrice':
@@ -673,7 +673,7 @@ class coinsph(Exchange, ImplicitAPI):
673
673
  'symbol': market['id'],
674
674
  }
675
675
  defaultMethod = 'publicGetOpenapiQuoteV1Ticker24hr'
676
- options = self.safe_value(self.options, 'fetchTicker', {})
676
+ options = self.safe_dict(self.options, 'fetchTicker', {})
677
677
  method = self.safe_string(options, 'method', defaultMethod)
678
678
  ticker = None
679
679
  if method == 'publicGetOpenapiQuoteV1TickerPrice':
@@ -1002,7 +1002,7 @@ class coinsph(Exchange, ImplicitAPI):
1002
1002
  'cost': feeCost,
1003
1003
  'currency': self.safe_currency_code(feeCurrencyId),
1004
1004
  }
1005
- isBuyer = self.safe_value_2(trade, 'isBuyer', 'isBuyerMaker', None)
1005
+ isBuyer = self.safe_bool_2(trade, 'isBuyer', 'isBuyerMaker', None)
1006
1006
  side = None
1007
1007
  if isBuyer is not None:
1008
1008
  side = 'buy' if (isBuyer is True) else 'sell'
@@ -1064,7 +1064,7 @@ class coinsph(Exchange, ImplicitAPI):
1064
1064
  return self.parse_balance(response)
1065
1065
 
1066
1066
  def parse_balance(self, response) -> Balances:
1067
- balances = self.safe_value(response, 'balances', [])
1067
+ balances = self.safe_list(response, 'balances', [])
1068
1068
  result: dict = {
1069
1069
  'info': response,
1070
1070
  'timestamp': None,
@@ -1484,7 +1484,7 @@ class coinsph(Exchange, ImplicitAPI):
1484
1484
  # }
1485
1485
  # ]
1486
1486
  #
1487
- tradingFee = self.safe_value(response, 0, {})
1487
+ tradingFee = self.safe_dict(response, 0, {})
1488
1488
  return self.parse_trading_fee(tradingFee, market)
1489
1489
 
1490
1490
  async def fetch_trading_fees(self, params={}) -> TradingFees:
@@ -270,7 +270,7 @@ class coinspot(Exchange, ImplicitAPI):
270
270
  response = await self.publicGetLatest(params)
271
271
  id = market['id']
272
272
  id = id.lower()
273
- prices = self.safe_value(response, 'prices')
273
+ prices = self.safe_dict(response, 'prices', {})
274
274
  #
275
275
  # {
276
276
  # "status":"ok",
@@ -301,22 +301,22 @@ class coinspot(Exchange, ImplicitAPI):
301
301
  #
302
302
  # {
303
303
  # "status": "ok",
304
- # "prices": {
305
- # "btc": {
306
- # "bid": "25050",
307
- # "ask": "25370",
308
- # "last": "25234"
309
- # },
310
- # "ltc": {
311
- # "bid": "79.39192993",
312
- # "ask": "87.98",
313
- # "last": "87.95"
304
+ # "prices": {
305
+ # "btc": {
306
+ # "bid": "25050",
307
+ # "ask": "25370",
308
+ # "last": "25234"
309
+ # },
310
+ # "ltc": {
311
+ # "bid": "79.39192993",
312
+ # "ask": "87.98",
313
+ # "last": "87.95"
314
+ # }
314
315
  # }
315
- # }
316
316
  # }
317
317
  #
318
318
  result: dict = {}
319
- prices = self.safe_value(response, 'prices')
319
+ prices = self.safe_dict(response, 'prices', {})
320
320
  ids = list(prices.keys())
321
321
  for i in range(0, len(ids)):
322
322
  id = ids[i]
@@ -377,35 +377,35 @@ class coinspot(Exchange, ImplicitAPI):
377
377
  request['startdate'] = self.yyyymmdd(since)
378
378
  response = await self.privatePostRoMyTransactions(self.extend(request, params))
379
379
  # {
380
- # "status": "ok",
381
- # "buyorders": [
382
- # {
383
- # "otc": False,
384
- # "market": "ALGO/AUD",
385
- # "amount": 386.95197925,
386
- # "created": "2022-10-20T09:56:44.502Z",
387
- # "audfeeExGst": 1.80018002,
388
- # "audGst": 0.180018,
389
- # "audtotal": 200
390
- # },
391
- # ],
392
- # "sellorders": [
393
- # {
394
- # "otc": False,
395
- # "market": "SOLO/ALGO",
396
- # "amount": 154.52345614,
397
- # "total": 115.78858204658796,
398
- # "created": "2022-04-16T09:36:43.698Z",
399
- # "audfeeExGst": 1.08995731,
400
- # "audGst": 0.10899573,
401
- # "audtotal": 118.7
402
- # },
403
- # ]
380
+ # "status": "ok",
381
+ # "buyorders": [
382
+ # {
383
+ # "otc": False,
384
+ # "market": "ALGO/AUD",
385
+ # "amount": 386.95197925,
386
+ # "created": "2022-10-20T09:56:44.502Z",
387
+ # "audfeeExGst": 1.80018002,
388
+ # "audGst": 0.180018,
389
+ # "audtotal": 200
390
+ # },
391
+ # ],
392
+ # "sellorders": [
393
+ # {
394
+ # "otc": False,
395
+ # "market": "SOLO/ALGO",
396
+ # "amount": 154.52345614,
397
+ # "total": 115.78858204658796,
398
+ # "created": "2022-04-16T09:36:43.698Z",
399
+ # "audfeeExGst": 1.08995731,
400
+ # "audGst": 0.10899573,
401
+ # "audtotal": 118.7
402
+ # },
403
+ # ]
404
404
  # }
405
- buyTrades = self.safe_value(response, 'buyorders', [])
405
+ buyTrades = self.safe_list(response, 'buyorders', [])
406
406
  for i in range(0, len(buyTrades)):
407
407
  buyTrades[i]['side'] = 'buy'
408
- sellTrades = self.safe_value(response, 'sellorders', [])
408
+ sellTrades = self.safe_list(response, 'sellorders', [])
409
409
  for i in range(0, len(sellTrades)):
410
410
  sellTrades[i]['side'] = 'sell'
411
411
  trades = self.array_concat(buyTrades, sellTrades)