ccxt 4.2.20__py2.py3-none-any.whl → 4.2.22__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.

Potentially problematic release.


This version of ccxt might be problematic. Click here for more details.

Files changed (62) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/binance.py +3 -0
  3. ccxt/abstract/binancecoinm.py +3 -0
  4. ccxt/abstract/binanceus.py +16 -12
  5. ccxt/abstract/binanceusdm.py +3 -0
  6. ccxt/abstract/gate.py +1 -0
  7. ccxt/abstract/gateio.py +1 -0
  8. ccxt/abstract/novadax.py +22 -18
  9. ccxt/abstract/phemex.py +1 -0
  10. ccxt/async_support/__init__.py +1 -1
  11. ccxt/async_support/base/exchange.py +16 -4
  12. ccxt/async_support/bigone.py +1 -0
  13. ccxt/async_support/binance.py +14 -3
  14. ccxt/async_support/bitget.py +11 -1
  15. ccxt/async_support/bitrue.py +1 -0
  16. ccxt/async_support/bitvavo.py +250 -152
  17. ccxt/async_support/blockchaincom.py +3 -1
  18. ccxt/async_support/bybit.py +49 -10
  19. ccxt/async_support/coinbasepro.py +1 -0
  20. ccxt/async_support/coinex.py +34 -12
  21. ccxt/async_support/deribit.py +145 -0
  22. ccxt/async_support/gate.py +30 -1
  23. ccxt/async_support/novadax.py +27 -23
  24. ccxt/async_support/okcoin.py +3 -0
  25. ccxt/async_support/phemex.py +7 -3
  26. ccxt/async_support/poloniex.py +1 -0
  27. ccxt/async_support/woo.py +1 -1
  28. ccxt/base/exchange.py +17 -5
  29. ccxt/bigone.py +1 -0
  30. ccxt/binance.py +14 -3
  31. ccxt/bitget.py +11 -1
  32. ccxt/bitrue.py +1 -0
  33. ccxt/bitvavo.py +250 -152
  34. ccxt/blockchaincom.py +3 -1
  35. ccxt/bybit.py +49 -10
  36. ccxt/coinbasepro.py +1 -0
  37. ccxt/coinex.py +34 -12
  38. ccxt/deribit.py +145 -0
  39. ccxt/gate.py +30 -1
  40. ccxt/novadax.py +27 -23
  41. ccxt/okcoin.py +3 -0
  42. ccxt/phemex.py +7 -3
  43. ccxt/poloniex.py +1 -0
  44. ccxt/pro/__init__.py +1 -1
  45. ccxt/pro/bequant.py +7 -1
  46. ccxt/pro/binance.py +7 -4
  47. ccxt/pro/binancecoinm.py +7 -1
  48. ccxt/pro/binanceus.py +7 -1
  49. ccxt/pro/bitcoincom.py +7 -1
  50. ccxt/pro/bitget.py +1 -1
  51. ccxt/pro/bitopro.py +7 -3
  52. ccxt/pro/bitrue.py +5 -1
  53. ccxt/pro/bitvavo.py +623 -19
  54. ccxt/pro/lbank.py +1 -1
  55. ccxt/pro/okx.py +10 -2
  56. ccxt/test/test_async.py +14 -1
  57. ccxt/test/test_sync.py +14 -1
  58. ccxt/woo.py +1 -1
  59. {ccxt-4.2.20.dist-info → ccxt-4.2.22.dist-info}/METADATA +4 -4
  60. {ccxt-4.2.20.dist-info → ccxt-4.2.22.dist-info}/RECORD +62 -62
  61. {ccxt-4.2.20.dist-info → ccxt-4.2.22.dist-info}/WHEEL +0 -0
  62. {ccxt-4.2.20.dist-info → ccxt-4.2.22.dist-info}/top_level.txt +0 -0
@@ -324,6 +324,7 @@ class bitvavo(Exchange, ImplicitAPI):
324
324
 
325
325
  async def fetch_markets(self, params={}):
