ccxt 4.1.80 → 4.1.82

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 (46) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.js +445 -175
  3. package/dist/ccxt.browser.min.js +5 -5
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/bybit.js +4 -2
  6. package/dist/cjs/src/coinex.js +191 -71
  7. package/dist/cjs/src/digifinex.js +42 -8
  8. package/dist/cjs/src/htx.js +12 -10
  9. package/dist/cjs/src/lbank.js +70 -38
  10. package/dist/cjs/src/okx.js +52 -7
  11. package/dist/cjs/src/pro/binance.js +1 -1
  12. package/dist/cjs/src/pro/bingx.js +1 -1
  13. package/dist/cjs/src/pro/bitget.js +1 -1
  14. package/dist/cjs/src/pro/bybit.js +1 -1
  15. package/dist/cjs/src/pro/cex.js +1 -1
  16. package/dist/cjs/src/pro/coinbasepro.js +1 -1
  17. package/dist/cjs/src/pro/cryptocom.js +1 -1
  18. package/dist/cjs/src/pro/gate.js +1 -1
  19. package/dist/cjs/src/pro/kucoin.js +1 -1
  20. package/dist/cjs/src/pro/kucoinfutures.js +1 -1
  21. package/dist/cjs/src/pro/okx.js +1 -1
  22. package/dist/cjs/src/whitebit.js +62 -27
  23. package/js/ccxt.d.ts +1 -1
  24. package/js/ccxt.js +1 -1
  25. package/js/src/abstract/bybit.d.ts +1 -0
  26. package/js/src/bybit.js +4 -2
  27. package/js/src/coinex.js +191 -71
  28. package/js/src/digifinex.d.ts +1 -0
  29. package/js/src/digifinex.js +42 -8
  30. package/js/src/htx.js +12 -10
  31. package/js/src/lbank.d.ts +1 -0
  32. package/js/src/lbank.js +71 -39
  33. package/js/src/okx.js +52 -7
  34. package/js/src/pro/binance.js +1 -1
  35. package/js/src/pro/bingx.js +1 -1
  36. package/js/src/pro/bitget.js +1 -1
  37. package/js/src/pro/bybit.js +1 -1
  38. package/js/src/pro/cex.js +1 -1
  39. package/js/src/pro/coinbasepro.js +1 -1
  40. package/js/src/pro/cryptocom.js +1 -1
  41. package/js/src/pro/gate.js +1 -1
  42. package/js/src/pro/kucoin.js +1 -1
  43. package/js/src/pro/kucoinfutures.js +1 -1
  44. package/js/src/pro/okx.js +1 -1
  45. package/js/src/whitebit.js +62 -27
  46. package/package.json +1 -1
