ccxt 4.1.12 → 4.1.14

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 (152) hide show
  1. package/CHANGELOG.md +219 -0
  2. package/CONTRIBUTING.md +1 -0
  3. package/README.md +3 -3
  4. package/dist/ccxt.browser.js +1242 -120
  5. package/dist/ccxt.browser.min.js +3 -3
  6. package/dist/cjs/ccxt.js +1 -1
  7. package/dist/cjs/src/ace.js +1 -0
  8. package/dist/cjs/src/alpaca.js +1 -0
  9. package/dist/cjs/src/ascendex.js +1 -0
  10. package/dist/cjs/src/base/Exchange.js +30 -0
  11. package/dist/cjs/src/bigone.js +1 -0
  12. package/dist/cjs/src/binance.js +237 -3
  13. package/dist/cjs/src/bingx.js +5 -2
  14. package/dist/cjs/src/bitbank.js +1 -0
  15. package/dist/cjs/src/bitbns.js +1 -0
  16. package/dist/cjs/src/bitfinex.js +1 -0
  17. package/dist/cjs/src/bitfinex2.js +1 -0
  18. package/dist/cjs/src/bitflyer.js +1 -0
  19. package/dist/cjs/src/bitforex.js +1 -0
  20. package/dist/cjs/src/bitget.js +203 -3
  21. package/dist/cjs/src/bithumb.js +1 -0
  22. package/dist/cjs/src/bitmart.js +105 -0
  23. package/dist/cjs/src/bitmex.js +70 -0
  24. package/dist/cjs/src/bitopro.js +1 -0
  25. package/dist/cjs/src/bitpanda.js +1 -0
  26. package/dist/cjs/src/bitrue.js +1 -0
  27. package/dist/cjs/src/bitso.js +1 -0
  28. package/dist/cjs/src/bitstamp.js +1 -0
  29. package/dist/cjs/src/bittrex.js +6 -0
  30. package/dist/cjs/src/bitvavo.js +1 -0
  31. package/dist/cjs/src/blockchaincom.js +1 -0
  32. package/dist/cjs/src/btcalpha.js +1 -0
  33. package/dist/cjs/src/btcmarkets.js +1 -0
  34. package/dist/cjs/src/btcturk.js +1 -0
  35. package/dist/cjs/src/bybit.js +3 -3
  36. package/dist/cjs/src/cex.js +1 -0
  37. package/dist/cjs/src/coinbase.js +1 -0
  38. package/dist/cjs/src/coinbasepro.js +1 -0
  39. package/dist/cjs/src/coinex.js +2 -0
  40. package/dist/cjs/src/coinfalcon.js +1 -0
  41. package/dist/cjs/src/coinmate.js +1 -0
  42. package/dist/cjs/src/coinone.js +2 -1
  43. package/dist/cjs/src/cryptocom.js +25 -87
  44. package/dist/cjs/src/currencycom.js +1 -0
  45. package/dist/cjs/src/delta.js +1 -0
  46. package/dist/cjs/src/deribit.js +164 -0
  47. package/dist/cjs/src/digifinex.js +1 -0
  48. package/dist/cjs/src/exmo.js +1 -0
  49. package/dist/cjs/src/gate.js +192 -0
  50. package/dist/cjs/src/gemini.js +1 -0
  51. package/dist/cjs/src/hitbtc.js +1 -0
  52. package/dist/cjs/src/hollaex.js +1 -0
  53. package/dist/cjs/src/huobi.js +102 -0
  54. package/dist/cjs/src/huobijp.js +1 -0
  55. package/dist/cjs/src/idex.js +1 -0
  56. package/dist/cjs/src/independentreserve.js +1 -0
  57. package/dist/cjs/src/indodax.js +1 -0
  58. package/dist/cjs/src/kraken.js +9 -0
  59. package/dist/cjs/src/krakenfutures.js +1 -0
  60. package/dist/cjs/src/kucoin.js +1 -0
  61. package/dist/cjs/src/kucoinfutures.js +1 -1
  62. package/dist/cjs/src/latoken.js +1 -0
  63. package/dist/cjs/src/okx.js +1 -0
  64. package/dist/cjs/src/poloniex.js +21 -7
  65. package/dist/cjs/src/poloniexfutures.js +8 -2
  66. package/dist/cjs/src/pro/krakenfutures.js +14 -10
  67. package/dist/cjs/src/woo.js +1 -0
  68. package/js/ccxt.d.ts +3 -3
  69. package/js/ccxt.js +1 -1
  70. package/js/src/abstract/binance.d.ts +4 -0
  71. package/js/src/abstract/binancecoinm.d.ts +4 -0
  72. package/js/src/abstract/binanceus.d.ts +4 -0
  73. package/js/src/abstract/binanceusdm.d.ts +4 -0
  74. package/js/src/abstract/kraken.d.ts +8 -0
  75. package/js/src/abstract/poloniex.d.ts +18 -5
  76. package/js/src/abstract/poloniexfutures.d.ts +6 -1
  77. package/js/src/ace.js +1 -0
  78. package/js/src/alpaca.js +1 -0
  79. package/js/src/ascendex.js +1 -0
  80. package/js/src/base/Exchange.d.ts +6 -2
  81. package/js/src/base/Exchange.js +30 -0
  82. package/js/src/base/types.d.ts +9 -0
  83. package/js/src/bigone.js +1 -0
  84. package/js/src/binance.d.ts +13 -1
  85. package/js/src/binance.js +237 -3
  86. package/js/src/bingx.d.ts +1 -0
  87. package/js/src/bingx.js +5 -2
  88. package/js/src/bitbank.js +1 -0
  89. package/js/src/bitbns.js +1 -0
  90. package/js/src/bitfinex.js +1 -0
  91. package/js/src/bitfinex2.js +1 -0
  92. package/js/src/bitflyer.js +1 -0
  93. package/js/src/bitforex.js +1 -0
  94. package/js/src/bitget.d.ts +28 -0
  95. package/js/src/bitget.js +203 -3
  96. package/js/src/bithumb.js +1 -0
  97. package/js/src/bitmart.d.ts +12 -0
  98. package/js/src/bitmart.js +105 -0
  99. package/js/src/bitmex.d.ts +13 -1
  100. package/js/src/bitmex.js +70 -0
  101. package/js/src/bitopro.js +1 -0
  102. package/js/src/bitpanda.js +1 -0
  103. package/js/src/bitrue.js +1 -0
  104. package/js/src/bitso.js +1 -0
  105. package/js/src/bitstamp.js +1 -0
  106. package/js/src/bittrex.d.ts +2 -2
  107. package/js/src/bittrex.js +6 -0
  108. package/js/src/bitvavo.js +1 -0
  109. package/js/src/blockchaincom.js +1 -0
  110. package/js/src/btcalpha.js +1 -0
  111. package/js/src/btcmarkets.js +1 -0
  112. package/js/src/btcturk.js +1 -0
  113. package/js/src/bybit.js +3 -3
  114. package/js/src/cex.js +1 -0
  115. package/js/src/coinbase.js +1 -0
  116. package/js/src/coinbasepro.js +1 -0
  117. package/js/src/coinex.js +2 -0
  118. package/js/src/coinfalcon.js +1 -0
  119. package/js/src/coinmate.js +1 -0
  120. package/js/src/coinone.js +2 -1
  121. package/js/src/cryptocom.d.ts +0 -2
  122. package/js/src/cryptocom.js +25 -87
  123. package/js/src/currencycom.js +1 -0
  124. package/js/src/delta.js +1 -0
  125. package/js/src/deribit.d.ts +14 -0
  126. package/js/src/deribit.js +164 -0
  127. package/js/src/digifinex.js +1 -0
  128. package/js/src/exmo.js +1 -0
  129. package/js/src/gate.d.ts +14 -0
  130. package/js/src/gate.js +192 -0
  131. package/js/src/gemini.d.ts +1 -0
  132. package/js/src/gemini.js +1 -0
  133. package/js/src/hitbtc.js +1 -0
  134. package/js/src/hollaex.js +1 -0
  135. package/js/src/huobi.d.ts +12 -0
  136. package/js/src/huobi.js +102 -0
  137. package/js/src/huobijp.js +1 -0
  138. package/js/src/idex.js +1 -0
  139. package/js/src/independentreserve.js +1 -0
  140. package/js/src/indodax.js +1 -0
  141. package/js/src/kraken.js +9 -0
  142. package/js/src/krakenfutures.js +1 -0
  143. package/js/src/kucoin.js +1 -0
  144. package/js/src/kucoinfutures.js +1 -1
  145. package/js/src/latoken.js +1 -0
  146. package/js/src/okx.js +1 -0
  147. package/js/src/poloniex.js +21 -7
  148. package/js/src/poloniexfutures.js +8 -2
  149. package/js/src/pro/krakenfutures.js +14 -10
  150. package/js/src/woo.js +1 -0
  151. package/package.json +1 -1
  152. package/skip-tests.json +94 -12