326
326
  """
327
+ :see: https://docs.bitvavo.com/#tag/General/paths/~1markets/get
327
328
  retrieves data on all markets for bitvavo
328
329
  :param dict [params]: extra parameters specific to the exchange API endpoint
329
330
  :returns dict[]: an array of objects representing market data
@@ -343,12 +344,15 @@ class bitvavo(Exchange, ImplicitAPI):
343
344
  # }
344
345
  # ]
345
346
  #
347
+ return self.parse_markets(response)
348
+
349
+ def parse_markets(self, markets):
346
350
  currencies = self.currencies
347
351
  currenciesById = self.index_by(currencies, 'id')
348
352
  result = []
349
353
  fees = self.fees
350
- for i in range(0, len(response)):
351
- market = response[i]
354
+ for i in range(0, len(markets)):
355
+ market = markets[i]
352
356
  id = self.safe_string(market, 'market')
353
357
  baseId = self.safe_string(market, 'base')
354
358
  quoteId = self.safe_string(market, 'quote')
@@ -412,11 +416,48 @@ class bitvavo(Exchange, ImplicitAPI):
412
416
 
413
417
  async def fetch_currencies(self, params={}):
414
418
  """
419
+ :see: https://docs.bitvavo.com/#tag/General/paths/~1assets/get
415
420
  fetches all available currencies on an exchange
416
421
  :param dict [params]: extra parameters specific to the exchange API endpoint
417
422
  :returns dict: an associative dictionary of currencies
418
423
  """
419
424
  response = await self.publicGetAssets(params)
425
+ #
426
+ # [
427
+ # {
428
+ # "symbol": "USDT",
429
+ # "displayTicker": "USDT",
430
+ # "name": "Tether",
431
+ # "slug": "tether",
432
+ # "popularity": -1,
433
+ # "decimals": 6,
434
+ # "depositFee": "0",
435
+ # "depositConfirmations": 64,
436
+ # "depositStatus": "OK",
437
+ # "withdrawalFee": "3.2",
438
+ # "withdrawalMinAmount": "3.2",
439
+ # "withdrawalStatus": "OK",
440
+ # "networks": [
441
+ # "ETH"
442
+ # ],
443
+ # "light": {
444
+ # "color": "#009393",
445
+ # "icon": {"hash": "4ad7c699", "svg": "https://...", "webp16": "https://...", "webp32": "https://...", "webp64": "https://...", "webp128": "https://...", "webp256": "https://...", "png16": "https://...", "png32": "https://...", "png64": "https://...", "png128": "https://...", "png256": "https://..."
446
+ # }
447
+ # },
448
+ # "dark": {
449
+ # "color": "#009393",
450
+ # "icon": {"hash": "4ad7c699", "svg": "https://...", "webp16": "https://...", "webp32": "https://...", "webp64": "https://...", "webp128": "https://...", "webp256": "https://...", "png16": "https://...", "png32": "https://...", "png64": "https://...", "png128": "https://...", "png256": "https://..."
451
+ # }
452
+ # },
453
+ # "visibility": "PUBLIC",
454
+ # "message": ""
455
+ # },
456
+ # ]
457
+ #
458
+ return self.parse_currencies(response)
459
+
460
+ def parse_currencies(self, currencies):
420
461
  #
421
462
  # [
422
463
  # {
@@ -451,8 +492,8 @@ class bitvavo(Exchange, ImplicitAPI):
451
492
  # ]
452
493
  #
453
494
  result = {}
454
- for i in range(0, len(response)):
455
- currency = response[i]
495
+ for i in range(0, len(currencies)):
496
+ currency = currencies[i]
456
497
  id = self.safe_string(currency, 'symbol')
457
498
  code = self.safe_currency_code(id)
458
499
  networks = {}
@@ -766,6 +807,7 @@ class bitvavo(Exchange, ImplicitAPI):
766
807
 
767
808
  async def fetch_trading_fees(self, params={}):
768
809
  """
810
+ :see: https://docs.bitvavo.com/#tag/Account/paths/~1account/get
769
811
  fetch the trading fees for multiple markets
770
812
  :param dict [params]: extra parameters specific to the exchange API endpoint
771
813
  :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
@@ -781,14 +823,26 @@ class bitvavo(Exchange, ImplicitAPI):
781
823
  # }
782
824
  # }
783
825
  #
784
- fees = self.safe_value(response, 'fees')
785
- maker = self.safe_number(fees, 'maker')
786
- taker = self.safe_number(fees, 'taker')
826
+ return self.parse_trading_fees(response)
827
+
828
+ def parse_trading_fees(self, fees, market=None):
829
+ #
830
+ # {
831
+ # "fees": {
832
+ # "taker": "0.0025",
833
+ # "maker": "0.0015",
834
+ # "volume": "10000.00"
835
+ # }
836
+ # }
837
+ #
838
+ feesValue = self.safe_value(fees, 'fees')
839
+ maker = self.safe_number(feesValue, 'maker')
840
+ taker = self.safe_number(feesValue, 'taker')
787
841
  result = {}
