ccxt 4.4.39 → 4.4.41

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 (190) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/ascendex.js +9 -9
  5. package/dist/cjs/src/base/Exchange.js +32 -21
  6. package/dist/cjs/src/binance.js +37 -43
  7. package/dist/cjs/src/bingx.js +4 -3
  8. package/dist/cjs/src/bit2c.js +0 -1
  9. package/dist/cjs/src/bitbank.js +0 -1
  10. package/dist/cjs/src/bitbns.js +0 -1
  11. package/dist/cjs/src/bitfinex.js +18 -19
  12. package/dist/cjs/src/bitfinex1.js +0 -1
  13. package/dist/cjs/src/bitflyer.js +0 -1
  14. package/dist/cjs/src/bitget.js +2 -2
  15. package/dist/cjs/src/bithumb.js +0 -1
  16. package/dist/cjs/src/bitmart.js +257 -5
  17. package/dist/cjs/src/bitmex.js +5 -6
  18. package/dist/cjs/src/bitopro.js +4 -5
  19. package/dist/cjs/src/bitrue.js +5 -7
  20. package/dist/cjs/src/bitso.js +1 -2
  21. package/dist/cjs/src/bitstamp.js +1 -2
  22. package/dist/cjs/src/bitteam.js +1 -3
  23. package/dist/cjs/src/bitvavo.js +2 -4
  24. package/dist/cjs/src/blockchaincom.js +5 -5
  25. package/dist/cjs/src/blofin.js +10 -10
  26. package/dist/cjs/src/btcalpha.js +0 -1
  27. package/dist/cjs/src/btcbox.js +0 -1
  28. package/dist/cjs/src/btcmarkets.js +1 -3
  29. package/dist/cjs/src/bybit.js +10 -11
  30. package/dist/cjs/src/cex.js +1 -1
  31. package/dist/cjs/src/coinbase.js +77 -1
  32. package/dist/cjs/src/coinbaseexchange.js +1 -1
  33. package/dist/cjs/src/coinbaseinternational.js +62 -0
  34. package/dist/cjs/src/coincatch.js +1 -1
  35. package/dist/cjs/src/coinex.js +9 -9
  36. package/dist/cjs/src/coinlist.js +1 -1
  37. package/dist/cjs/src/coinmetro.js +1 -1
  38. package/dist/cjs/src/cryptocom.js +91 -2
  39. package/dist/cjs/src/currencycom.js +1 -1
  40. package/dist/cjs/src/defx.js +1 -2
  41. package/dist/cjs/src/delta.js +1 -1
  42. package/dist/cjs/src/digifinex.js +1 -1
  43. package/dist/cjs/src/exmo.js +64 -6
  44. package/dist/cjs/src/gate.js +2 -2
  45. package/dist/cjs/src/hashkey.js +3 -5
  46. package/dist/cjs/src/htx.js +2 -2
  47. package/dist/cjs/src/hyperliquid.js +66 -2
  48. package/dist/cjs/src/kraken.js +130 -27
  49. package/dist/cjs/src/kucoin.js +30 -25
  50. package/dist/cjs/src/luno.js +1 -1
  51. package/dist/cjs/src/mexc.js +138 -2
  52. package/dist/cjs/src/ndax.js +1 -1
  53. package/dist/cjs/src/okcoin.js +18 -18
  54. package/dist/cjs/src/okx.js +27 -22
  55. package/dist/cjs/src/phemex.js +12 -8
  56. package/dist/cjs/src/poloniex.js +1 -1
  57. package/dist/cjs/src/poloniexfutures.js +6 -6
  58. package/dist/cjs/src/pro/bitget.js +1 -1
  59. package/dist/cjs/src/pro/bybit.js +13 -1
  60. package/dist/cjs/src/pro/coinex.js +2 -2
  61. package/dist/cjs/src/pro/gate.js +6 -6
  62. package/dist/cjs/src/pro/kucoin.js +3 -3
  63. package/dist/cjs/src/pro/okx.js +11 -11
  64. package/dist/cjs/src/pro/upbit.js +3 -3
  65. package/dist/cjs/src/vertex.js +11 -11
  66. package/dist/cjs/src/woo.js +33 -33
  67. package/dist/cjs/src/woofipro.js +24 -24
  68. package/dist/cjs/src/xt.js +31 -28
  69. package/dist/cjs/src/zonda.js +1 -1
  70. package/js/ccxt.d.ts +3 -3
  71. package/js/ccxt.js +1 -1
  72. package/js/src/abstract/bitmart.d.ts +2 -0
  73. package/js/src/abstract/okx.d.ts +5 -0
  74. package/js/src/ascendex.d.ts +2 -2
  75. package/js/src/ascendex.js +9 -9
  76. package/js/src/base/Exchange.d.ts +6 -3
  77. package/js/src/base/Exchange.js +32 -21
  78. package/js/src/base/types.d.ts +2 -0
  79. package/js/src/binance.d.ts +9 -9
  80. package/js/src/binance.js +37 -43
  81. package/js/src/bingx.d.ts +1 -1
  82. package/js/src/bingx.js +4 -3
  83. package/js/src/bit2c.js +0 -1
  84. package/js/src/bitbank.js +0 -1
  85. package/js/src/bitbns.js +0 -1
  86. package/js/src/bitfinex.d.ts +3 -3
  87. package/js/src/bitfinex.js +18 -19
  88. package/js/src/bitfinex1.js +0 -1
  89. package/js/src/bitflyer.js +0 -1
  90. package/js/src/bitget.d.ts +1 -1
  91. package/js/src/bitget.js +2 -2
  92. package/js/src/bithumb.js +0 -1
  93. package/js/src/bitmart.d.ts +53 -2
  94. package/js/src/bitmart.js +257 -5
  95. package/js/src/bitmex.d.ts +1 -1
  96. package/js/src/bitmex.js +5 -6
  97. package/js/src/bitopro.js +4 -5
  98. package/js/src/bitrue.js +5 -7
  99. package/js/src/bitso.d.ts +1 -1
  100. package/js/src/bitso.js +1 -2
  101. package/js/src/bitstamp.d.ts +1 -1
  102. package/js/src/bitstamp.js +1 -2
  103. package/js/src/bitteam.js +1 -3
  104. package/js/src/bitvavo.d.ts +1 -1
  105. package/js/src/bitvavo.js +2 -4
  106. package/js/src/blockchaincom.js +5 -5
  107. package/js/src/blofin.d.ts +3 -3
  108. package/js/src/blofin.js +10 -10
  109. package/js/src/btcalpha.js +0 -1
  110. package/js/src/btcbox.js +0 -1
  111. package/js/src/btcmarkets.js +1 -3
  112. package/js/src/bybit.d.ts +1 -1
  113. package/js/src/bybit.js +10 -11
  114. package/js/src/cex.d.ts +1 -1
  115. package/js/src/cex.js +1 -1
  116. package/js/src/coinbase.d.ts +1 -1
  117. package/js/src/coinbase.js +77 -1
  118. package/js/src/coinbaseexchange.d.ts +1 -1
  119. package/js/src/coinbaseexchange.js +1 -1
  120. package/js/src/coinbaseinternational.js +62 -0
  121. package/js/src/coincatch.d.ts +1 -1
  122. package/js/src/coincatch.js +1 -1
  123. package/js/src/coinex.js +9 -9
  124. package/js/src/coinlist.d.ts +1 -1
  125. package/js/src/coinlist.js +1 -1
  126. package/js/src/coinmetro.d.ts +1 -1
  127. package/js/src/coinmetro.js +1 -1
  128. package/js/src/cryptocom.d.ts +2 -2
  129. package/js/src/cryptocom.js +91 -2
  130. package/js/src/currencycom.d.ts +1 -1
  131. package/js/src/currencycom.js +1 -1
  132. package/js/src/defx.d.ts +1 -2
  133. package/js/src/defx.js +1 -2
  134. package/js/src/delta.d.ts +1 -1
  135. package/js/src/delta.js +1 -1
  136. package/js/src/digifinex.d.ts +1 -1
  137. package/js/src/digifinex.js +1 -1
  138. package/js/src/exmo.d.ts +35 -0
  139. package/js/src/exmo.js +64 -6
  140. package/js/src/gate.d.ts +1 -1
  141. package/js/src/gate.js +2 -2
  142. package/js/src/hashkey.d.ts +1 -1
  143. package/js/src/hashkey.js +3 -5
  144. package/js/src/htx.d.ts +1 -1
  145. package/js/src/htx.js +2 -2
  146. package/js/src/hyperliquid.d.ts +21 -2
  147. package/js/src/hyperliquid.js +66 -2
  148. package/js/src/kraken.d.ts +14 -8
  149. package/js/src/kraken.js +130 -27
  150. package/js/src/kucoin.d.ts +13 -13
  151. package/js/src/kucoin.js +30 -25
  152. package/js/src/luno.d.ts +1 -1
  153. package/js/src/luno.js +1 -1
  154. package/js/src/mexc.d.ts +1 -2
  155. package/js/src/mexc.js +138 -2
  156. package/js/src/ndax.d.ts +1 -1
  157. package/js/src/ndax.js +1 -1
  158. package/js/src/okcoin.d.ts +4 -4
  159. package/js/src/okcoin.js +18 -18
  160. package/js/src/okx.d.ts +3 -3
  161. package/js/src/okx.js +27 -22
  162. package/js/src/phemex.js +12 -8
  163. package/js/src/poloniex.d.ts +1 -1
  164. package/js/src/poloniex.js +1 -1
  165. package/js/src/poloniexfutures.d.ts +1 -1
  166. package/js/src/poloniexfutures.js +6 -6
  167. package/js/src/pro/bitget.d.ts +1 -1
  168. package/js/src/pro/bitget.js +1 -1
  169. package/js/src/pro/bybit.d.ts +1 -1
  170. package/js/src/pro/bybit.js +13 -1
  171. package/js/src/pro/coinex.js +2 -2
  172. package/js/src/pro/gate.d.ts +2 -2
  173. package/js/src/pro/gate.js +6 -6
  174. package/js/src/pro/kucoin.d.ts +1 -1
  175. package/js/src/pro/kucoin.js +3 -3
  176. package/js/src/pro/okx.d.ts +2 -2
  177. package/js/src/pro/okx.js +11 -11
  178. package/js/src/pro/upbit.d.ts +3 -3
  179. package/js/src/pro/upbit.js +3 -3
  180. package/js/src/vertex.d.ts +3 -3
  181. package/js/src/vertex.js +11 -11
  182. package/js/src/woo.d.ts +7 -7
  183. package/js/src/woo.js +33 -33
  184. package/js/src/woofipro.d.ts +1 -1
  185. package/js/src/woofipro.js +24 -24
  186. package/js/src/xt.d.ts +7 -7
  187. package/js/src/xt.js +31 -28
  188. package/js/src/zonda.d.ts +1 -1
  189. package/js/src/zonda.js +1 -1
  190. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bitmart.js';