@@ -51,6 +51,7 @@ interface binance {
51
51
  sapiGetMarginNextHourlyInterestRate(params?: {}): Promise<implicitReturnType>;
52
52
  sapiGetMarginCapitalFlow(params?: {}): Promise<implicitReturnType>;
53
53
  sapiGetMarginDelistSchedule(params?: {}): Promise<implicitReturnType>;
54
+ sapiGetMarginAvailableInventory(params?: {}): Promise<implicitReturnType>;
54
55
  sapiGetLoanVipLoanableData(params?: {}): Promise<implicitReturnType>;
55
56
  sapiGetLoanVipCollateralData(params?: {}): Promise<implicitReturnType>;
56
57
  sapiGetLoanVipRequestData(params?: {}): Promise<implicitReturnType>;
@@ -384,6 +385,7 @@ interface binance {
384
385
  dapiPublicGetTicker24hr(params?: {}): Promise<implicitReturnType>;
385
386
  dapiPublicGetTickerPrice(params?: {}): Promise<implicitReturnType>;
386
387
  dapiPublicGetTickerBookTicker(params?: {}): Promise<implicitReturnType>;
388
+ dapiPublicGetConstituents(params?: {}): Promise<implicitReturnType>;
387
389
  dapiPublicGetOpenInterest(params?: {}): Promise<implicitReturnType>;
388
390
  dapiDataGetOpenInterestHist(params?: {}): Promise<implicitReturnType>;
389
391
  dapiDataGetTopLongShortAccountRatio(params?: {}): Promise<implicitReturnType>;
@@ -446,6 +448,8 @@ interface binance {
446
448
  fapiPublicGetTickerBookTicker(params?: {}): Promise<implicitReturnType>;
447
449
  fapiPublicGetOpenInterest(params?: {}): Promise<implicitReturnType>;
448
450
  fapiPublicGetIndexInfo(params?: {}): Promise<implicitReturnType>;
451
+ fapiPublicGetAssetIndex(params?: {}): Promise<implicitReturnType>;
452
+ fapiPublicGetConstituents(params?: {}): Promise<implicitReturnType>;
449
453
  fapiPublicGetApiTradingStatus(params?: {}): Promise<implicitReturnType>;
450
454
  fapiPublicGetLvtKlines(params?: {}): Promise<implicitReturnType>;
451
455
  fapiDataGetOpenInterestHist(params?: {}): Promise<implicitReturnType>;
@@ -8,6 +8,7 @@ interface Exchange {
8
8
  publicGetDepth(params?: {}): Promise<implicitReturnType>;
9
9
  publicGetOHLC(params?: {}): Promise<implicitReturnType>;
10
10
  publicGetSpread(params?: {}): Promise<implicitReturnType>;
11
+ publicGetSystemStatus(params?: {}): Promise<implicitReturnType>;
11
12
  publicGetTicker(params?: {}): Promise<implicitReturnType>;
12
13
  publicGetTime(params?: {}): Promise<implicitReturnType>;
13
14
  publicGetTrades(params?: {}): Promise<implicitReturnType>;
@@ -16,6 +17,7 @@ interface Exchange {
16
17
  privatePostAddExport(params?: {}): Promise<implicitReturnType>;
17
18
  privatePostBalance(params?: {}): Promise<implicitReturnType>;
18
19
  privatePostCancelAll(params?: {}): Promise<implicitReturnType>;
20
+ privatePostCancelAllOrdersAfter(params?: {}): Promise<implicitReturnType>;
19
21
  privatePostCancelOrder(params?: {}): Promise<implicitReturnType>;
20
22
  privatePostCancelOrderBatch(params?: {}): Promise<implicitReturnType>;
21
23
  privatePostClosedOrders(params?: {}): Promise<implicitReturnType>;
@@ -49,6 +51,12 @@ interface Exchange {
49
51
  privatePostStakingTransactions(params?: {}): Promise<implicitReturnType>;
50
52
  privatePostCreateSubaccount(params?: {}): Promise<implicitReturnType>;
51
53
  privatePostAccountTransfer(params?: {}): Promise<implicitReturnType>;
54
+ privatePostEarnAllocate(params?: {}): Promise<implicitReturnType>;
55
+ privatePostEarnDeallocate(params?: {}): Promise<implicitReturnType>;
56
+ privatePostEarnAllocateStatus(params?: {}): Promise<implicitReturnType>;
57
+ privatePostEarnDeallocateStatus(params?: {}): Promise<implicitReturnType>;
58
+ privatePostEarnStrategies(params?: {}): Promise<implicitReturnType>;
59
+ privatePostEarnAllocations(params?: {}): Promise<implicitReturnType>;
52
60
  }
53
61
  declare abstract class Exchange extends _Exchange {
54
62
  }
@@ -5,35 +5,47 @@ interface Exchange {
5
5
  publicGetMarketsSymbol(params?: {}): Promise<implicitReturnType>;
6
6
  publicGetCurrencies(params?: {}): Promise<implicitReturnType>;
7
7
  publicGetCurrenciesCurrency(params?: {}): Promise<implicitReturnType>;
8
+ publicGetV2Currencies(params?: {}): Promise<implicitReturnType>;
9
+ publicGetV2CurrenciesCurrency(params?: {}): Promise<implicitReturnType>;
8
10
  publicGetTimestamp(params?: {}): Promise<implicitReturnType>;
9
11
  publicGetMarketsPrice(params?: {}): Promise<implicitReturnType>;
10
12
  publicGetMarketsSymbolPrice(params?: {}): Promise<implicitReturnType>;
13
+ publicGetMarketsMarkPrice(params?: {}): Promise<implicitReturnType>;
14
+ publicGetMarketsSymbolMarkPrice(params?: {}): Promise<implicitReturnType>;
15
+ publicGetMarketsSymbolMarkPriceComponents(params?: {}): Promise<implicitReturnType>;
11
16
  publicGetMarketsSymbolOrderBook(params?: {}): Promise<implicitReturnType>;
12
17
  publicGetMarketsSymbolCandles(params?: {}): Promise<implicitReturnType>;
13
18
  publicGetMarketsSymbolTrades(params?: {}): Promise<implicitReturnType>;
14
19
  publicGetMarketsTicker24h(params?: {}): Promise<implicitReturnType>;
15
20
  publicGetMarketsSymbolTicker24h(params?: {}): Promise<implicitReturnType>;
21
+ publicGetMarketsCollateralInfo(params?: {}): Promise<implicitReturnType>;
22
+ publicGetMarketsCurrencyCollateralInfo(params?: {}): Promise<implicitReturnType>;
23
+ publicGetMarketsBorrowRatesInfo(params?: {}): Promise<implicitReturnType>;
16
24
  privateGetAccounts(params?: {}): Promise<implicitReturnType>;
17
- privateGetAccountsActivity(params?: {}): Promise<implicitReturnType>;
18
25
  privateGetAccountsBalances(params?: {}): Promise<implicitReturnType>;
19
26
  privateGetAccountsIdBalances(params?: {}): Promise<implicitReturnType>;
27
+ privateGetAccountsActivity(params?: {}): Promise<implicitReturnType>;
20
28
  privateGetAccountsTransfer(params?: {}): Promise<implicitReturnType>;
21
29
  privateGetAccountsTransferId(params?: {}): Promise<implicitReturnType>;
30
+ privateGetFeeinfo(params?: {}): Promise<implicitReturnType>;
31
+ privateGetAccountsInterestHistory(params?: {}): Promise<implicitReturnType>;
22
32
  privateGetSubaccounts(params?: {}): Promise<implicitReturnType>;
23
33
  privateGetSubaccountsBalances(params?: {}): Promise<implicitReturnType>;
24
34
  privateGetSubaccountsIdBalances(params?: {}): Promise<implicitReturnType>;
25
35
  privateGetSubaccountsTransfer(params?: {}): Promise<implicitReturnType>;
26
36
  privateGetSubaccountsTransferId(params?: {}): Promise<implicitReturnType>;
27
- privateGetFeeinfo(params?: {}): Promise<implicitReturnType>;
28
37
  privateGetWalletsAddresses(params?: {}): Promise<implicitReturnType>;
29
- privateGetWalletsActivity(params?: {}): Promise<implicitReturnType>;
30
38
  privateGetWalletsAddressesCurrency(params?: {}): Promise<implicitReturnType>;
39
+ privateGetWalletsActivity(params?: {}): Promise<implicitReturnType>;
40
+ privateGetMarginAccountMargin(params?: {}): Promise<implicitReturnType>;
41
+ privateGetMarginBorrowStatus(params?: {}): Promise<implicitReturnType>;
42
+ privateGetMarginMaxSize(params?: {}): Promise<implicitReturnType>;
31
43
  privateGetOrders(params?: {}): Promise<implicitReturnType>;
32
44
  privateGetOrdersId(params?: {}): Promise<implicitReturnType>;
33
- privateGetOrdersHistory(params?: {}): Promise<implicitReturnType>;
34
45
  privateGetOrdersKillSwitchStatus(params?: {}): Promise<implicitReturnType>;
35
46
  privateGetSmartorders(params?: {}): Promise<implicitReturnType>;
36
47
  privateGetSmartordersId(params?: {}): Promise<implicitReturnType>;
48
+ privateGetOrdersHistory(params?: {}): Promise<implicitReturnType>;
37
49
  privateGetSmartordersHistory(params?: {}): Promise<implicitReturnType>;
38
50
  privateGetTrades(params?: {}): Promise<implicitReturnType>;
39
51
  privateGetOrdersIdTrades(params?: {}): Promise<implicitReturnType>;
@@ -41,9 +53,10 @@ interface Exchange {
41
53
  privatePostSubaccountsTransfer(params?: {}): Promise<implicitReturnType>;
42
54
  privatePostWalletsAddress(params?: {}): Promise<implicitReturnType>;
43
55
  privatePostWalletsWithdraw(params?: {}): Promise<implicitReturnType>;
56
+ privatePostV2WalletsWithdraw(params?: {}): Promise<implicitReturnType>;
44
57
  privatePostOrders(params?: {}): Promise<implicitReturnType>;
45
- privatePostOrdersKillSwitch(params?: {}): Promise<implicitReturnType>;
46
58
  privatePostOrdersBatch(params?: {}): Promise<implicitReturnType>;
59
+ privatePostOrdersKillSwitch(params?: {}): Promise<implicitReturnType>;
47
60
  privatePostSmartorders(params?: {}): Promise<implicitReturnType>;
48
61
  privateDeleteOrdersId(params?: {}): Promise<implicitReturnType>;
49
62
  privateDeleteOrdersCancelByIds(params?: {}): Promise<implicitReturnType>;
@@ -21,20 +21,25 @@ interface Exchange {
21
21
  publicPostBulletPublic(params?: {}): Promise<implicitReturnType>;
22
22
  privateGetAccountOverview(params?: {}): Promise<implicitReturnType>;
23
23
  privateGetTransactionHistory(params?: {}): Promise<implicitReturnType>;
24
+ privateGetMaxActiveOrders(params?: {}): Promise<implicitReturnType>;
25
+ privateGetMaxRiskLimit(params?: {}): Promise<implicitReturnType>;
26
+ privateGetUserFeeRate(params?: {}): Promise<implicitReturnType>;
27
+ privateGetMarginTypeQuery(params?: {}): Promise<implicitReturnType>;
24
28
  privateGetOrders(params?: {}): Promise<implicitReturnType>;
25
29
  privateGetStopOrders(params?: {}): Promise<implicitReturnType>;
26
30
  privateGetRecentDoneOrders(params?: {}): Promise<implicitReturnType>;
27
31
  privateGetOrdersOrderId(params?: {}): Promise<implicitReturnType>;
32
+ privateGetClientOrderIdClientOid(params?: {}): Promise<implicitReturnType>;
28
33
  privateGetFills(params?: {}): Promise<implicitReturnType>;
29
34
  privateGetOpenOrderStatistics(params?: {}): Promise<implicitReturnType>;
30
35
  privateGetPosition(params?: {}): Promise<implicitReturnType>;
31
36
  privateGetPositions(params?: {}): Promise<implicitReturnType>;
32
37
  privateGetFundingHistory(params?: {}): Promise<implicitReturnType>;
33
- privateGetMarginTypeQuery(params?: {}): Promise<implicitReturnType>;
34
38
  privatePostOrders(params?: {}): Promise<implicitReturnType>;
35
39
  privatePostBatchOrders(params?: {}): Promise<implicitReturnType>;
36
40
  privatePostPositionMarginAutoDepositStatus(params?: {}): Promise<implicitReturnType>;
37
41
  privatePostPositionMarginDepositMargin(params?: {}): Promise<implicitReturnType>;
42
+ privatePostPositionMarginWithdrawMargin(params?: {}): Promise<implicitReturnType>;
38
43
  privatePostBulletPrivate(params?: {}): Promise<implicitReturnType>;
39
44
  privatePostMarginTypeChange(params?: {}): Promise<implicitReturnType>;
40
45
  privateDeleteOrdersOrderId(params?: {}): Promise<implicitReturnType>;
package/js/src/ace.js CHANGED
@@ -245,6 +245,7 @@ export default class ace extends Exchange {
245
245
  'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'basePrecision'))),
246
246
  },
247
247
  'active': undefined,
248
+ 'created': undefined,
248
249
  'info': market,
249
250
  });
250
251
  }
package/js/src/alpaca.js CHANGED
@@ -309,6 +309,7 @@ export default class alpaca extends Exchange {
309
309
  'max': undefined,
310
310
  },
311
311
  },
312
+ 'created': undefined,
312
313
  'info': asset,
313
314
  });
314
315
  }
@@ -668,6 +668,7 @@ export default class ascendex extends Exchange {
668
668
  'max': this.safeNumber(market, 'maxNotional'),
669
669
  },
670
670
  },
