ccxt 4.1.62 → 4.1.64

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 (40) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.js +678 -201
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/alpaca.js +209 -48
  6. package/dist/cjs/src/binance.js +3 -3
  7. package/dist/cjs/src/binanceus.js +33 -4
  8. package/dist/cjs/src/kraken.js +20 -2
  9. package/dist/cjs/src/krakenfutures.js +7 -7
  10. package/dist/cjs/src/kucoinfutures.js +34 -13
  11. package/dist/cjs/src/luno.js +10 -11
  12. package/dist/cjs/src/phemex.js +130 -91
  13. package/dist/cjs/src/pro/krakenfutures.js +4 -1
  14. package/dist/cjs/src/pro/poloniex.js +205 -2
  15. package/dist/cjs/src/tokocrypto.js +1 -3
  16. package/dist/cjs/src/wazirx.js +7 -1
  17. package/doc/manual.rst +1 -1
  18. package/doc/readme.rst +1 -1
  19. package/js/ccxt.d.ts +1 -1
  20. package/js/ccxt.js +1 -1
  21. package/js/src/abstract/binance.d.ts +3 -3
  22. package/js/src/abstract/binancecoinm.d.ts +3 -3
  23. package/js/src/abstract/binanceus.d.ts +3 -3
  24. package/js/src/abstract/binanceusdm.d.ts +3 -3
  25. package/js/src/alpaca.d.ts +4 -0
  26. package/js/src/alpaca.js +209 -48
  27. package/js/src/binance.js +3 -3
  28. package/js/src/binanceus.js +33 -4
  29. package/js/src/kraken.js +20 -2
  30. package/js/src/krakenfutures.js +7 -7
  31. package/js/src/kucoinfutures.js +34 -13
  32. package/js/src/luno.js +10 -11
  33. package/js/src/phemex.js +130 -91
  34. package/js/src/pro/krakenfutures.js +4 -1
  35. package/js/src/pro/poloniex.d.ts +8 -1
  36. package/js/src/pro/poloniex.js +206 -3
  37. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  38. package/js/src/tokocrypto.js +1 -3
  39. package/js/src/wazirx.js +7 -1
  40. package/package.json +1 -1
package/js/src/alpaca.js CHANGED
@@ -53,7 +53,7 @@ export default class alpaca extends Exchange {
53
53
  'createOrder': true,
54
54
  'fetchBalance': true,
55
55
  'fetchBidsAsks': false,
56
- 'fetchClosedOrders': false,
56
+ 'fetchClosedOrders': true,
57
57
  'fetchCurrencies': false,
58
58
  'fetchDepositAddress': false,
59
59
  'fetchDepositAddressesByNetwork': false,
@@ -71,12 +71,12 @@ export default class alpaca extends Exchange {
71
71
  'fetchOpenOrders': true,
72
72
  'fetchOrder': true,
73
73
  'fetchOrderBook': true,
74
- 'fetchOrders': false,
74
+ 'fetchOrders': true,
75
75
  'fetchPositions': false,
76
76
  'fetchStatus': false,
77
77
  'fetchTicker': false,
78
78
  'fetchTickers': false,
79
- 'fetchTime': false,
79
+ 'fetchTime': true,
80
80
  'fetchTrades': true,
81
81
  'fetchTradingFee': false,
82
82
  'fetchTradingFees': false,
@@ -264,42 +264,90 @@ export default class alpaca extends Exchange {
264
264
  },
265
265
  });
266
266
  }