2
- import type { Int, OrderSide, Balances, OrderType, OHLCV, Order, Str, Trade, Transaction, Ticker, OrderBook, Tickers, Strings, Currency, Market, TransferEntry, Num, TradingFeeInterface, Currencies, IsolatedBorrowRates, IsolatedBorrowRate, Dict, OrderRequest, int, FundingRate, DepositAddress, BorrowInterest } from './base/types.js';
2
+ import type { Int, OrderSide, Balances, OrderType, OHLCV, Order, Str, Trade, Transaction, Ticker, OrderBook, Tickers, Strings, Currency, Market, TransferEntry, Num, TradingFeeInterface, Currencies, IsolatedBorrowRates, IsolatedBorrowRate, Dict, OrderRequest, int, FundingRate, DepositAddress, BorrowInterest, FundingRateHistory, LedgerEntry, FundingHistory } from './base/types.js';
3
3
  /**
4
4
  * @class bitmart
5
5
  * @augments Exchange
@@ -274,7 +274,7 @@ export default class bitmart extends Exchange {
274
274
  * @param {string} symbol unified symbol of the market the order was made in
275
275
  * @param {object} [params] extra parameters specific to the exchange API endpoint
276
276
  * @param {string} [params.clientOrderId] *spot only* the client order id of the order to cancel
277
- * @param {boolean} [params.stop] *swap only* whether the order is a stop order
277
+ * @param {boolean} [params.trigger] *swap only* whether the order is a trigger order
278
278
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
279
279
  */