671
+ 'created': this.safeInteger(market, 'tradingStartTime'),
671
672
  'info': market,
672
673
  });
673
674
  }
@@ -4,8 +4,8 @@ ExchangeError, AuthenticationError, DDoSProtection, RequestTimeout, ExchangeNotA
4
4
  import WsClient from './ws/WsClient.js';
5
5
  import { Future } from './ws/Future.js';
6
6
  import { OrderBook as WsOrderBook, IndexedOrderBook, CountedOrderBook } from './ws/OrderBook.js';
7
- import { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRateHistory, OpenInterest } from './types.js';
8
- export { Market, Trade, Fee, Position, Ticker } from './types.js';
7
+ import { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRateHistory, OpenInterest, Liquidation } from './types.js';
8
+ export { Market, Trade, Fee, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRateHistory, Liquidation } from './types.js';
9
9
  /**
10
10
  * @class Exchange
11
11
  */
@@ -724,6 +724,8 @@ export default class Exchange {
724
724
  fetchOpenOrdersWs(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
725
725
  fetchClosedOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
726
726
  fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
727
+ fetchMyLiquidations(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Liquidation[]>;
728
+ fetchLiquidations(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Liquidation[]>;
727
729
  fetchMyTradesWs(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
728
730
  watchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
729
731
  fetchOHLCVWs(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
@@ -816,5 +818,7 @@ export default class Exchange {
816
818
  removeRepeatedElementsFromArray(input: any): any;
817
819
  handleUntilOption(key: any, request: any, params: any, multiplier?: number): any[];
818
820
  safeOpenInterest(interest: any, market?: any): OpenInterest;
821
+ parseLiquidation(liquidation: any, market?: any): Liquidation;
822
+ parseLiquidations(liquidations: any, market?: any, since?: Int, limit?: Int): Liquidation[];
819
823
  }
820
824
  export { Exchange, };
@@ -3270,6 +3270,12 @@ export default class Exchange {
3270
3270
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
3271
3271
  throw new NotSupported(this.id + ' fetchMyTrades() is not supported yet');
3272
3272
  }
3273
+ async fetchMyLiquidations(symbol = undefined, since = undefined, limit = undefined, params = {}) {
3274
+ throw new NotSupported(this.id + ' fetchMyLiquidations() is not supported yet');
3275
+ }
3276
+ async fetchLiquidations(symbol, since = undefined, limit = undefined, params = {}) {
3277
+ throw new NotSupported(this.id + ' fetchLiquidations() is not supported yet');
3278
+ }
3273
3279
  async fetchMyTradesWs(symbol = undefined, since = undefined, limit = undefined, params = {}) {
3274
3280
  throw new NotSupported(this.id + ' fetchMyTradesWs() is not supported yet');
3275
3281
  }
@@ -4394,5 +4400,29 @@ export default class Exchange {
4394
4400
  'info': this.safeValue(interest, 'info'),
4395
4401
  });
4396
4402
  }
4403
+ parseLiquidation(liquidation, market = undefined) {
4404
+ throw new NotSupported(this.id + ' parseLiquidation () is not supported yet');
4405
+ }
4406
+ parseLiquidations(liquidations, market = undefined, since = undefined, limit = undefined) {
4407
+ /**
4408
+ * @ignore
4409
+ * @method
4410
+ * @description parses liquidation info from the exchange response
4411
+ * @param {object[]} liquidations each item describes an instance of a liquidation event
4412
+ * @param {object} market ccxt market
4413
+ * @param {int} [since] when defined, the response items are filtered to only include items after this timestamp
4414
+ * @param {int} [limit] limits the number of items in the response
4415
+ * @returns {object[]} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
4416
+ */
4417
+ const result = [];
4418
+ for (let i = 0; i < liquidations.length; i++) {
4419
+ const entry = liquidations[i];
4420
+ const parsed = this.parseLiquidation(entry, market);
4421
+ result.push(parsed);
4422
+ }
4423
+ const sorted = this.sortBy(result, 'timestamp');
4424
+ const symbol = this.safeString(market, 'symbol');
4425
+ return this.filterBySymbolSinceLimit(sorted, symbol, since, limit);
4426
+ }
4397
4427
  }
4398
4428
  export { Exchange, };
@@ -218,6 +218,15 @@ export interface OpenInterest {
218
218
  datetime?: string;
219
219
  info: any;
220
220
  }
221
+ export interface Liquidation {
222
+ info: any;
223
+ symbol: string;
224
+ timestamp?: number;
225
+ datetime?: string;
226
+ price: number;
227
+ baseValue?: number;
228
+ quoteValue?: number;
229
+ }
221
230
  /** [ timestamp, open, high, low, close, volume ] */
222
231
  export declare type OHLCV = [number, number, number, number, number, number];
223
232
  /** [ timestamp, open, high, low, close, volume, count ] */
package/js/src/bigone.js CHANGED
@@ -570,6 +570,7 @@ export default class bigone extends Exchange {
570
570
  'max': this.safeNumber(market, 'max_quote_value'),
571
571
  },
572
572
  },
573
+ 'created': undefined,
573
574
  'info': market,
574
575
  };
575
576
  result.push(entry);
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/binance.js';
2
- import { Market, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest } from './base/types.js';
2
+ import { Market, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation } from './base/types.js';
3
3
  /**
4
4
  * @class binance
5
5
  * @extends Exchange
@@ -497,4 +497,16 @@ export default class binance extends Exchange {
497
497
  fetchOpenInterestHistory(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OpenInterest[]>;
498
498
  fetchOpenInterest(symbol: string, params?: {}): Promise<OpenInterest>;
499
499
  parseOpenInterest(interest: any, market?: any): OpenInterest;
500
+ fetchMyLiquidations(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Liquidation[]>;
501
+ parseLiquidation(liquidation: any, market?: any): {
502
+ info: any;
503
+ symbol: any;
504
+ contracts: number;
505
+ contractSize: number;
506
+ price: number;
507
+ baseValue: number;
508
+ quoteValue: number;
509
+ timestamp: number;
510
+ datetime: string;
511
+ };
500
512
  }
package/js/src/binance.js CHANGED
@@ -77,9 +77,11 @@ export default class binance extends Exchange {
77
77
  'fetchLedger': true,
78
78
  'fetchLeverage': false,
79
79
  'fetchLeverageTiers': true,
80
+ 'fetchLiquidations': false,
80
81
  'fetchMarketLeverageTiers': 'emulated',
81
82
  'fetchMarkets': true,
82
83
  'fetchMarkOHLCV': true,
84
+ 'fetchMyLiquidations': true,
83
85
  'fetchMySettlementHistory': true,
84
86
  'fetchMyTrades': true,
85
87
  'fetchOHLCV': true,
@@ -248,7 +250,8 @@ export default class binance extends Exchange {
248
250
  'margin/exchange-small-liability-history': 0.6667,
249
251
  'margin/next-hourly-interest-rate': 0.6667,
250
252
  'margin/capital-flow': 10,
251
- 'margin/delist-schedule': 0.6667,
253
+ 'margin/delist-schedule': 10,
254
+ 'margin/available-inventory': 0.3334,
252
255
  'loan/vip/loanable/data': 40,
253
256
  'loan/vip/collateral/data': 40,
254
257
  'loan/vip/request/data': 2.6668,
@@ -639,7 +642,8 @@ export default class binance extends Exchange {
639
642
  'premiumIndexKlines': { 'cost': 1, 'byLimit': [[99, 1], [499, 2], [1000, 5], [10000, 10]] },
640
643
  'ticker/24hr': { 'cost': 1, 'noSymbol': 40 },
641
644
  'ticker/price': { 'cost': 1, 'noSymbol': 2 },
642
- 'ticker/bookTicker': { 'cost': 1, 'noSymbol': 2 },
645
+ 'ticker/bookTicker': { 'cost': 2, 'noSymbol': 5 },
646
+ 'constituents': 2,
643
647
  'openInterest': 1,
644
648
  },
645
649
  },
@@ -724,6 +728,8 @@ export default class binance extends Exchange {
724
728
  'ticker/bookTicker': { 'cost': 1, 'noSymbol': 2 },
725
729
  'openInterest': 1,
726
730
  'indexInfo': 1,
731
+ 'assetIndex': { 'cost': 1, 'noSymbol': 10 },
732
+ 'constituents': 2,
727
733
  'apiTradingStatus': { 'cost': 1, 'noSymbol': 10 },
728
734
  'lvtKlines': 1,
729
735
  },
@@ -8261,13 +8267,15 @@ export default class binance extends Exchange {
8261
8267
  let type = undefined;
8262
8268
  let subType = undefined;
8263
8269
  let currency = undefined;
8270
+ if (code !== undefined) {
8271
+ currency = this.currency(code);
8272
+ }
8264
8273
  let method = undefined;
8265
8274
  const request = {};
8266
8275
  [type, params] = this.handleMarketTypeAndParams('fetchLedger', undefined, params);
8267
8276
  [subType, params] = this.handleSubTypeAndParams('fetchLedger', undefined, params);
8268
8277
  if (type === 'option') {
8269
8278
  this.checkRequiredArgument('fetchLedger', code, 'code');
8270
- currency = this.currency(code);
8271
8279
  request['currency'] = currency['id'];
8272
8280
  method = 'eapiPrivateGetBill';
8273
8281
  }
@@ -9222,4 +9230,230 @@ export default class binance extends Exchange {
9222
9230
  'info': interest,
9223
9231
  }, market);
9224
9232
  }
9233
+ async fetchMyLiquidations(symbol = undefined, since = undefined, limit = undefined, params = {}) {
9234
+ /**
9235
+ * @method
9236
+ * @name binance#fetchMyLiquidations
9237
+ * @description retrieves the users liquidated positions
9238
+ * @see https://binance-docs.github.io/apidocs/spot/en/#get-force-liquidation-record-user_data
9239
+ * @see https://binance-docs.github.io/apidocs/futures/en/#user-39-s-force-orders-user_data
9240
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#user-39-s-force-orders-user_data
9241
+ * @param {string} [symbol] unified CCXT market symbol
9242
+ * @param {int} [since] the earliest time in ms to fetch liquidations for
9243
+ * @param {int} [limit] the maximum number of liquidation structures to retrieve
9244
+ * @param {object} [params] exchange specific parameters for the binance api endpoint
9245
+ * @param {int} [params.until] timestamp in ms of the latest liquidation
9246
+ * @param {boolean} [params.paginate] *spot only* default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
9247
+ * @returns {object} an array of [liquidation structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#liquidation-structure}
9248
+ */
9249
+ await this.loadMarkets();
9250
+ let paginate = false;
9251
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchMyLiquidations', 'paginate');
9252
+ if (paginate) {
9253
+ return await this.fetchPaginatedCallIncremental('fetchMyLiquidations', symbol, since, limit, params, 'current', 100);
9254
+ }
9255
+ let market = undefined;
9256
+ if (symbol !== undefined) {
9257
+ market = this.market(symbol);
9258
+ }
9259
+ let type = undefined;
9260
+ [type, params] = this.handleMarketTypeAndParams('fetchMyLiquidations', market, params);
9261
+ let subType = undefined;
9262
+ [subType, params] = this.handleSubTypeAndParams('fetchMyLiquidations', market, params, 'linear');
9263
+ let request = {};
9264
+ if (type !== 'spot') {
9265
+ request['autoCloseType'] = 'LIQUIDATION';
9266
+ }
9267
+ if (market !== undefined) {
9268
+ const symbolKey = market['spot'] ? 'isolatedSymbol' : 'symbol';
9269
+ request[symbolKey] = market['id'];
9270
+ }
9271
+ if (since !== undefined) {
9272
+ request['startTime'] = since;
9273
+ }
9274
+ if (limit !== undefined) {
9275
+ if (type === 'spot') {
9276
+ request['size'] = limit;
9277
+ }
9278
+ else {
9279
+ request['limit'] = limit;
9280
+ }
9281
+ }
9282
+ [request, params] = this.handleUntilOption('endTime', request, params);
9283
+ let response = undefined;
9284
+ if (type === 'spot') {
9285
+ response = await this.sapiGetMarginForceLiquidationRec(this.extend(request, params));
9286
+ }
9287
+ else if (subType === 'linear') {
9288
+ response = await this.fapiPrivateGetForceOrders(this.extend(request, params));
9289
+ }
9290
+ else if (subType === 'inverse') {
9291
+ response = await this.dapiPrivateGetForceOrders(this.extend(request, params));
9292
+ }
9293
+ else {
9294
+ throw new NotSupported(this.id + ' fetchMyLiquidations() does not support ' + market['type'] + ' markets');
9295
+ }
9296
+ //
9297
+ // margin
9298
+ //
9299
+ // {
9300
+ // "rows": [
9301
+ // {
9302
+ // "avgPrice": "0.00388359",
9303
+ // "executedQty": "31.39000000",
9304
+ // "orderId": 180015097,
9305
+ // "price": "0.00388110",
9306
+ // "qty": "31.39000000",
9307
+ // "side": "SELL",
9308
+ // "symbol": "BNBBTC",
9309
+ // "timeInForce": "GTC",
9310
+ // "isIsolated": true,
9311
+ // "updatedTime": 1558941374745
9312
+ // }
9313
+ // ],
9314
+ // "total": 1
9315
+ // }
9316
+ //
9317
+ // linear
9318
+ //
9319
+ // [
9320
+ // {
9321
+ // "orderId": 6071832819,
9322
+ // "symbol": "BTCUSDT",
9323
+ // "status": "FILLED",
9324
+ // "clientOrderId": "autoclose-1596107620040000020",
9325
+ // "price": "10871.09",
9326
+ // "avgPrice": "10913.21000",
9327
+ // "origQty": "0.001",
9328
+ // "executedQty": "0.001",
9329
+ // "cumQuote": "10.91321",
9330
+ // "timeInForce": "IOC",
9331
+ // "type": "LIMIT",
9332
+ // "reduceOnly": false,
9333
+ // "closePosition": false,
9334
+ // "side": "SELL",
9335
+ // "positionSide": "BOTH",
9336
+ // "stopPrice": "0",
9337
+ // "workingType": "CONTRACT_PRICE",
9338
+ // "origType": "LIMIT",
9339
+ // "time": 1596107620044,
9340
+ // "updateTime": 1596107620087
9341
+ // },
9342
+ // ]
9343
+ //
9344
+ // inverse
9345
+ //
9346
+ // [
9347
+ // {
9348
+ // "orderId": 165123080,
9349
+ // "symbol": "BTCUSD_200925",
9350
+ // "pair": "BTCUSD",
9351
+ // "status": "FILLED",
9352
+ // "clientOrderId": "autoclose-1596542005017000006",
9353
+ // "price": "11326.9",
9354
+ // "avgPrice": "11326.9",
9355
+ // "origQty": "1",
9356
+ // "executedQty": "1",
9357
+ // "cumBase": "0.00882854",
9358
+ // "timeInForce": "IOC",
9359
+ // "type": "LIMIT",
9360
+ // "reduceOnly": false,
9361
+ // "closePosition": false,
9362
+ // "side": "SELL",
9363
+ // "positionSide": "BOTH",
9364
+ // "stopPrice": "0",
9365
+ // "workingType": "CONTRACT_PRICE",
9366
+ // "priceProtect": false,
9367
+ // "origType": "LIMIT",
9368
+ // "time": 1596542005019,
9369
+ // "updateTime": 1596542005050
9370
+ // },
9371
+ // ]
9372
+ //
9373
+ const liquidations = this.safeValue(response, 'rows', response);
9374
+ return this.parseLiquidations(liquidations, market, since, limit);
9375
+ }
9376
+ parseLiquidation(liquidation, market = undefined) {
9377
+ //
9378
+ // margin
9379
+ //
9380
+ // {
9381
+ // "avgPrice": "0.00388359",
9382
+ // "executedQty": "31.39000000",
9383
+ // "orderId": 180015097,
9384
+ // "price": "0.00388110",
9385
+ // "qty": "31.39000000",
9386
+ // "side": "SELL",
9387
+ // "symbol": "BNBBTC",
9388
+ // "timeInForce": "GTC",
9389
+ // "isIsolated": true,
9390
+ // "updatedTime": 1558941374745
9391
+ // }
9392
+ //
9393
+ // linear
9394
+ //
9395
+ // {
9396
+ // "orderId": 6071832819,
9397
+ // "symbol": "BTCUSDT",
9398
+ // "status": "FILLED",
9399
+ // "clientOrderId": "autoclose-1596107620040000020",
9400
+ // "price": "10871.09",
9401
+ // "avgPrice": "10913.21000",
9402
+ // "origQty": "0.001",
9403
+ // "executedQty": "0.001",
9404
+ // "cumQuote": "10.91321",
9405
+ // "timeInForce": "IOC",
9406
+ // "type": "LIMIT",
9407
+ // "reduceOnly": false,
9408
+ // "closePosition": false,
9409
+ // "side": "SELL",
9410
+ // "positionSide": "BOTH",
9411
+ // "stopPrice": "0",
9412
+ // "workingType": "CONTRACT_PRICE",
9413
+ // "origType": "LIMIT",
9414
+ // "time": 1596107620044,
9415
+ // "updateTime": 1596107620087
9416
+ // }
9417
+ //
9418
+ // inverse
9419
+ //
9420
+ // {
9421
+ // "orderId": 165123080,
9422
+ // "symbol": "BTCUSD_200925",
9423
+ // "pair": "BTCUSD",
9424
+ // "status": "FILLED",
9425
+ // "clientOrderId": "autoclose-1596542005017000006",
9426
+ // "price": "11326.9",
9427
+ // "avgPrice": "11326.9",
9428
+ // "origQty": "1",
9429
+ // "executedQty": "1",
9430
+ // "cumBase": "0.00882854",
9431
+ // "timeInForce": "IOC",
9432
+ // "type": "LIMIT",
9433
+ // "reduceOnly": false,
9434
+ // "closePosition": false,
9435
+ // "side": "SELL",
9436
+ // "positionSide": "BOTH",
9437
+ // "stopPrice": "0",
9438
+ // "workingType": "CONTRACT_PRICE",
9439
+ // "priceProtect": false,
9440
+ // "origType": "LIMIT",
9441
+ // "time": 1596542005019,
9442
+ // "updateTime": 1596542005050
9443
+ // }
9444
+ //
9445
+ const marketId = this.safeString(liquidation, 'symbol');
9446
+ const timestamp = this.safeInteger2(liquidation, 'updatedTime', 'updateTime');
9447
+ return {
9448
+ 'info': liquidation,
9449
+ 'symbol': this.safeSymbol(marketId, market),
9450
+ 'contracts': this.safeNumber(liquidation, 'executedQty'),
9451
+ 'contractSize': this.safeNumber(market, 'contractSize'),
9452
+ 'price': this.safeNumber(liquidation, 'avgPrice'),
9453
+ 'baseValue': this.safeNumber(liquidation, 'cumBase'),
9454
+ 'quoteValue': this.safeNumber(liquidation, 'cumQuote'),
9455
+ 'timestamp': timestamp,
9456
+ 'datetime': this.iso8601(timestamp),
9457
+ };
9458
+ }
9225
9459
  }