package/js/src/coinex.js CHANGED
@@ -469,6 +469,8 @@ export default class coinex extends Exchange {
469
469
  * @method
470
470
  * @name coinex#fetchMarkets
471
471
  * @description retrieves data on all markets for coinex
472
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market002_all_market_info
473
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http006_market_list
472
474
  * @param {object} [params] extra parameters specific to the exchange API endpoint
473
475
  * @returns {object[]} an array of objects representing market data
474
476
  */
@@ -740,6 +742,8 @@ export default class coinex extends Exchange {
740
742
  * @method
741
743
  * @name coinex#fetchTicker
742
744
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
745
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market007_single_market_ticker
746
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http008_market_ticker
743
747
  * @param {string} symbol unified symbol of the market to fetch the ticker for
744
748
  * @param {object} [params] extra parameters specific to the exchange API endpoint
745
749
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -749,8 +753,13 @@ export default class coinex extends Exchange {
749
753
  const request = {
750
754
  'market': market['id'],
751
755
  };
752
- const method = market['swap'] ? 'perpetualPublicGetMarketTicker' : 'publicGetMarketTicker';
753
- const response = await this[method](this.extend(request, params));
756
+ let response = undefined;
757
+ if (market['swap']) {
758
+ response = await this.perpetualPublicGetMarketTicker(this.extend(request, params));
759
+ }
760
+ else {
761
+ response = await this.publicGetMarketTicker(this.extend(request, params));
762
+ }
754
763
  //
755
764
  // Spot
756
765
  //
@@ -826,8 +835,13 @@ export default class coinex extends Exchange {
826
835
  market = this.market(symbol);
827
836
  }
828
837
  const [marketType, query] = this.handleMarketTypeAndParams('fetchTickers', market, params);
829
- const method = (marketType === 'swap') ? 'perpetualPublicGetMarketTickerAll' : 'publicGetMarketTickerAll';
830
- const response = await this[method](query);
838
+ let response = undefined;
839
+ if (marketType === 'swap') {
840
+ response = await this.perpetualPublicGetMarketTickerAll(query);
841
+ }
842
+ else {
843
+ response = await this.publicGetMarketTickerAll();
844
+ }
831
845
  //
832
846
  // Spot
833
847
  //
@@ -909,6 +923,7 @@ export default class coinex extends Exchange {
909
923
  * @method
910
924
  * @name coinex#fetchTime
911
925
  * @description fetches the current integer timestamp in milliseconds from the exchange server
926
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http005_system_time
912
927
  * @param {object} [params] extra parameters specific to the exchange API endpoint
913
928
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
914
929
  */
@@ -927,6 +942,8 @@ export default class coinex extends Exchange {
927
942
  * @method
928
943
  * @name coinex#fetchOrderBook
929
944
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
945
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market004_market_depth
946
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http010_market_depth
930
947
  * @param {string} symbol unified symbol of the market to fetch the order book for
931
948
  * @param {int} [limit] the maximum amount of order book entries to return
932
949
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -942,8 +959,13 @@ export default class coinex extends Exchange {
942
959
  'merge': '0',
943
960
  'limit': limit.toString(),
944
961
  };
945
- const method = market['swap'] ? 'perpetualPublicGetMarketDepth' : 'publicGetMarketDepth';
946
- const response = await this[method](this.extend(request, params));
962
+ let response = undefined;
963
+ if (market['swap']) {
964
+ response = await this.perpetualPublicGetMarketDepth(this.extend(request, params));
965
+ }
966
+ else {
967
+ response = await this.publicGetMarketDepth(this.extend(request, params));
968
+ }
947
969
  //
948
970
  // Spot
949
971
  //
@@ -1123,6 +1145,8 @@ export default class coinex extends Exchange {
1123
1145
  * @method
1124
1146
  * @name coinex#fetchTrades
1125
1147
  * @description get the list of most recent trades for a particular symbol
1148
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market005_market_deals
1149
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http011_market_deals
1126
1150
  * @param {string} symbol unified symbol of the market to fetch trades for
1127
1151
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
1128
1152
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -1138,8 +1162,13 @@ export default class coinex extends Exchange {
1138
1162
  if (limit !== undefined) {
1139
1163
  request['limit'] = limit;
1140
1164
  }
1141
- const method = market['swap'] ? 'perpetualPublicGetMarketDeals' : 'publicGetMarketDeals';
1142
- const response = await this[method](this.extend(request, params));
1165
+ let response = undefined;
1166
+ if (market['swap']) {
1167
+ response = await this.perpetualPublicGetMarketDeals(this.extend(request, params));
1168
+ }
1169
+ else {
1170
+ response = await this.publicGetMarketDeals(this.extend(request, params));
1171
+ }
1143
1172
  //
1144
1173
  // Spot and Swap
1145
1174
  //
@@ -1165,6 +1194,7 @@ export default class coinex extends Exchange {
1165
1194
  * @method
1166
1195
  * @name coinex#fetchTradingFee
1167
1196
  * @description fetch the trading fees for a market
1197
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market003_single_market_info
1168
1198
  * @param {string} symbol unified market symbol
1169
1199
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1170
1200
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -1199,6 +1229,7 @@ export default class coinex extends Exchange {
1199
1229
  * @method
1200
1230
  * @name coinex#fetchTradingFees
1201
1231
  * @description fetch the trading fees for multiple markets
1232
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market002_all_market_info
1202
1233
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1203
1234
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
1204
1235
  */
@@ -1271,6 +1302,8 @@ export default class coinex extends Exchange {
1271
1302
  * @method
1272
1303
  * @name coinex#fetchOHLCV
1273
1304
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1305
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market006_market_kline
1306
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http012_market_kline
1274
1307
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1275
1308
  * @param {string} timeframe the length of time each candle represents
1276
1309
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -1287,8 +1320,13 @@ export default class coinex extends Exchange {
1287
1320
  if (limit !== undefined) {
1288
1321
  request['limit'] = limit;
1289
1322
  }
1290
- const method = market['swap'] ? 'perpetualPublicGetMarketKline' : 'publicGetMarketKline';
1291
- const response = await this[method](this.extend(request, params));
1323
+ let response = undefined;
1324
+ if (market['swap']) {
1325
+ response = await this.perpetualPublicGetMarketKline(this.extend(request, params));
1326
+ }
1327
+ else {
1328
+ response = await this.publicGetMarketKline(this.extend(request, params));
1329
+ }
1292
1330
  //
1293
1331
  // Spot
1294
1332
  //
@@ -2536,6 +2574,10 @@ export default class coinex extends Exchange {
2536
2574
  * @method
2537
2575
  * @name coinex#cancelOrder
2538
2576
  * @description cancels an open order
2577
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade018_cancle_stop_pending_order
2578
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade015_cancel_order
2579
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http023_cancel_stop_order
2580
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http021_cancel_order
2539
2581
  * @param {string} id order id
2540
2582
  * @param {string} symbol unified symbol of the market the order was made in
2541
2583
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2553,15 +2595,6 @@ export default class coinex extends Exchange {
2553
2595
  };
2554
2596
  const idRequest = swap ? 'order_id' : 'id';
2555
2597
  request[idRequest] = id;
2556
- let method = swap ? 'perpetualPrivatePostOrderCancel' : 'privateDeleteOrderPending';
2557
- if (stop) {
2558
- if (swap) {
2559
- method = 'perpetualPrivatePostOrderCancelStop';
2560
- }
2561
- else {
2562
- method = 'privateDeleteOrderStopPendingId';
2563
- }
2564
- }
2565
2598
  const accountId = this.safeInteger(params, 'account_id');
2566
2599
  const defaultType = this.safeString(this.options, 'defaultType');
2567
2600
  if (defaultType === 'margin') {
@@ -2571,7 +2604,23 @@ export default class coinex extends Exchange {
2571
2604
  request['account_id'] = accountId;
2572
2605
  }
2573
2606
  const query = this.omit(params, ['stop', 'account_id']);
2574
- const response = await this[method](this.extend(request, query));
2607
+ let response = undefined;
2608
+ if (stop) {
2609
+ if (swap) {
2610
+ response = await this.perpetualPrivatePostOrderCancelStop(this.extend(request, query));
2611
+ }
2612
+ else {
2613
+ response = await this.privateDeleteOrderStopPendingId(this.extend(request, query));
2614
+ }
2615
+ }
2616
+ else {
2617
+ if (swap) {
2618
+ response = await this.perpetualPrivatePostOrderCancel(this.extend(request, query));
2619
+ }
2620
+ else {
2621
+ response = await this.privateDeleteOrderPending(this.extend(request, query));
2622
+ }
2623
+ }
2575
2624
  //
2576
2625
  // Spot and Margin
2577
2626
  //
@@ -2686,6 +2735,10 @@ export default class coinex extends Exchange {
2686
2735
  * @method
2687
2736
  * @name coinex#cancelAllOrders
2688
2737
  * @description cancel all open orders in a market
2738
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade018_cancle_stop_pending_order
2739
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade015_cancel_order
2740
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http024_cancel_stop_all
2741
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http022_cancel_all
2689
2742
  * @param {string} symbol unified market symbol of the market to cancel orders in
2690
2743
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2691
2744
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -2704,22 +2757,25 @@ export default class coinex extends Exchange {
2704
2757
  };
2705
2758
  const swap = market['swap'];
2706
2759
  const stop = this.safeValue(params, 'stop');
2707
- let method;
2760
+ params = this.omit(params, ['stop', 'account_id']);
2761
+ let response = undefined;
2708
2762
  if (swap) {
2709
- method = 'perpetualPrivatePostOrderCancelAll';
2710
2763
  if (stop) {
2711
- method = 'perpetualPrivatePostOrderCancelStopAll';
2764
+ response = await this.perpetualPrivatePostOrderCancelStopAll(this.extend(request, params));
2765
+ }
2766
+ else {
2767
+ response = await this.perpetualPrivatePostOrderCancelAll(this.extend(request, params));
2712
2768
  }
2713
2769
  }
2714
2770
  else {
2715
- method = 'privateDeleteOrderPending';
2771
+ request['account_id'] = accountId;
2716
2772
  if (stop) {
2717
- method = 'privateDeleteOrderStopPending';
2773
+ response = await this.privateDeleteOrderStopPending(this.extend(request, params));
2774
+ }
2775
+ else {
2776
+ response = await this.privateDeleteOrderPending(this.extend(request, params));
2718
2777
  }
2719
- request['account_id'] = accountId;
2720
2778
  }
2721
- params = this.omit(params, ['stop', 'account_id']);
2722
- const response = await this[method](this.extend(request, params));
2723
2779
  //
2724
2780
  // Spot and Margin
2725
2781
  //
@@ -2736,6 +2792,9 @@ export default class coinex extends Exchange {
2736
2792
  * @method
2737
2793
  * @name coinex#fetchOrder
2738
2794
  * @description fetches information on an order made by the user
2795
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http028_stop_status
2796
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http026_order_status
2797
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade007_order_status
2739
2798
  * @param {string} symbol unified symbol of the market the order was made in
2740
2799
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2741
2800
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -2747,6 +2806,7 @@ export default class coinex extends Exchange {
2747
2806
  const market = this.market(symbol);
2748
2807
  const swap = market['swap'];
2749
2808
  const stop = this.safeValue(params, 'stop');
2809
+ params = this.omit(params, 'stop');
2750
2810
  const request = {
2751
2811
  'market': market['id'],
2752
2812
  // 'id': id, // SPOT
@@ -2754,15 +2814,18 @@ export default class coinex extends Exchange {
2754
2814
  };
2755
2815
  const idRequest = swap ? 'order_id' : 'id';
2756
2816
  request[idRequest] = id;
2757
- let method = undefined;
2817
+ let response = undefined;
2758
2818
  if (swap) {
2759
- method = stop ? 'perpetualPrivateGetOrderStopStatus' : 'perpetualPrivateGetOrderStatus';
2819
+ if (stop) {
2820
+ response = await this.perpetualPrivateGetOrderStopStatus(this.extend(request, params));
2821
+ }
2822
+ else {
2823
+ response = await this.perpetualPrivateGetOrderStatus(this.extend(request, params));
2824
+ }
2760
2825
  }
2761
2826
  else {
2762
- method = 'privateGetOrderStatus';
2827
+ response = await this.privateGetOrderStatus(this.extend(request, params));
2763
2828
  }
2764
- params = this.omit(params, 'stop');
2765
- const response = await this[method](this.extend(request, params));
2766
2829
  //
2767
2830
  // Spot
2768
2831
  //
@@ -2882,15 +2945,20 @@ export default class coinex extends Exchange {
2882
2945
  request['market'] = market['id'];
2883
2946
  }
2884
2947
  const [marketType, query] = this.handleMarketTypeAndParams('fetchOrdersByStatus', market, params);
2885
- let method = undefined;
2948
+ const accountId = this.safeInteger(params, 'account_id');
2949
+ const defaultType = this.safeString(this.options, 'defaultType');
2950
+ if (defaultType === 'margin') {
2951
+ if (accountId === undefined) {
2952
+ throw new BadRequest(this.id + ' fetchOpenOrders() and fetchClosedOrders() require an account_id parameter for margin orders');
2953
+ }
2954
+ request['account_id'] = accountId;
2955
+ }
2956
+ params = this.omit(query, 'account_id');
2957
+ let response = undefined;
2886
2958
  if (marketType === 'swap') {
2887
2959
  if (symbol === undefined) {
2888
2960
  throw new ArgumentsRequired(this.id + ' fetchOrdersByStatus() requires a symbol argument for swap markets');
2889
2961
  }
2890
- method = 'perpetualPrivateGetOrder' + this.capitalize(status);
2891
- if (stop) {
2892
- method = 'perpetualPrivateGetOrderStopPending';
2893
- }
2894
2962
  if (side !== undefined) {
2895
2963
  request['side'] = side;
2896
2964
  }
@@ -2898,24 +2966,37 @@ export default class coinex extends Exchange {
2898
2966
  request['side'] = 0;
2899
2967
  }
2900
2968
  request['offset'] = 0;
2901
- }
2902
- else {
2903
- method = 'privateGetOrder' + this.capitalize(status);
2904
2969
  if (stop) {
2905
- method = 'privateGetOrderStop' + this.capitalize(status);
2970
+ response = await this.perpetualPrivateGetOrderStopPending(this.extend(request, params));
2971
+ }
2972
+ else {
2973
+ if (status === 'finished') {
2974
+ response = await this.perpetualPrivateGetOrderFinished(this.extend(request, params));
2975
+ }
2976
+ else if (status === 'pending') {
2977
+ response = await this.perpetualPrivateGetOrderPending(this.extend(request, params));
2978
+ }
2906
2979
  }
2907
- request['page'] = 1;
2908
2980
  }
2909
- const accountId = this.safeInteger(params, 'account_id');
2910
- const defaultType = this.safeString(this.options, 'defaultType');
2911
- if (defaultType === 'margin') {
2912
- if (accountId === undefined) {
2913
- throw new BadRequest(this.id + ' fetchOpenOrders() and fetchClosedOrders() require an account_id parameter for margin orders');
2981
+ else {
2982
+ request['page'] = 1;
2983
+ if (status === 'finished') {
2984
+ if (stop) {
2985
+ response = await this.privateGetOrderStopFinished(this.extend(request, params));
2986
+ }
2987
+ else {
2988
+ response = await this.privateGetOrderFinished(this.extend(request, params));
2989
+ }
2990
+ }
2991
+ else if (status === 'pending') {
2992
+ if (stop) {
2993
+ response = await this.privateGetOrderStopPending(this.extend(request, params));
2994
+ }
2995
+ else {
2996
+ response = await this.privateGetOrderPending(this.extend(request, params));
2997
+ }
2914
2998
  }
2915
- request['account_id'] = accountId;
2916
2999
  }
2917
- params = this.omit(query, 'account_id');
2918
- const response = await this[method](this.extend(request, params));
2919
3000
  //
2920
3001
  // Spot and Margin
2921
3002
  //
@@ -3076,6 +3157,10 @@ export default class coinex extends Exchange {
3076
3157
  * @method
3077
3158
  * @name coinex#fetchOpenOrders
3078
3159
  * @description fetch all unfilled currently open orders
3160
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http027_query_pending_stop
3161
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http025_query_pending
3162
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade013_stop_pending_order
3163
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade011_pending_order
3079
3164
  * @param {string} symbol unified market symbol
3080
3165
  * @param {int} [since] the earliest time in ms to fetch open orders for
3081
3166
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -3089,6 +3174,9 @@ export default class coinex extends Exchange {
3089
3174
  * @method
3090
3175
  * @name coinex#fetchClosedOrders
3091
3176
  * @description fetches information on multiple closed orders made by the user
3177
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http029_query_finished
3178
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade010_stop_finished_order
3179
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade012_finished_order
3092
3180
  * @param {string} symbol unified market symbol of the market orders were made in
3093
3181
  * @param {int} [since] the earliest time in ms to fetch orders for
3094
3182
  * @param {int} [limit] the maximum number of orde structures to retrieve
@@ -3102,6 +3190,7 @@ export default class coinex extends Exchange {
3102
3190
  * @method
3103
3191
  * @name coinex#createDepositAddress
3104
3192
  * @description create a currency deposit address
3193
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account019_update_deposit_address
3105
3194
  * @param {string} code unified currency code of the currency for the deposit address
3106
3195
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3107
3196
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -3134,6 +3223,7 @@ export default class coinex extends Exchange {
3134
3223
  * @method
3135
3224
  * @name coinex#fetchDepositAddress
3136
3225
  * @description fetch the deposit address for a currency associated with this account
3226
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account020_query_deposit_address
3137
3227
  * @param {string} code unified currency code
3138
3228
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3139
3229
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -3228,6 +3318,8 @@ export default class coinex extends Exchange {
3228
3318
  * @method
3229
3319
  * @name coinex#fetchMyTrades
3230
3320
  * @description fetch all trades made by the user
3321
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http013_user_deals
3322
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade014_user_deals
3231
3323
  * @param {string} symbol unified market symbol
3232
3324
  * @param {int} [since] the earliest time in ms to fetch trades for
3233
3325
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -3257,9 +3349,17 @@ export default class coinex extends Exchange {
3257
3349
  throw new ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument for non-spot markets');
3258
3350
  }
3259
3351
  const swap = (type === 'swap');
3260
- let method = undefined;
3352
+ const accountId = this.safeInteger(params, 'account_id');
3353
+ const defaultType = this.safeString(this.options, 'defaultType');
3354
+ if (defaultType === 'margin') {
3355
+ if (accountId === undefined) {
3356
+ throw new BadRequest(this.id + ' fetchMyTrades() requires an account_id parameter for margin trades');
3357
+ }
3358
+ request['account_id'] = accountId;
3359
+ params = this.omit(params, 'account_id');
3360
+ }
3361
+ let response = undefined;
3261
3362
  if (swap) {
3262
- method = 'perpetualPublicGetMarketUserDeals';
3263
3363
  const side = this.safeInteger(params, 'side');
3264
3364
  if (side === undefined) {
3265
3365
  throw new ArgumentsRequired(this.id + ' fetchMyTrades() requires a side parameter for swap markets');
@@ -3269,21 +3369,12 @@ export default class coinex extends Exchange {
3269
3369
  }
3270
3370
  request['side'] = side;
3271
3371
  params = this.omit(params, 'side');
3372
+ response = await this.perpetualPublicGetMarketUserDeals(this.extend(request, params));
3272
3373
  }
3273
3374
  else {
3274
- method = 'privateGetOrderUserDeals';
3275
3375
  request['page'] = 1;
3376
+ response = await this.privateGetOrderUserDeals(this.extend(request, params));
3276
3377
  }
3277
- const accountId = this.safeInteger(params, 'account_id');
3278
- const defaultType = this.safeString(this.options, 'defaultType');
3279
- if (defaultType === 'margin') {
3280
- if (accountId === undefined) {
3281
- throw new BadRequest(this.id + ' fetchMyTrades() requires an account_id parameter for margin trades');
3282
- }
3283
- request['account_id'] = accountId;
3284
- params = this.omit(params, 'account_id');
3285
- }
3286
- const response = await this[method](this.extend(request, params));
3287
3378
  //
3288
3379
  // Spot and Margin
3289
3380
  //
@@ -3366,6 +3457,7 @@ export default class coinex extends Exchange {
3366
3457
  * @method
3367
3458
  * @name coinex#fetchPositions
3368
3459
  * @description fetch all open positions
3460
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033_pending_position
3369
3461
  * @param {string[]|undefined} symbols list of unified market symbols
3370
3462
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3371
3463
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
@@ -3461,6 +3553,7 @@ export default class coinex extends Exchange {
3461
3553
  * @method
3462
3554
  * @name coinex#fetchPosition
3463
3555
  * @description fetch data on a single open contract trade position
3556
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033_pending_position
3464
3557
  * @param {string} symbol unified market symbol of the market the position is held in, default is undefined
3465
3558
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3466
3559
  * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
@@ -3643,6 +3736,7 @@ export default class coinex extends Exchange {
3643
3736
  * @method
3644
3737
  * @name coinex#setMarginMode
3645
3738
  * @description set margin mode to 'cross' or 'isolated'
3739
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http014_adjust_leverage
3646
3740
  * @param {string} marginMode 'cross' or 'isolated'
3647
3741
  * @param {string} symbol unified market symbol
3648
3742
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3732,6 +3826,7 @@ export default class coinex extends Exchange {
3732
3826
  * @method
3733
3827
  * @name coinex#fetchLeverageTiers
3734
3828
  * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
3829
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http007_market_limit
3735
3830
  * @param {string[]|undefined} symbols list of unified market symbols
3736
3831
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3737
3832
  * @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
@@ -3896,6 +3991,7 @@ export default class coinex extends Exchange {
3896
3991
  * @method
3897
3992
  * @name coinex#addMargin
3898
3993
  * @description add margin
3994
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
3899
3995
  * @param {string} symbol unified market symbol
3900
3996
  * @param {float} amount amount of margin to add
3901
3997
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3908,6 +4004,7 @@ export default class coinex extends Exchange {
3908
4004
  * @method
3909
4005
  * @name coinex#reduceMargin
3910
4006
  * @description remove margin from a position
4007
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
3911
4008
  * @param {string} symbol unified market symbol
3912
4009
  * @param {float} amount the amount of margin to remove
3913
4010
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3920,6 +4017,7 @@ export default class coinex extends Exchange {
3920
4017
  * @method
3921
4018
  * @name coinex#fetchFundingHistory
3922
4019
  * @description fetch the history of funding payments paid and received on this account
4020
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http034_funding_position
3923
4021
  * @param {string} symbol unified market symbol
3924
4022
  * @param {int} [since] the earliest time in ms to fetch funding history for
3925
4023
  * @param {int} [limit] the maximum number of funding history structures to retrieve
@@ -3995,6 +4093,7 @@ export default class coinex extends Exchange {
3995
4093
  * @method
3996
4094
  * @name coinex#fetchFundingRate
3997
4095
  * @description fetch the current funding rate
4096
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http008_market_ticker
3998
4097
  * @param {string} symbol unified market symbol
3999
4098
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4000
4099
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
@@ -4103,6 +4202,7 @@ export default class coinex extends Exchange {
4103
4202
  * @method
4104
4203
  * @name coinex#fetchFundingRates
4105
4204
  * @description fetch the current funding rates
4205
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http009_market_ticker_all
4106
4206
  * @param {string[]} symbols unified market symbols
4107
4207
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4108
4208
  * @returns {object[]} an array of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
@@ -4429,6 +4529,8 @@ export default class coinex extends Exchange {
4429
4529
  * @method
4430
4530
  * @name coinex#transfer
4431
4531
  * @description transfer currency internally between wallets on the same account
4532
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account014_balance_contract_transfer
4533
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account013_margin_transfer
4432
4534
  * @param {string} code unified currency code
4433
4535
  * @param {float} amount amount to transfer
4434
4536
  * @param {string} fromAccount account to transfer from
@@ -4443,12 +4545,14 @@ export default class coinex extends Exchange {
4443
4545
  'amount': amountToPrecision,
4444
4546
  'coin_type': currency['id'],
4445
4547
  };
4446
- let method = 'privatePostContractBalanceTransfer';
4548
+ let response = undefined;
4447
4549
  if ((fromAccount === 'spot') && (toAccount === 'swap')) {
4448
4550
  request['transfer_side'] = 'in'; // 'in' spot to swap, 'out' swap to spot
4551
+ response = await this.privatePostContractBalanceTransfer(this.extend(request, params));
4449
4552
  }
4450
4553
  else if ((fromAccount === 'swap') && (toAccount === 'spot')) {
4451
4554
  request['transfer_side'] = 'out'; // 'in' spot to swap, 'out' swap to spot
4555
+ response = await this.privatePostContractBalanceTransfer(this.extend(request, params));
4452
4556
  }
4453
4557
  else {
4454
4558
  const accountsById = this.safeValue(this.options, 'accountsById', {});
@@ -4458,9 +4562,8 @@ export default class coinex extends Exchange {
4458
4562
  // spot is 0, use fetchBalance() to find the margin account id
4459
4563
  request['from_account'] = parseInt(fromId);
4460
4564
  request['to_account'] = parseInt(toId);
4461
- method = 'privatePostMarginTransfer';
4565
+ response = await this.privatePostMarginTransfer(this.extend(request, params));
4462
4566
  }
4463
- const response = await this[method](this.extend(request, params));
4464
4567
  //
4465
4568
  // {"code": 0, "data": null, "message": "Success"}
4466
4569
  //
@@ -4542,6 +4645,8 @@ export default class coinex extends Exchange {
4542
4645
  * @method
4543
4646
  * @name coinex#fetchTransfers
4544
4647
  * @description fetch a history of internal transfers made on an account
4648
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account025_margin_transfer_history
4649
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account024_contract_transfer_history
4545
4650
  * @param {string} code unified currency code of the currency transferred
4546
4651
  * @param {int} [since] the earliest time in ms to fetch transfers for
4547
4652
  * @param {int} [limit] the maximum number of transfers structures to retrieve
@@ -4552,7 +4657,7 @@ export default class coinex extends Exchange {
4552
4657
  let currency = undefined;
4553
4658
  const request = {
4554
4659
  'page': 1,
4555
- 'limit': limit,
4660
+ // 'limit': limit,
4556
4661
  // 'asset': 'USDT',
4557
4662
  // 'start_time': since,
4558
4663
  // 'end_time': 1515806440,
@@ -4563,16 +4668,27 @@ export default class coinex extends Exchange {
4563
4668
  request['page'] = page;
4564
4669
  }
4565
4670
  if (code !== undefined) {
4566
- currency = this.safeCurrencyCode(code);
4671
+ currency = this.currency(code);
4567
4672
  request['asset'] = currency['id'];
4568
4673
  }
4569
4674
  if (since !== undefined) {
4570
4675
  request['start_time'] = since;
4571
4676
  }
4677
+ if (limit !== undefined) {
4678
+ request['limit'] = limit;
4679
+ }
4680
+ else {
4681
+ request['limit'] = 100;
4682
+ }
4572
4683
  params = this.omit(params, 'page');
4573
4684
  const defaultType = this.safeString(this.options, 'defaultType');
4574
- const method = (defaultType === 'margin') ? 'privateGetMarginTransferHistory' : 'privateGetContractTransferHistory';
4575
- const response = await this[method](this.extend(request, params));
4685
+ let response = undefined;
4686
+ if (defaultType === 'margin') {
4687
+ response = await this.privateGetMarginTransferHistory(this.extend(request, params));
4688
+ }
4689
+ else {
4690
+ response = await this.privateGetContractTransferHistory(this.extend(request, params));
4691
+ }
4576
4692
  //
4577
4693
  // Swap
4578
4694
  //
@@ -4626,6 +4742,7 @@ export default class coinex extends Exchange {
4626
4742
  * @method
4627
4743
  * @name coinex#fetchWithdrawals
4628
4744
  * @description fetch all withdrawals made from an account
4745
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account026_withdraw_list
4629
4746
  * @param {string} code unified currency code
4630
4747
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
4631
4748
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -4692,6 +4809,7 @@ export default class coinex extends Exchange {
4692
4809
  * @method
4693
4810
  * @name coinex#fetchDeposits
4694
4811
  * @description fetch all deposits made to an account
4812
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account009_deposit_list
4695
4813
  * @param {string} code unified currency code
4696
4814
  * @param {int} [since] the earliest time in ms to fetch deposits for
4697
4815
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -4791,6 +4909,7 @@ export default class coinex extends Exchange {
4791
4909
  * @method
4792
4910
  * @name coinex#fetchIsolatedBorrowRate
4793
4911
  * @description fetch the rate of interest to borrow a currency for margin trading
4912
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account007_margin_account_settings
4794
4913
  * @param {string} symbol unified symbol of the market to fetch the borrow rate for
4795
4914
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4796
4915
  * @returns {object} an [isolated borrow rate structure]{@link https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure}
@@ -4829,6 +4948,7 @@ export default class coinex extends Exchange {
4829
4948
  * @method
4830
4949
  * @name coinex#fetchIsolatedBorrowRates
4831
4950
  * @description fetch the borrow interest rates of all currencies
4951
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account007_margin_account_settings
4832
4952
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4833
4953
  * @returns {object} a list of [isolated borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
4834
4954
  */
@@ -31,6 +31,7 @@ export default class digifinex extends Exchange {
31
31
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
32
32
  createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
33
33
  createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): any;
34
+ createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
34
35
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
35
36
  cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any>;
36
37
  parseOrderStatus(status: any): string;