267
+ async fetchTime(params = {}) {
268
+ /**
269
+ * @method
270
+ * @name alpaca#fetchTime
271
+ * @description fetches the current integer timestamp in milliseconds from the exchange server
272
+ * @param {object} [params] extra parameters specific to the alpaca api endpoint
273
+ * @returns {int} the current integer timestamp in milliseconds from the exchange server
274
+ */
275
+ const response = await this.traderPrivateGetV2Clock(params);
276
+ //
277
+ // {
278
+ // timestamp: '2023-11-22T08:07:57.654738097-05:00',
279
+ // is_open: false,
280
+ // next_open: '2023-11-22T09:30:00-05:00',
281
+ // next_close: '2023-11-22T16:00:00-05:00'
282
+ // }
283
+ //
284
+ const timestamp = this.safeString(response, 'timestamp');
285
+ const localTime = timestamp.slice(0, 23);
286
+ const jetlagStrStart = timestamp.length - 6;
287
+ const jetlagStrEnd = timestamp.length - 3;
288
+ const jetlag = timestamp.slice(jetlagStrStart, jetlagStrEnd);
289
+ const iso = this.parse8601(localTime) - this.parseToNumeric(jetlag) * 3600 * 1000;
290
+ return iso;
291
+ }
267
292
  async fetchMarkets(params = {}) {
268
293
  /**
269
294
  * @method
270
295
  * @name alpaca#fetchMarkets
271
296
  * @description retrieves data on all markets for alpaca
297
+ * @see https://docs.alpaca.markets/reference/get-v2-assets
272
298
  * @param {object} [params] extra parameters specific to the exchange api endpoint
273
299
  * @returns {object[]} an array of objects representing market data
274
300
  */
275
301
  const request = {
276
302
  'asset_class': 'crypto',
277
- 'tradeable': true,
303
+ 'status': 'active',
278
304
  };
279
305
  const assets = await this.traderPrivateGetV2Assets(this.extend(request, params));
280
306
  //
281
- // [
282
- // {
283
- // "id":"a3ba8ac0-166d-460b-b17a-1f035622dd47",
284
- // "class":"crypto",
285
- // "exchange":"FTXU",
286
- // "symbol":"DOGEUSD",
287
- // "name":"Dogecoin",
288
- // "status":"active",
289
- // "tradable":true,
290
- // "marginable":false,
291
- // "shortable":false,
292
- // "easy_to_borrow":false,
293
- // "fractionable":true,
294
- // "min_order_size":"1",
295
- // "min_trade_increment":"1",
296
- // "price_increment":"0.0000005"
297
- // }
298
- // ]
307
+ // [
308
+ // {
309
+ // "id": "c150e086-1e75-44e6-9c2c-093bb1e93139",
310
+ // "class": "crypto",
311
+ // "exchange": "CRYPTO",
312
+ // "symbol": "BTC/USDT",
313
+ // "name": "Bitcoin / USD Tether",
314
+ // "status": "active",
315
+ // "tradable": true,
316
+ // "marginable": false,
317
+ // "maintenance_margin_requirement": 100,
318
+ // "shortable": false,
319
+ // "easy_to_borrow": false,
320
+ // "fractionable": true,
321
+ // "attributes": [],
322
+ // "min_order_size": "0.000026873",
323
+ // "min_trade_increment": "0.000000001",
324
+ // "price_increment": "1"
325
+ // }
326
+ // ]
299
327
  //
300
328
  return this.parseMarkets(assets);
301
329
  }