280
280
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
@@ -572,6 +572,18 @@ export default class bitmart extends Exchange {
572
572
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
573
573
  */
574
574
  fetchFundingRate(symbol: string, params?: {}): Promise<FundingRate>;
575
+ /**
576
+ * @method
577
+ * @name bitmart#fetchFundingRateHistory
578
+ * @description fetches historical funding rate prices
579
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-funding-rate-history
580
+ * @param {string} symbol unified symbol of the market to fetch the funding rate history for
581
+ * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
582
+ * @param {int} [limit] the maximum amount of funding rate structures to fetch
583
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
584
+ * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
585
+ */
586
+ fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
575
587
  parseFundingRate(contract: any, market?: Market): FundingRate;
576
588
  /**
577
589
  * @method
@@ -635,6 +647,45 @@ export default class bitmart extends Exchange {
635
647
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
636
648
  */
637
649
  editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
650
+ /**
651
+ * @method
652
+ * @name bitmart#fetchLedger
653
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
654
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-transaction-history-keyed
655
+ * @param {string} [code] unified currency code
656
+ * @param {int} [since] timestamp in ms of the earliest ledger entry
657
+ * @param {int} [limit] max number of ledger entries to return
658
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
659
+ * @param {int} [params.until] timestamp in ms of the latest ledger entry
660
+ * @returns {object[]} a list of [ledger structures]{@link https://docs.ccxt.com/#/?id=ledger}
661
+ */
662
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
663
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
664
+ parseLedgerEntryType(type: any): string;
665
+ fetchTransactionsRequest(flowType?: Int, symbol?: Str, since?: Int, limit?: Int, params?: {}): any;
666
+ /**
667
+ * @method
668
+ * @name bitmart#fetchFundingHistory
669
+ * @description fetch the history of funding payments paid and received on this account
670
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-transaction-history-keyed
671
+ * @param {string} [symbol] unified market symbol
672
+ * @param {int} [since] the starting timestamp in milliseconds
673
+ * @param {int} [limit] the number of entries to return
674
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
675
+ * @param {int} [params.until] the latest time in ms to fetch funding history for
676
+ * @returns {object[]} a list of [funding history structures]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
677
+ */
678
+ fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
679
+ parseFundingHistory(contract: any, market?: Market): {
680
+ info: any;
681
+ symbol: string;
682
+ code: string;
683
+ timestamp: number;
684
+ datetime: string;
685
+ id: string;
686
+ amount: number;
687
+ };
688
+ parseFundingHistories(contracts: any, market?: any, since?: Int, limit?: Int): FundingHistory[];
638
689
  nonce(): number;
639
690
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
640
691
  url: string;
package/js/src/bitmart.js CHANGED
@@ -65,12 +65,13 @@ export default class bitmart extends Exchange {
65
65
  'fetchDeposits': true,
66
66
  'fetchDepositWithdrawFee': true,
67
67
  'fetchDepositWithdrawFees': false,
68
- 'fetchFundingHistory': undefined,
68
+ 'fetchFundingHistory': true,
69
69
  'fetchFundingRate': true,
70
70
  'fetchFundingRateHistory': false,
71
71
  'fetchFundingRates': false,
72
72
  'fetchIsolatedBorrowRate': true,
73
73
  'fetchIsolatedBorrowRates': true,
74
+ 'fetchLedger': true,
74
75
  'fetchLiquidations': false,
75
76
  'fetchMarginMode': false,
76
77
  'fetchMarkets': true,
@@ -157,6 +158,7 @@ export default class bitmart extends Exchange {
157
158
  'contract/public/depth': 5,
158
159
  'contract/public/open-interest': 30,
159
160
  'contract/public/funding-rate': 30,
161
+ 'contract/public/funding-rate-history': 30,
160
162
  'contract/public/kline': 6,
161
163
  'account/v1/currencies': 30,
162
164
  },
@@ -207,6 +209,7 @@ export default class bitmart extends Exchange {
207
209
  'contract/private/position-risk': 10,
208
210
  'contract/private/affilate/rebate-list': 10,
209
211
  'contract/private/affilate/trade-list': 10,
212
+ 'contract/private/transaction-history': 10,
210
213
  },
211
214
  'post': {
212
215
  // sub-account endpoints
@@ -2559,7 +2562,6 @@ export default class bitmart extends Exchange {
2559
2562
  'postOnly': postOnly,
2560
2563
  'side': this.parseOrderSide(this.safeString(order, 'side')),
2561
2564
  'price': this.omitZero(priceString),
2562
- 'stopPrice': trailingActivationPrice,
2563
2565
  'triggerPrice': trailingActivationPrice,
2564
2566
  'amount': this.omitZero(this.safeString(order, 'size')),
2565
2567
  'cost': this.safeString2(order, 'filled_notional', 'filledNotional'),
@@ -3025,7 +3027,7 @@ export default class bitmart extends Exchange {
3025
3027
  * @param {string} symbol unified symbol of the market the order was made in
3026
3028
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3027
3029
  * @param {string} [params.clientOrderId] *spot only* the client order id of the order to cancel
3028
- * @param {boolean} [params.stop] *swap only* whether the order is a stop order
3030
+ * @param {boolean} [params.trigger] *swap only* whether the order is a trigger order
3029
3031
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3030
3032
  */
3031
3033
  async cancelOrder(id, symbol = undefined, params = {}) {
@@ -3050,9 +3052,9 @@ export default class bitmart extends Exchange {
3050
3052
  response = await this.privatePostSpotV3CancelOrder(this.extend(request, params));
3051
3053
  }
3052
3054
  else {
3053
- const stop = this.safeBool2(params, 'stop', 'trigger');
3055
+ const trigger = this.safeBool2(params, 'stop', 'trigger');
3054
3056
  params = this.omit(params, ['stop', 'trigger']);
3055
- if (!stop) {
3057
+ if (!trigger) {
3056
3058
  response = await this.privatePostContractPrivateCancelOrder(this.extend(request, params));
3057
3059
  }
3058
3060
  else {
@@ -4619,6 +4621,65 @@ export default class bitmart extends Exchange {
4619
4621
  const data = this.safeDict(response, 'data', {});
4620
4622
  return this.parseFundingRate(data, market);
4621
4623
  }
4624
+ /**
4625
+ * @method
4626
+ * @name bitmart#fetchFundingRateHistory
4627
+ * @description fetches historical funding rate prices
4628
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-funding-rate-history
4629
+ * @param {string} symbol unified symbol of the market to fetch the funding rate history for
4630
+ * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
4631
+ * @param {int} [limit] the maximum amount of funding rate structures to fetch
4632
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4633
+ * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
4634
+ */
4635
+ async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4636
+ if (symbol === undefined) {
4637
+ throw new ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
4638
+ }
4639
+ await this.loadMarkets();
4640
+ const market = this.market(symbol);
4641
+ const request = {
4642
+ 'symbol': market['id'],
4643
+ };
4644
+ if (limit !== undefined) {
4645
+ request['limit'] = limit;
4646
+ }
4647
+ const response = await this.publicGetContractPublicFundingRateHistory(this.extend(request, params));
4648
+ //
4649
+ // {
4650
+ // "code": 1000,
4651
+ // "message": "Ok",
4652
+ // "data": {
4653
+ // "list": [
4654
+ // {
4655
+ // "symbol": "BTCUSDT",
4656
+ // "funding_rate": "0.000091412174",
4657
+ // "funding_time": "1734336000000"
4658
+ // },
4659
+ // ]
4660
+ // },
4661
+ // "trace": "fg73d949fgfdf6a40c8fc7f5ae6738.54.345345345345"
4662
+ // }
4663
+ //
4664
+ const data = this.safeDict(response, 'data', {});
4665
+ const result = this.safeList(data, 'list', []);
4666
+ const rates = [];
4667
+ for (let i = 0; i < result.length; i++) {
4668
+ const entry = result[i];
4669
+ const marketId = this.safeString(entry, 'symbol');
4670
+ const symbolInner = this.safeSymbol(marketId, market, '-', 'swap');
4671
+ const timestamp = this.safeInteger(entry, 'funding_time');
4672
+ rates.push({
4673
+ 'info': entry,
4674
+ 'symbol': symbolInner,
4675
+ 'fundingRate': this.safeNumber(entry, 'funding_rate'),
4676
+ 'timestamp': timestamp,
4677
+ 'datetime': this.iso8601(timestamp),
4678
+ });
4679
+ }
4680
+ const sorted = this.sortBy(rates, 'timestamp');
4681
+ return this.filterBySymbolSinceLimit(sorted, market['symbol'], since, limit);
4682
+ }
4622
4683
  parseFundingRate(contract, market = undefined) {
4623
4684
  //
4624
4685
  // {
@@ -5053,6 +5114,197 @@ export default class bitmart extends Exchange {
5053
5114
  const data = this.safeDict(response, 'data', {});
5054
5115
  return this.parseOrder(data, market);
5055
5116
  }
5117
+ /**
5118
+ * @method
5119
+ * @name bitmart#fetchLedger
5120
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
5121
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-transaction-history-keyed
5122
+ * @param {string} [code] unified currency code
5123
+ * @param {int} [since] timestamp in ms of the earliest ledger entry
5124
+ * @param {int} [limit] max number of ledger entries to return
5125
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
5126
+ * @param {int} [params.until] timestamp in ms of the latest ledger entry
5127
+ * @returns {object[]} a list of [ledger structures]{@link https://docs.ccxt.com/#/?id=ledger}
5128
+ */
5129
+ async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
5130
+ await this.loadMarkets();
5131
+ let currency = undefined;
5132
+ if (code !== undefined) {
5133
+ currency = this.currency(code);
5134
+ }
5135
+ let request = {};
5136
+ [request, params] = this.handleUntilOption('end_time', request, params);
5137
+ const transactionsRequest = this.fetchTransactionsRequest(0, undefined, since, limit, params);
5138
+ const response = await this.privateGetContractPrivateTransactionHistory(transactionsRequest);
5139
+ //
5140
+ // {
5141
+ // "code": 1000,
5142
+ // "message": "Ok",
5143
+ // "data": [
5144
+ // {
5145
+ // "time": "1734422402121",
5146
+ // "type": "Funding Fee",
5147
+ // "amount": "-0.00008253",
5148
+ // "asset": "USDT",
5149
+ // "symbol": "LTCUSDT",
5150
+ // "tran_id": "1734422402121",
5151
+ // "flow_type": 3
5152
+ // },
5153
+ // ],
5154
+ // "trace": "4cd11f83c71egfhfgh842790f07241e.23.173442343427772866"
5155
+ // }
5156
+ //
5157
+ const data = this.safeList(response, 'data', []);
5158
+ return this.parseLedger(data, currency, since, limit);
5159
+ }
5160
+ parseLedgerEntry(item, currency = undefined) {
5161
+ //
5162
+ // {
5163
+ // "time": "1734422402121",
5164
+ // "type": "Funding Fee",
5165
+ // "amount": "-0.00008253",
5166
+ // "asset": "USDT",
5167
+ // "symbol": "LTCUSDT",
5168
+ // "tran_id": "1734422402121",
5169
+ // "flow_type": 3
5170
+ // }
5171
+ //
5172
+ let amount = this.safeString(item, 'amount');
5173
+ let direction = undefined;
5174
+ if (Precise.stringLe(amount, '0')) {
5175
+ direction = 'out';
5176
+ amount = Precise.stringMul('-1', amount);
5177
+ }
5178
+ else {
5179
+ direction = 'in';
5180
+ }
5181
+ const currencyId = this.safeString(item, 'asset');
5182
+ const timestamp = this.safeInteger(item, 'time');
5183
+ const type = this.safeString(item, 'type');
5184
+ return this.safeLedgerEntry({
5185
+ 'info': item,
5186
+ 'id': this.safeString(item, 'tran_id'),
5187
+ 'direction': direction,
5188
+ 'account': undefined,
5189
+ 'referenceAccount': undefined,
5190
+ 'referenceId': this.safeString(item, 'tradeId'),
5191
+ 'type': this.parseLedgerEntryType(type),
5192
+ 'currency': this.safeCurrencyCode(currencyId, currency),
5193
+ 'amount': this.parseNumber(amount),
5194
+ 'timestamp': timestamp,
5195
+ 'datetime': this.iso8601(timestamp),
5196
+ 'before': undefined,
5197
+ 'after': undefined,
5198
+ 'status': undefined,
5199
+ 'fee': undefined,
5200
+ }, currency);
5201
+ }
5202
+ parseLedgerEntryType(type) {
5203
+ const ledgerType = {
5204
+ 'Commission Fee': 'fee',
5205
+ 'Funding Fee': 'fee',
5206
+ 'Realized PNL': 'trade',
5207
+ 'Transfer': 'transfer',
5208
+ 'Liquidation Clearance': 'settlement',
5209
+ };
5210
+ return this.safeString(ledgerType, type, type);
5211
+ }
5212
+ fetchTransactionsRequest(flowType = undefined, symbol = undefined, since = undefined, limit = undefined, params = {}) {
5213
+ let request = {};
5214
+ if (flowType !== undefined) {
5215
+ request['flow_type'] = flowType;
5216
+ }
5217
+ let market = undefined;
5218
+ if (symbol !== undefined) {
5219
+ market = this.market(symbol);
5220
+ request['symbol'] = market['id'];
5221
+ }
5222
+ if (since !== undefined) {
5223
+ request['start_time'] = since;
5224
+ }
5225
+ if (limit !== undefined) {
5226
+ request['page_size'] = limit;
5227
+ }
5228
+ [request, params] = this.handleUntilOption('end_time', request, params);
5229
+ return this.extend(request, params);
5230
+ }
5231
+ /**
5232
+ * @method
5233
+ * @name bitmart#fetchFundingHistory
5234
+ * @description fetch the history of funding payments paid and received on this account
5235
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-transaction-history-keyed
5236
+ * @param {string} [symbol] unified market symbol
5237
+ * @param {int} [since] the starting timestamp in milliseconds
5238
+ * @param {int} [limit] the number of entries to return
5239
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
5240
+ * @param {int} [params.until] the latest time in ms to fetch funding history for
5241
+ * @returns {object[]} a list of [funding history structures]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
5242
+ */
5243
+ async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
5244
+ await this.loadMarkets();
5245
+ let market = undefined;
5246
+ if (symbol !== undefined) {
5247
+ market = this.market(symbol);
5248
+ }
5249
+ let request = {};
5250
+ [request, params] = this.handleUntilOption('end_time', request, params);
5251
+ const transactionsRequest = this.fetchTransactionsRequest(3, symbol, since, limit, params);
5252
+ const response = await this.privateGetContractPrivateTransactionHistory(transactionsRequest);
5253
+ //
5254
+ // {
5255
+ // "code": 1000,
5256
+ // "message": "Ok",
5257
+ // "data": [
5258
+ // {
5259
+ // "time": "1734422402121",
5260
+ // "type": "Funding Fee",
5261
+ // "amount": "-0.00008253",
5262
+ // "asset": "USDT",
5263
+ // "symbol": "LTCUSDT",
5264
+ // "tran_id": "1734422402121",
5265
+ // "flow_type": 3
5266
+ // },
5267
+ // ],
5268
+ // "trace": "4cd11f83c71egfhfgh842790f07241e.23.173442343427772866"
5269
+ // }
5270
+ //
5271
+ const data = this.safeList(response, 'data', []);
5272
+ return this.parseFundingHistories(data, market, since, limit);
5273
+ }
5274
+ parseFundingHistory(contract, market = undefined) {
5275
+ //
5276
+ // {
5277
+ // "time": "1734422402121",
5278
+ // "type": "Funding Fee",
5279
+ // "amount": "-0.00008253",
5280
+ // "asset": "USDT",
5281
+ // "symbol": "LTCUSDT",
5282
+ // "tran_id": "1734422402121",
5283
+ // "flow_type": 3
5284
+ // }
5285
+ //
5286
+ const marketId = this.safeString(contract, 'symbol');
5287
+ const currencyId = this.safeString(contract, 'asset');
5288
+ const timestamp = this.safeInteger(contract, 'time');
5289
+ return {
5290
+ 'info': contract,
5291
+ 'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
5292
+ 'code': this.safeCurrencyCode(currencyId),
5293
+ 'timestamp': timestamp,
5294
+ 'datetime': this.iso8601(timestamp),
5295
+ 'id': this.safeString(contract, 'tran_id'),
5296
+ 'amount': this.safeNumber(contract, 'amount'),
5297
+ };
5298
+ }
5299
+ parseFundingHistories(contracts, market = undefined, since = undefined, limit = undefined) {
5300
+ const result = [];
5301
+ for (let i = 0; i < contracts.length; i++) {
5302
+ const contract = contracts[i];
5303
+ result.push(this.parseFundingHistory(contract, market));
5304
+ }
5305
+ const sorted = this.sortBy(result, 'timestamp');
5306
+ return this.filterBySinceLimit(sorted, since, limit);
5307
+ }
5056
5308
  nonce() {
5057
5309
  return this.milliseconds();
5058
5310
  }
@@ -124,7 +124,7 @@ export default class bitmex extends Exchange {
124
124
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
125
125
  * @param {int} [limit] max number of ledger entries to return, default is undefined
126
126
  * @param {object} [params] extra parameters specific to the exchange API endpoint
127
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
127
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
128
128
  */
129
129
  fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
130
130
  /**
package/js/src/bitmex.js CHANGED
@@ -1310,7 +1310,7 @@ export default class bitmex extends Exchange {
1310
1310
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
1311
1311
  * @param {int} [limit] max number of ledger entries to return, default is undefined
1312
1312
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1313
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
1313
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
1314
1314
  */
1315
1315
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
1316
1316
  await this.loadMarkets();
@@ -1868,7 +1868,7 @@ export default class bitmex extends Exchange {
1868
1868
  postOnly = (execInst === 'ParticipateDoNotInitiate');
1869
1869
  }
1870
1870
  const timestamp = this.parse8601(this.safeString(order, 'timestamp'));
1871
- const stopPrice = this.safeNumber(order, 'stopPx');
1871
+ const triggerPrice = this.safeNumber(order, 'stopPx');
1872
1872
  const remaining = this.safeString(order, 'leavesQty');
1873
1873
  return this.safeOrder({
1874
1874
  'info': order,
@@ -1883,8 +1883,7 @@ export default class bitmex extends Exchange {
1883
1883
  'postOnly': postOnly,
1884
1884
  'side': this.safeStringLower(order, 'side'),
1885
1885
  'price': this.safeString(order, 'price'),
1886
- 'stopPrice': stopPrice,
1887
- 'triggerPrice': stopPrice,
1886
+ 'triggerPrice': triggerPrice,
1888
1887
  'amount': amount,
1889
1888
  'cost': cost,
1890
1889
  'average': average,
@@ -2038,7 +2037,7 @@ export default class bitmex extends Exchange {
2038
2037
  else {
2039
2038
  if (triggerPrice === undefined) {
2040
2039
  // if exchange specific trigger types were provided
2041
- throw new ArgumentsRequired(this.id + ' createOrder() requires a triggerPrice (stopPx|stopPrice) parameter for the ' + orderType + ' order type');
2040
+ throw new ArgumentsRequired(this.id + ' createOrder() requires a triggerPrice parameter for the ' + orderType + ' order type');
2042
2041
  }
2043
2042
  request['stopPx'] = this.parseToNumeric(this.priceToPrecision(symbol, triggerPrice));
2044
2043
  }
@@ -2632,7 +2631,7 @@ export default class bitmex extends Exchange {
2632
2631
  'timestamp': this.parse8601(datetime),
2633
2632
  'datetime': datetime,
2634
2633
  'fundingRate': this.safeNumber(contract, 'fundingRate'),
2635
- 'fundingTimestamp': this.parseToNumeric(this.iso8601(fundingDatetime)),
2634
+ 'fundingTimestamp': this.parse8601(fundingDatetime),
2636
2635
  'fundingDatetime': fundingDatetime,
2637
2636
  'nextFundingRate': this.safeNumber(contract, 'indicativeFundingRate'),
2638
2637
  'nextFundingTimestamp': undefined,
package/js/src/bitopro.js CHANGED
@@ -984,7 +984,6 @@ export default class bitopro extends Exchange {
984
984
  'postOnly': postOnly,
985
985
  'side': side,
986
986
  'price': price,
987
- 'stopPrice': undefined,
988
987
  'triggerPrice': undefined,
989
988
  'amount': amount,
990
989
  'cost': undefined,
@@ -1027,13 +1026,13 @@ export default class bitopro extends Exchange {
1027
1026
  }
1028
1027
  if (orderType === 'STOP_LIMIT') {
1029
1028
  request['price'] = this.priceToPrecision(symbol, price);
1030
- const stopPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
1029
+ const triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
1031
1030
  params = this.omit(params, ['triggerPrice', 'stopPrice']);
1032
- if (stopPrice === undefined) {
1033
- throw new InvalidOrder(this.id + ' createOrder() requires a stopPrice parameter for ' + orderType + ' orders');
1031
+ if (triggerPrice === undefined) {
1032
+ throw new InvalidOrder(this.id + ' createOrder() requires a triggerPrice parameter for ' + orderType + ' orders');
1034
1033
  }
1035
1034
  else {
1036
- request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
1035
+ request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
1037
1036
  }
1038
1037
  const condition = this.safeString(params, 'condition');
1039
1038
  if (condition === undefined) {
package/js/src/bitrue.js CHANGED
@@ -1837,8 +1837,7 @@ export default class bitrue extends Exchange {
1837
1837
  if (type === 'limit_maker') {
1838
1838
  type = 'limit';
1839
1839
  }
1840
- const stopPriceString = this.safeString(order, 'stopPrice');
1841
- const stopPrice = this.parseNumber(this.omitZero(stopPriceString));
1840
+ const triggerPrice = this.parseNumber(this.omitZero(this.safeString(order, 'stopPrice')));
1842
1841
  return this.safeOrder({
1843
1842
  'info': order,
1844
1843
  'id': id,
@@ -1852,8 +1851,7 @@ export default class bitrue extends Exchange {
1852
1851
  'postOnly': postOnly,
1853
1852
  'side': side,
1854
1853
  'price': price,
1855
- 'stopPrice': stopPrice,
1856
- 'triggerPrice': stopPrice,
1854
+ 'triggerPrice': triggerPrice,
1857
1855
  'amount': amount,
1858
1856
  'cost': cost,
1859
1857
  'average': average,
@@ -1991,10 +1989,10 @@ export default class bitrue extends Exchange {
1991
1989
  params = this.omit(params, ['newClientOrderId', 'clientOrderId']);
1992
1990
  request['newClientOrderId'] = clientOrderId;
1993
1991
  }
1994
- const stopPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
1995
- if (stopPrice !== undefined) {
1992
+ const triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
1993
+ if (triggerPrice !== undefined) {
1996
1994
  params = this.omit(params, ['triggerPrice', 'stopPrice']);
1997
- request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
1995
+ request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
1998
1996
  }
1999
1997
  response = await this.spotV1PrivatePostOrder(this.extend(request, params));
2000
1998
  data = response;
package/js/src/bitso.d.ts CHANGED
@@ -14,7 +14,7 @@ export default class bitso extends Exchange {
14
14
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
15
15
  * @param {int} [limit] max number of ledger entries to return, default is undefined
16
16
  * @param {object} [params] extra parameters specific to the exchange API endpoint
17
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
17
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
18
18
  */
19
19
  fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
20
20
  parseLedgerEntryType(type: any): string;
package/js/src/bitso.js CHANGED
@@ -205,7 +205,7 @@ export default class bitso extends Exchange {
205
205
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
206
206
  * @param {int} [limit] max number of ledger entries to return, default is undefined
207
207
  * @param {object} [params] extra parameters specific to the exchange API endpoint
208
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
208
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
209
209
  */
210
210
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
211
211
  const request = {};
@@ -1140,7 +1140,6 @@ export default class bitso extends Exchange {
1140
1140
  'postOnly': undefined,
1141
1141
  'side': side,
1142
1142
  'price': price,
1143
- 'stopPrice': undefined,
1144
1143
  'triggerPrice': undefined,
1145
1144
  'amount': amount,
1146
1145
  'cost': undefined,
@@ -276,7 +276,7 @@ export default class bitstamp extends Exchange {
276
276
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
277
277
  * @param {int} [limit] max number of ledger entries to return, default is undefined
278
278
  * @param {object} [params] extra parameters specific to the exchange API endpoint
279
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
279
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
280
280
  */
281
281
  fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
282
282
  /**
@@ -1918,7 +1918,6 @@ export default class bitstamp extends Exchange {
1918
1918
  'postOnly': undefined,
1919
1919
  'side': side,
1920
1920
  'price': price,
1921
- 'stopPrice': undefined,
1922
1921
  'triggerPrice': undefined,
1923
1922
  'cost': undefined,
1924
1923
  'amount': amount,
@@ -2042,7 +2041,7 @@ export default class bitstamp extends Exchange {
2042
2041
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2043
2042
  * @param {int} [limit] max number of ledger entries to return, default is undefined
2044
2043
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2045
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
2044
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
2046
2045
  */
2047
2046
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
2048
2047
  await this.loadMarkets();
package/js/src/bitteam.js CHANGED
@@ -1196,7 +1196,6 @@ export default class bitteam extends Exchange {
1196
1196
  const side = this.safeString(order, 'side');
1197
1197
  const feeRaw = this.safeValue(order, 'fee');
1198
1198
  const price = this.safeString(order, 'price');
1199
- const stopPrice = this.safeString(order, 'stopPrice');
1200
1199
  const amount = this.safeString(order, 'quantity');
1201
1200
  const filled = this.safeString(order, 'executed');
1202
1201
  let fee = undefined;
@@ -1222,8 +1221,7 @@ export default class bitteam extends Exchange {
1222
1221
  'timeInForce': 'GTC',
1223
1222
  'side': side,
1224
1223
  'price': price,
1225
- 'stopPrice': stopPrice,
1226
- 'triggerPrice': stopPrice,
1224
+ 'triggerPrice': this.safeString(order, 'stopPrice'),
1227
1225
  'average': undefined,
1228
1226
  'amount': amount,
1229
1227
  'cost': undefined,
@@ -141,7 +141,7 @@ export default class bitvavo extends Exchange {
141
141
  * @param {float} price the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
142
142
  * @param {object} [params] extra parameters specific to the bitvavo api endpoint
143
143
  * @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
144
- * @param {float} [params.stopPrice] The price at which a trigger order is triggered at
144
+ * @param {float} [params.stopPrice] Alias for triggerPrice
145
145
  * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
146
146
  * @param {bool} [params.postOnly] If true, the order will only be posted to the order book and not executed immediately
147
147
  * @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
package/js/src/bitvavo.js CHANGED
@@ -1131,7 +1131,7 @@ export default class bitvavo extends Exchange {
1131
1131
  * @param {float} price the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1132
1132
  * @param {object} [params] extra parameters specific to the bitvavo api endpoint
1133
1133
  * @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
1134
- * @param {float} [params.stopPrice] The price at which a trigger order is triggered at
1134
+ * @param {float} [params.stopPrice] Alias for triggerPrice
1135
1135
  * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
1136
1136
  * @param {bool} [params.postOnly] If true, the order will only be posted to the order book and not executed immediately
1137
1137
  * @param {float} [params.stopLossPrice] The price at which a stop loss order is triggered at
@@ -1602,7 +1602,6 @@ export default class bitvavo extends Exchange {
1602
1602
  const timeInForce = this.safeString(order, 'timeInForce');
1603
1603
  const postOnly = this.safeValue(order, 'postOnly');
1604
1604
  // https://github.com/ccxt/ccxt/issues/8489
1605
- const stopPrice = this.safeNumber(order, 'triggerPrice');
1606
1605
  return this.safeOrder({
1607
1606
  'info': order,
1608
1607
  'id': id,
@@ -1616,8 +1615,7 @@ export default class bitvavo extends Exchange {
1616
1615
  'postOnly': postOnly,
1617
1616
  'side': side,
1618
1617
  'price': price,
1619
- 'stopPrice': stopPrice,
1620
- 'triggerPrice': stopPrice,
1618
+ 'triggerPrice': this.safeNumber(order, 'triggerPrice'),
1621
1619
  'amount': amount,
1622
1620
  'cost': cost,
1623
1621
  'average': undefined,