ccxt 4.1.75 → 4.1.76

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 (122) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +212 -225
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/ace.js +2 -0
  6. package/dist/cjs/src/alpaca.js +2 -0
  7. package/dist/cjs/src/base/Exchange.js +8 -0
  8. package/dist/cjs/src/base/errors.js +7 -7
  9. package/dist/cjs/src/base/ws/Client.js +2 -0
  10. package/dist/cjs/src/binance.js +4 -0
  11. package/dist/cjs/src/binanceus.js +2 -0
  12. package/dist/cjs/src/bingx.js +78 -23
  13. package/dist/cjs/src/bit2c.js +2 -0
  14. package/dist/cjs/src/bitbank.js +2 -0
  15. package/dist/cjs/src/bithumb.js +2 -0
  16. package/dist/cjs/src/bitopro.js +2 -0
  17. package/dist/cjs/src/bitpanda.js +2 -0
  18. package/dist/cjs/src/bitso.js +2 -0
  19. package/dist/cjs/src/bitstamp.js +2 -0
  20. package/dist/cjs/src/bittrex.js +2 -0
  21. package/dist/cjs/src/bitvavo.js +2 -0
  22. package/dist/cjs/src/bl3p.js +2 -0
  23. package/dist/cjs/src/btcalpha.js +2 -0
  24. package/dist/cjs/src/btcbox.js +2 -0
  25. package/dist/cjs/src/btcmarkets.js +2 -0
  26. package/dist/cjs/src/btcturk.js +2 -0
  27. package/dist/cjs/src/bybit.js +2 -0
  28. package/dist/cjs/src/coinbase.js +2 -0
  29. package/dist/cjs/src/coincheck.js +2 -0
  30. package/dist/cjs/src/coinlist.js +2 -0
  31. package/dist/cjs/src/coinmate.js +2 -0
  32. package/dist/cjs/src/coinone.js +2 -0
  33. package/dist/cjs/src/coinsph.js +2 -0
  34. package/dist/cjs/src/coinspot.js +2 -0
  35. package/dist/cjs/src/cryptocom.js +2 -185
  36. package/dist/cjs/src/gemini.js +2 -0
  37. package/dist/cjs/src/idex.js +2 -0
  38. package/dist/cjs/src/independentreserve.js +2 -0
  39. package/dist/cjs/src/indodax.js +2 -0
  40. package/dist/cjs/src/kucoin.js +2 -0
  41. package/dist/cjs/src/kuna.js +2 -0
  42. package/dist/cjs/src/latoken.js +2 -0
  43. package/dist/cjs/src/luno.js +2 -0
  44. package/dist/cjs/src/mercado.js +2 -0
  45. package/dist/cjs/src/mexc.js +2 -0
  46. package/dist/cjs/src/ndax.js +2 -0
  47. package/dist/cjs/src/novadax.js +2 -0
  48. package/dist/cjs/src/okx.js +24 -9
  49. package/dist/cjs/src/p2b.js +2 -0
  50. package/dist/cjs/src/static_dependencies/proxies/http-proxy-agent/index.js +8 -11
  51. package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/index.js +5 -8
  52. package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +5 -12
  53. package/dist/cjs/src/wavesexchange.js +2 -0
  54. package/dist/cjs/src/wazirx.js +2 -0
  55. package/dist/cjs/src/woo.js +2 -0
  56. package/dist/cjs/src/yobit.js +2 -0
  57. package/dist/cjs/src/zonda.js +2 -0
  58. package/js/ccxt.d.ts +1 -1
  59. package/js/ccxt.js +1 -1
  60. package/js/src/abstract/binance.d.ts +2 -0
  61. package/js/src/abstract/binancecoinm.d.ts +2 -0
  62. package/js/src/abstract/binanceus.d.ts +2 -0
  63. package/js/src/abstract/binanceusdm.d.ts +2 -0
  64. package/js/src/abstract/okx.d.ts +14 -0
  65. package/js/src/ace.js +2 -0
  66. package/js/src/alpaca.js +2 -0
  67. package/js/src/base/Exchange.d.ts +4 -0
  68. package/js/src/base/Exchange.js +8 -0
  69. package/js/src/base/errors.d.ts +4 -4
  70. package/js/src/base/errors.js +7 -7
  71. package/js/src/base/ws/Client.js +2 -0
  72. package/js/src/binance.js +4 -0
  73. package/js/src/binanceus.js +2 -0
  74. package/js/src/bingx.d.ts +4 -3
  75. package/js/src/bingx.js +78 -23
  76. package/js/src/bit2c.js +2 -0
  77. package/js/src/bitbank.js +2 -0
  78. package/js/src/bithumb.js +2 -0
  79. package/js/src/bitopro.js +2 -0
  80. package/js/src/bitpanda.js +2 -0
  81. package/js/src/bitso.js +2 -0
  82. package/js/src/bitstamp.js +2 -0
  83. package/js/src/bittrex.js +2 -0
  84. package/js/src/bitvavo.js +2 -0
  85. package/js/src/bl3p.js +2 -0
  86. package/js/src/btcalpha.js +2 -0
  87. package/js/src/btcbox.js +2 -0
  88. package/js/src/btcmarkets.js +2 -0
  89. package/js/src/btcturk.js +2 -0
  90. package/js/src/bybit.js +2 -0
  91. package/js/src/coinbase.js +2 -0
  92. package/js/src/coincheck.js +2 -0
  93. package/js/src/coinlist.js +2 -0
  94. package/js/src/coinmate.js +2 -0
  95. package/js/src/coinone.js +2 -0
  96. package/js/src/coinsph.js +2 -0
  97. package/js/src/coinspot.js +2 -0
  98. package/js/src/cryptocom.d.ts +0 -24
  99. package/js/src/cryptocom.js +2 -185
  100. package/js/src/gemini.js +2 -0
  101. package/js/src/idex.js +2 -0
  102. package/js/src/independentreserve.js +2 -0
  103. package/js/src/indodax.js +2 -0
  104. package/js/src/kucoin.js +2 -0
  105. package/js/src/kuna.js +2 -0
  106. package/js/src/latoken.js +2 -0
  107. package/js/src/luno.js +2 -0
  108. package/js/src/mercado.js +2 -0
  109. package/js/src/mexc.js +2 -0
  110. package/js/src/ndax.js +2 -0
  111. package/js/src/novadax.js +2 -0
  112. package/js/src/okx.js +24 -9
  113. package/js/src/p2b.js +2 -0
  114. package/js/src/static_dependencies/proxies/http-proxy-agent/index.js +9 -8
  115. package/js/src/static_dependencies/proxies/https-proxy-agent/index.js +5 -7
  116. package/js/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +5 -7
  117. package/js/src/wavesexchange.js +2 -0
  118. package/js/src/wazirx.js +2 -0
  119. package/js/src/woo.js +2 -0
  120. package/js/src/yobit.js +2 -0
  121. package/js/src/zonda.js +2 -0
  122. package/package.json +1 -1