302
330
  parseMarket(asset) {
331
+ //
332
+ // {
333
+ // "id": "c150e086-1e75-44e6-9c2c-093bb1e93139",
334
+ // "class": "crypto",
335
+ // "exchange": "CRYPTO",
336
+ // "symbol": "BTC/USDT",
337
+ // "name": "Bitcoin / USD Tether",
338
+ // "status": "active",
339
+ // "tradable": true,
340
+ // "marginable": false,
341
+ // "maintenance_margin_requirement": 100,
342
+ // "shortable": false,
343
+ // "easy_to_borrow": false,
344
+ // "fractionable": true,
345
+ // "attributes": [],
346
+ // "min_order_size": "0.000026873",
347
+ // "min_trade_increment": "0.000000001",
348
+ // "price_increment": "1"
349
+ // }
350
+ //
303
351
  const marketId = this.safeString(asset, 'symbol');
304
352
  const parts = marketId.split('/');
305
353
  const baseId = this.safeString(parts, 0);
@@ -439,21 +487,17 @@ export default class alpaca extends Exchange {
439
487
  return this.parseTrades(symbolTrades, market, since, limit);
440
488
  }
441
489
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
442
- //
443
- // @method
444
- // @name alpaca#fetchOrderBook
445
- // @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
446
- // @see https://docs.alpaca.markets/reference/cryptolatestorderbooks
447
- // @param {string} symbol unified symbol of the market to fetch the order book for
448
- // @param {int} [limit] the maximum amount of order book entries to return
449
- // @param {object} [params] extra parameters specific to the alpaca api endpoint
450
- // <<<<<<< HEAD
451
- // @param {string} [params.loc] crypto location, default: us
452
- // @returns {object} A dictionary of [order book structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure} indexed by market symbols
453
- // =======
454
- // @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
455
- // >>>>>>> f68b1b599ee41469fefa424f0efc9b6891549278
456
- //
490
+ /**
491
+ * @method
492
+ * @name alpaca#fetchOrderBook
493
+ * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
494
+ * @see https://docs.alpaca.markets/reference/cryptolatestorderbooks
495
+ * @param {string} symbol unified symbol of the market to fetch the order book for
496
+ * @param {int} [limit] the maximum amount of order book entries to return
497
+ * @param {object} [params] extra parameters specific to the alpaca api endpoint
498
+ * @param {string} [params.loc] crypto location, default: us
499
+ * @returns {object} A dictionary of [order book structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-book-structure} indexed by market symbols
500
+ */
457
501
  await this.loadMarkets();
458
502
  const market = this.market(symbol);
459
503
  const id = market['id'];
@@ -628,6 +672,7 @@ export default class alpaca extends Exchange {
628
672
  * @method
629
673
  * @name alpaca#createOrder
630
674
  * @description create a trade order
675
+ * @see https://docs.alpaca.markets/reference/postorder
631
676
  * @param {string} symbol unified symbol of the market to create an order in
632
677
  * @param {string} type 'market', 'limit' or 'stop_limit'
633
678
  * @param {string} side 'buy' or 'sell'
@@ -716,6 +761,7 @@ export default class alpaca extends Exchange {
716
761
  * @method
717
762
  * @name alpaca#cancelOrder
718
763
  * @description cancels an open order
764
+ * @see https://docs.alpaca.markets/reference/deleteorderbyorderid
719
765
  * @param {string} id order id
720
766
  * @param {string} symbol unified symbol of the market the order was made in
721
767
  * @param {object} [params] extra parameters specific to the alpaca api endpoint
@@ -733,11 +779,31 @@ export default class alpaca extends Exchange {
733
779
  //
734
780
  return this.safeValue(response, 'message', {});
735
781
  }
782
+ async cancelAllOrders(symbol = undefined, params = {}) {
783
+ /**
784
+ * @method
785
+ * @name alpaca#cancelAllOrders
786
+ * @description cancel all open orders in a market
787
+ * @see https://docs.alpaca.markets/reference/deleteallorders
788
+ * @param {string} symbol alpaca cancelAllOrders cannot setting symbol, it will cancel all open orders
789
+ * @param {object} [params] extra parameters specific to the alpaca api endpoint
790
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
791
+ */
792
+ await this.loadMarkets();
793
+ const response = await this.traderPrivateDeleteV2Orders(params);
794
+ if (Array.isArray(response)) {
795
+ return this.parseOrders(response, undefined);
796
+ }
797
+ else {
798
+ return response;
799
+ }
800
+ }
736
801
  async fetchOrder(id, symbol = undefined, params = {}) {
737
802
  /**
738
803
  * @method
739
804
  * @name alpaca#fetchOrder
740
805
  * @description fetches information on an order made by the user
806
+ * @see https://docs.alpaca.markets/reference/getorderbyorderid
741
807
  * @param {string} symbol unified symbol of the market the order was made in
742
808
  * @param {object} [params] extra parameters specific to the alpaca api endpoint
743
809
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -751,24 +817,117 @@ export default class alpaca extends Exchange {
751
817
  const market = this.safeMarket(marketId);
752
818
  return this.parseOrder(order, market);
753
819
  }
754
- async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
820
+ async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
755
821
  /**
756
822
  * @method
757
- * @name alpaca#fetchOpenOrders
758
- * @description fetch all unfilled currently open orders
759
- * @param {string} symbol unified market symbol
760
- * @param {int} [since] the earliest time in ms to fetch open orders for
761
- * @param {int} [limit] the maximum number of open orders structures to retrieve
823
+ * @name alpaca#fetchOrders
824
+ * @description fetches information on multiple orders made by the user
825
+ * @see https://docs.alpaca.markets/reference/getallorders
826
+ * @param {string} symbol unified market symbol of the market orders were made in
827
+ * @param {int} [since] the earliest time in ms to fetch orders for
828
+ * @param {int} [limit] the maximum number of order structures to retrieve
762
829
  * @param {object} [params] extra parameters specific to the alpaca api endpoint
830
+ * @param {int} [params.until] the latest time in ms to fetch orders for
763
831
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
764
832
  */
765
833
  await this.loadMarkets();
834
+ const request = {
835
+ 'status': 'all',
836
+ };
766
837
  let market = undefined;
767
838
  if (symbol !== undefined) {
768
839
  market = this.market(symbol);
840
+ request['symbols'] = market['id'];
769
841
  }
770
- const orders = await this.traderPrivateGetV2Orders(params);
771
- return this.parseOrders(orders, market, since, limit);
842
+ const until = this.safeInteger(params, 'until');
843
+ if (until !== undefined) {
844
+ params = this.omit(params, 'until');
845
+ request['endTime'] = until;
846
+ }
847
+ if (since !== undefined) {
848
+ request['after'] = since;
849
+ }
850
+ if (limit !== undefined) {
851
+ request['limit'] = limit;
852
+ }
853
+ const response = await this.traderPrivateGetV2Orders(this.extend(request, params));
854
+ //
855
+ // [
856
+ // {
857
+ // "id": "cbaf12d7-69b8-49c0-a31b-b46af35c755c",
858
+ // "client_order_id": "ccxt_b36156ae6fd44d098ac9c179bab33efd",
859
+ // "created_at": "2023-11-17T04:21:42.234579Z",
860
+ // "updated_at": "2023-11-17T04:22:34.442765Z",
861
+ // "submitted_at": "2023-11-17T04:21:42.233357Z",
862
+ // "filled_at": null,
863
+ // "expired_at": null,
864
+ // "canceled_at": "2023-11-17T04:22:34.399019Z",
865
+ // "failed_at": null,
866
+ // "replaced_at": null,
867
+ // "replaced_by": null,
868
+ // "replaces": null,
869
+ // "asset_id": "77c6f47f-0939-4b23-b41e-47b4469c4bc8",
870
+ // "symbol": "LTC/USDT",
871
+ // "asset_class": "crypto",
872
+ // "notional": null,
873
+ // "qty": "0.001",
874
+ // "filled_qty": "0",
875
+ // "filled_avg_price": null,
876
+ // "order_class": "",
877
+ // "order_type": "limit",
878
+ // "type": "limit",
879
+ // "side": "sell",
880
+ // "time_in_force": "gtc",
881
+ // "limit_price": "1000",
882
+ // "stop_price": null,
883
+ // "status": "canceled",
884
+ // "extended_hours": false,
885
+ // "legs": null,
886
+ // "trail_percent": null,
887
+ // "trail_price": null,
888
+ // "hwm": null,
889
+ // "subtag": null,
890
+ // "source": "access_key"
891
+ // }
892
+ // ]
893
+ //
894
+ return this.parseOrders(response, market, since, limit);
895
+ }
896
+ async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
897
+ /**
898
+ * @method
899
+ * @name alpaca#fetchOpenOrders
900
+ * @description fetch all unfilled currently open orders
901
+ * @see https://docs.alpaca.markets/reference/getallorders
902
+ * @param {string} symbol unified market symbol of the market orders were made in
903
+ * @param {int} [since] the earliest time in ms to fetch orders for
904
+ * @param {int} [limit] the maximum number of order structures to retrieve
905
+ * @param {object} [params] extra parameters specific to the alpaca api endpoint
906
+ * @param {int} [params.until] the latest time in ms to fetch orders for
907
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
908
+ */
909
+ const request = {
910
+ 'status': 'open',
911
+ };
912
+ return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
913
+ }
914
+ async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
915
+ /**
916
+ * @method
917
+ * @name alpaca#fetchClosedOrders
918
+ * @description fetches information on multiple closed orders made by the user
919
+ * @see https://docs.alpaca.markets/reference/getallorders
920
+ * @param {string} symbol unified market symbol of the market orders were made in
921
+ * @param {int} [since] the earliest time in ms to fetch orders for
922
+ * @param {int} [limit] the maximum number of order structures to retrieve
923
+ * @param {object} [params] extra parameters specific to the alpaca api endpoint
924
+ * @param {int} [params.until] the latest time in ms to fetch orders for
925
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
926
+ */
927
+ const request = {
928
+ 'status': 'closed',
929
+ };
930
+ return await this.fetchOrders(symbol, since, limit, this.extend(request, params));
772
931
  }
773
932
  parseOrder(order, market = undefined) {
774
933
  //
@@ -823,9 +982,11 @@ export default class alpaca extends Exchange {
823
982
  };
824
983
  }
825
984
  let orderType = this.safeString(order, 'order_type');
826
- if (orderType.indexOf('limit') >= 0) {
827
- // might be limit or stop-limit
828
- orderType = 'limit';
985
+ if (orderType !== undefined) {
986
+ if (orderType.indexOf('limit') >= 0) {
987
+ // might be limit or stop-limit
988
+ orderType = 'limit';
989
+ }
829
990
  }
830
991
  const datetime = this.safeString(order, 'submitted_at');
831
992
  const timestamp = this.parse8601(datetime);
package/js/src/binance.js CHANGED
@@ -970,7 +970,7 @@ export default class binance extends Exchange {
970
970
  'cm/income': 30,
971
971
  'um/account': 5,
972
972
  'cm/account': 5,
973
- 'portfolio/repay-futures-switch': 3,
973
+ 'repay-futures-switch': 3,
974
974
  'um/adlQuantile': 5,
975
975
  'cm/adlQuantile': 5,
976
976
  },
@@ -989,8 +989,8 @@ export default class binance extends Exchange {
989
989
  'cm/positionSide/dual': 1,
990
990
  'auto-collection': 0.6667,
991
991
  'bnb-transfer': 0.6667,
992
- 'portfolio/repay-futures-switch': 150,
993
- 'portfolio/repay-futures-negative-balance': 150,
992
+ 'repay-futures-switch': 150,
993
+ 'repay-futures-negative-balance': 150,
994
994
  'listenKey': 1,
995
995
  'asset-collection': 3,
996
996
  },
@@ -45,10 +45,39 @@ export default class binanceus extends binance {
45
45
  'has': {
46
46
  'CORS': undefined,
47
47
  'spot': true,
48
- 'margin': undefined,
49
- 'swap': undefined,
50
- 'future': undefined,
51
- 'option': undefined,
48
+ 'margin': false,
49
+ 'swap': false,
50
+ 'option': false,
51
+ 'addMargin': false,
52
+ 'borrowMargin': false,
53
+ 'createReduceOnlyOrder': false,
54
+ 'fetchBorrowInterest': false,
55
+ 'fetchBorrowRate': false,
56
+ 'fetchBorrowRateHistories': false,
57
+ 'fetchBorrowRateHistory': false,
58
+ 'fetchBorrowRates': false,
59
+ 'fetchBorrowRatesPerSymbol': false,
60
+ 'fetchFundingHistory': false,
61
+ 'fetchFundingRate': false,
62
+ 'fetchFundingRateHistory': false,
63
+ 'fetchFundingRates': false,
64
+ 'fetchIndexOHLCV': false,
65
+ 'fetchIsolatedPositions': false,
66
+ 'fetchLeverage': false,
67
+ 'fetchLeverageTiers': false,
68
+ 'fetchMarketLeverageTiers': false,
69
+ 'fetchMarkOHLCV': false,
70
+ 'fetchOpenInterestHistory': false,
71
+ 'fetchPosition': false,
72
+ 'fetchPositions': false,
73
+ 'fetchPositionsRisk': false,
74
+ 'fetchPremiumIndexOHLCV': false,
75
+ 'reduceMargin': false,
76
+ 'repayMargin': false,
77
+ 'setLeverage': false,
78
+ 'setMargin': false,
79
+ 'setMarginMode': false,
80
+ 'setPositionMode': false,
52
81
  },
53
82
  });
54
83
  }
