ccxt 4.4.5 → 4.4.6

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.
package/js/src/bitmart.js CHANGED
@@ -252,6 +252,10 @@ export default class bitmart extends Exchange {
252
252
  'contract/private/submit-plan-order': 2.5,
253
253
  'contract/private/cancel-plan-order': 1.5,
254
254
  'contract/private/submit-leverage': 2.5,
255
+ 'contract/private/submit-tp-sl-order': 2.5,
256
+ 'contract/private/modify-plan-order': 2.5,
257
+ 'contract/private/modify-preset-plan-order': 2.5,
258
+ 'contract/private/modify-tp-sl-order': 2.5,
255
259
  },
256
260
  },
257
261
  },
@@ -874,43 +878,43 @@ export default class bitmart extends Exchange {
874
878
  async fetchContractMarkets(params = {}) {
875
879
  const response = await this.publicGetContractPublicDetails(params);
876
880
  //
877
- // {
878
- // "code": 1000,
879
- // "message": "Ok",
880
- // "trace": "9b92a999-9463-4c96-91a4-93ad1cad0d72",
881
- // "data": {
882
- // "symbols": [
883
- // {
884
- // "symbol": "BTCUSDT",
885
- // "product_type": 1,
886
- // "open_timestamp": 1594080000,
887
- // "expire_timestamp": 0,
888
- // "settle_timestamp": 0,
889
- // "base_currency": "BTC",
890
- // "quote_currency": "USDT",
891
- // "last_price": "23920",
892
- // "volume_24h": "18969368",
893
- // "turnover_24h": "458933659.7858",
894
- // "index_price": "23945.25191635",
895
- // "index_name": "BTCUSDT",
896
- // "contract_size": "0.001",
897
- // "min_leverage": "1",
898
- // "max_leverage": "100",
899
- // "price_precision": "0.1",
900
- // "vol_precision": "1",
901
- // "max_volume": "500000",
902
- // "min_volume": "1",
903
- // "funding_rate": "0.0001",
904
- // "expected_funding_rate": "0.00011",
905
- // "open_interest": "4134180870",
906
- // "open_interest_value": "94100888927.0433258",
907
- // "high_24h": "23900",
908
- // "low_24h": "23100",
909
- // "change_24h": "0.004"
910
- // },
911
- // ]
881
+ // {
882
+ // "code": 1000,
883
+ // "message": "Ok",
884
+ // "data": {
885
+ // "symbols": [
886
+ // {
887
+ // "symbol": "BTCUSDT",
888
+ // "product_type": 1,
889
+ // "open_timestamp": 1645977600000,
890
+ // "expire_timestamp": 0,
891
+ // "settle_timestamp": 0,
892
+ // "base_currency": "BTC",
893
+ // "quote_currency": "USDT",
894
+ // "last_price": "63547.4",
895
+ // "volume_24h": "110938430",
896
+ // "turnover_24h": "7004836342.6944",
897
+ // "index_price": "63587.85404255",
898
+ // "index_name": "BTCUSDT",
899
+ // "contract_size": "0.001",
900
+ // "min_leverage": "1",
901
+ // "max_leverage": "100",
902
+ // "price_precision": "0.1",
903
+ // "vol_precision": "1",
904
+ // "max_volume": "1000000",
905
+ // "min_volume": "1",
906
+ // "funding_rate": "0.0000801",
907
+ // "expected_funding_rate": "-0.0000035",
908
+ // "open_interest": "278214",
909
+ // "open_interest_value": "17555316.9355496",
910
+ // "high_24h": "64109.4",
911
+ // "low_24h": "61857.6",
912
+ // "change_24h": "0.0239264900886327",
913
+ // "funding_time": 1726819200000
914
+ // },
915
+ // ]
916
+ // }
912
917
  // }
913
- // }
914
918
  //
915
919
  const data = this.safeValue(response, 'data', {});
916
920
  const symbols = this.safeValue(data, 'symbols', []);
@@ -1196,33 +1200,34 @@ export default class bitmart extends Exchange {
1196
1200
  // swap
1197
1201
  //
1198
1202
  // {
1199
- // "symbol": "BTCUSDT",
1200
- // "product_type": 1,
1201
- // "open_timestamp": 1594080000,
1202
- // "expire_timestamp": 0,
1203
- // "settle_timestamp": 0,
1204
- // "base_currency": "BTC",
1205
- // "quote_currency": "USDT",
1206
- // "last_price": "23920",
1207
- // "volume_24h": "18969368",
1208
- // "turnover_24h": "458933659.7858",
1209
- // "index_price": "23945.25191635",
1210
- // "index_name": "BTCUSDT",
1211
- // "contract_size": "0.001",
1212
- // "min_leverage": "1",
1213
- // "max_leverage": "100",
1214
- // "price_precision": "0.1",
1215
- // "vol_precision": "1",
1216
- // "max_volume": "500000",
1217
- // "min_volume": "1",
1218
- // "funding_rate": "0.0001",
1219
- // "expected_funding_rate": "0.00011",
1220
- // "open_interest": "4134180870",
1221
- // "open_interest_value": "94100888927.0433258",
1222
- // "high_24h": "23900",
1223
- // "low_24h": "23100",
1224
- // "change_24h": "0.004"
1225
- // }
1203
+ // "symbol": "BTCUSDT",
1204
+ // "product_type": 1,
1205
+ // "open_timestamp": 1645977600000,
1206
+ // "expire_timestamp": 0,
1207
+ // "settle_timestamp": 0,
1208
+ // "base_currency": "BTC",
1209
+ // "quote_currency": "USDT",
1210
+ // "last_price": "63547.4",
1211
+ // "volume_24h": "110938430",
1212
+ // "turnover_24h": "7004836342.6944",
1213
+ // "index_price": "63587.85404255",
1214
+ // "index_name": "BTCUSDT",
1215
+ // "contract_size": "0.001",
1216
+ // "min_leverage": "1",
1217
+ // "max_leverage": "100",
1218
+ // "price_precision": "0.1",
1219
+ // "vol_precision": "1",
1220
+ // "max_volume": "1000000",
1221
+ // "min_volume": "1",
1222
+ // "funding_rate": "0.0000801",
1223
+ // "expected_funding_rate": "-0.0000035",
1224
+ // "open_interest": "278214",
1225
+ // "open_interest_value": "17555316.9355496",
1226
+ // "high_24h": "64109.4",
1227
+ // "low_24h": "61857.6",
1228
+ // "change_24h": "0.0239264900886327",
1229
+ // "funding_time": 1726819200000
1230
+ // }
1226
1231
  //
1227
1232
  const result = this.safeList(ticker, 'result', []);
1228
1233
  const average = this.safeString2(ticker, 'avg_price', 'index_price');
@@ -1319,27 +1324,43 @@ export default class bitmart extends Exchange {
1319
1324
  request['symbol'] = market['id'];
1320
1325
  response = await this.publicGetContractPublicDetails(this.extend(request, params));
1321
1326
  //
1322
- // {
1323
- // "message":"OK",
1324
- // "code":1000,
1325
- // "trace":"4a0ebceb-d3f7-45a3-8feb-f61e230e24cd",
1326
- // "data":{
1327
- // "tickers":[
1328
- // {
1329
- // "contract_symbol":"DOGEUSDT",
1330
- // "last_price":"0.130180",
1331
- // "index_price":"0.13028635",
1332
- // "last_funding_rate":"0.00002025",
1333
- // "price_change_percent_24h":"-2.326",
1334
- // "volume_24h":"116789313.01797258",
1335
- // "url":"https://futures.bitmart.com/en?symbol=DOGEUSDT",
1336
- // "high_price":"0.134520",
1337
- // "low_price":"0.128570",
1338
- // "legal_coin_price":"0.13017401"
1339
- // }
1340
- // ]
1341
- // }
1342
- // }
1327
+ // {
1328
+ // "code": 1000,
1329
+ // "message": "Ok",
1330
+ // "data": {
1331
+ // "symbols": [
1332
+ // {
1333
+ // "symbol": "BTCUSDT",
1334
+ // "product_type": 1,
1335
+ // "open_timestamp": 1645977600000,
1336
+ // "expire_timestamp": 0,
1337
+ // "settle_timestamp": 0,
1338
+ // "base_currency": "BTC",
1339
+ // "quote_currency": "USDT",
1340
+ // "last_price": "63547.4",
1341
+ // "volume_24h": "110938430",
1342
+ // "turnover_24h": "7004836342.6944",
1343
+ // "index_price": "63587.85404255",
1344
+ // "index_name": "BTCUSDT",
1345
+ // "contract_size": "0.001",
1346
+ // "min_leverage": "1",
1347
+ // "max_leverage": "100",
1348
+ // "price_precision": "0.1",
1349
+ // "vol_precision": "1",
1350
+ // "max_volume": "1000000",
1351
+ // "min_volume": "1",
1352
+ // "funding_rate": "0.0000801",
1353
+ // "expected_funding_rate": "-0.0000035",
1354
+ // "open_interest": "278214",
1355
+ // "open_interest_value": "17555316.9355496",
1356
+ // "high_24h": "64109.4",
1357
+ // "low_24h": "61857.6",
1358
+ // "change_24h": "0.0239264900886327",
1359
+ // "funding_time": 1726819200000
1360
+ // },
1361
+ // ]
1362
+ // }
1363
+ // }
1343
1364
  //
1344
1365
  }
1345
1366
  else if (market['spot']) {
@@ -1435,43 +1456,43 @@ export default class bitmart extends Exchange {
1435
1456
  else if (type === 'swap') {
1436
1457
  response = await this.publicGetContractPublicDetails(params);
1437
1458
  //
1438
- // {
1439
- // "code": 1000,
1440
- // "message": "Ok",
1441
- // "trace": "9b92a999-9463-4c96-91a4-93ad1cad0d72",
1442
- // "data": {
1443
- // "symbols": [
1444
- // {
1445
- // "symbol": "BTCUSDT",
1446
- // "product_type": 1,
1447
- // "open_timestamp": 1594080000,
1448
- // "expire_timestamp": 0,
1449
- // "settle_timestamp": 0,
1450
- // "base_currency": "BTC",
1451
- // "quote_currency": "USDT",
1452
- // "last_price": "23920",
1453
- // "volume_24h": "18969368",
1454
- // "turnover_24h": "458933659.7858",
1455
- // "index_price": "23945.25191635",
1456
- // "index_name": "BTCUSDT",
1457
- // "contract_size": "0.001",
1458
- // "min_leverage": "1",
1459
- // "max_leverage": "100",
1460
- // "price_precision": "0.1",
1461
- // "vol_precision": "1",
1462
- // "max_volume": "500000",
1463
- // "min_volume": "1",
1464
- // "funding_rate": "0.0001",
1465
- // "expected_funding_rate": "0.00011",
1466
- // "open_interest": "4134180870",
1467
- // "open_interest_value": "94100888927.0433258",
1468
- // "high_24h": "23900",
1469
- // "low_24h": "23100",
1470
- // "change_24h": "0.004"
1471
- // },
1472
- // ]
1473
- // }
1474
- // }
1459
+ // {
1460
+ // "code": 1000,
1461
+ // "message": "Ok",
1462
+ // "data": {
1463
+ // "symbols": [
1464
+ // {
1465
+ // "symbol": "BTCUSDT",
1466
+ // "product_type": 1,
1467
+ // "open_timestamp": 1645977600000,
1468
+ // "expire_timestamp": 0,
1469
+ // "settle_timestamp": 0,
1470
+ // "base_currency": "BTC",
1471
+ // "quote_currency": "USDT",
1472
+ // "last_price": "63547.4",
1473
+ // "volume_24h": "110938430",
1474
+ // "turnover_24h": "7004836342.6944",
1475
+ // "index_price": "63587.85404255",
1476
+ // "index_name": "BTCUSDT",
1477
+ // "contract_size": "0.001",
1478
+ // "min_leverage": "1",
1479
+ // "max_leverage": "100",
1480
+ // "price_precision": "0.1",
1481
+ // "vol_precision": "1",
1482
+ // "max_volume": "1000000",
1483
+ // "min_volume": "1",
1484
+ // "funding_rate": "0.0000801",
1485
+ // "expected_funding_rate": "-0.0000035",
1486
+ // "open_interest": "278214",
1487
+ // "open_interest_value": "17555316.9355496",
1488
+ // "high_24h": "64109.4",
1489
+ // "low_24h": "61857.6",
1490
+ // "change_24h": "0.0239264900886327",
1491
+ // "funding_time": 1726819200000
1492
+ // },
1493
+ // ]
1494
+ // }
1495
+ // }
1475
1496
  //
1476
1497
  }
1477
1498
  else {
@@ -2466,6 +2487,7 @@ export default class bitmart extends Exchange {
2466
2487
  * @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
2467
2488
  * @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
2468
2489
  * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
2490
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-or-sl-order-signed
2469
2491
  * @param {string} symbol unified symbol of the market to create an order in
2470
2492
  * @param {string} type 'market', 'limit' or 'trailing' for swap markets only
2471
2493
  * @param {string} side 'buy' or 'sell'
@@ -2483,6 +2505,9 @@ export default class bitmart extends Exchange {
2483
2505
  * @param {int} [params.activation_price_type] *swap trailing order only* 1: last price, 2: fair price, default is 1
2484
2506
  * @param {string} [params.trailingPercent] *swap only* the percent to trail away from the current market price, min 0.1 max 5
2485
2507
  * @param {string} [params.trailingTriggerPrice] *swap only* the price to trigger a trailing order, default uses the price argument
2508
+ * @param {string} [params.stopLossPrice] *swap only* the price to trigger a stop-loss order
2509
+ * @param {string} [params.takeProfitPrice] *swap only* the price to trigger a take-profit order
2510
+ * @param {int} [params.plan_category] *swap tp/sl only* 1: tp/sl, 2: position tp/sl, default is 1
2486
2511
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2487
2512
  */
2488
2513
  await this.loadMarkets();
@@ -2490,6 +2515,10 @@ export default class bitmart extends Exchange {
2490
2515
  const result = this.handleMarginModeAndParams('createOrder', params);
2491
2516
  const marginMode = this.safeString(result, 0);
2492
2517
  const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'trigger_price']);
2518
+ const stopLossPrice = this.safeString(params, 'stopLossPrice');
2519
+ const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
2520
+ const isStopLoss = stopLossPrice !== undefined;
2521
+ const isTakeProfit = takeProfitPrice !== undefined;
2493
2522
  const isTriggerOrder = triggerPrice !== undefined;
2494
2523
  let response = undefined;
2495
2524
  if (market['spot']) {
@@ -2506,6 +2535,9 @@ export default class bitmart extends Exchange {
2506
2535
  if (isTriggerOrder) {
2507
2536
  response = await this.privatePostContractPrivateSubmitPlanOrder(swapRequest);
2508
2537
  }
2538
+ else if (isStopLoss || isTakeProfit) {
2539
+ response = await this.privatePostContractPrivateSubmitTpSlOrder(swapRequest);
2540
+ }
2509
2541
  else {
2510
2542
  response = await this.privatePostContractPrivateSubmitOrder(swapRequest);
2511
2543
  }
@@ -2612,8 +2644,9 @@ export default class bitmart extends Exchange {
2612
2644
  * @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
2613
2645
  * @see https://developer-pro.bitmart.com/en/futures/#submit-plan-order-signed
2614
2646
  * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
2647
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-or-sl-order-signed
2615
2648
  * @param {string} symbol unified symbol of the market to create an order in
2616
- * @param {string} type 'market', 'limit' or 'trailing'
2649
+ * @param {string} type 'market', 'limit', 'trailing', 'stop_loss', or 'take_profit'
2617
2650
  * @param {string} side 'buy' or 'sell'
2618
2651
  * @param {float} amount how much of currency you want to trade in units of base currency
2619
2652
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
@@ -2628,9 +2661,22 @@ export default class bitmart extends Exchange {
2628
2661
  * @param {int} [params.activation_price_type] *swap trailing order only* 1: last price, 2: fair price, default is 1
2629
2662
  * @param {string} [params.trailingPercent] *swap only* the percent to trail away from the current market price, min 0.1 max 5
2630
2663
  * @param {string} [params.trailingTriggerPrice] *swap only* the price to trigger a trailing order, default uses the price argument
2664
+ * @param {string} [params.stopLossPrice] *swap only* the price to trigger a stop-loss order
2665
+ * @param {string} [params.takeProfitPrice] *swap only* the price to trigger a take-profit order
2666
+ * @param {int} [params.plan_category] *swap tp/sl only* 1: tp/sl, 2: position tp/sl, default is 1
2631
2667
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2632
2668
  */
2633
2669
  const market = this.market(symbol);
2670
+ const stopLossPrice = this.safeString(params, 'stopLossPrice');
2671
+ const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
2672
+ const isStopLoss = stopLossPrice !== undefined;
2673
+ const isTakeProfit = takeProfitPrice !== undefined;
2674
+ if (isStopLoss) {
2675
+ type = 'stop_loss';
2676
+ }
2677
+ else if (isTakeProfit) {
2678
+ type = 'take_profit';
2679
+ }
2634
2680
  const request = {
2635
2681
  'symbol': market['id'],
2636
2682
  'type': type,
@@ -2640,7 +2686,7 @@ export default class bitmart extends Exchange {
2640
2686
  const mode = this.safeInteger(params, 'mode'); // only for swap
2641
2687
  const isMarketOrder = type === 'market';
2642
2688
  let postOnly = undefined;
2643
- const reduceOnly = this.safeValue(params, 'reduceOnly');
2689
+ let reduceOnly = this.safeBool(params, 'reduceOnly');
2644
2690
  const isExchangeSpecificPo = (mode === 4);
2645
2691
  [postOnly, params] = this.handlePostOnly(isMarketOrder, isExchangeSpecificPo, params);
2646
2692
  const ioc = ((timeInForce === 'IOC') || (mode === 3));
@@ -2693,6 +2739,22 @@ export default class bitmart extends Exchange {
2693
2739
  }
2694
2740
  }
2695
2741
  }
2742
+ let marginMode = undefined;
2743
+ [marginMode, params] = this.handleMarginModeAndParams('createOrder', params, 'cross');
2744
+ if (isStopLoss || isTakeProfit) {
2745
+ reduceOnly = true;
2746
+ request['price_type'] = this.safeInteger(params, 'price_type', 1);
2747
+ request['executive_price'] = this.priceToPrecision(symbol, price);
2748
+ if (isStopLoss) {
2749
+ request['trigger_price'] = this.priceToPrecision(symbol, stopLossPrice);
2750
+ }
2751
+ else {
2752
+ request['trigger_price'] = this.priceToPrecision(symbol, takeProfitPrice);
2753
+ }
2754
+ }
2755
+ else {
2756
+ request['open_type'] = marginMode;
2757
+ }
2696
2758
  if (side === 'buy') {
2697
2759
  if (reduceOnly) {
2698
2760
  request['side'] = 2; // buy close short
@@ -2709,16 +2771,13 @@ export default class bitmart extends Exchange {
2709
2771
  request['side'] = 4; // sell open short
2710
2772
  }
2711
2773
  }
2712
- let marginMode = undefined;
2713
- [marginMode, params] = this.handleMarginModeAndParams('createOrder', params, 'cross');
2714
- request['open_type'] = marginMode;
2715
2774
  const clientOrderId = this.safeString(params, 'clientOrderId');
2716
2775
  if (clientOrderId !== undefined) {
2717
2776
  params = this.omit(params, 'clientOrderId');
2718
2777
  request['client_order_id'] = clientOrderId;
2719
2778
  }
2720
2779
  const leverage = this.safeInteger(params, 'leverage');
2721
- params = this.omit(params, ['timeInForce', 'postOnly', 'reduceOnly', 'leverage', 'trailingTriggerPrice', 'trailingPercent', 'triggerPrice', 'stopPrice']);
2780
+ params = this.omit(params, ['timeInForce', 'postOnly', 'reduceOnly', 'leverage', 'trailingTriggerPrice', 'trailingPercent', 'triggerPrice', 'stopPrice', 'stopLossPrice', 'takeProfitPrice']);
2722
2781
  if (leverage !== undefined) {
2723
2782
  request['leverage'] = this.numberToString(leverage);
2724
2783
  }
package/js/src/bybit.js CHANGED
@@ -1645,13 +1645,20 @@ export default class bybit extends Exchange {
1645
1645
  async fetchFutureMarkets(params) {
1646
1646
  params = this.extend(params);
1647
1647
  params['limit'] = 1000; // minimize number of requests
1648
+ let preLaunchMarkets = [];
1648
1649
  const usePrivateInstrumentsInfo = this.safeBool(this.options, 'usePrivateInstrumentsInfo', false);
1649
1650
  let response = undefined;
1650
1651
  if (usePrivateInstrumentsInfo) {
1651
1652
  response = await this.privateGetV5MarketInstrumentsInfo(params);
1652
1653
  }
1653
1654
  else {
1654
- response = await this.publicGetV5MarketInstrumentsInfo(params);
1655
+ const linearPromises = [
1656
+ this.publicGetV5MarketInstrumentsInfo(params),
1657
+ this.publicGetV5MarketInstrumentsInfo(this.extend(params, { 'status': 'PreLaunch' })),
1658
+ ];
1659
+ const promises = await Promise.all(linearPromises);
1660
+ response = this.safeDict(promises, 0, {});
1661
+ preLaunchMarkets = this.safeDict(promises, 1, {});
1655
1662
  }
1656
1663
  const data = this.safeDict(response, 'result', {});
1657
1664
  let markets = this.safeList(data, 'list', []);
@@ -1720,6 +1727,9 @@ export default class bybit extends Exchange {
1720
1727
  // "time": 1672712495660
1721
1728
  // }
1722
1729
  //
1730
+ const preLaunchData = this.safeDict(preLaunchMarkets, 'result', {});
1731
+ const preLaunchMarketsList = this.safeList(preLaunchData, 'list', []);
1732
+ markets = this.arrayConcat(markets, preLaunchMarketsList);
1723
1733
  const result = [];
1724
1734
  let category = this.safeString(data, 'category');
1725
1735
  for (let i = 0; i < markets.length; i++) {
@@ -770,30 +770,28 @@ export default class coinbase extends Exchange {
770
770
  /**
771
771
  * @method
772
772
  * @name coinbase#fetchWithdrawals
773
- * @description fetch all withdrawals made from an account
774
- * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-withdrawals#list-withdrawals
773
+ * @description Fetch all withdrawals made from an account. Won't return crypto withdrawals. Use fetchLedger for those.
774
+ * @see https://docs.cdp.coinbase.com/coinbase-app/docs/api-withdrawals#list-withdrawals
775
775
  * @param {string} code unified currency code
776
776
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
777
777
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
778
778
  * @param {object} [params] extra parameters specific to the exchange API endpoint
779
779
  * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
780
780
  */
781
- // fiat only, for crypto transactions use fetchLedger
782
781
  return await this.fetchTransactionsWithMethod('v2PrivateGetAccountsAccountIdWithdrawals', code, since, limit, params);
783
782
  }
784
783
  async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
785
784
  /**
786
785
  * @method
787
786
  * @name coinbase#fetchDeposits
788
- * @description fetch all deposits made to an account
789
- * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-deposits#list-deposits
787
+ * @description Fetch all fiat deposits made to an account. Won't return crypto deposits or staking rewards. Use fetchLedger for those.
788
+ * @see https://docs.cdp.coinbase.com/coinbase-app/docs/api-deposits#list-deposits
790
789
  * @param {string} code unified currency code
791
790
  * @param {int} [since] the earliest time in ms to fetch deposits for
792
791
  * @param {int} [limit] the maximum number of deposits structures to retrieve
793
792
  * @param {object} [params] extra parameters specific to the exchange API endpoint
794
793
  * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
795
794
  */
796
- // fiat only, for crypto transactions use fetchLedger
797
795
  return await this.fetchTransactionsWithMethod('v2PrivateGetAccountsAccountIdDeposits', code, since, limit, params);
798
796
  }
799
797
  parseTransactionStatus(status) {
@@ -2260,8 +2258,8 @@ export default class coinbase extends Exchange {
2260
2258
  /**
2261
2259
  * @method
2262
2260
  * @name coinbase#fetchLedger
2263
- * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2264
- * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-transactions#list-transactions
2261
+ * @description Fetch the history of changes, i.e. actions done by the user or operations that altered the balance. Will return staking rewards, and crypto deposits or withdrawals.
2262
+ * @see https://docs.cdp.coinbase.com/coinbase-app/docs/api-transactions#list-transactions
2265
2263
  * @param {string} [code] unified currency code, default is undefined
2266
2264
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2267
2265
  * @param {int} [limit] max number of ledger entries to return, default is undefined
package/js/src/kraken.js CHANGED
@@ -234,6 +234,8 @@ export default class kraken extends Exchange {
234
234
  'XDG': 'DOGE',
235
235
  },
236
236
  'options': {
237
+ 'timeDifference': 0,
238
+ 'adjustForTimeDifference': false,
237
239
  'marketsByAltname': {},
238
240
  'delistedMarketsById': {},
239
241
  // cannot withdraw/deposit these
@@ -464,6 +466,9 @@ export default class kraken extends Exchange {
464
466
  * @param {object} [params] extra parameters specific to the exchange API endpoint
465
467
  * @returns {object[]} an array of objects representing market data
466
468
  */
469
+ if (this.options['adjustForTimeDifference']) {
470
+ await this.loadTimeDifference();
471
+ }
467
472
  const response = await this.publicGetAssetPairs(params);
468
473
  //
469
474
  // {
@@ -3148,7 +3153,7 @@ export default class kraken extends Exchange {
3148
3153
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
3149
3154
  }
3150
3155
  nonce() {
3151
- return this.milliseconds();
3156
+ return this.milliseconds() - this.options['timeDifference'];
3152
3157
  }
3153
3158
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
3154
3159
  if (code === 520) {
package/js/src/mexc.d.ts CHANGED
@@ -156,6 +156,7 @@ export default class mexc extends Exchange {
156
156
  parseLeverage(leverage: Dict, market?: Market): Leverage;
157
157
  handleMarginModeAndParams(methodName: any, params?: {}, defaultValue?: any): any[];
158
158
  fetchPositionsHistory(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
159
+ nonce(): number;
159
160
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
160
161
  url: any;
161
162
  method: string;