@@ -552,6 +552,7 @@ interface Exchange {
552
552
  publicGetUiKlines(params?: {}): Promise<implicitReturnType>;
553
553
  publicGetTicker24hr(params?: {}): Promise<implicitReturnType>;
554
554
  publicGetTicker(params?: {}): Promise<implicitReturnType>;
555
+ publicGetTickerTradingDay(params?: {}): Promise<implicitReturnType>;
555
556
  publicGetTickerPrice(params?: {}): Promise<implicitReturnType>;
556
557
  publicGetTickerBookTicker(params?: {}): Promise<implicitReturnType>;
557
558
  publicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
@@ -570,6 +571,7 @@ interface Exchange {
570
571
  privateGetRateLimitOrder(params?: {}): Promise<implicitReturnType>;
571
572
  privateGetMyPreventedMatches(params?: {}): Promise<implicitReturnType>;
572
573
  privateGetMyAllocations(params?: {}): Promise<implicitReturnType>;
574
+ privateGetAccountCommission(params?: {}): Promise<implicitReturnType>;
573
575
  privatePostOrderOco(params?: {}): Promise<implicitReturnType>;
574
576
  privatePostSorOrder(params?: {}): Promise<implicitReturnType>;
575
577
  privatePostSorOrderTest(params?: {}): Promise<implicitReturnType>;
@@ -552,6 +552,7 @@ interface binance {
552
552
  publicGetUiKlines(params?: {}): Promise<implicitReturnType>;
553
553
  publicGetTicker24hr(params?: {}): Promise<implicitReturnType>;
554
554
  publicGetTicker(params?: {}): Promise<implicitReturnType>;
555
+ publicGetTickerTradingDay(params?: {}): Promise<implicitReturnType>;
555
556
  publicGetTickerPrice(params?: {}): Promise<implicitReturnType>;
556
557
  publicGetTickerBookTicker(params?: {}): Promise<implicitReturnType>;
557
558
  publicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
@@ -570,6 +571,7 @@ interface binance {
570
571
  privateGetRateLimitOrder(params?: {}): Promise<implicitReturnType>;
571
572
  privateGetMyPreventedMatches(params?: {}): Promise<implicitReturnType>;
572
573
  privateGetMyAllocations(params?: {}): Promise<implicitReturnType>;
574
+ privateGetAccountCommission(params?: {}): Promise<implicitReturnType>;
573
575
  privatePostOrderOco(params?: {}): Promise<implicitReturnType>;
574
576
  privatePostSorOrder(params?: {}): Promise<implicitReturnType>;
575
577
  privatePostSorOrderTest(params?: {}): Promise<implicitReturnType>;
@@ -552,6 +552,7 @@ interface binance {
552
552
  publicGetUiKlines(params?: {}): Promise<implicitReturnType>;
553
553
  publicGetTicker24hr(params?: {}): Promise<implicitReturnType>;
554
554
  publicGetTicker(params?: {}): Promise<implicitReturnType>;
555
+ publicGetTickerTradingDay(params?: {}): Promise<implicitReturnType>;
555
556
  publicGetTickerPrice(params?: {}): Promise<implicitReturnType>;
556
557
  publicGetTickerBookTicker(params?: {}): Promise<implicitReturnType>;
557
558
  publicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
@@ -570,6 +571,7 @@ interface binance {
570
571
  privateGetRateLimitOrder(params?: {}): Promise<implicitReturnType>;
571
572
  privateGetMyPreventedMatches(params?: {}): Promise<implicitReturnType>;
572
573
  privateGetMyAllocations(params?: {}): Promise<implicitReturnType>;
574
+ privateGetAccountCommission(params?: {}): Promise<implicitReturnType>;
573
575
  privatePostOrderOco(params?: {}): Promise<implicitReturnType>;
574
576
  privatePostSorOrder(params?: {}): Promise<implicitReturnType>;
575
577
  privatePostSorOrderTest(params?: {}): Promise<implicitReturnType>;
@@ -552,6 +552,7 @@ interface binance {
552
552
  publicGetUiKlines(params?: {}): Promise<implicitReturnType>;
553
553
  publicGetTicker24hr(params?: {}): Promise<implicitReturnType>;
554
554
  publicGetTicker(params?: {}): Promise<implicitReturnType>;
555
+ publicGetTickerTradingDay(params?: {}): Promise<implicitReturnType>;
555
556
  publicGetTickerPrice(params?: {}): Promise<implicitReturnType>;
556
557
  publicGetTickerBookTicker(params?: {}): Promise<implicitReturnType>;
557
558
  publicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
@@ -570,6 +571,7 @@ interface binance {
570
571
  privateGetRateLimitOrder(params?: {}): Promise<implicitReturnType>;
571
572
  privateGetMyPreventedMatches(params?: {}): Promise<implicitReturnType>;
572
573
  privateGetMyAllocations(params?: {}): Promise<implicitReturnType>;
574
+ privateGetAccountCommission(params?: {}): Promise<implicitReturnType>;
573
575
  privatePostOrderOco(params?: {}): Promise<implicitReturnType>;
574
576
  privatePostSorOrder(params?: {}): Promise<implicitReturnType>;
575
577
  privatePostSorOrderTest(params?: {}): Promise<implicitReturnType>;
@@ -65,6 +65,12 @@ interface Exchange {
65
65
  publicGetFinanceSavingsLendingRateSummary(params?: {}): Promise<implicitReturnType>;
66
66
  publicGetFinanceSavingsLendingRateHistory(params?: {}): Promise<implicitReturnType>;
67
67
  publicGetFinanceSfpDcdProducts(params?: {}): Promise<implicitReturnType>;
68
+ publicGetCopytradingPublicLeadTraders(params?: {}): Promise<implicitReturnType>;
69
+ publicGetCopytradingPublicWeeklyPnl(params?: {}): Promise<implicitReturnType>;
70
+ publicGetCopytradingPublicStats(params?: {}): Promise<implicitReturnType>;
71
+ publicGetCopytradingPublicPreferenceCurrency(params?: {}): Promise<implicitReturnType>;
72
+ publicGetCopytradingPublicCurrentSubpositions(params?: {}): Promise<implicitReturnType>;
73
+ publicGetCopytradingPublicSubpositionsHistory(params?: {}): Promise<implicitReturnType>;
68
74
  privateGetRfqCounterparties(params?: {}): Promise<implicitReturnType>;
69
75
  privateGetRfqMakerInstrumentSettings(params?: {}): Promise<implicitReturnType>;
70
76
  privateGetRfqRfqs(params?: {}): Promise<implicitReturnType>;
@@ -166,6 +172,10 @@ interface Exchange {
166
172
  privateGetCopytradingProfitSharingDetails(params?: {}): Promise<implicitReturnType>;
167
173
  privateGetCopytradingTotalProfitSharing(params?: {}): Promise<implicitReturnType>;
168
174
  privateGetCopytradingUnrealizedProfitSharingDetails(params?: {}): Promise<implicitReturnType>;
175
+ privateGetCopytradingCopySettings(params?: {}): Promise<implicitReturnType>;
176
+ privateGetCopytradingBatchLeverageInfo(params?: {}): Promise<implicitReturnType>;
177
+ privateGetCopytradingCurrentLeadTraders(params?: {}): Promise<implicitReturnType>;
178
+ privateGetCopytradingLeadTradersHistory(params?: {}): Promise<implicitReturnType>;
169
179
  privateGetBrokerNdInfo(params?: {}): Promise<implicitReturnType>;
170
180
  privateGetBrokerNdSubaccountInfo(params?: {}): Promise<implicitReturnType>;
171
181
  privateGetBrokerNdSubaccountApikey(params?: {}): Promise<implicitReturnType>;
@@ -259,6 +269,10 @@ interface Exchange {
259
269
  privatePostCopytradingAlgoOrder(params?: {}): Promise<implicitReturnType>;
260
270
  privatePostCopytradingCloseSubposition(params?: {}): Promise<implicitReturnType>;
261
271
  privatePostCopytradingSetInstruments(params?: {}): Promise<implicitReturnType>;
272
+ privatePostCopytradingFirstCopySettings(params?: {}): Promise<implicitReturnType>;
273
+ privatePostCopytradingAmendCopySettings(params?: {}): Promise<implicitReturnType>;
274
+ privatePostCopytradingStopCopyTrading(params?: {}): Promise<implicitReturnType>;
275
+ privatePostCopytradingBatchSetLeverage(params?: {}): Promise<implicitReturnType>;
262
276
  privatePostBrokerNdCreateSubaccount(params?: {}): Promise<implicitReturnType>;
263
277
  privatePostBrokerNdDeleteSubaccount(params?: {}): Promise<implicitReturnType>;
264
278
  privatePostBrokerNdSubaccountApikey(params?: {}): Promise<implicitReturnType>;
package/js/src/ace.js CHANGED
@@ -34,6 +34,8 @@ export default class ace extends Exchange {
34
34
  'cancelAllOrders': false,
35
35
  'cancelOrder': true,
36
36
  'cancelOrders': false,
37
+ 'closeAllPositions': false,
38
+ 'closePosition': false,
37
39
  'createOrder': true,
38
40
  'editOrder': false,
39
41
  'fetchBalance': true,
package/js/src/alpaca.js CHANGED
@@ -50,6 +50,8 @@ export default class alpaca extends Exchange {
50
50
  'option': false,
51
51
  'cancelAllOrders': true,
52
52
  'cancelOrder': true,
53
+ 'closeAllPositions': false,
54
+ 'closePosition': false,
53
55
  'createOrder': true,
54
56
  'fetchBalance': true,
55
57
  'fetchBidsAsks': false,
@@ -291,6 +291,8 @@ export default class Exchange {
291
291
  cancelAllOrders: any;
292
292
  cancelOrder: boolean;
293
293
  cancelOrders: any;
294
+ closeAllPositions: any;
295
+ closePosition: any;
294
296
  createDepositAddress: any;
295
297
  createLimitOrder: boolean;
296
298
  createMarketOrder: boolean;
@@ -790,6 +792,8 @@ export default class Exchange {
790
792
  fetchOpenInterest(symbol: string, params?: {}): Promise<OpenInterest>;
791
793
  fetchFundingRateHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
792
794
  fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
795
+ closePosition(symbol: string, side?: OrderSide, marginMode?: string, params?: {}): Promise<Position>;
796
+ closeAllPositions(params?: {}): Promise<Position[]>;
793
797
  parseLastPrice(price: any, market?: Market): any;
794
798
  fetchDepositAddress(code: string, params?: {}): Promise<any>;
795
799
  account(): Account;
@@ -349,6 +349,8 @@ export default class Exchange {
349
349
  'cancelAllOrders': undefined,
350
350
  'cancelOrder': true,
351
351
  'cancelOrders': undefined,
352
+ 'closeAllPositions': undefined,
353
+ 'closePosition': undefined,
352
354
  'createDepositAddress': undefined,
353
355
  'createLimitOrder': true,
354
356
  'createMarketOrder': true,
@@ -3694,6 +3696,12 @@ export default class Exchange {
3694
3696
  async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
3695
3697
  throw new NotSupported(this.id + ' fetchFundingHistory() is not supported yet');
3696
3698
  }
3699
+ async closePosition(symbol, side = undefined, marginMode = undefined, params = {}) {
3700
+ throw new NotSupported(this.id + ' closePositions() is not supported yet');
3701
+ }
3702
+ async closeAllPositions(params = {}) {
3703
+ throw new NotSupported(this.id + ' closeAllPositions() is not supported yet');
3704
+ }
3697
3705
  parseLastPrice(price, market = undefined) {
3698
3706
  throw new NotSupported(this.id + ' parseLastPrice() is not supported yet');
3699
3707
  }
@@ -76,7 +76,10 @@ declare class DuplicateOrderId extends InvalidOrder {
76
76
  declare class NotSupported extends ExchangeError {
77
77
  constructor(message: any);
78
78
  }
79
- declare class NetworkError extends BaseError {
79
+ declare class OperationFailed extends BaseError {
80
+ constructor(message: any);
81
+ }
82
+ declare class NetworkError extends OperationFailed {
80
83
  constructor(message: any);
81
84
  }
82
85
  declare class DDoSProtection extends NetworkError {
@@ -97,9 +100,6 @@ declare class InvalidNonce extends NetworkError {
97
100
  declare class RequestTimeout extends NetworkError {
98
101
  constructor(message: any);
99
102
  }
100
- declare class OperationFailed extends BaseError {
101
- constructor(message: any);
102
- }
103
103
  declare const errors: {
104
104
  BaseError: typeof BaseError;
105
105
  ExchangeError: typeof ExchangeError;
@@ -192,8 +192,14 @@ class NotSupported extends ExchangeError {
192
192
  this.name = 'NotSupported';
193
193
  }
194
194
  }
195
+ class OperationFailed extends BaseError {
196
+ constructor(message) {
197
+ super(message);
198
+ this.name = 'OperationFailed';
199
+ }
200
+ }
195
201
  // Network error
196
- class NetworkError extends BaseError {
202
+ class NetworkError extends OperationFailed {
197
203
  constructor(message) {
198
204
  super(message);
199
205
  this.name = 'NetworkError';
@@ -235,12 +241,6 @@ class RequestTimeout extends NetworkError {
235
241
  this.name = 'RequestTimeout';
236
242
  }
237
243
  }
238
- class OperationFailed extends BaseError {
239
- constructor(message) {
240
- super(message);
241
- this.name = 'OperationFailed';
242
- }
243
- }
244
244
  /* ------------------------------------------------------------------------ */
245
245
  // export default subclass (
246
246
  // // Root class
@@ -199,6 +199,7 @@ export default class Client {
199
199
  this.reset(this.error);
200
200
  this.onErrorCallback(this, this.error);
201
201
  }
202
+ /* eslint-disable no-shadow */
202
203
  onClose(event) {
203
204
  if (this.verbose) {
204
205
  this.log(new Date(), 'onClose', event);
@@ -226,6 +227,7 @@ export default class Client {
226
227
  message = (typeof message === 'string') ? message : JSON.stringify(message);
227
228
  const future = createFuture();
228
229
  if (isNode) {
230
+ /* eslint-disable no-inner-declarations */
229
231
  function onSendComplete(error) {
230
232
  if (error) {
231
233
  future.reject(error);
package/js/src/binance.js CHANGED
@@ -41,6 +41,8 @@ export default class binance extends Exchange {
41
41
  'cancelAllOrders': true,
42
42
  'cancelOrder': true,
43
43
  'cancelOrders': true,
44
+ 'closeAllPositions': false,
45
+ 'closePosition': false,
44
46
  'createDepositAddress': false,
45
47
  'createOrder': true,
46
48
  'createOrders': true,
@@ -877,6 +879,7 @@ export default class binance extends Exchange {
877
879
  'uiKlines': 0.4,
878
880
  'ticker/24hr': { 'cost': 0.4, 'noSymbol': 16 },
879
881
  'ticker': { 'cost': 0.4, 'noSymbol': 16 },
882
+ 'ticker/tradingDay': 0.8,
880
883
  'ticker/price': { 'cost': 0.4, 'noSymbol': 0.8 },
881
884
  'ticker/bookTicker': { 'cost': 0.4, 'noSymbol': 0.8 },
882
885
  'exchangeInfo': 4,
@@ -905,6 +908,7 @@ export default class binance extends Exchange {
905
908
  'rateLimit/order': 8,
906
909
  'myPreventedMatches': 4,
907
910
  'myAllocations': 4,
911
+ 'account/commission': 4,
908
912
  },
909
913
  'post': {
910
914
  'order/oco': 0.2,
@@ -51,6 +51,8 @@ export default class binanceus extends binance {
51
51
  'option': false,
52
52
  'addMargin': false,
53
53
  'borrowMargin': false,
54
+ 'closeAllPositions': false,
55
+ 'closePosition': false,
54
56
  'createReduceOnlyOrder': false,
55
57
  'fetchBorrowInterest': false,
56
58
  'fetchBorrowRate': false,
package/js/src/bingx.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bingx.js';
2
- import { Int, OrderSide, OHLCV, FundingRateHistory, Order, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency } from './base/types.js';
2
+ import { Int, OrderSide, OHLCV, FundingRateHistory, Order, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position } from './base/types.js';
3
3
  export default class bingx extends Exchange {
4
4
  describe(): any;
5
5
  fetchTime(params?: {}): Promise<number>;
@@ -59,8 +59,8 @@ export default class bingx extends Exchange {
59
59
  parseTicker(ticker: any, market?: Market): Ticker;
60
60
  fetchBalance(params?: {}): Promise<Balances>;
61
61
  parseBalance(response: any): Balances;
62
- fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
63
- parsePosition(position: any, market?: Market): import("./base/types.js").Position;
62
+ fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
63
+ parsePosition(position: any, market?: Market): Position;
64
64
  createMarketOrderWithCost(symbol: string, side: OrderSide, cost: any, params?: {}): Promise<Order>;
65
65
  createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
66
66
  createMarketSellOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
@@ -133,6 +133,7 @@ export default class bingx extends Exchange {
133
133
  parseParams(params: any): {};
134
134
  fetchMyLiquidations(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Liquidation[]>;
135
135
  parseLiquidation(liquidation: any, market?: Market): import("./base/types.js").Liquidation;
136
+ closeAllPositions(params?: {}): Promise<Position[]>;
136
137
  sign(path: any, section?: string, method?: string, params?: {}, headers?: any, body?: any): {
137
138
  url: any;
138
139
  method: string;
package/js/src/bingx.js CHANGED
@@ -83,10 +83,18 @@ export default class bingx extends Exchange {
83
83
  'www': 'https://bingx.com/',
84
84
  'doc': 'https://bingx-api.github.io/docs/',
85
85
  'referral': 'https://bingx.com/invite/OHETOM',
86
- 'fees': {
87
- 'trading': {
88
- 'tierBased': true,
89
- },
86
+ },
87
+ 'fees': {
88
+ 'tierBased': true,
89
+ 'spot': {
90
+ 'feeSide': 'get',
91
+ 'maker': this.parseNumber('0.001'),
92
+ 'taker': this.parseNumber('0.001'),
93
+ },
94
+ 'swap': {
95
+ 'feeSide': 'quote',
96
+ 'maker': this.parseNumber('0.0002'),
97
+ 'taker': this.parseNumber('0.0005'),
90
98
  },
91
99
  },
92
100
  'requiredCredentials': {
@@ -305,9 +313,6 @@ export default class bingx extends Exchange {
305
313
  '1w': '1w',
306
314
  '1M': '1M',
307
315
  },
308
- 'fees': {
309
- 'trading': {},
310
- },
311
316
  'precisionMode': DECIMAL_PLACES,
312
317
  'exceptions': {
313
318
  'exact': {
@@ -559,11 +564,12 @@ export default class bingx extends Exchange {
559
564
  if (settle !== undefined) {
560
565
  symbol += ':' + settle;
561
566
  }
567
+ const fees = this.safeValue(this.fees, type, {});
562
568
  const contractSize = this.safeNumber(market, 'size');
563
569
  const isActive = this.safeString(market, 'status') === '1';
564
570
  const isInverse = (spot) ? undefined : false;
565
571
  const isLinear = (spot) ? undefined : swap;
566
- return {
572
+ return this.safeMarketStructure({
567
573
  'id': id,
568
574
  'symbol': symbol,
569
575
  'base': base,
@@ -582,8 +588,9 @@ export default class bingx extends Exchange {
582
588
  'contract': swap,
583
589
  'linear': isLinear,
584
590
  'inverse': isInverse,
585
- 'taker': undefined,
586
- 'maker': undefined,
591
+ 'taker': this.safeNumber(fees, 'taker'),
592
+ 'maker': this.safeNumber(fees, 'maker'),
593
+ 'feeSide': this.safeString(fees, 'feeSide'),
587
594
  'contractSize': contractSize,
588
595
  'expiry': undefined,
589
596
  'expiryDatetime': undefined,
@@ -613,7 +620,7 @@ export default class bingx extends Exchange {
613
620
  },
614
621
  'created': undefined,
615
622
  'info': market,
616
- };
623
+ });
617
624
  }
618
625
  async fetchMarkets(params = {}) {
619
626
  /**
@@ -1579,23 +1586,28 @@ export default class bingx extends Exchange {
1579
1586
  // "avgPrice": "2.2",
1580
1587
  // "leverage": 10,
1581
1588
  // }
1589
+ //
1582
1590
  // standard position
1591
+ //
1583
1592
  // {
1584
- // "currentPrice":"82.91",
1585
- // "symbol":"LTC/USDT",
1586
- // "initialMargin":"5.00000000000000000000",
1587
- // "unrealizedProfit":"-0.26464500",
1588
- // "leverage":"20.000000000",
1589
- // "isolated":true,
1590
- // "entryPrice":"83.13",
1591
- // "positionSide":"LONG",
1592
- // "positionAmt":"1.20365912",
1593
+ // "currentPrice": "82.91",
1594
+ // "symbol": "LTC/USDT",
1595
+ // "initialMargin": "5.00000000000000000000",
1596
+ // "unrealizedProfit": "-0.26464500",
1597
+ // "leverage": "20.000000000",
1598
+ // "isolated": true,
1599
+ // "entryPrice": "83.13",
1600
+ // "positionSide": "LONG",
1601
+ // "positionAmt": "1.20365912",
1593
1602
  // }
1594
1603
  //
1595
- let marketId = this.safeString(position, 'symbol');
1604
+ let marketId = this.safeString(position, 'symbol', '');
1596
1605
  marketId = marketId.replace('/', '-'); // standard return different format
1597
1606
  const isolated = this.safeValue(position, 'isolated');
1598
- const marginMode = isolated ? 'isolated' : 'cross';
1607
+ let marginMode = undefined;
1608
+ if (isolated !== undefined) {
1609
+ marginMode = isolated ? 'isolated' : 'cross';
1610
+ }
1599
1611
  return this.safePosition({
1600
1612
  'info': position,
1601
1613
  'id': this.safeString(position, 'positionId'),
@@ -1791,7 +1803,6 @@ export default class bingx extends Exchange {
1791
1803
  * @method
1792
1804
  * @name bingx#createOrder
1793
1805
  * @description create a trade order
1794
- * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Create%20an%20Order
1795
1806
  * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Trade%20order
1796
1807
  * @param {string} symbol unified symbol of the market to create an order in
1797
1808
  * @param {string} type 'market' or 'limit'
@@ -3412,6 +3423,50 @@ export default class bingx extends Exchange {
3412
3423
  'datetime': this.iso8601(timestamp),
3413
3424
  });
3414
3425
  }
3426
+ async closeAllPositions(params = {}) {
3427
+ /**
3428
+ * @method
3429
+ * @name bitget#closePositions
3430
+ * @description closes open positions for a market
3431
+ * @see https://bitgetlimited.github.io/apidoc/en/mix/#close-all-position
3432
+ * @param {object} [params] extra parameters specific to the okx api endpoint
3433
+ * @param {string} [params.recvWindow] request valid time window value
3434
+ * @returns {[object]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
3435
+ */
3436
+ await this.loadMarkets();
3437
+ const defaultRecvWindow = this.safeInteger(this.options, 'recvWindow');
3438
+ const recvWindow = this.safeInteger(this.parseParams, 'recvWindow', defaultRecvWindow);
3439
+ let marketType = undefined;
3440
+ [marketType, params] = this.handleMarketTypeAndParams('closeAllPositions', undefined, params);
3441
+ if (marketType === 'margin') {
3442
+ throw new BadRequest(this.id + ' closePositions () cannot be used for ' + marketType + ' markets');
3443
+ }
3444
+ const request = {
3445
+ 'recvWindow': recvWindow,
3446
+ };
3447
+ const response = await this.swapV2PrivatePostTradeCloseAllPositions(this.extend(request, params));
3448
+ //
3449
+ // {
3450
+ // "code": 0,
3451
+ // "msg": "",
3452
+ // "data": {
3453
+ // "success": [
3454
+ // 1727686766700486656,
3455
+ // 1727686767048613888
3456
+ // ],
3457
+ // "failed": null
3458
+ // }
3459
+ // }
3460
+ //
3461
+ const data = this.safeValue(response, 'data', {});
3462
+ const success = this.safeValue(data, 'success', []);
3463
+ const positions = [];
3464
+ for (let i = 0; i < success.length; i++) {
3465
+ const position = this.parsePosition({ 'positionId': success[i] });
3466
+ positions.push(position);
3467
+ }
3468
+ return positions;
3469
+ }
3415
3470
  sign(path, section = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
3416
3471
  const type = section[0];
3417
3472
  const version = section[1];
package/js/src/bit2c.js CHANGED
@@ -32,6 +32,8 @@ export default class bit2c extends Exchange {
32
32
  'option': false,
33
33
  'addMargin': false,
34
34
  'cancelOrder': true,
35
+ 'closeAllPositions': false,
36
+ 'closePosition': false,
35
37
  'createOrder': true,
36
38
  'createReduceOnlyOrder': false,
37
39
  'fetchBalance': true,
package/js/src/bitbank.js CHANGED
@@ -30,6 +30,8 @@ export default class bitbank extends Exchange {
30
30
  'option': false,
31
31
  'addMargin': false,
32
32
  'cancelOrder': true,
33
+ 'closeAllPositions': false,
34
+ 'closePosition': false,
33
35
  'createOrder': true,
34
36
  'createReduceOnlyOrder': false,
35
37
  'fetchBalance': true,
package/js/src/bithumb.js CHANGED
@@ -31,6 +31,8 @@ export default class bithumb extends Exchange {
31
31
  'option': false,
32
32
  'addMargin': false,
33
33
  'cancelOrder': true,
34
+ 'closeAllPositions': false,
35
+ 'closePosition': false,
34
36
  'createMarketOrder': true,
35
37
  'createOrder': true,
36
38
  'createReduceOnlyOrder': false,
package/js/src/bitopro.js CHANGED
@@ -34,6 +34,8 @@ export default class bitopro extends Exchange {
34
34
  'cancelAllOrders': true,
35
35
  'cancelOrder': true,
36
36
  'cancelOrders': true,
37
+ 'closeAllPositions': false,
38
+ 'closePosition': false,
37
39
  'createOrder': true,
38
40
  'editOrder': false,
39
41
  'fetchBalance': true,
@@ -35,6 +35,8 @@ export default class bitpanda extends Exchange {
35
35
  'cancelAllOrders': true,
36
36
  'cancelOrder': true,
37
37
  'cancelOrders': true,
38
+ 'closeAllPositions': false,
39
+ 'closePosition': false,
38
40
  'createDepositAddress': true,
39
41
  'createOrder': true,
40
42
  'createReduceOnlyOrder': false,
package/js/src/bitso.js CHANGED
@@ -34,6 +34,8 @@ export default class bitso extends Exchange {
34
34
  'cancelAllOrders': true,
35
35
  'cancelOrder': true,
36
36
  'cancelOrders': true,
37
+ 'closeAllPositions': false,
38
+ 'closePosition': false,
37
39
  'createDepositAddress': false,
38
40
  'createOrder': true,
39
41
  'createReduceOnlyOrder': false,
@@ -36,6 +36,8 @@ export default class bitstamp extends Exchange {
36
36
  'addMargin': false,
37
37
  'cancelAllOrders': true,
38
38
  'cancelOrder': true,
39
+ 'closeAllPositions': false,
40
+ 'closePosition': false,
39
41
  'createOrder': true,
40
42
  'createReduceOnlyOrder': false,
41
43
  'createStopLimitOrder': false,
package/js/src/bittrex.js CHANGED
@@ -35,6 +35,8 @@ export default class bittrex extends Exchange {
35
35
  'addMargin': false,
36
36
  'cancelAllOrders': true,
37
37
  'cancelOrder': true,
38
+ 'closeAllPositions': false,
39
+ 'closePosition': false,
38
40
  'createDepositAddress': true,
39
41
  'createMarketOrder': true,
40
42
  'createOrder': true,
package/js/src/bitvavo.js CHANGED
@@ -35,6 +35,8 @@ export default class bitvavo extends Exchange {
35
35
  'addMargin': false,
36
36
  'cancelAllOrders': true,
37
37
  'cancelOrder': true,
38
+ 'closeAllPositions': false,
39
+ 'closePosition': false,
38
40
  'createOrder': true,
39
41
  'createReduceOnlyOrder': false,
40
42
  'createStopLimitOrder': true,
package/js/src/bl3p.js CHANGED
@@ -33,6 +33,8 @@ export default class bl3p extends Exchange {
33
33
  'option': false,
34
34
  'addMargin': false,
35
35
  'cancelOrder': true,
36
+ 'closeAllPositions': false,
37
+ 'closePosition': false,
36
38
  'createOrder': true,
37
39
  'createReduceOnlyOrder': false,
38
40
  'createStopLimitOrder': false,
@@ -31,6 +31,8 @@ export default class btcalpha extends Exchange {
31
31
  'option': false,
32
32
  'addMargin': false,
33
33
  'cancelOrder': true,
34
+ 'closeAllPositions': false,
35
+ 'closePosition': false,
34
36
  'createOrder': true,
35
37
  'createReduceOnlyOrder': false,
36
38
  'createStopLimitOrder': false,
package/js/src/btcbox.js CHANGED
@@ -33,6 +33,8 @@ export default class btcbox extends Exchange {
33
33
  'option': false,
34
34
  'addMargin': false,
35
35
  'cancelOrder': true,
36
+ 'closeAllPositions': false,
37
+ 'closePosition': false,
36
38
  'createOrder': true,
37
39
  'createReduceOnlyOrder': false,
38
40
  'fetchBalance': true,
@@ -33,6 +33,8 @@ export default class btcmarkets extends Exchange {
33
33
  'addMargin': false,
34
34
  'cancelOrder': true,
35
35
  'cancelOrders': true,
36
+ 'closeAllPositions': false,
37
+ 'closePosition': false,
36
38
  'createOrder': true,
37
39
  'createReduceOnlyOrder': false,
38
40
  'fetchBalance': true,
package/js/src/btcturk.js CHANGED
@@ -32,6 +32,8 @@ export default class btcturk extends Exchange {
32
32
  'option': false,
33
33
  'addMargin': false,
34
34
  'cancelOrder': true,
35
+ 'closeAllPositions': false,
36
+ 'closePosition': false,
35
37
  'createOrder': true,
36
38
  'createReduceOnlyOrder': false,
37
39
  'fetchBalance': true,
package/js/src/bybit.js CHANGED
@@ -38,6 +38,8 @@ export default class bybit extends Exchange {
38
38
  'borrowCrossMargin': true,
39
39
  'cancelAllOrders': true,
40
40
  'cancelOrder': true,
41
+ 'closeAllPositions': false,
42
+ 'closePosition': false,
41
43
  'createMarketBuyOrderWithCost': true,
42
44
  'createMarketSellOrderWithCost': false,
43
45
  'createOrder': true,
@@ -38,6 +38,8 @@ export default class coinbase extends Exchange {
38
38
  'addMargin': false,
39
39
  'cancelOrder': true,
40
40
  'cancelOrders': true,
41
+ 'closeAllPositions': false,
42
+ 'closePosition': false,
41
43
  'createDepositAddress': true,
42
44
  'createLimitBuyOrder': true,
43
45
  'createLimitSellOrder': true,
@@ -30,6 +30,8 @@ export default class coincheck extends Exchange {
30
30
  'option': false,
31
31
  'addMargin': false,
32
32
  'cancelOrder': true,
33
+ 'closeAllPositions': false,
34
+ 'closePosition': false,
33
35
  'createOrder': true,
34
36
  'createReduceOnlyOrder': false,
35
37
  'fetchBalance': true,