package/js/src/kraken.js CHANGED
@@ -1529,8 +1529,8 @@ export default class kraken extends Exchange {
1529
1529
  //
1530
1530
  // market
1531
1531
  // limit (price = limit price)
1532
- // stop-loss (price = stop loss price)
1533
- // take-profit (price = take profit price)
1532
+ // stop-loss (price = stop loss trigger price)
1533
+ // take-profit (price = take profit trigger price)
1534
1534
  // stop-loss-limit (price = stop loss trigger price, price2 = triggered limit price)
1535
1535
  // take-profit-limit (price = take profit trigger price, price2 = triggered limit price)
1536
1536
  // settle-position
@@ -1801,6 +1801,15 @@ export default class kraken extends Exchange {
1801
1801
  return result;
1802
1802
  }
1803
1803
  async fetchOrdersByIds(ids, symbol = undefined, params = {}) {
1804
+ /**
1805
+ * @method
1806
+ * @name kraken#fetchOrdersByIds
1807
+ * @description fetch orders by the list of order id
1808
+ * @see https://docs.kraken.com/rest/#tag/Account-Data/operation/getClosedOrders
1809
+ * @param {string[]|undefined} ids list of order id
1810
+ * @param {object} [params] extra parameters specific to the kraken api endpoint
1811
+ * @returns {object[]} a list of [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1812
+ */
1804
1813
  await this.loadMarkets();
1805
1814
  const response = await this.privatePostQueryOrders(this.extend({
1806
1815
  'trades': true,
@@ -2296,6 +2305,15 @@ export default class kraken extends Exchange {
2296
2305
  return await this.fetchDepositAddress(code, this.extend(request, params));
2297
2306
  }
2298
2307
  async fetchDepositMethods(code, params = {}) {
2308
+ /**
2309
+ * @method
2310
+ * @name kraken#fetchDepositMethods
2311
+ * @description fetch deposit methods for a currency associated with this account
2312
+ * @see https://docs.kraken.com/rest/#tag/Funding/operation/getDepositMethods
2313
+ * @param {string} code unified currency code
2314
+ * @param {object} [params] extra parameters specific to the kraken api endpoint
2315
+ * @returns {object} of deposit methods
2316
+ */
2299
2317
  await this.loadMarkets();
2300
2318
  const currency = this.currency(code);
2301
2319
  const request = {
@@ -89,7 +89,7 @@ export default class krakenfutures extends Exchange {
89
89
  },
90
90
  'www': 'https://futures.kraken.com/',
91
91
  'doc': [
92
- 'https://support.kraken.com/hc/en-us/categories/360001806372-Futures-API',
92
+ 'https://docs.futures.kraken.com/#introduction',
93
93
  ],
94
94
  'fees': 'https://support.kraken.com/hc/en-us/articles/360022835771-Transaction-fees-and-rebates-for-Kraken-Futures',
95
95
  'referral': undefined,
@@ -2232,26 +2232,26 @@ export default class krakenfutures extends Exchange {
2232
2232
  */
2233
2233
  await this.loadMarkets();
2234
2234
  const currency = this.currency(code);
2235
- let method = 'privatePostTransfer';
2236
- const request = {
2237
- 'amount': amount,
2238
- };
2239
2235
  if (fromAccount === 'spot') {
2240
2236
  throw new BadRequest(this.id + ' transfer does not yet support transfers from spot');
2241
2237
  }
2238
+ const request = {
2239
+ 'amount': amount,
2240
+ };
2241
+ let response = undefined;
2242
2242
  if (toAccount === 'spot') {
2243
2243
  if (this.parseAccount(fromAccount) !== 'cash') {
2244
2244
  throw new BadRequest(this.id + ' transfer cannot transfer from ' + fromAccount + ' to ' + toAccount);
2245
2245
  }
2246
- method = 'privatePostWithdrawal';
2247
2246
  request['currency'] = currency['id'];
2247
+ response = await this.privatePostWithdrawal(this.extend(request, params));
2248
2248
  }
2249
2249
  else {
2250
2250
  request['fromAccount'] = this.parseAccount(fromAccount);
2251
2251
  request['toAccount'] = this.parseAccount(toAccount);
2252
2252
  request['unit'] = currency['id'];
2253
+ response = await this.privatePostTransfer(this.extend(request, params));
2253
2254
  }
2254
- const response = await this[method](this.extend(request, params));
2255
2255
  //
2256
2256
  // {
2257
2257
  // "result": "success",