788
842
  for i in range(0, len(self.symbols)):
789
843
  symbol = self.symbols[i]
790
844
  result[symbol] = {
791
- 'info': response,
845
+ 'info': fees,
792
846
  'symbol': symbol,
793
847
  'maker': maker,
794
848
  'taker': taker,
@@ -854,25 +908,8 @@ class bitvavo(Exchange, ImplicitAPI):
854
908
  self.safe_number(ohlcv, 5),
855
909
  ]
856
910
 
857
- async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
858
- """
859
- :see: https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1candles/get
860
- fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
861
- :param str symbol: unified symbol of the market to fetch OHLCV data for
862
- :param str timeframe: the length of time each candle represents
863
- :param int [since]: timestamp in ms of the earliest candle to fetch
864
- :param int [limit]: the maximum amount of candles to fetch
865
- :param dict [params]: extra parameters specific to the exchange API endpoint
866
- :param int [params.until]: the latest time in ms to fetch entries for
867
- :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)
868
- :returns int[][]: A list of candles ordered, open, high, low, close, volume
869
- """
870
- await self.load_markets()
911
+ def fetch_ohlcv_request(self, symbol: Str, timeframe='1m', since: Int = None, limit: Int = None, params={}):
871
912
  market = self.market(symbol)
872
- paginate = False
873
- paginate, params = self.handle_option_and_params(params, 'fetchOHLCV', 'paginate')
874
- if paginate:
875
- return await self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1440)
876
913
  request = {
877
914
  'market': market['id'],
878
915
  'interval': self.safe_string(self.timeframes, timeframe, timeframe),
@@ -890,7 +927,29 @@ class bitvavo(Exchange, ImplicitAPI):
890
927
  request, params = self.handle_until_option('end', request, params)
891
928
  if limit is not None:
892
929
  request['limit'] = limit # default 1440, max 1440
893
- response = await self.publicGetMarketCandles(self.extend(request, params))
930
+ return self.extend(request, params)
931
+
932
+ async def fetch_ohlcv(self, symbol: Str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
933
+ """
934
+ :see: https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1candles/get
935
+ fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
936
+ :param str symbol: unified symbol of the market to fetch OHLCV data for
937
+ :param str timeframe: the length of time each candle represents
938
+ :param int [since]: timestamp in ms of the earliest candle to fetch
939
+ :param int [limit]: the maximum amount of candles to fetch
940
+ :param dict [params]: extra parameters specific to the exchange API endpoint
941
+ :param int [params.until]: the latest time in ms to fetch entries for
942
+ :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)
943
+ :returns int[][]: A list of candles ordered, open, high, low, close, volume
944
+ """
945
+ await self.load_markets()
946
+ market = self.market(symbol)
947
+ paginate = False
948
+ paginate, params = self.handle_option_and_params(params, 'fetchOHLCV', 'paginate')
949
+ if paginate:
950
+ return await self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1440)
951
+ request = self.fetch_ohlcv_request(symbol, timeframe, since, limit, params)
952
+ response = await self.publicGetMarketCandles(request)
894
953
  #
895
954
  # [
896
955
  # [1590383700000,"8088.5","8088.5","8088.5","8088.5","0.04788623"],
@@ -918,6 +977,7 @@ class bitvavo(Exchange, ImplicitAPI):
918
977
 
919
978
  async def fetch_balance(self, params={}) -> Balances:
920
979
  """
980
+ :see: https://docs.bitvavo.com/#tag/Account/paths/~1balance/get
921
981
  query for balance and get the amount of funds available for trading or funds locked in orders
922
982
  :param dict [params]: extra parameters specific to the exchange API endpoint
923
983
  :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
@@ -965,31 +1025,7 @@ class bitvavo(Exchange, ImplicitAPI):
965
1025
  'info': response,
966
1026
  }
967
1027
 
968
- async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}):
969
- """
970
- create a trade order
971
- :see: https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/post
972
- :param str symbol: unified symbol of the market to create an order in
973
- :param str type: 'market' or 'limit'
974
- :param str side: 'buy' or 'sell'
975
- :param float amount: how much of currency you want to trade in units of base currency
976
- :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
977
- :param dict [params]: extra parameters specific to the exchange API endpoint
978
- :param str [params.timeInForce]: "GTC", "IOC", or "PO"
979
- :param float [params.stopPrice]: The price at which a trigger order is triggered at
980
- :param float [params.triggerPrice]: The price at which a trigger order is triggered at
981
- :param bool [params.postOnly]: If True, the order will only be posted to the order book and not executed immediately
982
- :param float [params.stopLossPrice]: The price at which a stop loss order is triggered at
983
- :param float [params.takeProfitPrice]: The price at which a take profit order is triggered at
984
- :param str [params.triggerType]: "price"
985
- :param str [params.triggerReference]: "lastTrade", "bestBid", "bestAsk", "midPrice" Only for stop orders: Use self to determine which parameter will trigger the order
986
- :param str [params.selfTradePrevention]: "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
987
- :param bool [params.disableMarketProtection]: don't cancel if the next fill price is 10% worse than the best fill price
988
- :param bool [params.responseRequired]: Set self to 'false' when only an acknowledgement of success or failure is required, self is faster.
989
- :param str [params.clientOrderId]: An ID supplied by the client that must be unique among all open orders for the same market
990
- :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
991
- """
992
- await self.load_markets()
1028
+ def create_order_request(self, symbol: Str, type: OrderType, side: OrderSide, amount, price=None, params={}):
993
1029
  market = self.market(symbol)
994
1030
  request = {
995
1031
  'market': market['id'],
@@ -1040,7 +1076,35 @@ class bitvavo(Exchange, ImplicitAPI):
1040
1076
  request['timeInForce'] = timeInForce
1041
1077
  if postOnly:
1042
1078
  request['postOnly'] = True
1043
- response = await self.privatePostOrder(self.extend(request, params))
1079
+ return self.extend(request, params)
1080
+
1081
+ async def create_order(self, symbol: Str, type: OrderType, side: OrderSide, amount, price=None, params={}):
1082
+ """
1083
+ create a trade order
1084
+ :see: https://docs.bitvavo.com/#tag/Orders/paths/~1order/post
1085
+ :param str symbol: unified symbol of the market to create an order in
1086
+ :param str type: 'market' or 'limit'
1087
+ :param str side: 'buy' or 'sell'
1088
+ :param float amount: how much of currency you want to trade in units of base currency
1089
+ :param float price: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1090
+ :param dict [params]: extra parameters specific to the bitvavo api endpoint
1091
+ :param str [params.timeInForce]: "GTC", "IOC", or "PO"
1092
+ :param float [params.stopPrice]: The price at which a trigger order is triggered at
1093
+ :param float [params.triggerPrice]: The price at which a trigger order is triggered at
1094
+ :param bool [params.postOnly]: If True, the order will only be posted to the order book and not executed immediately
1095
+ :param float [params.stopLossPrice]: The price at which a stop loss order is triggered at
1096
+ :param float [params.takeProfitPrice]: The price at which a take profit order is triggered at
1097
+ :param str [params.triggerType]: "price"
1098
+ :param str [params.triggerReference]: "lastTrade", "bestBid", "bestAsk", "midPrice" Only for stop orders: Use self to determine which parameter will trigger the order
1099
+ :param str [params.selfTradePrevention]: "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
1100
+ :param bool [params.disableMarketProtection]: don't cancel if the next fill price is 10% worse than the best fill price
1101
+ :param bool [params.responseRequired]: Set self to 'false' when only an acknowledgement of success or failure is required, self is faster.
1102
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1103
+ """
1104
+ await self.load_markets()
1105
+ market = self.market(symbol)
1106
+ request = self.create_order_request(symbol, type, side, amount, price, params)
1107
+ response = await self.privatePostOrder(request)
1044
1108
  #
1045
1109
  # {
1046
1110
  # "orderId":"dec6a640-5b4c-45bc-8d22-3b41c6716630",
@@ -1083,54 +1147,63 @@ class bitvavo(Exchange, ImplicitAPI):
1083
1147
  #
1084
1148
  return self.parse_order(response, market)
1085
1149
 
1150
+ def edit_order_request(self, id: str, symbol, type, side, amount=None, price=None, params={}):
1151
+ request = {}
1152
+ market = self.market(symbol)
1153
+ amountRemaining = self.safe_number(params, 'amountRemaining')
1154
+ triggerPrice = self.safe_string_n(params, ['triggerPrice', 'stopPrice', 'triggerAmount'])
1155
+ params = self.omit(params, ['amountRemaining', 'triggerPrice', 'stopPrice', 'triggerAmount'])
1156
+ if price is not None:
1157
+ request['price'] = self.price_to_precision(symbol, price)
1158
+ if amount is not None:
1159
+ request['amount'] = self.amount_to_precision(symbol, amount)
1160
+ if amountRemaining is not None:
1161
+ request['amountRemaining'] = self.amount_to_precision(symbol, amountRemaining)
1162
+ if triggerPrice is not None:
1163
+ request['triggerAmount'] = self.price_to_precision(symbol, triggerPrice)
1164
+ request = self.extend(request, params)
1165
+ if self.is_empty(request):
1166
+ raise ArgumentsRequired(self.id + ' editOrder() requires an amount argument, or a price argument, or non-empty params')
1167
+ clientOrderId = self.safe_string(params, 'clientOrderId')
1168
+ if clientOrderId is None:
1169
+ request['orderId'] = id
1170
+ request['market'] = market['id']
1171
+ return request
1172
+
1086
1173
  async def edit_order(self, id: str, symbol, type, side, amount=None, price=None, params={}):
1087
1174
  """
1088
1175
  edit a trade order
1089
- :see: https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/put
1176
+ :see: https://docs.bitvavo.com/#tag/Orders/paths/~1order/put
1177
+ :param str id: cancel order id
1090
1178
  :param str symbol: unified symbol of the market to create an order in
1091
1179
  :param str type: 'market' or 'limit'
1092
1180
  :param str side: 'buy' or 'sell'
1093
- :param float amount: how much of currency you want to trade in units of base currency
1094
- :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1095
- :param dict [params]: extra parameters specific to the exchange API endpoint
1096
- :param str [params.timeInForce]: "GTC", "IOC", or "PO"
1097
- :param bool [params.postOnly]: If True, the order will only be posted to the order book and not executed immediately
1098
- :param float [params.stopPrice]: The price at which a trigger order is triggered at
1099
- :param float [params.triggerPrice]: The price at which a trigger order is triggered at
1100
- :param str [params.selfTradePrevention]: "decrementAndCancel", "cancelOldest", "cancelNewest", "cancelBoth"
1101
- :param bool [params.responseRequired]: Set self to 'false' when only an acknowledgement of success or failure is required, self is faster.
1102
- :param str [params.clientOrderId]: An ID supplied by the client
1181
+ :param float [amount]: how much of currency you want to trade in units of base currency
1182
+ :param float [price]: the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
1183
+ :param dict [params]: extra parameters specific to the bitvavo api endpoint
1103
1184
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1104
1185
  """
1105
1186
  await self.load_markets()
1106
1187
  market = self.market(symbol)
1188
+ request = self.edit_order_request(id, symbol, type, side, amount, price, params)
1189
+ response = await self.privatePutOrder(request)
1190
+ return self.parse_order(response, market)
1191
+
1192
+ def cancel_order_request(self, id: Str, symbol: Str = None, params={}):
1193
+ if symbol is None:
1194
+ raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
1195
+ market = self.market(symbol)
1107
1196
  request = {
1108
1197
  'market': market['id'],
1109
1198
  }
1110
1199
  clientOrderId = self.safe_string(params, 'clientOrderId')
1111
1200
  if clientOrderId is None:
1112
1201
  request['orderId'] = id
1113
- amountRemaining = self.safe_number(params, 'amountRemaining')
1114
- triggerPrice = self.safe_string_n(params, ['triggerPrice', 'stopPrice', 'triggerAmount'])
1115
- params = self.omit(params, ['amountRemaining', 'triggerPrice', 'stopPrice', 'triggerAmount'])
1116
- updateRequest = {}
1117
- if price is not None:
1118
- updateRequest['price'] = self.price_to_precision(symbol, price)
1119
- if amount is not None:
1120
- updateRequest['amount'] = self.amount_to_precision(symbol, amount)
1121
- if amountRemaining is not None:
1122
- updateRequest['amountRemaining'] = self.amount_to_precision(symbol, amountRemaining)
1123
- if triggerPrice is not None:
1124
- updateRequest['triggerAmount'] = self.price_to_precision(symbol, triggerPrice)
1125
- updateRequest = self.extend(updateRequest, params)
1126
- if updateRequest:
1127
- response = await self.privatePutOrder(self.extend(request, updateRequest))
1128
- return self.parse_order(response, market)
1129
- else:
1130
- raise ArgumentsRequired(self.id + ' editOrder() requires an amount argument, or a price argument, or non-empty params')
1202
+ return self.extend(request, params)
1131
1203
 
1132
1204
  async def cancel_order(self, id: str, symbol: Str = None, params={}):
1133
1205
  """
1206
+ :see: https://docs.bitvavo.com/#tag/Orders/paths/~1order/delete
1134
1207
  cancels an open order
1135
1208
  :see: https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1order/delete
1136
1209
  :param str id: order id
@@ -1138,17 +1211,10 @@ class bitvavo(Exchange, ImplicitAPI):
1138
1211
  :param dict [params]: extra parameters specific to the exchange API endpoint
1139
1212
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1140
1213
  """
1141
- if symbol is None:
1142
- raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
1143
1214
  await self.load_markets()
1144
1215
  market = self.market(symbol)
1145
- request = {
1146
- 'market': market['id'],
1147
- }
1148
- clientOrderId = self.safe_string(params, 'clientOrderId')
1149
- if clientOrderId is None:
1150
- request['orderId'] = id
1151
- response = await self.privateDeleteOrder(self.extend(request, params))
1216
+ request = self.cancel_order_request(id, symbol, params)
1217
+ response = await self.privateDeleteOrder(request)
1152
1218
  #
1153
1219
  # {
1154
1220
  # "orderId": "2e7ce7fc-44e2-4d80-a4a7-d079c4750b61"
@@ -1158,6 +1224,7 @@ class bitvavo(Exchange, ImplicitAPI):
1158
1224
 
1159
1225
  async def cancel_all_orders(self, symbol: Str = None, params={}):
1160
1226
  """
1227
+ :see: https://docs.bitvavo.com/#tag/Orders/paths/~1orders/delete
1161
1228
  cancel all open orders
1162
1229
  :param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
1163
1230
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1234,6 +1301,23 @@ class bitvavo(Exchange, ImplicitAPI):
1234
1301
  #
1235
1302
  return self.parse_order(response, market)
1236
1303
 
1304
+ def fetch_orders_request(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1305
+ market = self.market(symbol)
1306
+ request = {
1307
+ 'market': market['id'],
1308
+ # "limit": 500,
1309
+ # "start": since,
1310
+ # "end": self.milliseconds(),
1311
+ # "orderIdFrom": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
1312
+ # "orderIdTo": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
1313
+ }
1314
+ if since is not None:
1315
+ request['start'] = since
1316
+ if limit is not None:
1317
+ request['limit'] = limit # default 500, max 1000
1318
+ request, params = self.handle_until_option('end', request, params)
1319
+ return self.extend(request, params)
1320
+
1237
1321
  async def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1238
1322
  """
1239
1323
  :see: https://docs.bitvavo.com/#tag/Trading-endpoints/paths/~1orders/get
@@ -1254,20 +1338,8 @@ class bitvavo(Exchange, ImplicitAPI):
1254
1338
  if paginate:
1255
1339
  return await self.fetch_paginated_call_dynamic('fetchOrders', symbol, since, limit, params)
1256
1340
  market = self.market(symbol)
1257
- request = {
1258
- 'market': market['id'],
1259
- # "limit": 500,
1260
- # "start": since,
1261
- # "end": self.milliseconds(),
1262
- # "orderIdFrom": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
1263
- # "orderIdTo": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
1264
- }
1265
- if since is not None:
1266
- request['start'] = since
1267
- if limit is not None:
1268
- request['limit'] = limit # default 500, max 1000
1269
- request, params = self.handle_until_option('end', request, params)
1270
- response = await self.privateGetOrders(self.extend(request, params))
1341
+ request = self.fetch_orders_request(symbol, since, limit, params)
1342
+ response = await self.privateGetOrders(request)
1271
1343
  #
1272
1344
  # [
1273
1345
  # {
@@ -1482,7 +1554,24 @@ class bitvavo(Exchange, ImplicitAPI):
1482
1554
  'trades': rawTrades,
1483
1555
  }, market)
1484
1556
 
1485
- async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1557
+ def fetch_my_trades_request(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1558
+ market = self.market(symbol)
1559
+ request = {
1560
+ 'market': market['id'],
1561
+ # "limit": 500,
1562
+ # "start": since,
1563
+ # "end": self.milliseconds(),
1564
+ # "tradeIdFrom": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
1565
+ # "tradeIdTo": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
1566
+ }
1567
+ if since is not None:
1568
+ request['start'] = since
1569
+ if limit is not None:
1570
+ request['limit'] = limit # default 500, max 1000
1571
+ request, params = self.handle_until_option('end', request, params)
1572
+ return self.extend(request, params)
1573
+
1574
+ async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
1486
1575
  """
1487
1576
  :see: https://docs.bitvavo.com/#tag/Trades/paths/~1trades/get
1488
1577
  fetch all trades made by the user
@@ -1502,20 +1591,8 @@ class bitvavo(Exchange, ImplicitAPI):
1502
1591
  if paginate:
1503
1592
  return await self.fetch_paginated_call_dynamic('fetchMyTrades', symbol, since, limit, params)
1504
1593
  market = self.market(symbol)
1505
- request = {
1506
- 'market': market['id'],
1507
- # "limit": 500,
1508
- # "start": since,
1509
- # "end": self.milliseconds(),
1510
- # "tradeIdFrom": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
1511
- # "tradeIdTo": "af76d6ce-9f7c-4006-b715-bb5d430652d0",
1512
- }
1513
- if since is not None:
1514
- request['start'] = since
1515
- if limit is not None:
1516
- request['limit'] = limit # default 500, max 1000
1517
- request, params = self.handle_until_option('end', request, params)
1518
- response = await self.privateGetTrades(self.extend(request, params))
1594
+ request = self.fetch_my_trades_request(symbol, since, limit, params)
1595
+ response = await self.privateGetTrades(request)
1519
1596
  #
1520
1597
  # [
1521
1598
  # {
@@ -1535,6 +1612,19 @@ class bitvavo(Exchange, ImplicitAPI):
1535
1612
  #
1536
1613
  return self.parse_trades(response, market, since, limit)
1537
1614
 
1615
+ def withdraw_request(self, code: Str, amount, address, tag=None, params={}):
1616
+ currency = self.currency(code)
1617
+ request = {
1618
+ 'symbol': currency['id'],
1619
+ 'amount': self.currency_to_precision(code, amount),
1620
+ 'address': address, # address or IBAN
1621
+ # 'internal': False, # transfer to another Bitvavo user address, no fees
1622
+ # 'addWithdrawalFee': False, # True = add the fee on top, otherwise the fee is subtracted from the amount
1623
+ }
1624
+ if tag is not None:
1625
+ request['paymentId'] = tag
1626
+ return self.extend(request, params)
1627
+
1538
1628
  async def withdraw(self, code: str, amount, address, tag=None, params={}):
1539
1629
  """
1540
1630
  make a withdrawal
@@ -1549,16 +1639,8 @@ class bitvavo(Exchange, ImplicitAPI):
1549
1639
  self.check_address(address)
1550
1640
  await self.load_markets()
1551
1641
  currency = self.currency(code)
1552
- request = {
1553
- 'symbol': currency['id'],
1554
- 'amount': self.currency_to_precision(code, amount),
1555
- 'address': address, # address or IBAN
1556
- # "internal": False, # transfer to another Bitvavo user address, no fees
1557
- # "addWithdrawalFee": False, # True = add the fee on top, otherwise the fee is subtracted from the amount
1558
- }
1559
- if tag is not None:
1560
- request['paymentId'] = tag
1561
- response = await self.privatePostWithdrawal(self.extend(request, params))
1642
+ request = self.withdraw_request(code, amount, address, tag, params)
1643
+ response = await self.privatePostWithdrawal(request)
1562
1644
  #
1563
1645
  # {
1564
1646
  # "success": True,
@@ -1568,16 +1650,7 @@ class bitvavo(Exchange, ImplicitAPI):
1568
1650
  #
1569
1651
  return self.parse_transaction(response, currency)
1570
1652
 
1571
- async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1572
- """
1573
- fetch all withdrawals made from an account
1574
- :param str code: unified currency code
1575
- :param int [since]: the earliest time in ms to fetch withdrawals for
1576
- :param int [limit]: the maximum number of withdrawals structures to retrieve
1577
- :param dict [params]: extra parameters specific to the exchange API endpoint
1578
- :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
1579
- """
1580
- await self.load_markets()
1653
+ def fetch_withdrawals_request(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1581
1654
  request = {
1582
1655
  # 'symbol': currency['id'],
1583
1656
  # 'limit': 500, # default 500, max 1000
@@ -1592,7 +1665,24 @@ class bitvavo(Exchange, ImplicitAPI):
1592
1665
  request['start'] = since
1593
1666
  if limit is not None:
1594
1667
  request['limit'] = limit # default 500, max 1000
1595
- response = await self.privateGetWithdrawalHistory(self.extend(request, params))
1668
+ return self.extend(request, params)
1669
+
1670
+ async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1671
+ """
1672
+ :see: https://docs.bitvavo.com/#tag/Account/paths/~1withdrawalHistory/get
1673
+ fetch all withdrawals made from an account
1674
+ :param str code: unified currency code
1675
+ :param int [since]: the earliest time in ms to fetch withdrawals for
1676
+ :param int [limit]: the maximum number of withdrawals structures to retrieve
1677
+ :param dict [params]: extra parameters specific to the bitvavo api endpoint
1678
+ :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
1679
+ """
1680
+ await self.load_markets()
1681
+ request = self.fetch_withdrawals_request(code, since, limit, params)
1682
+ currency = None
1683
+ if code is not None:
1684
+ currency = self.currency(code)
1685
+ response = await self.privateGetWithdrawalHistory(request)
1596
1686
  #
1597
1687
  # [
1598
1688
  # {
@@ -1609,16 +1699,7 @@ class bitvavo(Exchange, ImplicitAPI):
1609
1699
  #
1610
1700
  return self.parse_transactions(response, currency, since, limit, {'type': 'withdrawal'})
1611
1701
 
1612
- async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1613
- """
1614
- fetch all deposits made to an account
1615
- :param str code: unified currency code
1616
- :param int [since]: the earliest time in ms to fetch deposits for
1617
- :param int [limit]: the maximum number of deposits structures to retrieve
1618
- :param dict [params]: extra parameters specific to the exchange API endpoint
1619
- :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
1620
- """
1621
- await self.load_markets()
1702
+ def fetch_deposits_request(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1622
1703
  request = {
1623
1704
  # 'symbol': currency['id'],
1624
1705
  # 'limit': 500, # default 500, max 1000
@@ -1633,7 +1714,24 @@ class bitvavo(Exchange, ImplicitAPI):
1633
1714
  request['start'] = since
1634
1715
  if limit is not None:
1635
1716
  request['limit'] = limit # default 500, max 1000
1636
- response = await self.privateGetDepositHistory(self.extend(request, params))
1717
+ return self.extend(request, params)
1718
+
1719
+ async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1720
+ """
1721
+ :see: https://docs.bitvavo.com/#tag/Account/paths/~1depositHistory/get
1722
+ fetch all deposits made to an account
1723
+ :param str code: unified currency code
1724
+ :param int [since]: the earliest time in ms to fetch deposits for
1725
+ :param int [limit]: the maximum number of deposits structures to retrieve
1726
+ :param dict [params]: extra parameters specific to the bitvavo api endpoint
1727
+ :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
1728
+ """
1729
+ await self.load_markets()
1730
+ request = self.fetch_deposits_request(code, since, limit, params)
1731
+ currency = None
1732
+ if code is not None:
1733
+ currency = self.currency(code)
1734
+ response = await self.privateGetDepositHistory(request)
1637
1735
  #
1638
1736
  # [
1639
1737
  # {
@@ -770,8 +770,10 @@ class blockchaincom(Exchange, ImplicitAPI):
770
770
  tag = None
771
771
  address = None
772
772
  if rawAddress is not None:
773
+ addressParts = rawAddress.split(';')
773
774
  # if a tag or memo is used it is separated by a colon in the 'address' value
774
- address, tag = rawAddress.split(':')
775
+ tag = self.safe_string(addressParts, 0)
776
+ address = self.safe_string(addressParts, 1)
775
777
  result = {'info': response}
776
778
  result['currency'] = currency['code']
777
779
  result['address'] = address