package/js/src/bingx.d.ts CHANGED
@@ -56,6 +56,7 @@ export default class bingx extends Exchange {
56
56
  max: number;
57
57
  };
58
58
  };
59
+ created: any;
59
60
  info: any;
60
61
  };
61
62
  fetchMarkets(params?: {}): Promise<any>;
package/js/src/bingx.js CHANGED
@@ -613,6 +613,7 @@ export default class bingx extends Exchange {
613
613
  'max': this.safeNumber(market, 'maxNotional'),
614
614
  },
615
615
  },
616
+ 'created': undefined,
616
617
  'info': market,
617
618
  };
618
619
  return entry;
@@ -2699,8 +2700,10 @@ export default class bingx extends Exchange {
2699
2700
  const network = this.safeString(transaction, 'network');
2700
2701
  const currencyId = this.safeString(transaction, 'coin');
2701
2702
  let code = this.safeCurrencyCode(currencyId, currency);
2702
- if (code !== undefined && code.indexOf(network) >= 0) {
2703
- code = code.replace(network, '');
2703
+ if ((code !== undefined) && (code !== network) && code.indexOf(network) >= 0) {
2704
+ if (network !== undefined) {
2705
+ code = code.replace(network, '');
2706
+ }
2704
2707
  }
2705
2708
  const rawType = this.safeString(transaction, 'transferType');
2706
2709
  const type = (rawType === '0') ? 'deposit' : 'withdrawal';
package/js/src/bitbank.js CHANGED
@@ -249,6 +249,7 @@ export default class bitbank extends Exchange {
249
249
  'max': undefined,
250
250
  },
251
251
  },
252
+ 'created': undefined,
252
253
  'info': entry,
253
254
  });
254
255
  }
package/js/src/bitbns.js CHANGED
@@ -278,6 +278,7 @@ export default class bitbns extends Exchange {
278
278
  'max': this.safeNumber(costLimits, 'max'),
279
279
  },
280
280
  },
281
+ 'created': undefined,
281
282
  'info': market,
282
283
  });
283
284
  }
@@ -657,6 +657,7 @@ export default class bitfinex extends Exchange {
657
657
  'max': undefined,
658
658
  },
659
659
  },
660
+ 'created': undefined,
660
661
  'info': market,
661
662
  });
662
663
  }