ccxt 4.4.68 → 4.4.70

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 (51) 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/base/Exchange.js +0 -1
  5. package/dist/cjs/src/binance.js +20 -3
  6. package/dist/cjs/src/bitget.js +49 -335
  7. package/dist/cjs/src/bitstamp.js +2 -3
  8. package/dist/cjs/src/bybit.js +7 -0
  9. package/dist/cjs/src/coinbase.js +25 -9
  10. package/dist/cjs/src/cryptomus.js +214 -116
  11. package/dist/cjs/src/hyperliquid.js +19 -8
  12. package/dist/cjs/src/okx.js +4 -0
  13. package/dist/cjs/src/paradex.js +172 -4
  14. package/dist/cjs/src/phemex.js +2 -2
  15. package/dist/cjs/src/pro/bitget.js +40 -7
  16. package/dist/cjs/src/pro/bybit.js +86 -38
  17. package/dist/cjs/src/tradeogre.js +34 -11
  18. package/dist/cjs/src/whitebit.js +211 -1
  19. package/js/ccxt.d.ts +1 -1
  20. package/js/ccxt.js +1 -1
  21. package/js/src/abstract/bybit.d.ts +4 -0
  22. package/js/src/abstract/myokx.d.ts +3 -0
  23. package/js/src/abstract/okx.d.ts +3 -0
  24. package/js/src/abstract/paradex.d.ts +23 -0
  25. package/js/src/abstract/tradeogre.d.ts +2 -1
  26. package/js/src/base/Exchange.js +0 -1
  27. package/js/src/base/types.d.ts +2 -2
  28. package/js/src/binance.js +20 -3
  29. package/js/src/bitget.d.ts +0 -1
  30. package/js/src/bitget.js +49 -335
  31. package/js/src/bitstamp.js +2 -3
  32. package/js/src/bybit.js +7 -0
  33. package/js/src/coinbase.d.ts +0 -5
  34. package/js/src/coinbase.js +25 -9
  35. package/js/src/cryptomus.d.ts +127 -1
  36. package/js/src/cryptomus.js +214 -116
  37. package/js/src/hyperliquid.js +19 -8
  38. package/js/src/okx.d.ts +1 -0
  39. package/js/src/okx.js +4 -0
  40. package/js/src/paradex.d.ts +48 -1
  41. package/js/src/paradex.js +172 -4
  42. package/js/src/phemex.d.ts +1 -1
  43. package/js/src/phemex.js +2 -2
  44. package/js/src/pro/bitget.js +40 -7
  45. package/js/src/pro/bybit.d.ts +1 -0
  46. package/js/src/pro/bybit.js +86 -38
  47. package/js/src/tradeogre.d.ts +1 -0
  48. package/js/src/tradeogre.js +34 -11
  49. package/js/src/whitebit.d.ts +35 -1
  50. package/js/src/whitebit.js +211 -1
  51. package/package.json +1 -1
package/js/src/bybit.js CHANGED
@@ -246,6 +246,8 @@ export default class bybit extends Exchange {
246
246
  // institutional lending
247
247
  'v5/ins-loan/product-infos': 5,
248
248
  'v5/ins-loan/ensure-tokens-convert': 5,
249
+ // earn
250
+ 'v5/earn/product': 5,
249
251
  },
250
252
  },
251
253
  'private': {
@@ -404,6 +406,9 @@ export default class bybit extends Exchange {
404
406
  'v5/broker/earnings-info': 5,
405
407
  'v5/broker/account-info': 5,
406
408
  'v5/broker/asset/query-sub-member-deposit-record': 10,
409
+ // earn
410
+ 'v5/earn/order': 5,
411
+ 'v5/earn/position': 5,
407
412
  },
408
413
  'post': {
409
414
  // spot
@@ -539,6 +544,8 @@ export default class bybit extends Exchange {
539
544
  'v5/broker/award/info': 5,
540
545
  'v5/broker/award/distribute-award': 5,
541
546
  'v5/broker/award/distribution-record': 5,
547
+ // earn
548
+ 'v5/earn/place-order': 5,
542
549
  },
543
550
  },
544
551
  },
@@ -615,11 +615,6 @@ export default class coinbase extends Exchange {
615
615
  * @returns {any[]} An account structure <https://docs.ccxt.com/#/?id=account-structure>
616
616
  */
617
617
  fetchPortfolioDetails(portfolioUuid: string, params?: {}): Promise<any[]>;
618
- /**
619
- * Parse a Coinbase portfolio JSON object and extract relevant trading information.
620
- * @param {Dict} portfolioData The JSON response containing portfolio details
621
- * @returns {any[]} List of dictionaries with parsed portfolio position data
622
- */
623
618
  parsePortfolioDetails(portfolioData: Dict): any[];
624
619
  createAuthToken(seconds: Int, method?: Str, url?: Str): string;
625
620
  nonce(): number;
@@ -322,6 +322,7 @@ export default class coinbase extends Exchange {
322
322
  'INSUFFICIENT_FUND': BadRequest,
323
323
  'PERMISSION_DENIED': PermissionDenied,
324
324
  'INVALID_ARGUMENT': BadRequest,
325
+ 'PREVIEW_STOP_PRICE_ABOVE_LAST_TRADE_PRICE': InvalidOrder,
325
326
  },
326
327
  'broad': {
327
328
  'request timestamp expired': InvalidNonce,
@@ -4264,6 +4265,7 @@ export default class coinbase extends Exchange {
4264
4265
  'amount': this.numberToString(amount),
4265
4266
  'currency': code.toUpperCase(),
4266
4267
  'payment_method': id,
4268
+ 'commit': true, // otheriwse the deposit does not go through
4267
4269
  };
4268
4270
  const response = await this.v2PrivatePostAccountsAccountIdDeposits(this.extend(request, params));
4269
4271
  //
@@ -4884,11 +4886,6 @@ export default class coinbase extends Exchange {
4884
4886
  const result = this.parsePortfolioDetails(response);
4885
4887
  return result;
4886
4888
  }
4887
- /**
4888
- * Parse a Coinbase portfolio JSON object and extract relevant trading information.
4889
- * @param {Dict} portfolioData The JSON response containing portfolio details
4890
- * @returns {any[]} List of dictionaries with parsed portfolio position data
4891
- */
4892
4889
  parsePortfolioDetails(portfolioData) {
4893
4890
  const breakdown = portfolioData['breakdown'];
4894
4891
  const portfolioInfo = this.safeDict(breakdown, 'portfolio', {});
@@ -5084,20 +5081,39 @@ export default class coinbase extends Exchange {
5084
5081
  // ]
5085
5082
  // }
5086
5083
  // or
5087
- // {
5084
+ // {
5085
+ // "success": false,
5086
+ // "error_response": {
5088
5087
  // "error": "UNKNOWN_FAILURE_REASON",
5089
5088
  // "message": "",
5090
5089
  // "error_details": "",
5091
- // "preview_failure_reason": "PREVIEW_STOP_PRICE_BELOW_LAST_TRADE_PRICE"
5092
- // }
5090
+ // "preview_failure_reason": "PREVIEW_STOP_PRICE_ABOVE_LAST_TRADE_PRICE"
5091
+ // },
5092
+ // "order_configuration": {
5093
+ // "stop_limit_stop_limit_gtc": {
5094
+ // "base_size": "0.0001",
5095
+ // "limit_price": "2000",
5096
+ // "stop_price": "2005",
5097
+ // "stop_direction": "STOP_DIRECTION_STOP_DOWN",
5098
+ // "reduce_only": false
5099
+ // }
5100
+ // }
5101
+ // }
5093
5102
  //
5094
5103
  let errorCode = this.safeString(response, 'error');
5095
5104
  if (errorCode !== undefined) {
5096
- const errorMessage = this.safeString2(response, 'error_description', 'preview_failure_reason');
5105
+ const errorMessage = this.safeString2(response, 'error_description', 'error');
5097
5106
  this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
5098
5107
  this.throwBroadlyMatchedException(this.exceptions['broad'], errorMessage, feedback);
5099
5108
  throw new ExchangeError(feedback);
5100
5109
  }
5110
+ const errorResponse = this.safeDict(response, 'error_response');
5111
+ if (errorResponse !== undefined) {
5112
+ const errorMessageInner = this.safeString2(errorResponse, 'preview_failure_reason', 'preview_failure_reason');
5113
+ this.throwExactlyMatchedException(this.exceptions['exact'], errorMessageInner, feedback);
5114
+ this.throwBroadlyMatchedException(this.exceptions['broad'], errorMessageInner, feedback);
5115
+ throw new ExchangeError(feedback);
5116
+ }
5101
5117
  const errors = this.safeList(response, 'errors');
5102
5118
  if (errors !== undefined) {
5103
5119
  if (Array.isArray(errors)) {
@@ -1,27 +1,153 @@
1
1
  import Exchange from './abstract/cryptomus.js';
2
- import type { Balances, Currencies, Dict, int, Int, Market, Num, Order, OrderBook, OrderType, OrderSide, Str, Strings, Ticker, Tickers, Trade } from './base/types.js';
2
+ import type { Balances, Currencies, Dict, int, Int, Market, Num, Order, OrderBook, OrderType, OrderSide, Str, Strings, Ticker, Tickers, Trade, TradingFees } from './base/types.js';
3
3
  /**
4
4
  * @class cryptomus
5
5
  * @augments Exchange
6
6
  */
7
7
  export default class cryptomus extends Exchange {
8
8
  describe(): any;
9
+ /**
10
+ * @method
11
+ * @name cryptomus#fetchMarkets
12
+ * @description retrieves data on all markets for the exchange
13
+ * @see https://doc.cryptomus.com/personal/market-cap/tickers
14
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
15
+ * @returns {object[]} an array of objects representing market data
16
+ */
9
17
  fetchMarkets(params?: {}): Promise<Market[]>;
10
18
  parseMarket(market: Dict): Market;
19
+ /**
20
+ * @method
21
+ * @name cryptomus#fetchCurrencies
22
+ * @description fetches all available currencies on an exchange
23
+ * @see https://doc.cryptomus.com/personal/market-cap/assets
24
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
25
+ * @returns {object} an associative dictionary of currencies
26
+ */
11
27
  fetchCurrencies(params?: {}): Promise<Currencies>;
28
+ /**
29
+ * @method
30
+ * @name cryptomus#fetchTickers
31
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
32
+ * @see https://doc.cryptomus.com/personal/market-cap/tickers
33
+ * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
34
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
35
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
36
+ */
12
37
  fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
13
38
  parseTicker(ticker: any, market?: Market): Ticker;
39
+ /**
40
+ * @method
41
+ * @name cryptomus#fetchOrderBook
42
+ * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
43
+ * @see https://doc.cryptomus.com/personal/market-cap/orderbook
44
+ * @param {string} symbol unified symbol of the market to fetch the order book for
45
+ * @param {int} [limit] the maximum amount of order book entries to return
46
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
47
+ * @param {int} [params.level] 0 or 1 or 2 or 3 or 4 or 5 - the level of volume
48
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
49
+ */
14
50
  fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
51
+ /**
52
+ * @method
53
+ * @name cryptomus#fetchTrades
54
+ * @description get the list of most recent trades for a particular symbol
55
+ * @see https://doc.cryptomus.com/personal/market-cap/trades
56
+ * @param {string} symbol unified symbol of the market to fetch trades for
57
+ * @param {int} [since] timestamp in ms of the earliest trade to fetch
58
+ * @param {int} [limit] the maximum amount of trades to fetch (maximum value is 100)
59
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
60
+ * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
61
+ */
15
62
  fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
16
63
  parseTrade(trade: Dict, market?: Market): Trade;
64
+ /**
65
+ * @method
66
+ * @name cryptomus#fetchBalance
67
+ * @description query for balance and get the amount of funds available for trading or funds locked in orders
68
+ * @see https://doc.cryptomus.com/personal/converts/balance
69
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
70
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
71
+ */
17
72
  fetchBalance(params?: {}): Promise<Balances>;
18
73
  parseBalance(balance: any): Balances;
74
+ /**
75
+ * @method
76
+ * @name cryptomus#createOrder
77
+ * @description create a trade order
78
+ * @see https://doc.cryptomus.com/personal/exchange/market-order-creation
79
+ * @see https://doc.cryptomus.com/personal/exchange/limit-order-creation
80
+ * @param {string} symbol unified symbol of the market to create an order in
81
+ * @param {string} type 'market' or 'limit' or for spot
82
+ * @param {string} side 'buy' or 'sell'
83
+ * @param {float} amount how much of you want to trade in units of the base currency
84
+ * @param {float} [price] the price that the order is to be fulfilled, in units of the quote currency, ignored in market orders (only for limit orders)
85
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
86
+ * @param {float} [params.cost] *market buy only* the quote quantity that can be used as an alternative for the amount
87
+ * @param {string} [params.clientOrderId] a unique identifier for the order (optional)
88
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
89
+ */
19
90
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
91
+ /**
92
+ * @method
93
+ * @name cryptomus#cancelOrder
94
+ * @description cancels an open limit order
95
+ * @see https://doc.cryptomus.com/personal/exchange/limit-order-cancellation
96
+ * @param {string} id order id
97
+ * @param {string} symbol unified symbol of the market the order was made in (not used in cryptomus)
98
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
99
+ * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
100
+ */
20
101
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
102
+ /**
103
+ * @method
104
+ * @name cryptomus#fetchOrders
105
+ * @description fetches information on multiple orders made by the user
106
+ * @see https://doc.cryptomus.com/personal/exchange/history-of-completed-orders
107
+ * @param {string} symbol unified market symbol of the market orders were made in (not used in cryptomus)
108
+ * @param {int} [since] the earliest time in ms to fetch orders for (not used in cryptomus)
109
+ * @param {int} [limit] the maximum number of order structures to retrieve (not used in cryptomus)
110
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
111
+ * @param {string} [params.direction] order direction 'buy' or 'sell'
112
+ * @param {string} [params.order_id] order id
113
+ * @param {string} [params.client_order_id] client order id
114
+ * @param {string} [params.limit] A special parameter that sets the maximum number of records the request will return
115
+ * @param {string} [params.offset] A special parameter that sets the number of records from the beginning of the list
116
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
117
+ */
21
118
  fetchCanceledAndClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
119
+ /**
120
+ * @method
121
+ * @name cryptomus#fetchOpenOrders
122
+ * @description fetch all unfilled currently open orders
123
+ * @see https://doc.cryptomus.com/personal/exchange/list-of-active-orders
124
+ * @param {string} symbol unified market symbol
125
+ * @param {int} [since] the earliest time in ms to fetch open orders for (not used in cryptomus)
126
+ * @param {int} [limit] the maximum number of open orders structures to retrieve (not used in cryptomus)
127
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
128
+ * @param {string} [params.direction] order direction 'buy' or 'sell'
129
+ * @param {string} [params.order_id] order id
130
+ * @param {string} [params.client_order_id] client order id
131
+ * @param {string} [params.limit] A special parameter that sets the maximum number of records the request will return
132
+ * @param {string} [params.offset] A special parameter that sets the number of records from the beginning of the list
133
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
134
+ */
22
135
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
23
136
  parseOrder(order: Dict, market?: Market): Order;
24
137
  parseOrderStatus(status?: Str): Str;
138
+ /**
139
+ * @method
140
+ * @name cryptomus#fetchTradingFees
141
+ * @description fetch the trading fees for multiple markets
142
+ * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-fees
143
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
144
+ * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
145
+ */
146
+ fetchTradingFees(params?: {}): Promise<TradingFees>;
147
+ parseFeeTiers(feeTiers: any, market?: Market): {
148
+ maker: any[];
149
+ taker: any[];
150
+ };
25
151
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
26
152
  url: string;
27
153
  method: string;